blob: bee35ea8b174851b97aaae107be6804137280b14 [file] [log] [blame]
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;
static field x1 = self::Foo|x1;
get x2 = self::Foo|get#x2;
set x2 = self::Foo|set#x2;
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 synthetic method Foo|constructor#_#new#tearOff(core::String x) → self::Foo% /* erasure=core::String, declared=! */
return self::Foo|constructor#(x);
static abstract extension-type-member method Foo|get#x2(lowered core::String #this) → core::int;
static abstract extension-type-member method Foo|set#x2(lowered core::String #this, synthesized core::int #externalFieldValue) → void;
static extension-type-member method Foo|bar1(lowered final self::Foo% /* erasure=core::String, declared=! */ #this, {erroneously-initialized 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 ({erroneously-initialized 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, {erroneously-initialized 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 ({erroneously-initialized 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
}