Skip to content

Commit 411ca9c

Browse files
kallentuCommit Queue
authored andcommitted
[cfe] Issue 60121: Fix bug with isWildcard flag for formals.
The `isWildcard` flag for formals was being set as `false` since it was checking that the parameter was `_` after the formal was lowered already into something like `#wc0#formal`. Tested: Existing VM tests that have been updated. Fixes: #60121 Bug: #60121 Change-Id: I4df96d47ef8b6af8ece634360d14a19d1cb9d916 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410161 Reviewed-by: Chloe Stefantsova <[email protected]> Commit-Queue: Kallen Tu <[email protected]> Reviewed-by: Derek Xu <[email protected]>
1 parent 78eedc4 commit 411ca9c

File tree

122 files changed

+311
-312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+311
-312
lines changed

pkg/front_end/lib/src/kernel/body_builder.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5464,8 +5464,7 @@ class BodyBuilder extends StackListenerImpl
54645464
offsetForToken(nameToken),
54655465
fileUri: uri,
54665466
hasImmediatelyDeclaredInitializer: initializerStart != null,
5467-
isWildcard: libraryFeatures.wildcardVariables.isEnabled &&
5468-
parameterName == '_');
5467+
isWildcard: isWildcard);
54695468
}
54705469
VariableDeclaration variable = parameter.build(libraryBuilder);
54715470
Expression? initializer = name?.initializer;

pkg/front_end/testcases/general/await_complex.dart.strong.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static final field core::bool assertStatementsEnabled = (() → core::bool {
3939
assert(false);
4040
return false;
4141
}
42-
on core::Object catch(final core::Object _#wc0#formal) {
42+
on core::Object catch(final wildcard core::Object _#wc0#formal) {
4343
return true;
4444
}
4545
})(){() → core::bool};

pkg/front_end/testcases/general/await_complex.dart.strong.modular.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static final field core::bool assertStatementsEnabled = (() → core::bool {
3939
assert(false);
4040
return false;
4141
}
42-
on core::Object catch(final core::Object _#wc0#formal) {
42+
on core::Object catch(final wildcard core::Object _#wc0#formal) {
4343
return true;
4444
}
4545
})(){() → core::bool};

pkg/front_end/testcases/general/await_complex.dart.strong.transformed.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static final field core::bool assertStatementsEnabled = (() → core::bool {
3939
assert(false);
4040
return false;
4141
}
42-
on core::Object catch(final core::Object _#wc0#formal) {
42+
on core::Object catch(final wildcard core::Object _#wc0#formal) {
4343
return true;
4444
}
4545
})(){() → core::bool};

pkg/front_end/testcases/general/bad_setter_abstract.dart.strong.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static method test() → dynamic {
151151
invalid-expression "The class 'B' is abstract and can't be instantiated.";
152152
threw = false;
153153
}
154-
on core::Error catch(final core::Error _#wc0#formal) {
154+
on core::Error catch(final wildcard core::Error _#wc0#formal) {
155155
}
156156
if(!threw) {
157157
throw "Expected an error above.";

pkg/front_end/testcases/general/bad_setter_abstract.dart.strong.modular.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static method test() → dynamic {
151151
invalid-expression "The class 'B' is abstract and can't be instantiated.";
152152
threw = false;
153153
}
154-
on core::Error catch(final core::Error _#wc0#formal) {
154+
on core::Error catch(final wildcard core::Error _#wc0#formal) {
155155
}
156156
if(!threw) {
157157
throw "Expected an error above.";

pkg/front_end/testcases/general/bad_setter_abstract.dart.strong.transformed.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static method test() → dynamic {
151151
invalid-expression "The class 'B' is abstract and can't be instantiated.";
152152
threw = false;
153153
}
154-
on core::Error catch(final core::Error _#wc0#formal) {
154+
on core::Error catch(final wildcard core::Error _#wc0#formal) {
155155
}
156156
if(!threw) {
157157
throw "Expected an error above.";

pkg/front_end/testcases/general/issue34899.dart.strong.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Foo<T extends core::Object? = dynamic> extends core::Object {
1010
: self::Foo::quux = quux, self::Foo::t = t, super core::Object::•()
1111
;
1212
method call() → asy::Future<self::Foo::T%>
13-
return this.{self::Foo::quux}{() → asy::Future<dynamic>}(){() → asy::Future<dynamic>}.{asy::Future::then}<self::Foo::T%>((dynamic _#wc0#formal) → self::Foo::T% => this.{self::Foo::t}{self::Foo::T%}){((dynamic) → FutureOr<self::Foo::T%>, {onError: core::Function?}) → asy::Future<self::Foo::T%>};
13+
return this.{self::Foo::quux}{() → asy::Future<dynamic>}(){() → asy::Future<dynamic>}.{asy::Future::then}<self::Foo::T%>((wildcard dynamic _#wc0#formal) → self::Foo::T% => this.{self::Foo::t}{self::Foo::T%}){((dynamic) → FutureOr<self::Foo::T%>, {onError: core::Function?}) → asy::Future<self::Foo::T%>};
1414
}
1515
class Bar extends core::Object {
1616
field self::Foo<self::Baz> qux = throw "";

pkg/front_end/testcases/general/issue34899.dart.strong.modular.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Foo<T extends core::Object? = dynamic> extends core::Object {
1010
: self::Foo::quux = quux, self::Foo::t = t, super core::Object::•()
1111
;
1212
method call() → asy::Future<self::Foo::T%>
13-
return this.{self::Foo::quux}{() → asy::Future<dynamic>}(){() → asy::Future<dynamic>}.{asy::Future::then}<self::Foo::T%>((dynamic _#wc0#formal) → self::Foo::T% => this.{self::Foo::t}{self::Foo::T%}){((dynamic) → FutureOr<self::Foo::T%>, {onError: core::Function?}) → asy::Future<self::Foo::T%>};
13+
return this.{self::Foo::quux}{() → asy::Future<dynamic>}(){() → asy::Future<dynamic>}.{asy::Future::then}<self::Foo::T%>((wildcard dynamic _#wc0#formal) → self::Foo::T% => this.{self::Foo::t}{self::Foo::T%}){((dynamic) → FutureOr<self::Foo::T%>, {onError: core::Function?}) → asy::Future<self::Foo::T%>};
1414
}
1515
class Bar extends core::Object {
1616
field self::Foo<self::Baz> qux = throw "";

pkg/front_end/testcases/general/issue34899.dart.strong.transformed.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Foo<T extends core::Object? = dynamic> extends core::Object {
1010
: self::Foo::quux = quux, self::Foo::t = t, super core::Object::•()
1111
;
1212
method call() → asy::Future<self::Foo::T%>
13-
return this.{self::Foo::quux}{() → asy::Future<dynamic>}(){() → asy::Future<dynamic>}.{asy::Future::then}<self::Foo::T%>((dynamic _#wc0#formal) → self::Foo::T% => this.{self::Foo::t}{self::Foo::T%}){((dynamic) → FutureOr<self::Foo::T%>, {onError: core::Function?}) → asy::Future<self::Foo::T%>};
13+
return this.{self::Foo::quux}{() → asy::Future<dynamic>}(){() → asy::Future<dynamic>}.{asy::Future::then}<self::Foo::T%>((wildcard dynamic _#wc0#formal) → self::Foo::T% => this.{self::Foo::t}{self::Foo::T%}){((dynamic) → FutureOr<self::Foo::T%>, {onError: core::Function?}) → asy::Future<self::Foo::T%>};
1414
}
1515
class Bar extends core::Object {
1616
field self::Foo<self::Baz> qux = throw "";

0 commit comments

Comments
 (0)