diff --git a/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t01.dart b/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t01.dart index a3c5f84982..960babacba 100644 --- a/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t01.dart +++ b/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t01.dart @@ -2,51 +2,89 @@ // 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 Let C be a class. It is a compile-time error if C declares a -/// constructor named C.n and a static member with basename n. +/// @assertion Let `C` be a class. It is a compile-time error if `C` declares a +/// constructor named `C.n` and a static member with basename `n`. /// /// @description Check that it is a compile-time error if class `C` declares a -/// constructor named `C.n` and a static member with basename `n`. +/// generative constructor named `C.n` and a static member with basename `n`. /// @author sgrekhov@unipro.ru /// @issue 46814 class C { C.s1() {} -// ^ +// ^^ // [analyzer] unspecified static set s1(var value) {} -// ^ +// ^^ // [cfe] unspecified C.s2() {} -// ^ +// ^^ // [analyzer] unspecified static void s2() {} -// ^ +// ^^ // [cfe] unspecified C.s3() {} -// ^ +// ^^ // [analyzer] unspecified static int s3() => 1; -// ^ +// ^^ // [cfe] unspecified C.s4() {} -// ^ +// ^^ // [analyzer] unspecified static int get s4 => 1; -// ^ +// ^^ // [cfe] unspecified C.s5() {} -// ^ +// ^^ +// [analyzer] unspecified + static int s5 = 1; +// ^^ +// [cfe] unspecified +} + +extension type ET(int _) { + ET.s1(this._) {} +// ^^ +// [analyzer] unspecified + static set s1(var _) {} +// ^^ +// [cfe] unspecified + + ET.s2(this._) {} +// ^^ +// [analyzer] unspecified + static void s2() {} +// ^^ +// [cfe] unspecified + + ET.s3(this._) {} +// ^^ +// [analyzer] unspecified + static int s3() => 1; +// ^^ +// [cfe] unspecified + + ET.s4(this._) {} +// ^^ +// [analyzer] unspecified + static int get s4 => 1; +// ^^ +// [cfe] unspecified + + ET.s5(this._) {} +// ^^ // [analyzer] unspecified static int s5 = 1; -// ^ +// ^^ // [cfe] unspecified } main() { print(C); + print(ET); } diff --git a/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t02.dart b/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t02.dart new file mode 100644 index 0000000000..7602581982 --- /dev/null +++ b/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t02.dart @@ -0,0 +1,129 @@ +// 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 Let `C` be a class. It is a compile-time error if `C` declares a +/// constructor named `C.n` and a static member with basename `n`. +/// +/// @description Check that it is a compile-time error if class `C` declares a +/// constant generative constructor named `C.n` and a static member with +/// basename `n`. +/// @author sgrekhov22@gmail.com + +class C { + const C.s1(); +// ^^ +// [analyzer] unspecified + static set s1(var value) {} +// ^^ +// [cfe] unspecified + + const C.s2(); +// ^^ +// [analyzer] unspecified + static void s2() {} +// ^^ +// [cfe] unspecified + + const C.s3(); +// ^^ +// [analyzer] unspecified + static int s3() => 1; +// ^^ +// [cfe] unspecified + + const C.s4(); +// ^^ +// [analyzer] unspecified + static int get s4 => 1; +// ^^ +// [cfe] unspecified + + const C.s5(); +// ^^ +// [analyzer] unspecified + static int s5 = 1; +// ^^ +// [cfe] unspecified +} + +enum E { + e0.s1(); + + const E.s1(); +// ^^ +// [analyzer] unspecified + static set s1(var value) {} +// ^^ +// [cfe] unspecified + + const E.s2(); +// ^^ +// [analyzer] unspecified + static void s2() {} +// ^^ +// [cfe] unspecified + + const E.s3(); +// ^^ +// [analyzer] unspecified + static int s3() => 1; +// ^^ +// [cfe] unspecified + + const E.s4(); +// ^^ +// [analyzer] unspecified + static int get s4 => 1; +// ^^ +// [cfe] unspecified + + const E.s5(); +// ^^ +// [analyzer] unspecified + static int s5 = 1; +// ^^ +// [cfe] unspecified +} + +extension type ET(int _) { + const ET.s1(this._); +// ^^ +// [analyzer] unspecified + static set s1(var _) {} +// ^^ +// [cfe] unspecified + + const ET.s2(this._); +// ^^ +// [analyzer] unspecified + static void s2() {} +// ^^ +// [cfe] unspecified + + const ET.s3(this._); +// ^^ +// [analyzer] unspecified + static int s3() => 1; +// ^^ +// [cfe] unspecified + + const ET.s4(this._); +// ^^ +// [analyzer] unspecified + static int get s4 => 1; +// ^^ +// [cfe] unspecified + + const ET.s5(this._); +// ^^ +// [analyzer] unspecified + static int s5 = 1; +// ^^ +// [cfe] unspecified +} + +main() { + print(C); + print(ET); +} diff --git a/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t03.dart b/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t03.dart new file mode 100644 index 0000000000..ae05dc5841 --- /dev/null +++ b/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t03.dart @@ -0,0 +1,132 @@ +// 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 Let `C` be a class. It is a compile-time error if `C` declares a +/// constructor named `C.n` and a static member with basename `n`. +/// +/// @description Check that it is a compile-time error if class `C` declares a +/// redirecting constructor named `C.n` and a static member with basename `n`. +/// @author sgrekhov22@gmail.com + +class C { + C(); + + C.s1() : this(); +// ^^ +// [analyzer] unspecified + static set s1(var value) {} +// ^^ +// [cfe] unspecified + + C.s2() : this(); +// ^^ +// [analyzer] unspecified + static void s2() {} +// ^^ +// [cfe] unspecified + + C.s3() : this(); +// ^^ +// [analyzer] unspecified + static int s3() => 1; +// ^^ +// [cfe] unspecified + + C.s4() : this(); +// ^^ +// [analyzer] unspecified + static int get s4 => 1; +// ^^ +// [cfe] unspecified + + C.s5() : this(); +// ^^ +// [analyzer] unspecified + static int s5 = 1; +// ^^ +// [cfe] unspecified +} + +enum E { + e0; + + const E(); + + const E.s1() : this(); +// ^^ +// [analyzer] unspecified + static set s1(var value) {} +// ^^ +// [cfe] unspecified + + const E.s2() : this(); +// ^^ +// [analyzer] unspecified + static void s2() {} +// ^^ +// [cfe] unspecified + + const E.s3() : this(); +// ^^ +// [analyzer] unspecified + static int s3() => 1; +// ^^ +// [cfe] unspecified + + const E.s4() : this(); +// ^^ +// [analyzer] unspecified + static int get s4 => 1; +// ^^ +// [cfe] unspecified + + const E.s5() : this(); +// ^^ +// [analyzer] unspecified + static int s5 = 1; +// ^^ +// [cfe] unspecified +} + +extension type ET(int n) { + ET.s1(int n) : this(n); +// ^^ +// [analyzer] unspecified + static set s1(var _) {} +// ^^ +// [cfe] unspecified + + ET.s2(int n) : this(n); +// ^^ +// [analyzer] unspecified + static void s2() {} +// ^^ +// [cfe] unspecified + + ET.s3(int n) : this(n); +// ^^ +// [analyzer] unspecified + static int s3() => 1; +// ^^ +// [cfe] unspecified + + ET.s4(int n) : this(n); +// ^^ +// [analyzer] unspecified + static int get s4 => 1; +// ^^ +// [cfe] unspecified + + ET.s5(int n) : this(n); +// ^^ +// [analyzer] unspecified + static int s5 = 1; +// ^^ +// [cfe] unspecified +} + +main() { + print(C); + print(ET); +} diff --git a/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t04.dart b/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t04.dart new file mode 100644 index 0000000000..192b4dd25e --- /dev/null +++ b/Language/Classes/Class_Member_Conflicts/static_member_and_constructor_t04.dart @@ -0,0 +1,91 @@ +// 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 Let `C` be a class. It is a compile-time error if `C` declares a +/// constructor named `C.n` and a static member with basename `n`. +/// +/// @description Check that it is a compile-time error if class `C` declares a +/// factory constructor named `C.n` and a static member with basename `n`. +/// @author sgrekhov22@gmail.com + +class C { + C(); + + factory C.s1() = C; +// ^^ +// [analyzer] unspecified + static set s1(var value) {} +// ^^ +// [cfe] unspecified + + factory C.s2() = C; +// ^^ +// [analyzer] unspecified + static void s2() {} +// ^^ +// [cfe] unspecified + + factory C.s3() = C; +// ^^ +// [analyzer] unspecified + static int s3() => 1; +// ^^ +// [cfe] unspecified + + factory C.s4() = C; +// ^^ +// [analyzer] unspecified + static int get s4 => 1; +// ^^ +// [cfe] unspecified + + factory C.s5() = C; +// ^^ +// [analyzer] unspecified + static int s5 = 1; +// ^^ +// [cfe] unspecified +} + +extension type ET(int n) { + factory ET.s1(int n) = ET; +// ^^ +// [analyzer] unspecified + static set s1(var _) {} +// ^^ +// [cfe] unspecified + + factory ET.s2(int n) = ET; +// ^^ +// [analyzer] unspecified + static void s2() {} +// ^^ +// [cfe] unspecified + + factory ET.s3(int n) = ET; +// ^^ +// [analyzer] unspecified + static int s3() => 1; +// ^^ +// [cfe] unspecified + + factory ET.s4(int n) = ET; +// ^^ +// [analyzer] unspecified + static int get s4 => 1; +// ^^ +// [cfe] unspecified + + factory ET.s5(int n) = ET; +// ^^ +// [analyzer] unspecified + static int s5 = 1; +// ^^ +// [cfe] unspecified +} + +main() { + print(C); + print(ET); +}