blob: 1cec7e796d93a35a46169e41928a7c2f3bd85a8e [file] [log] [blame] [edit]
// Copyright (c) 2025, 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 A compile-time error occurs if an assignment to a primary
/// parameter occurs in the initializing expression of a non-late instance
/// variable, or in the initializer list of the body part of a primary
/// constructor.
///
/// @description Check that it is a compile-time error if an assignment to a
/// primary parameter occurs in the initializing expression of a non-late
/// instance variable.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=primary-constructors
class C(var int a, var int b) {
int x = (a = 1);
// ^
// [analyzer] unspecified
// [cfe] unspecified
int y = b++;
// ^
// [analyzer] unspecified
// [cfe] unspecified
}
main() {
print(C);
}