blob: b71c078214b92a99f974620b5fa114b8a1716811 [file] [log] [blame]
// Copyright (c) 2011, 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.
/// @assertion It is a compile-time error if a constant constructor is declared
/// by a class C if any instance variable declared in C is initialized with an
/// expression that is not a constant expression.
/// A superclass of C cannot declare such an initializer either, because it must
/// necessarily declare constant constructor as well (unless it is Object, which
/// declares no instance variables)
/// @description Checks that compile error is produced if class declares a
/// constant constructor and its superclass has instance variable initialized
/// by non-constant expression
/// @author sgrekhov@unipro.ru
class A {
}
class B {
final x = new A();
}
class C extends B {
final y = 1;
const C();
// ^
// [analyzer] unspecified
// [cfe] unspecified
}
main() {
const C();
}