blob: 07ed00c5ffddf0ce2ff89cd13772e5270eb66249 [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();
}