blob: c08bae4c63f946235b08e3fbdab331b62359ad05 [file] [log] [blame]
library;
//
// Problems in library:
//
// pkg/front_end/testcases/regress/invalid_this_reference_10.dart:6:14: Error: Extensions 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_10.dart:7:14: Error: Extensions 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_10.dart:6:21: Error: Undefined name 'bar'.
// late final foo1 = bar;
// ^^^
//
// pkg/front_end/testcases/regress/invalid_this_reference_10.dart:7:21: Error: Can't access 'this' in a field initializer to read 'baz'.
// late final foo2 = baz(0);
// ^^^
//
import self as self;
import "dart:core" as core;
extension Foo on dynamic {
field foo1 = self::Foo|foo1;
field foo2 = self::Foo|foo2;
method baz = self::Foo|baz;
method tearoff baz = self::Foo|get#baz;
}
late static final field invalid-type Foo|foo1 = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_10.dart:6:21: Error: Undefined name 'bar'.
late final foo1 = bar;
^^^";
late static final field invalid-type Foo|foo2 = invalid-expression "pkg/front_end/testcases/regress/invalid_this_reference_10.dart:7:21: Error: Can't access 'this' in a field initializer to read 'baz'.
late final foo2 = baz(0);
^^^";
static extension-member method Foo|baz(lowered final dynamic #this, core::int i) → core::int {
core::print(#this{dynamic}.bar);
core::print(#this{dynamic}.x{dynamic}.bar);
if(i =={core::num::==}{(core::Object) core::bool} 0) {
core::int b1 = self::Foo|baz(#this, 1);
dynamic b2 = #this{dynamic}.baz(1);
core::print(b1.{core::num::+}(b2 as{TypeError,ForDynamic} core::num){(core::num) core::num});
}
return 42;
}
static extension-member method Foo|get#baz(lowered final dynamic #this) → (core::int) → core::int
return (core::int i) core::int => self::Foo|baz(#this, i);