blob: 8732b620c8f96536690b2304c50b7d675404c830 [file] [log] [blame] [edit]
// Copyright (c) 2026, 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 a mixin class declaration has a
/// primary constructor which is not trivial, that is, it declares one or more
/// parameters, or it has a body part that has an initializer list or a body.
///
/// @description Check that it is a compile-time error if a mixin class
/// declaration has a primary constructor which has a body part that has an
/// initializer list.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=primary-constructors
mixin class M1() {
this : assert(2 > 1);
// ^
// [analyzer] unspecified
// [cfe] unspecified
}
mixin class M2() {
int? x;
this : x = 1;
// ^
// [analyzer] unspecified
// [cfe] unspecified
}
main() {
print(M1);
print(M2);
}