Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2162. Add static member and non-redirecting factory constructor conflict test #3056

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
/// 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`.
/// redirecting factory constructor named `C.n` and a static member with
/// basename `n`.
/// @author [email protected]

class C {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// 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
/// non-redirecting factory constructor named `C.n` and a static member with
/// basename `n`.
/// @author [email protected]

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(n);
// ^^
// [analyzer] unspecified
static set s1(var _) {}
// ^^
// [cfe] unspecified

factory ET.s2(int n) => ET(n);
// ^^
// [analyzer] unspecified
static void s2() {}
// ^^
// [cfe] unspecified

factory ET.s3(int n) => ET(n);
// ^^
// [analyzer] unspecified
static int s3() => 1;
// ^^
// [cfe] unspecified

factory ET.s4(int n) => ET(n);
// ^^
// [analyzer] unspecified
static int get s4 => 1;
// ^^
// [cfe] unspecified

factory ET.s5(int n) => ET(n);
// ^^
// [analyzer] unspecified
static int s5 = 1;
// ^^
// [cfe] unspecified
}

main() {
print(C);
print(ET);
}
Loading