[cfe] Exclude extension types from scopes of on-types
Change-Id: I3512b6ea023df0f0e9d1121454366d7daafa38a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204722
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 317a63f..2addb57 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -4092,10 +4092,18 @@
void forEachExtensionInScope(void Function(ExtensionBuilder) f) {
if (_extensionsInScope == null) {
_extensionsInScope = <ExtensionBuilder>{};
- scope.forEachExtension(_extensionsInScope.add);
+ scope.forEachExtension((e) {
+ if (!e.extension.isExtensionTypeDeclaration) {
+ _extensionsInScope.add(e);
+ }
+ });
if (_prefixBuilders != null) {
for (PrefixBuilder prefix in _prefixBuilders) {
- prefix.exportScope.forEachExtension(_extensionsInScope.add);
+ prefix.exportScope.forEachExtension((e) {
+ if (!e.extension.isExtensionTypeDeclaration) {
+ _extensionsInScope.add(e);
+ }
+ });
}
}
}
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index e88b901..2a53afb 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -276,6 +276,7 @@
erased
err
esc
+et
everytime
evicting
exceed
diff --git a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart
index 114ac6f..9ecf985 100644
--- a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart
+++ b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart
@@ -10,11 +10,22 @@
double get bar => 3.14;
}
-test(A a, E e) {
+extension type ET on A {
+ String get baz => "baz";
+}
+
+test(A a, E e, ET et) {
a.foo; // Ok.
a.bar; // Ok.
+ a.baz; // Error.
+
e.foo; // Error.
e.bar; // Ok.
+ e.baz; // Error.
+
+ et.foo; // Error.
+ et.bar; // Error.
+ et.baz; // Ok.
}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.strong.expect b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.strong.expect
index f7bc273..b0091c5 100644
--- a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.strong.expect
+++ b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.strong.expect
@@ -2,11 +2,32 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:16:5: Error: The getter 'foo' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:20:5: Error: The getter 'baz' isn't defined for the class 'A'.
+// - 'A' is from 'pkg/front_end/testcases/extension_types/simple_getter_resolution.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'baz'.
+// a.baz; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:22:5: Error: The getter 'foo' isn't defined for the extension 'E'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'foo'.
// e.foo; // Error.
// ^^^
//
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:24:5: Error: The getter 'baz' isn't defined for the extension 'E'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'baz'.
+// e.baz; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:26:6: Error: The getter 'foo' isn't defined for the extension 'ET'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'foo'.
+// et.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:27:6: Error: The getter 'bar' isn't defined for the extension 'ET'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'bar'.
+// et.bar; // Error.
+// ^^^
+//
import self as self;
import "dart:core" as core;
@@ -20,15 +41,38 @@
extension E on self::A {
get bar = self::E|get#bar;
}
+extension type ET on self::A {
+ get baz = self::ET|get#baz;
+}
static method E|get#bar(lowered final self::A #this) → core::double
return 3.14;
-static method test(self::A a, self::E e) → dynamic {
+static method ET|get#baz(lowered final self::A #this) → core::String
+ return "baz";
+static method test(self::A a, self::E e, self::ET et) → dynamic {
a.{self::A::foo}{core::int};
self::E|get#bar(a);
- invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:16:5: Error: The getter 'foo' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:20:5: Error: The getter 'baz' isn't defined for the class 'A'.
+ - 'A' is from 'pkg/front_end/testcases/extension_types/simple_getter_resolution.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'baz'.
+ a.baz; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:22:5: Error: The getter 'foo' isn't defined for the extension 'E'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'foo'.
e.foo; // Error.
^^^";
self::E|get#bar(e);
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:24:5: Error: The getter 'baz' isn't defined for the extension 'E'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'baz'.
+ e.baz; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:26:6: Error: The getter 'foo' isn't defined for the extension 'ET'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'foo'.
+ et.foo; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:27:6: Error: The getter 'bar' isn't defined for the extension 'ET'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'bar'.
+ et.bar; // Error.
+ ^^^";
+ self::ET|get#baz(et);
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.textual_outline.expect
index 587163f..643c52f 100644
--- a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.textual_outline.expect
@@ -1,10 +1,11 @@
class A {
int get foo => 42;
}
-
extension E on A {
double get bar => 3.14;
}
-
-test(A a, E e) {}
+extension type ET on A {
+ String get baz => "baz";
+}
+test(A a, E e, ET et) {}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.weak.expect b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.weak.expect
index f7bc273..b0091c5 100644
--- a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.weak.expect
+++ b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.weak.expect
@@ -2,11 +2,32 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:16:5: Error: The getter 'foo' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:20:5: Error: The getter 'baz' isn't defined for the class 'A'.
+// - 'A' is from 'pkg/front_end/testcases/extension_types/simple_getter_resolution.dart'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'baz'.
+// a.baz; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:22:5: Error: The getter 'foo' isn't defined for the extension 'E'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'foo'.
// e.foo; // Error.
// ^^^
//
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:24:5: Error: The getter 'baz' isn't defined for the extension 'E'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'baz'.
+// e.baz; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:26:6: Error: The getter 'foo' isn't defined for the extension 'ET'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'foo'.
+// et.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:27:6: Error: The getter 'bar' isn't defined for the extension 'ET'.
+// Try correcting the name to the name of an existing getter, or defining a getter or field named 'bar'.
+// et.bar; // Error.
+// ^^^
+//
import self as self;
import "dart:core" as core;
@@ -20,15 +41,38 @@
extension E on self::A {
get bar = self::E|get#bar;
}
+extension type ET on self::A {
+ get baz = self::ET|get#baz;
+}
static method E|get#bar(lowered final self::A #this) → core::double
return 3.14;
-static method test(self::A a, self::E e) → dynamic {
+static method ET|get#baz(lowered final self::A #this) → core::String
+ return "baz";
+static method test(self::A a, self::E e, self::ET et) → dynamic {
a.{self::A::foo}{core::int};
self::E|get#bar(a);
- invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:16:5: Error: The getter 'foo' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:20:5: Error: The getter 'baz' isn't defined for the class 'A'.
+ - 'A' is from 'pkg/front_end/testcases/extension_types/simple_getter_resolution.dart'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'baz'.
+ a.baz; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:22:5: Error: The getter 'foo' isn't defined for the extension 'E'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'foo'.
e.foo; // Error.
^^^";
self::E|get#bar(e);
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:24:5: Error: The getter 'baz' isn't defined for the extension 'E'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'baz'.
+ e.baz; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:26:6: Error: The getter 'foo' isn't defined for the extension 'ET'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'foo'.
+ et.foo; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_getter_resolution.dart:27:6: Error: The getter 'bar' isn't defined for the extension 'ET'.
+Try correcting the name to the name of an existing getter, or defining a getter or field named 'bar'.
+ et.bar; // Error.
+ ^^^";
+ self::ET|get#baz(et);
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.weak.outline.expect
index 08cef61..23219b8 100644
--- a/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_getter_resolution.dart.weak.outline.expect
@@ -11,9 +11,14 @@
extension E on self::A {
get bar = self::E|get#bar;
}
+extension type ET on self::A {
+ get baz = self::ET|get#baz;
+}
static method E|get#bar(lowered final self::A #this) → core::double
;
-static method test(self::A a, self::E e) → dynamic
+static method ET|get#baz(lowered final self::A #this) → core::String
+ ;
+static method test(self::A a, self::E e, self::ET et) → dynamic
;
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart
index 0406a33..d53964e 100644
--- a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart
+++ b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart
@@ -10,11 +10,22 @@
void bar() => foo();
}
-test(A a, E e) {
+extension type ET on A {
+ void baz() => foo();
+}
+
+test(A a, E e, ET et) {
a.foo(); // Ok.
a.bar(); // Ok.
+ a.baz(); // Error.
+
e.foo(); // Error.
e.bar(); // Ok.
+ e.baz(); // Error.
+
+ et.foo(); // Error.
+ et.bar(); // Error.
+ et.baz(); // Ok.
}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.strong.expect b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.strong.expect
index 043030d..d468a09 100644
--- a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.strong.expect
+++ b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.strong.expect
@@ -2,11 +2,32 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:16:5: Error: The method 'foo' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:20:5: Error: The method 'baz' isn't defined for the class 'A'.
+// - 'A' is from 'pkg/front_end/testcases/extension_types/simple_method_resolution.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named 'baz'.
+// a.baz(); // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:22:5: Error: The method 'foo' isn't defined for the extension 'E'.
// Try correcting the name to the name of an existing method, or defining a method name 'foo'.
// e.foo(); // Error.
// ^^^
//
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:24:5: Error: The method 'baz' isn't defined for the extension 'E'.
+// Try correcting the name to the name of an existing method, or defining a method name 'baz'.
+// e.baz(); // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:26:6: Error: The method 'foo' isn't defined for the extension 'ET'.
+// Try correcting the name to the name of an existing method, or defining a method name 'foo'.
+// et.foo(); // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:27:6: Error: The method 'bar' isn't defined for the extension 'ET'.
+// Try correcting the name to the name of an existing method, or defining a method name 'bar'.
+// et.bar(); // Error.
+// ^^^
+//
import self as self;
import "dart:core" as core;
@@ -20,17 +41,43 @@
method bar = self::E|bar;
tearoff bar = self::E|get#bar;
}
+extension type ET on self::A {
+ method baz = self::ET|baz;
+ tearoff baz = self::ET|get#baz;
+}
static method E|bar(lowered final self::A #this) → void
return #this.{self::A::foo}(){() → void};
static method E|get#bar(lowered final self::A #this) → () → void
return () → void => self::E|bar(#this);
-static method test(self::A a, self::E e) → dynamic {
+static method ET|baz(lowered final self::A #this) → void
+ return #this.{self::A::foo}(){() → void};
+static method ET|get#baz(lowered final self::A #this) → () → void
+ return () → void => self::ET|baz(#this);
+static method test(self::A a, self::E e, self::ET et) → dynamic {
a.{self::A::foo}(){() → void};
self::E|bar(a);
- invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:16:5: Error: The method 'foo' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:20:5: Error: The method 'baz' isn't defined for the class 'A'.
+ - 'A' is from 'pkg/front_end/testcases/extension_types/simple_method_resolution.dart'.
+Try correcting the name to the name of an existing method, or defining a method named 'baz'.
+ a.baz(); // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:22:5: Error: The method 'foo' isn't defined for the extension 'E'.
Try correcting the name to the name of an existing method, or defining a method name 'foo'.
e.foo(); // Error.
^^^";
self::E|bar(e);
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:24:5: Error: The method 'baz' isn't defined for the extension 'E'.
+Try correcting the name to the name of an existing method, or defining a method name 'baz'.
+ e.baz(); // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:26:6: Error: The method 'foo' isn't defined for the extension 'ET'.
+Try correcting the name to the name of an existing method, or defining a method name 'foo'.
+ et.foo(); // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:27:6: Error: The method 'bar' isn't defined for the extension 'ET'.
+Try correcting the name to the name of an existing method, or defining a method name 'bar'.
+ et.bar(); // Error.
+ ^^^";
+ self::ET|baz(et);
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.textual_outline.expect
index d2f4abf..2bc13be 100644
--- a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.textual_outline.expect
@@ -1,10 +1,11 @@
class A {
void foo() {}
}
-
extension E on A {
void bar() => foo();
}
-
-test(A a, E e) {}
+extension type ET on A {
+ void baz() => foo();
+}
+test(A a, E e, ET et) {}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.weak.expect b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.weak.expect
index 043030d..d468a09 100644
--- a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.weak.expect
+++ b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.weak.expect
@@ -2,11 +2,32 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:16:5: Error: The method 'foo' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:20:5: Error: The method 'baz' isn't defined for the class 'A'.
+// - 'A' is from 'pkg/front_end/testcases/extension_types/simple_method_resolution.dart'.
+// Try correcting the name to the name of an existing method, or defining a method named 'baz'.
+// a.baz(); // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:22:5: Error: The method 'foo' isn't defined for the extension 'E'.
// Try correcting the name to the name of an existing method, or defining a method name 'foo'.
// e.foo(); // Error.
// ^^^
//
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:24:5: Error: The method 'baz' isn't defined for the extension 'E'.
+// Try correcting the name to the name of an existing method, or defining a method name 'baz'.
+// e.baz(); // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:26:6: Error: The method 'foo' isn't defined for the extension 'ET'.
+// Try correcting the name to the name of an existing method, or defining a method name 'foo'.
+// et.foo(); // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_method_resolution.dart:27:6: Error: The method 'bar' isn't defined for the extension 'ET'.
+// Try correcting the name to the name of an existing method, or defining a method name 'bar'.
+// et.bar(); // Error.
+// ^^^
+//
import self as self;
import "dart:core" as core;
@@ -20,17 +41,43 @@
method bar = self::E|bar;
tearoff bar = self::E|get#bar;
}
+extension type ET on self::A {
+ method baz = self::ET|baz;
+ tearoff baz = self::ET|get#baz;
+}
static method E|bar(lowered final self::A #this) → void
return #this.{self::A::foo}(){() → void};
static method E|get#bar(lowered final self::A #this) → () → void
return () → void => self::E|bar(#this);
-static method test(self::A a, self::E e) → dynamic {
+static method ET|baz(lowered final self::A #this) → void
+ return #this.{self::A::foo}(){() → void};
+static method ET|get#baz(lowered final self::A #this) → () → void
+ return () → void => self::ET|baz(#this);
+static method test(self::A a, self::E e, self::ET et) → dynamic {
a.{self::A::foo}(){() → void};
self::E|bar(a);
- invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:16:5: Error: The method 'foo' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:20:5: Error: The method 'baz' isn't defined for the class 'A'.
+ - 'A' is from 'pkg/front_end/testcases/extension_types/simple_method_resolution.dart'.
+Try correcting the name to the name of an existing method, or defining a method named 'baz'.
+ a.baz(); // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:22:5: Error: The method 'foo' isn't defined for the extension 'E'.
Try correcting the name to the name of an existing method, or defining a method name 'foo'.
e.foo(); // Error.
^^^";
self::E|bar(e);
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:24:5: Error: The method 'baz' isn't defined for the extension 'E'.
+Try correcting the name to the name of an existing method, or defining a method name 'baz'.
+ e.baz(); // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:26:6: Error: The method 'foo' isn't defined for the extension 'ET'.
+Try correcting the name to the name of an existing method, or defining a method name 'foo'.
+ et.foo(); // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_method_resolution.dart:27:6: Error: The method 'bar' isn't defined for the extension 'ET'.
+Try correcting the name to the name of an existing method, or defining a method name 'bar'.
+ et.bar(); // Error.
+ ^^^";
+ self::ET|baz(et);
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.weak.outline.expect
index e77d076..6072cb8 100644
--- a/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_method_resolution.dart.weak.outline.expect
@@ -12,11 +12,19 @@
method bar = self::E|bar;
tearoff bar = self::E|get#bar;
}
+extension type ET on self::A {
+ method baz = self::ET|baz;
+ tearoff baz = self::ET|get#baz;
+}
static method E|bar(lowered final self::A #this) → void
;
static method E|get#bar(lowered final self::A #this) → () → void
return () → void => self::E|bar(#this);
-static method test(self::A a, self::E e) → dynamic
+static method ET|baz(lowered final self::A #this) → void
+ ;
+static method ET|get#baz(lowered final self::A #this) → () → void
+ return () → void => self::ET|baz(#this);
+static method test(self::A a, self::E e, self::ET et) → dynamic
;
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart
index 7f1f10b..ace84f6 100644
--- a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart
+++ b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart
@@ -13,18 +13,31 @@
dynamic operator+(dynamic other) => 42;
}
-test(A a, E e) {
+extension type ET on A {
+ dynamic operator~/(dynamic other) => 42;
+}
+
+test(A a, E e, ET et) {
a * "foobar"; // Ok.
a[0]; // Ok.
a[0] = "foobar"; // Ok.
-a; // Ok.
a + "foobar"; // Ok.
+ a ~/ "foobar"; // Error.
e * "foobar"; // Error.
e[0]; // Error.
e[0] = "foobar"; // Error.
-e; // Error.
e + "foobar"; // Ok.
+ e ~/ "foobar"; // Error.
+
+ et * "foobar"; // Error.
+ et[0]; // Error.
+ et[0] = "foobar"; // Error.
+ -et; // Error.
+ et + "foobar"; // Error.
+ et ~/ "foobar"; // Ok.
}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.strong.expect b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.strong.expect
index 2ff87ce..743deb8 100644
--- a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.strong.expect
+++ b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.strong.expect
@@ -2,26 +2,62 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:23:5: Error: The operator '*' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:26:5: Error: The operator '~/' isn't defined for the class 'A'.
+// - 'A' is from 'pkg/front_end/testcases/extension_types/simple_operator_resolution.dart'.
+// Try correcting the operator to an existing operator, or defining a '~/' operator.
+// a ~/ "foobar"; // Error.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:28:5: Error: The operator '*' isn't defined for the extension 'E'.
// Try correcting the operator to an existing operator, or defining a '*' operator.
// e * "foobar"; // Error.
// ^
//
-// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:24:4: Error: The operator '[]' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:29:4: Error: The operator '[]' isn't defined for the extension 'E'.
// Try correcting the operator to an existing operator, or defining a '[]' operator.
// e[0]; // Error.
// ^
//
-// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:25:4: Error: The operator '[]=' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:30:4: Error: The operator '[]=' isn't defined for the extension 'E'.
// Try correcting the operator to an existing operator, or defining a '[]=' operator.
// e[0] = "foobar"; // Error.
// ^
//
-// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:26:3: Error: The operator 'unary-' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:31:3: Error: The operator 'unary-' isn't defined for the extension 'E'.
// Try correcting the operator to an existing operator, or defining a 'unary-' operator.
// -e; // Error.
// ^
//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:33:5: Error: The operator '~/' isn't defined for the extension 'E'.
+// Try correcting the operator to an existing operator, or defining a '~/' operator.
+// e ~/ "foobar"; // Error.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:35:6: Error: The operator '*' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a '*' operator.
+// et * "foobar"; // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:36:5: Error: The operator '[]' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a '[]' operator.
+// et[0]; // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:37:5: Error: The operator '[]=' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a '[]=' operator.
+// et[0] = "foobar"; // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:38:3: Error: The operator 'unary-' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a 'unary-' operator.
+// -et; // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:39:6: Error: The operator '+' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a '+' operator.
+// et + "foobar"; // Error.
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -40,30 +76,65 @@
extension E on self::A {
operator + = self::E|+;
}
+extension type ET on self::A {
+ operator ~/ = self::ET|~/;
+}
static method E|+(lowered final self::A #this, dynamic other) → dynamic
return 42;
-static method test(self::A a, self::E e) → dynamic {
+static method ET|~/(lowered final self::A #this, dynamic other) → dynamic
+ return 42;
+static method test(self::A a, self::E e, self::ET et) → dynamic {
a.{self::A::*}("foobar"){(dynamic) → dynamic};
a.{self::A::[]}(0){(core::int) → dynamic};
a.{self::A::[]=}(0, "foobar"){(core::int, dynamic) → void};
a.{self::A::unary-}(){() → dynamic};
self::E|+(a, "foobar");
- invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:23:5: Error: The operator '*' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:26:5: Error: The operator '~/' isn't defined for the class 'A'.
+ - 'A' is from 'pkg/front_end/testcases/extension_types/simple_operator_resolution.dart'.
+Try correcting the operator to an existing operator, or defining a '~/' operator.
+ a ~/ \"foobar\"; // Error.
+ ^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:28:5: Error: The operator '*' isn't defined for the extension 'E'.
Try correcting the operator to an existing operator, or defining a '*' operator.
e * \"foobar\"; // Error.
^";
- invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:24:4: Error: The operator '[]' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:29:4: Error: The operator '[]' isn't defined for the extension 'E'.
Try correcting the operator to an existing operator, or defining a '[]' operator.
e[0]; // Error.
^";
- invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:25:4: Error: The operator '[]=' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:30:4: Error: The operator '[]=' isn't defined for the extension 'E'.
Try correcting the operator to an existing operator, or defining a '[]=' operator.
e[0] = \"foobar\"; // Error.
^";
- invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:26:3: Error: The operator 'unary-' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:31:3: Error: The operator 'unary-' isn't defined for the extension 'E'.
Try correcting the operator to an existing operator, or defining a 'unary-' operator.
-e; // Error.
^";
self::E|+(e, "foobar");
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:33:5: Error: The operator '~/' isn't defined for the extension 'E'.
+Try correcting the operator to an existing operator, or defining a '~/' operator.
+ e ~/ \"foobar\"; // Error.
+ ^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:35:6: Error: The operator '*' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a '*' operator.
+ et * \"foobar\"; // Error.
+ ^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:36:5: Error: The operator '[]' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a '[]' operator.
+ et[0]; // Error.
+ ^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:37:5: Error: The operator '[]=' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a '[]=' operator.
+ et[0] = \"foobar\"; // Error.
+ ^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:38:3: Error: The operator 'unary-' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a 'unary-' operator.
+ -et; // Error.
+ ^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:39:6: Error: The operator '+' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a '+' operator.
+ et + \"foobar\"; // Error.
+ ^";
+ self::ET|~/(et, "foobar");
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.textual_outline.expect
index b773643..d324d2b 100644
--- a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.textual_outline.expect
@@ -1,13 +1,14 @@
class A {
- dynamic operator *(dynamic other) => 42;
- dynamic operator [](int index) => 42;
- void operator []=(int index, dynamic value) {}
- dynamic operator -() => 42;
+ dynamic operator*(dynamic other) => 42;
+ dynamic operator[](int index) => 42;
+ void operator[]=(int index, dynamic value) {}
+ dynamic operator-() => 42;
}
-
extension E on A {
- dynamic operator +(dynamic other) => 42;
+ dynamic operator+(dynamic other) => 42;
}
-
-test(A a, E e) {}
+extension type ET on A {
+ dynamic operator~/(dynamic other) => 42;
+}
+test(A a, E e, ET et) {}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.weak.expect b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.weak.expect
index 2ff87ce..743deb8 100644
--- a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.weak.expect
+++ b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.weak.expect
@@ -2,26 +2,62 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:23:5: Error: The operator '*' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:26:5: Error: The operator '~/' isn't defined for the class 'A'.
+// - 'A' is from 'pkg/front_end/testcases/extension_types/simple_operator_resolution.dart'.
+// Try correcting the operator to an existing operator, or defining a '~/' operator.
+// a ~/ "foobar"; // Error.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:28:5: Error: The operator '*' isn't defined for the extension 'E'.
// Try correcting the operator to an existing operator, or defining a '*' operator.
// e * "foobar"; // Error.
// ^
//
-// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:24:4: Error: The operator '[]' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:29:4: Error: The operator '[]' isn't defined for the extension 'E'.
// Try correcting the operator to an existing operator, or defining a '[]' operator.
// e[0]; // Error.
// ^
//
-// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:25:4: Error: The operator '[]=' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:30:4: Error: The operator '[]=' isn't defined for the extension 'E'.
// Try correcting the operator to an existing operator, or defining a '[]=' operator.
// e[0] = "foobar"; // Error.
// ^
//
-// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:26:3: Error: The operator 'unary-' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:31:3: Error: The operator 'unary-' isn't defined for the extension 'E'.
// Try correcting the operator to an existing operator, or defining a 'unary-' operator.
// -e; // Error.
// ^
//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:33:5: Error: The operator '~/' isn't defined for the extension 'E'.
+// Try correcting the operator to an existing operator, or defining a '~/' operator.
+// e ~/ "foobar"; // Error.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:35:6: Error: The operator '*' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a '*' operator.
+// et * "foobar"; // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:36:5: Error: The operator '[]' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a '[]' operator.
+// et[0]; // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:37:5: Error: The operator '[]=' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a '[]=' operator.
+// et[0] = "foobar"; // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:38:3: Error: The operator 'unary-' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a 'unary-' operator.
+// -et; // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:39:6: Error: The operator '+' isn't defined for the extension 'ET'.
+// Try correcting the operator to an existing operator, or defining a '+' operator.
+// et + "foobar"; // Error.
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -40,30 +76,65 @@
extension E on self::A {
operator + = self::E|+;
}
+extension type ET on self::A {
+ operator ~/ = self::ET|~/;
+}
static method E|+(lowered final self::A #this, dynamic other) → dynamic
return 42;
-static method test(self::A a, self::E e) → dynamic {
+static method ET|~/(lowered final self::A #this, dynamic other) → dynamic
+ return 42;
+static method test(self::A a, self::E e, self::ET et) → dynamic {
a.{self::A::*}("foobar"){(dynamic) → dynamic};
a.{self::A::[]}(0){(core::int) → dynamic};
a.{self::A::[]=}(0, "foobar"){(core::int, dynamic) → void};
a.{self::A::unary-}(){() → dynamic};
self::E|+(a, "foobar");
- invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:23:5: Error: The operator '*' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:26:5: Error: The operator '~/' isn't defined for the class 'A'.
+ - 'A' is from 'pkg/front_end/testcases/extension_types/simple_operator_resolution.dart'.
+Try correcting the operator to an existing operator, or defining a '~/' operator.
+ a ~/ \"foobar\"; // Error.
+ ^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:28:5: Error: The operator '*' isn't defined for the extension 'E'.
Try correcting the operator to an existing operator, or defining a '*' operator.
e * \"foobar\"; // Error.
^";
- invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:24:4: Error: The operator '[]' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:29:4: Error: The operator '[]' isn't defined for the extension 'E'.
Try correcting the operator to an existing operator, or defining a '[]' operator.
e[0]; // Error.
^";
- invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:25:4: Error: The operator '[]=' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:30:4: Error: The operator '[]=' isn't defined for the extension 'E'.
Try correcting the operator to an existing operator, or defining a '[]=' operator.
e[0] = \"foobar\"; // Error.
^";
- invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:26:3: Error: The operator 'unary-' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:31:3: Error: The operator 'unary-' isn't defined for the extension 'E'.
Try correcting the operator to an existing operator, or defining a 'unary-' operator.
-e; // Error.
^";
self::E|+(e, "foobar");
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:33:5: Error: The operator '~/' isn't defined for the extension 'E'.
+Try correcting the operator to an existing operator, or defining a '~/' operator.
+ e ~/ \"foobar\"; // Error.
+ ^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:35:6: Error: The operator '*' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a '*' operator.
+ et * \"foobar\"; // Error.
+ ^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:36:5: Error: The operator '[]' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a '[]' operator.
+ et[0]; // Error.
+ ^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:37:5: Error: The operator '[]=' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a '[]=' operator.
+ et[0] = \"foobar\"; // Error.
+ ^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:38:3: Error: The operator 'unary-' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a 'unary-' operator.
+ -et; // Error.
+ ^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_operator_resolution.dart:39:6: Error: The operator '+' isn't defined for the extension 'ET'.
+Try correcting the operator to an existing operator, or defining a '+' operator.
+ et + \"foobar\"; // Error.
+ ^";
+ self::ET|~/(et, "foobar");
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.weak.outline.expect
index af29517..f6ffff4 100644
--- a/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_operator_resolution.dart.weak.outline.expect
@@ -17,9 +17,14 @@
extension E on self::A {
operator + = self::E|+;
}
+extension type ET on self::A {
+ operator ~/ = self::ET|~/;
+}
static method E|+(lowered final self::A #this, dynamic other) → dynamic
;
-static method test(self::A a, self::E e) → dynamic
+static method ET|~/(lowered final self::A #this, dynamic other) → dynamic
+ ;
+static method test(self::A a, self::E e, self::ET et) → dynamic
;
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart
index 20f43d6..0205c3e 100644
--- a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart
+++ b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart
@@ -10,11 +10,22 @@
void set bar(int value) {}
}
+extension type ET on A {
+ void set baz(int value) {}
+}
+
test(A a, E e) {
a.foo = 42; // Ok.
a.bar = 42; // Ok.
+ a.baz = 42; // Error.
+
e.foo = 42; // Error.
e.bar = 42; // Ok.
+ e.baz = 42; // Error.
+
+ et.foo = 42; // Error.
+ et.bar = 42; // Error.
+ et.baz = 42; // Ok.
}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.strong.expect b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.strong.expect
index c7f4354..1ce4b82 100644
--- a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.strong.expect
+++ b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.strong.expect
@@ -2,11 +2,34 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:16:5: Error: The setter 'foo' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:26:3: Error: Getter not found: 'et'.
+// et.foo = 42; // Error.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:27:3: Error: Getter not found: 'et'.
+// et.bar = 42; // Error.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:28:3: Error: Getter not found: 'et'.
+// et.baz = 42; // Ok.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:20:5: Error: The setter 'baz' isn't defined for the class 'A'.
+// - 'A' is from 'pkg/front_end/testcases/extension_types/simple_setter_resolution.dart'.
+// Try correcting the name to the name of an existing setter, or defining a setter or field named 'baz'.
+// a.baz = 42; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:22:5: Error: The setter 'foo' isn't defined for the extension 'E'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named 'foo'.
// e.foo = 42; // Error.
// ^^^
//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:24:5: Error: The setter 'baz' isn't defined for the extension 'E'.
+// Try correcting the name to the name of an existing setter, or defining a setter or field named 'baz'.
+// e.baz = 42; // Error.
+// ^^^
+//
import self as self;
import "dart:core" as core;
@@ -19,14 +42,36 @@
extension E on self::A {
set bar = self::E|set#bar;
}
+extension type ET on self::A {
+ set baz = self::ET|set#baz;
+}
static method E|set#bar(lowered final self::A #this, core::int value) → void {}
+static method ET|set#baz(lowered final self::A #this, core::int value) → void {}
static method test(self::A a, self::E e) → dynamic {
a.{self::A::foo} = 42;
self::E|set#bar(a, 42);
- invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:16:5: Error: The setter 'foo' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:20:5: Error: The setter 'baz' isn't defined for the class 'A'.
+ - 'A' is from 'pkg/front_end/testcases/extension_types/simple_setter_resolution.dart'.
+Try correcting the name to the name of an existing setter, or defining a setter or field named 'baz'.
+ a.baz = 42; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:22:5: Error: The setter 'foo' isn't defined for the extension 'E'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'foo'.
e.foo = 42; // Error.
^^^";
self::E|set#bar(e, 42);
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:24:5: Error: The setter 'baz' isn't defined for the extension 'E'.
+Try correcting the name to the name of an existing setter, or defining a setter or field named 'baz'.
+ e.baz = 42; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:26:3: Error: Getter not found: 'et'.
+ et.foo = 42; // Error.
+ ^^"{dynamic}.foo = 42;
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:27:3: Error: Getter not found: 'et'.
+ et.bar = 42; // Error.
+ ^^"{dynamic}.bar = 42;
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:28:3: Error: Getter not found: 'et'.
+ et.baz = 42; // Ok.
+ ^^"{dynamic}.baz = 42;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.textual_outline.expect
index d7b5425..60eca21 100644
--- a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.textual_outline.expect
@@ -1,10 +1,11 @@
class A {
void set foo(int value) {}
}
-
extension E on A {
void set bar(int value) {}
}
-
+extension type ET on A {
+ void set baz(int value) {}
+}
test(A a, E e) {}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.weak.expect b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.weak.expect
index c7f4354..1ce4b82 100644
--- a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.weak.expect
+++ b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.weak.expect
@@ -2,11 +2,34 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:16:5: Error: The setter 'foo' isn't defined for the extension 'E'.
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:26:3: Error: Getter not found: 'et'.
+// et.foo = 42; // Error.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:27:3: Error: Getter not found: 'et'.
+// et.bar = 42; // Error.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:28:3: Error: Getter not found: 'et'.
+// et.baz = 42; // Ok.
+// ^^
+//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:20:5: Error: The setter 'baz' isn't defined for the class 'A'.
+// - 'A' is from 'pkg/front_end/testcases/extension_types/simple_setter_resolution.dart'.
+// Try correcting the name to the name of an existing setter, or defining a setter or field named 'baz'.
+// a.baz = 42; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:22:5: Error: The setter 'foo' isn't defined for the extension 'E'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named 'foo'.
// e.foo = 42; // Error.
// ^^^
//
+// pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:24:5: Error: The setter 'baz' isn't defined for the extension 'E'.
+// Try correcting the name to the name of an existing setter, or defining a setter or field named 'baz'.
+// e.baz = 42; // Error.
+// ^^^
+//
import self as self;
import "dart:core" as core;
@@ -19,14 +42,36 @@
extension E on self::A {
set bar = self::E|set#bar;
}
+extension type ET on self::A {
+ set baz = self::ET|set#baz;
+}
static method E|set#bar(lowered final self::A #this, core::int value) → void {}
+static method ET|set#baz(lowered final self::A #this, core::int value) → void {}
static method test(self::A a, self::E e) → dynamic {
a.{self::A::foo} = 42;
self::E|set#bar(a, 42);
- invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:16:5: Error: The setter 'foo' isn't defined for the extension 'E'.
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:20:5: Error: The setter 'baz' isn't defined for the class 'A'.
+ - 'A' is from 'pkg/front_end/testcases/extension_types/simple_setter_resolution.dart'.
+Try correcting the name to the name of an existing setter, or defining a setter or field named 'baz'.
+ a.baz = 42; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:22:5: Error: The setter 'foo' isn't defined for the extension 'E'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'foo'.
e.foo = 42; // Error.
^^^";
self::E|set#bar(e, 42);
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:24:5: Error: The setter 'baz' isn't defined for the extension 'E'.
+Try correcting the name to the name of an existing setter, or defining a setter or field named 'baz'.
+ e.baz = 42; // Error.
+ ^^^";
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:26:3: Error: Getter not found: 'et'.
+ et.foo = 42; // Error.
+ ^^"{dynamic}.foo = 42;
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:27:3: Error: Getter not found: 'et'.
+ et.bar = 42; // Error.
+ ^^"{dynamic}.bar = 42;
+ invalid-expression "pkg/front_end/testcases/extension_types/simple_setter_resolution.dart:28:3: Error: Getter not found: 'et'.
+ et.baz = 42; // Ok.
+ ^^"{dynamic}.baz = 42;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.weak.outline.expect
index 05a6bb6..191e17f 100644
--- a/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_setter_resolution.dart.weak.outline.expect
@@ -11,8 +11,13 @@
extension E on self::A {
set bar = self::E|set#bar;
}
+extension type ET on self::A {
+ set baz = self::ET|set#baz;
+}
static method E|set#bar(lowered final self::A #this, core::int value) → void
;
+static method ET|set#baz(lowered final self::A #this, core::int value) → void
+ ;
static method test(self::A a, self::E e) → dynamic
;
static method main() → dynamic
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index 7c64966..fd8e874 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -33,6 +33,10 @@
constructor_tearoffs/unnamed_constructor: FormatterCrash
dart2js/late_fields: FormatterCrash
dart2js/late_statics: FormatterCrash
+extension_types/simple_getter_resolution: FormatterCrash
+extension_types/simple_method_resolution: FormatterCrash
+extension_types/simple_operator_resolution: FormatterCrash
+extension_types/simple_setter_resolution: FormatterCrash
extensions/extension_constructor: FormatterCrash
extensions/extension_field_with_type_parameter_usage: FormatterCrash
extensions/issue38600: FormatterCrash