Files
sdk/tests/language_2/const/constructor_mixin2_test.dart
T
Brian Wilkerson 877d6f745d Improve the range selected for const_constructor_with_non_final_field
Change-Id: I168e92c32b581dffcad25804161b56f4d99c1dd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-05 23:50:22 +00:00

29 lines
670 B
Dart

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class Mixin {
var nonFinalField;
}
class A {
const A(foo);
}
class B extends A
with Mixin
{
const B(foo) : super(foo);
// ^
// [analyzer] COMPILE_TIME_ERROR.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD
// ^
// [analyzer] COMPILE_TIME_ERROR.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD
// ^
// [cfe] A constant constructor can't call a non-constant super constructor.
}
main() {
var a = const B(42);
a.nonFinalField = 54;
}