diff --git a/pkg/front_end/lib/src/kernel/body_builder.dart b/pkg/front_end/lib/src/kernel/body_builder.dart index c7f31c46e62..6a992033ff0 100644 --- a/pkg/front_end/lib/src/kernel/body_builder.dart +++ b/pkg/front_end/lib/src/kernel/body_builder.dart @@ -3292,6 +3292,10 @@ class BodyBuilder extends StackListenerImpl // semantics, such parameters introduces a new parameter with that // name that should be resolved here. !_context.isConstructor) { + if (declaration.isExtensionTypeInstanceMember) { + return new IncompleteErrorGenerator( + this, nameToken, fasta.messageNotAConstantExpression); + } addProblem( fasta.messageNotAConstantExpression, nameOffset, nameToken.length); } @@ -7178,8 +7182,13 @@ class BodyBuilder extends StackListenerImpl debugEvent("ThisExpression"); if (context.isScopeReference && isDeclarationInstanceContext) { if (thisVariable != null && !inConstructorInitializer) { - push(_createReadOnlyVariableAccess(thisVariable!, token, - offsetForToken(token), 'this', ReadOnlyAccessKind.ExtensionThis)); + if (constantContext != ConstantContext.none) { + push(new IncompleteErrorGenerator( + this, token, fasta.messageThisAsIdentifier)); + } else { + push(_createReadOnlyVariableAccess(thisVariable!, token, + offsetForToken(token), 'this', ReadOnlyAccessKind.ExtensionThis)); + } } else { push(new ThisAccessGenerator(this, token, inInitializerLeftHandSide, inFieldInitializer, inLateFieldInitializer)); diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt index e1781699280..cab162b99e5 100644 --- a/pkg/front_end/test/spell_checking_list_tests.txt +++ b/pkg/front_end/test/spell_checking_list_tests.txt @@ -348,6 +348,7 @@ foos forbidden forces foreground +forgot forrest forth forty @@ -577,6 +578,7 @@ oo oobar oocf ooo +oops oovf opacity operate diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_01.dart b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart new file mode 100644 index 00000000000..07dc796b8ce --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart @@ -0,0 +1,10 @@ +// Copyright (c) 2024, 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. + +extension type Foo(String x) { + int x2 = 42; + + @x2 + int? a, b; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.expect b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.expect new file mode 100644 index 00000000000..1711f58ded6 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.expect @@ -0,0 +1,49 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:6:7: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int x2 = 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:9:8: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int? a, b; +// ^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. +// @x2 +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. +// @x2 +// ^ +// +import self as self; +import "dart:core" as core; + +extension type Foo(core::String x) { + abstract extension-type-member representation-field get x() → core::String; + abstract extension-type-member representation-field get x2() → core::int; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. + @x2 + ^^" + abstract extension-type-member representation-field get a() → core::int?; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. + @x2 + ^^" + abstract extension-type-member representation-field get b() → core::int?; + constructor • = self::Foo|constructor#; + constructor tearoff • = self::Foo|constructor#_#new#tearOff; +} +static extension-type-member method Foo|constructor#(core::String x) → self::Foo% /* erasure=core::String, declared=! */ { + lowered final self::Foo% /* erasure=core::String, declared=! */ #this = x; + return #this; +} +static extension-type-member method Foo|constructor#_#new#tearOff(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + return self::Foo|constructor#(x); diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.modular.expect b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.modular.expect new file mode 100644 index 00000000000..1711f58ded6 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.modular.expect @@ -0,0 +1,49 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:6:7: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int x2 = 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:9:8: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int? a, b; +// ^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. +// @x2 +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. +// @x2 +// ^ +// +import self as self; +import "dart:core" as core; + +extension type Foo(core::String x) { + abstract extension-type-member representation-field get x() → core::String; + abstract extension-type-member representation-field get x2() → core::int; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. + @x2 + ^^" + abstract extension-type-member representation-field get a() → core::int?; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. + @x2 + ^^" + abstract extension-type-member representation-field get b() → core::int?; + constructor • = self::Foo|constructor#; + constructor tearoff • = self::Foo|constructor#_#new#tearOff; +} +static extension-type-member method Foo|constructor#(core::String x) → self::Foo% /* erasure=core::String, declared=! */ { + lowered final self::Foo% /* erasure=core::String, declared=! */ #this = x; + return #this; +} +static extension-type-member method Foo|constructor#_#new#tearOff(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + return self::Foo|constructor#(x); diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.outline.expect new file mode 100644 index 00000000000..0db5e8e37d5 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.outline.expect @@ -0,0 +1,47 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:6:7: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int x2 = 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:9:8: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int? a, b; +// ^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. +// @x2 +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. +// @x2 +// ^ +// +import self as self; +import "dart:core" as core; + +extension type Foo(core::String x) { + abstract extension-type-member representation-field get x() → core::String; + abstract extension-type-member representation-field get x2() → core::int; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. + @x2 + ^^" + abstract extension-type-member representation-field get a() → core::int?; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. + @x2 + ^^" + abstract extension-type-member representation-field get b() → core::int?; + constructor • = self::Foo|constructor#; + constructor tearoff • = self::Foo|constructor#_#new#tearOff; +} +static extension-type-member method Foo|constructor#(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + ; +static extension-type-member method Foo|constructor#_#new#tearOff(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + return self::Foo|constructor#(x); diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.transformed.expect new file mode 100644 index 00000000000..1711f58ded6 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.strong.transformed.expect @@ -0,0 +1,49 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:6:7: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int x2 = 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:9:8: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int? a, b; +// ^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. +// @x2 +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. +// @x2 +// ^ +// +import self as self; +import "dart:core" as core; + +extension type Foo(core::String x) { + abstract extension-type-member representation-field get x() → core::String; + abstract extension-type-member representation-field get x2() → core::int; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. + @x2 + ^^" + abstract extension-type-member representation-field get a() → core::int?; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_01.dart:8:4: Error: Not a constant expression. + @x2 + ^^" + abstract extension-type-member representation-field get b() → core::int?; + constructor • = self::Foo|constructor#; + constructor tearoff • = self::Foo|constructor#_#new#tearOff; +} +static extension-type-member method Foo|constructor#(core::String x) → self::Foo% /* erasure=core::String, declared=! */ { + lowered final self::Foo% /* erasure=core::String, declared=! */ #this = x; + return #this; +} +static extension-type-member method Foo|constructor#_#new#tearOff(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + return self::Foo|constructor#(x); diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.textual_outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.textual_outline.expect new file mode 100644 index 00000000000..3d5a22a986c --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.textual_outline.expect @@ -0,0 +1,5 @@ +extension type Foo(String x) { + int x2 = 42; + @x2 + int? a, b; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..4ff42a6a549 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_01.dart.textual_outline_modelled.expect @@ -0,0 +1,5 @@ +extension type Foo(String x) { + @x2 + int? a, b; + int x2 = 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_02.dart b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart new file mode 100644 index 00000000000..01bfe8c8c52 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2024, 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. + +extension type Foo(String x) { + static const int x1 = 42; + int x2 = 42; + + int bar1({int baz = x2}) => 42; + int bar2({int baz = x /* oops forgot the 1 */}) => 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.expect b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.expect new file mode 100644 index 00000000000..5a97b5b64b7 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.expect @@ -0,0 +1,58 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:7:7: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int x2 = 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:9:23: Error: Not a constant expression. +// int bar1({int baz = x2}) => 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:10:23: Error: Not a constant expression. +// int bar2({int baz = x /* oops forgot the 1 */}) => 42; +// ^ +// +import self as self; +import "dart:core" as core; + +extension type Foo(core::String x) { + abstract extension-type-member representation-field get x() → core::String; + abstract extension-type-member representation-field get x2() → core::int; + static field x1 = self::Foo|x1; + method bar1 = self::Foo|bar1; + method tearoff bar1 = self::Foo|get#bar1; + method bar2 = self::Foo|bar2; + method tearoff bar2 = self::Foo|get#bar2; + constructor • = self::Foo|constructor#; + constructor tearoff • = self::Foo|constructor#_#new#tearOff; +} +static const field core::int Foo|x1 = #C1; +static extension-type-member method Foo|constructor#(core::String x) → self::Foo% /* erasure=core::String, declared=! */ { + lowered final self::Foo% /* erasure=core::String, declared=! */ #this = x; + return #this; +} +static extension-type-member method Foo|constructor#_#new#tearOff(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + return self::Foo|constructor#(x); +static extension-type-member method Foo|bar1(lowered final self::Foo% /* erasure=core::String, declared=! */ #this, {core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:9:23: Error: Not a constant expression. + int bar1({int baz = x2}) => 42; + ^^"}) → core::int + return 42; +static extension-type-member method Foo|get#bar1(lowered final self::Foo% /* erasure=core::String, declared=! */ #this) → ({baz: core::int}) → core::int + return ({core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:9:23: Error: Not a constant expression. + int bar1({int baz = x2}) => 42; + ^^"}) → core::int => self::Foo|bar1(#this, baz: baz); +static extension-type-member method Foo|bar2(lowered final self::Foo% /* erasure=core::String, declared=! */ #this, {core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:10:23: Error: Not a constant expression. + int bar2({int baz = x /* oops forgot the 1 */}) => 42; + ^"}) → core::int + return 42; +static extension-type-member method Foo|get#bar2(lowered final self::Foo% /* erasure=core::String, declared=! */ #this) → ({baz: core::int}) → core::int + return ({core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:10:23: Error: Not a constant expression. + int bar2({int baz = x /* oops forgot the 1 */}) => 42; + ^"}) → core::int => self::Foo|bar2(#this, baz: baz); + +constants { + #C1 = 42 +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.modular.expect b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.modular.expect new file mode 100644 index 00000000000..5a97b5b64b7 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.modular.expect @@ -0,0 +1,58 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:7:7: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int x2 = 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:9:23: Error: Not a constant expression. +// int bar1({int baz = x2}) => 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:10:23: Error: Not a constant expression. +// int bar2({int baz = x /* oops forgot the 1 */}) => 42; +// ^ +// +import self as self; +import "dart:core" as core; + +extension type Foo(core::String x) { + abstract extension-type-member representation-field get x() → core::String; + abstract extension-type-member representation-field get x2() → core::int; + static field x1 = self::Foo|x1; + method bar1 = self::Foo|bar1; + method tearoff bar1 = self::Foo|get#bar1; + method bar2 = self::Foo|bar2; + method tearoff bar2 = self::Foo|get#bar2; + constructor • = self::Foo|constructor#; + constructor tearoff • = self::Foo|constructor#_#new#tearOff; +} +static const field core::int Foo|x1 = #C1; +static extension-type-member method Foo|constructor#(core::String x) → self::Foo% /* erasure=core::String, declared=! */ { + lowered final self::Foo% /* erasure=core::String, declared=! */ #this = x; + return #this; +} +static extension-type-member method Foo|constructor#_#new#tearOff(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + return self::Foo|constructor#(x); +static extension-type-member method Foo|bar1(lowered final self::Foo% /* erasure=core::String, declared=! */ #this, {core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:9:23: Error: Not a constant expression. + int bar1({int baz = x2}) => 42; + ^^"}) → core::int + return 42; +static extension-type-member method Foo|get#bar1(lowered final self::Foo% /* erasure=core::String, declared=! */ #this) → ({baz: core::int}) → core::int + return ({core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:9:23: Error: Not a constant expression. + int bar1({int baz = x2}) => 42; + ^^"}) → core::int => self::Foo|bar1(#this, baz: baz); +static extension-type-member method Foo|bar2(lowered final self::Foo% /* erasure=core::String, declared=! */ #this, {core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:10:23: Error: Not a constant expression. + int bar2({int baz = x /* oops forgot the 1 */}) => 42; + ^"}) → core::int + return 42; +static extension-type-member method Foo|get#bar2(lowered final self::Foo% /* erasure=core::String, declared=! */ #this) → ({baz: core::int}) → core::int + return ({core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:10:23: Error: Not a constant expression. + int bar2({int baz = x /* oops forgot the 1 */}) => 42; + ^"}) → core::int => self::Foo|bar2(#this, baz: baz); + +constants { + #C1 = 42 +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.outline.expect new file mode 100644 index 00000000000..e3e93ee5662 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.outline.expect @@ -0,0 +1,36 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:7:7: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int x2 = 42; +// ^^ +// +import self as self; +import "dart:core" as core; + +extension type Foo(core::String x) { + abstract extension-type-member representation-field get x() → core::String; + abstract extension-type-member representation-field get x2() → core::int; + static field x1 = self::Foo|x1; + method bar1 = self::Foo|bar1; + method tearoff bar1 = self::Foo|get#bar1; + method bar2 = self::Foo|bar2; + method tearoff bar2 = self::Foo|get#bar2; + constructor • = self::Foo|constructor#; + constructor tearoff • = self::Foo|constructor#_#new#tearOff; +} +static const field core::int Foo|x1 = 42; +static extension-type-member method Foo|constructor#(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + ; +static extension-type-member method Foo|constructor#_#new#tearOff(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + return self::Foo|constructor#(x); +static extension-type-member method Foo|bar1(lowered final self::Foo% /* erasure=core::String, declared=! */ #this, {has-declared-initializer core::int baz}) → core::int + ; +static extension-type-member method Foo|get#bar1(lowered final self::Foo% /* erasure=core::String, declared=! */ #this) → ({baz: core::int}) → core::int + return ({core::int baz}) → core::int => self::Foo|bar1(#this, baz: baz); +static extension-type-member method Foo|bar2(lowered final self::Foo% /* erasure=core::String, declared=! */ #this, {has-declared-initializer core::int baz}) → core::int + ; +static extension-type-member method Foo|get#bar2(lowered final self::Foo% /* erasure=core::String, declared=! */ #this) → ({baz: core::int}) → core::int + return ({core::int baz}) → core::int => self::Foo|bar2(#this, baz: baz); diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.transformed.expect new file mode 100644 index 00000000000..5a97b5b64b7 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.strong.transformed.expect @@ -0,0 +1,58 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:7:7: Error: Extension types can't declare instance fields +// Try removing the field declaration or making it a static field +// int x2 = 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:9:23: Error: Not a constant expression. +// int bar1({int baz = x2}) => 42; +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_02.dart:10:23: Error: Not a constant expression. +// int bar2({int baz = x /* oops forgot the 1 */}) => 42; +// ^ +// +import self as self; +import "dart:core" as core; + +extension type Foo(core::String x) { + abstract extension-type-member representation-field get x() → core::String; + abstract extension-type-member representation-field get x2() → core::int; + static field x1 = self::Foo|x1; + method bar1 = self::Foo|bar1; + method tearoff bar1 = self::Foo|get#bar1; + method bar2 = self::Foo|bar2; + method tearoff bar2 = self::Foo|get#bar2; + constructor • = self::Foo|constructor#; + constructor tearoff • = self::Foo|constructor#_#new#tearOff; +} +static const field core::int Foo|x1 = #C1; +static extension-type-member method Foo|constructor#(core::String x) → self::Foo% /* erasure=core::String, declared=! */ { + lowered final self::Foo% /* erasure=core::String, declared=! */ #this = x; + return #this; +} +static extension-type-member method Foo|constructor#_#new#tearOff(core::String x) → self::Foo% /* erasure=core::String, declared=! */ + return self::Foo|constructor#(x); +static extension-type-member method Foo|bar1(lowered final self::Foo% /* erasure=core::String, declared=! */ #this, {core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:9:23: Error: Not a constant expression. + int bar1({int baz = x2}) => 42; + ^^"}) → core::int + return 42; +static extension-type-member method Foo|get#bar1(lowered final self::Foo% /* erasure=core::String, declared=! */ #this) → ({baz: core::int}) → core::int + return ({core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:9:23: Error: Not a constant expression. + int bar1({int baz = x2}) => 42; + ^^"}) → core::int => self::Foo|bar1(#this, baz: baz); +static extension-type-member method Foo|bar2(lowered final self::Foo% /* erasure=core::String, declared=! */ #this, {core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:10:23: Error: Not a constant expression. + int bar2({int baz = x /* oops forgot the 1 */}) => 42; + ^"}) → core::int + return 42; +static extension-type-member method Foo|get#bar2(lowered final self::Foo% /* erasure=core::String, declared=! */ #this) → ({baz: core::int}) → core::int + return ({core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_02.dart:10:23: Error: Not a constant expression. + int bar2({int baz = x /* oops forgot the 1 */}) => 42; + ^"}) → core::int => self::Foo|bar2(#this, baz: baz); + +constants { + #C1 = 42 +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.textual_outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.textual_outline.expect new file mode 100644 index 00000000000..2781a507509 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.textual_outline.expect @@ -0,0 +1,6 @@ +extension type Foo(String x) { + static const int x1 = 42; + int x2 = 42; + int bar1({int baz = x2}) => 42; + int bar2({int baz = x}) => 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..bc6d65f4a7f --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_02.dart.textual_outline_modelled.expect @@ -0,0 +1,6 @@ +extension type Foo(String x) { + int bar1({int baz = x2}) => 42; + int bar2({int baz = x}) => 42; + int x2 = 42; + static const int x1 = 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_03.dart b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart new file mode 100644 index 00000000000..0cb64992b43 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart @@ -0,0 +1,7 @@ +// Copyright (c) 2024, 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. + +extension on int { + int bar({int baz = this}) => 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.expect b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.expect new file mode 100644 index 00000000000..f56327fdfeb --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.expect @@ -0,0 +1,23 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_03.dart:6:22: Error: Expected identifier, but got 'this'. +// int bar({int baz = this}) => 42; +// ^^^^ +// +import self as self; +import "dart:core" as core; + +extension /* unnamed */ _extension#0 on core::int { + method bar = self::_extension#0|bar; + method tearoff bar = self::_extension#0|get#bar; +} +static extension-member method _extension#0|bar(lowered final core::int #this, {core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_03.dart:6:22: Error: Expected identifier, but got 'this'. + int bar({int baz = this}) => 42; + ^^^^"}) → core::int + return 42; +static extension-member method _extension#0|get#bar(lowered final core::int #this) → ({baz: core::int}) → core::int + return ({core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_03.dart:6:22: Error: Expected identifier, but got 'this'. + int bar({int baz = this}) => 42; + ^^^^"}) → core::int => self::_extension#0|bar(#this, baz: baz); diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.modular.expect b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.modular.expect new file mode 100644 index 00000000000..f56327fdfeb --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.modular.expect @@ -0,0 +1,23 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_03.dart:6:22: Error: Expected identifier, but got 'this'. +// int bar({int baz = this}) => 42; +// ^^^^ +// +import self as self; +import "dart:core" as core; + +extension /* unnamed */ _extension#0 on core::int { + method bar = self::_extension#0|bar; + method tearoff bar = self::_extension#0|get#bar; +} +static extension-member method _extension#0|bar(lowered final core::int #this, {core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_03.dart:6:22: Error: Expected identifier, but got 'this'. + int bar({int baz = this}) => 42; + ^^^^"}) → core::int + return 42; +static extension-member method _extension#0|get#bar(lowered final core::int #this) → ({baz: core::int}) → core::int + return ({core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_03.dart:6:22: Error: Expected identifier, but got 'this'. + int bar({int baz = this}) => 42; + ^^^^"}) → core::int => self::_extension#0|bar(#this, baz: baz); diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.outline.expect new file mode 100644 index 00000000000..a5109ded384 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.outline.expect @@ -0,0 +1,12 @@ +library; +import self as self; +import "dart:core" as core; + +extension /* unnamed */ _extension#0 on core::int { + method bar = self::_extension#0|bar; + method tearoff bar = self::_extension#0|get#bar; +} +static extension-member method _extension#0|bar(lowered final core::int #this, {has-declared-initializer core::int baz}) → core::int + ; +static extension-member method _extension#0|get#bar(lowered final core::int #this) → ({baz: core::int}) → core::int + return ({core::int baz}) → core::int => self::_extension#0|bar(#this, baz: baz); diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.transformed.expect new file mode 100644 index 00000000000..f56327fdfeb --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.strong.transformed.expect @@ -0,0 +1,23 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_03.dart:6:22: Error: Expected identifier, but got 'this'. +// int bar({int baz = this}) => 42; +// ^^^^ +// +import self as self; +import "dart:core" as core; + +extension /* unnamed */ _extension#0 on core::int { + method bar = self::_extension#0|bar; + method tearoff bar = self::_extension#0|get#bar; +} +static extension-member method _extension#0|bar(lowered final core::int #this, {core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_03.dart:6:22: Error: Expected identifier, but got 'this'. + int bar({int baz = this}) => 42; + ^^^^"}) → core::int + return 42; +static extension-member method _extension#0|get#bar(lowered final core::int #this) → ({baz: core::int}) → core::int + return ({core::int baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_03.dart:6:22: Error: Expected identifier, but got 'this'. + int bar({int baz = this}) => 42; + ^^^^"}) → core::int => self::_extension#0|bar(#this, baz: baz); diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.textual_outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.textual_outline.expect new file mode 100644 index 00000000000..a60f2aea80a --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.textual_outline.expect @@ -0,0 +1,3 @@ +extension on int { + int bar({int baz = this}) => 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..a60f2aea80a --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_03.dart.textual_outline_modelled.expect @@ -0,0 +1,3 @@ +extension on int { + int bar({int baz = this}) => 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_04.dart b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart new file mode 100644 index 00000000000..bb1127a09a0 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart @@ -0,0 +1,7 @@ +// Copyright (c) 2024, 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. + +class Foo { + int bar({dynamic baz = this}) => 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.expect b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.expect new file mode 100644 index 00000000000..cde8da7b43a --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.expect @@ -0,0 +1,20 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_04.dart:6:26: Error: Expected identifier, but got 'this'. +// int bar({dynamic baz = this}) => 42; +// ^^^^ +// +import self as self; +import "dart:core" as core; + +class Foo extends core::Object { + synthetic constructor •() → self::Foo + : super core::Object::•() + ; + method bar({dynamic baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_04.dart:6:26: Error: Expected identifier, but got 'this'. + int bar({dynamic baz = this}) => 42; + ^^^^"}) → core::int + return 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.modular.expect b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.modular.expect new file mode 100644 index 00000000000..cde8da7b43a --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.modular.expect @@ -0,0 +1,20 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_04.dart:6:26: Error: Expected identifier, but got 'this'. +// int bar({dynamic baz = this}) => 42; +// ^^^^ +// +import self as self; +import "dart:core" as core; + +class Foo extends core::Object { + synthetic constructor •() → self::Foo + : super core::Object::•() + ; + method bar({dynamic baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_04.dart:6:26: Error: Expected identifier, but got 'this'. + int bar({dynamic baz = this}) => 42; + ^^^^"}) → core::int + return 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.outline.expect new file mode 100644 index 00000000000..6c4e26f04f1 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.outline.expect @@ -0,0 +1,19 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_04.dart:6:26: Error: Expected identifier, but got 'this'. +// int bar({dynamic baz = this}) => 42; +// ^^^^ +// +import self as self; +import "dart:core" as core; + +class Foo extends core::Object { + synthetic constructor •() → self::Foo + ; + method bar({dynamic baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_04.dart:6:26: Error: Expected identifier, but got 'this'. + int bar({dynamic baz = this}) => 42; + ^^^^"}) → core::int + ; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.transformed.expect new file mode 100644 index 00000000000..cde8da7b43a --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.strong.transformed.expect @@ -0,0 +1,20 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_04.dart:6:26: Error: Expected identifier, but got 'this'. +// int bar({dynamic baz = this}) => 42; +// ^^^^ +// +import self as self; +import "dart:core" as core; + +class Foo extends core::Object { + synthetic constructor •() → self::Foo + : super core::Object::•() + ; + method bar({dynamic baz = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_04.dart:6:26: Error: Expected identifier, but got 'this'. + int bar({dynamic baz = this}) => 42; + ^^^^"}) → core::int + return 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.textual_outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.textual_outline.expect new file mode 100644 index 00000000000..5080d0af593 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.textual_outline.expect @@ -0,0 +1,3 @@ +class Foo { + int bar({dynamic baz = this}) => 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..5080d0af593 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_04.dart.textual_outline_modelled.expect @@ -0,0 +1,3 @@ +class Foo { + int bar({dynamic baz = this}) => 42; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_05.dart b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart new file mode 100644 index 00000000000..72b12d5072e --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart @@ -0,0 +1,10 @@ +// Copyright (c) 2024, 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. + +class Foo { + int x2 = 42; + + @x2 + int? a, b; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.expect b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.expect new file mode 100644 index 00000000000..ee832f72c62 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.expect @@ -0,0 +1,29 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: Not a constant expression. +// @x2 +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. +// @x2 +// ^ +// +import self as self; +import "dart:core" as core; + +class Foo extends core::Object { + field core::int x2 = 42; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" + field core::int? a = null; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" + field core::int? b = null; + synthetic constructor •() → self::Foo + : super core::Object::•() + ; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.modular.expect b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.modular.expect new file mode 100644 index 00000000000..ee832f72c62 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.modular.expect @@ -0,0 +1,29 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: Not a constant expression. +// @x2 +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. +// @x2 +// ^ +// +import self as self; +import "dart:core" as core; + +class Foo extends core::Object { + field core::int x2 = 42; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" + field core::int? a = null; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" + field core::int? b = null; + synthetic constructor •() → self::Foo + : super core::Object::•() + ; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.outline.expect new file mode 100644 index 00000000000..cd0208c9be4 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.outline.expect @@ -0,0 +1,28 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: Not a constant expression. +// @x2 +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. +// @x2 +// ^ +// +import self as self; +import "dart:core" as core; + +class Foo extends core::Object { + field core::int x2; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in this.{self::Foo::x2}{core::int} + field core::int? a; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" in this.{self::Foo::x2}{core::int} + field core::int? b; + synthetic constructor •() → self::Foo + ; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.transformed.expect new file mode 100644 index 00000000000..ee832f72c62 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.strong.transformed.expect @@ -0,0 +1,29 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: Not a constant expression. +// @x2 +// ^^ +// +// pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. +// @x2 +// ^ +// +import self as self; +import "dart:core" as core; + +class Foo extends core::Object { + field core::int x2 = 42; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" + field core::int? a = null; + @invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_05.dart:8:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. + @x2 + ^" + field core::int? b = null; + synthetic constructor •() → self::Foo + : super core::Object::•() + ; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.textual_outline.expect b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.textual_outline.expect new file mode 100644 index 00000000000..9a7b0d05cb3 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.textual_outline.expect @@ -0,0 +1,5 @@ +class Foo { + int x2 = 42; + @x2 + int? a, b; +} diff --git a/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..59f3c0a88f2 --- /dev/null +++ b/pkg/front_end/testcases/regress/invalid_this_reference_05.dart.textual_outline_modelled.expect @@ -0,0 +1,5 @@ +class Foo { + @x2 + int? a, b; + int x2 = 42; +}