blob: 613cac1a6f03dc9fe02611d960c3f333a050e9ba [file] [log] [blame]
library;
//
// Problems in library:
//
// pkg/front_end/testcases/regress/invalid_this_reference_09.dart:6:14: Error: Extension types can't declare instance fields
// Try removing the field declaration or making it a static field
// late final foo1 = bar;
// ^^^^
//
// pkg/front_end/testcases/regress/invalid_this_reference_09.dart:7:14: Error: Extension types can't declare instance fields
// Try removing the field declaration or making it a static field
// late final foo2 = baz(0);
// ^^^^
//
// pkg/front_end/testcases/regress/invalid_this_reference_09.dart:6:21: Error: Undefined name 'bar'.
// late final foo1 = bar;
// ^^^
//
// pkg/front_end/testcases/regress/invalid_this_reference_09.dart:7:21: Error: Can't access 'this' in a field initializer to read 'baz'.
// late final foo2 = baz(0);
// ^^^
//
// pkg/front_end/testcases/regress/invalid_this_reference_09.dart:10:11: Error: The getter 'bar' isn't defined for the type 'Foo'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'bar'.
// print(bar);
// ^^^
//
import self as self;
import "dart:core" as core;
extension type Foo(dynamic x) {
abstract extension-type-member representation-field get x() dynamic;
get foo1 = self::Foo|get#foo1;
get foo2 = self::Foo|get#foo2;
method baz = self::Foo|baz;
method tearoff baz = self::Foo|get#baz;
constructor = self::Foo|constructor#;
constructor tearoff = self::Foo|constructor#_#new#tearOff;
}
extension type Foo2(dynamic _input) {
abstract extension-type-member representation-field get _input() dynamic;
constructor _ = self::Foo2|constructor#_;
constructor tearoff _ = self::Foo2|constructor#_#_#tearOff;
constructor fromInt = self::Foo2|constructor#fromInt;
constructor tearoff fromInt = self::Foo2|constructor#_#fromInt#tearOff;
}
static extension-type-member method Foo|constructor#(dynamic x) → self::Foo% /* erasure=dynamic, declared=! */ {
lowered final self::Foo% /* erasure=dynamic, declared=! */ #this = x;
return #this;
}
static extension-type-member synthetic method Foo|constructor#_#new#tearOff(dynamic x) → self::Foo% /* erasure=dynamic, declared=! */
return self::Foo|constructor#(x);
static abstract extension-type-member method Foo|get#foo1(lowered dynamic #this) → invalid-type;
static abstract extension-type-member method Foo|get#foo2(lowered dynamic #this) → invalid-type;
static extension-type-member method Foo|baz(lowered final self::Foo% /* erasure=dynamic, declared=! */ #this, core::int i) → core::int {
core::print(invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_09.dart:10:11: Error: The getter 'bar' isn't defined for the type 'Foo'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'bar'.
print(bar);
^^^" in #this{<unresolved>}.bar);
core::print((#this as{Unchecked} dynamic){dynamic}.bar);
if(i =={core::num::==}{(core::Object) core::bool} 0) {
core::int b1 = self::Foo|baz(#this, 1);
core::int b2 = self::Foo|baz(#this, 1);
core::print(b1.{core::num::+}(b2){(core::num) core::int});
}
return 42;
}
static extension-type-member method Foo|get#baz(lowered final self::Foo% /* erasure=dynamic, declared=! */ #this) → (core::int) → core::int
return (core::int i) core::int => self::Foo|baz(#this, i);
static extension-type-member method Foo2|constructor#_(dynamic _input) → self::Foo2% /* erasure=dynamic, declared=! */ {
lowered final self::Foo2% /* erasure=dynamic, declared=! */ #this = _input;
return #this;
}
static extension-type-member synthetic method Foo2|constructor#_#_#tearOff(dynamic _input) → self::Foo2% /* erasure=dynamic, declared=! */
return self::Foo2|constructor#_(_input);
static extension-type-member method Foo2|constructor#fromInt(core::int i) → self::Foo2% /* erasure=dynamic, declared=! */ {
lowered final self::Foo2% /* erasure=dynamic, declared=! */ #this;
#this = self::Foo2|constructor#_(i.{core::num::*}(2){(core::num) → core::int});
return #this;
}
static extension-type-member synthetic method Foo2|constructor#_#fromInt#tearOff(core::int i) → self::Foo2% /* erasure=dynamic, declared=! */
return self::Foo2|constructor#fromInt(i);