Skip to content

Commit

Permalink
Fixes dart-lang#3039. Fix the new roll failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov committed Jan 10, 2025
1 parent 044cf88 commit 3fb0a7c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/// @description Checks that it is a compile-time error when a constant
/// constructor's initializer list contains a function call.
/// @author iefremov
/// @issue 59804
f1() {}
int f2() => 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ class C {

extension type const ET(String value) {
const ET.id(this.value, [String s = ""]);
const factory ET.f(String value, {String s = ""}) = ET;
const ET.id2(this.value, {String s = ""});
const factory ET.f(String value, {String s}) = ET.id2;
}

main() {
main() {/*
String s = "Not a constant";
const C c1 = const .new(s);
// ^
Expand Down Expand Up @@ -93,4 +94,5 @@ main() {
// ^
// [analyzer] unspecified
// [cfe] unspecified
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ class C {
}

mixin M {
final String value;
static const M instance = MO("M instance");
static const M instance = MO();
}
class MO with M {
final String value = "M instance";
const MO();
}

class MO = Object with M;

extension type const ET(String value) {
static const instance = ET("ET instance");
Expand All @@ -42,6 +43,9 @@ main() {
const C c = .instance;
Expect.equals("C instance", c.value);

const M m = .instance;
Expect.equals("M instance", (m as MO).value);

const ET et = .instance;
Expect.equals("ET instance", et.value);
}

0 comments on commit 3fb0a7c

Please sign in to comment.