Version 2.18.0-95.0.dev

Merge commit 'daba3529cbcf3e5aa5b20ce8d2b553d5606d5fc7' into 'dev'
diff --git a/DEPS b/DEPS
index 2b71b25..57d0d22 100644
--- a/DEPS
+++ b/DEPS
@@ -108,11 +108,11 @@
   "dart_style_rev": "d7b73536a8079331c888b7da539b80e6825270ea",
 
   "dartdoc_rev": "334072b0cad436c05f6bcecf8a1a59f2f0809b84",
-  "devtools_rev": "6ca0b315ccafb7e2a5c6081063d28b546a0f7101",
+  "devtools_rev": "3c16b8d73120e46958982d94215d499793b972eb",
   "ffi_rev": "4dd32429880a57b64edaf54c9d5af8a9fa9a4ffb",
   "file_rev": "1ebc38852ffed24b564910317982298b56c2cedd",
   "fixnum_rev": "3bfc2ed1eea7e7acb79ad4f17392f92c816fc5ce",
-  "glob_rev": "da1f4595ee2f87982cbcc663d4cac244822d9227",
+  "glob_rev": "e10eb2407c58427144004458ef85c9bbf7286e56",
   "html_rev": "f108bce59d136c584969fd24a5006914796cf213",
   "http_io_rev": "2fa188caf7937e313026557713f7feffedd4978b",
   "http_multi_server_rev": "34bf7f04b61cce561f47f7f275c2cc811534a05a",
diff --git a/pkg/analysis_server/test/analysis/get_errors_test.dart b/pkg/analysis_server/test/analysis/get_errors_test.dart
index ece1a97..00d0e26 100644
--- a/pkg/analysis_server/test/analysis/get_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/get_errors_test.dart
@@ -28,7 +28,7 @@
 
   Future<void> test_afterAnalysisComplete() async {
     newFile(testFilePath, '''
-main() {
+void f() {
   print(42)
 }
 ''');
@@ -74,7 +74,7 @@
 
   Future<void> test_hasErrors() async {
     newFile(testFilePath, '''
-main() {
+void f() {
   print(42)
 }
 ''');
@@ -112,7 +112,7 @@
 
   Future<void> test_noErrors() async {
     newFile(testFilePath, '''
-main() {
+void f() {
   print(42);
 }
 ''');
diff --git a/pkg/analysis_server/test/analysis/get_navigation_test.dart b/pkg/analysis_server/test/analysis/get_navigation_test.dart
index 15c022d..e0c55b0 100644
--- a/pkg/analysis_server/test/analysis/get_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/get_navigation_test.dart
@@ -29,7 +29,7 @@
 
   Future<void> test_beforeAnalysisComplete() async {
     addTestFile('''
-main() {
+void f() {
   var test = 0;
   print(test);
 }
@@ -42,7 +42,7 @@
   Future<void> test_comment_outsideReference() async {
     addTestFile('''
 /// Returns a [String].
-String main() {
+String f() {
 }''');
     await waitForTasksFinished();
     await _getNavigation(search: 'Returns', length: 1);
@@ -52,7 +52,7 @@
   Future<void> test_comment_reference() async {
     addTestFile('''
 /// Returns a [String].
-String main() {
+String f() {
 }''');
     await waitForTasksFinished();
     await _getNavigation(search: '[String', length: 1);
@@ -67,7 +67,7 @@
 /// {@tool dartpad}
 /// ** See code in $examplePath **
 /// {@end-tool}
-String main() {
+String f() {
 }''');
     await waitForTasksFinished();
     await _getNavigation(search: examplePath, length: 1);
@@ -148,7 +148,7 @@
   @FailingTest(reason: 'requires infrastructure rewriting')
   Future<void> test_fileOutsideOfRoot() async {
     var file = newFile('/outside.dart', '''
-main() {
+void f() {
   var test = 0;
   print(test);
 }
@@ -162,7 +162,7 @@
     addTestFile('''
 import 'dart:math';
 
-main() {
+void f() {
 }''');
     await waitForTasksFinished();
     await _getNavigation(offset: 0, length: 17);
@@ -176,7 +176,7 @@
     addTestFile('''
 import 'dart:math';
 
-main() {
+void f() {
 }''');
     await waitForTasksFinished();
     await _getNavigation(offset: 7, length: 11);
@@ -194,7 +194,7 @@
   if (dart.library.io) 'io.dart'
   if (dart.library.html) 'html.dart';
 
-main() {
+void f() {
 }''');
     await waitForTasksFinished();
 
@@ -240,7 +240,7 @@
 
   Future<void> test_multipleRegions() async {
     addTestFile('''
-main() {
+void f() {
   var aaa = 1;
   var bbb = 2;
   var ccc = 3;
@@ -316,7 +316,7 @@
 
   Future<void> test_zeroLength_end() async {
     addTestFile('''
-main() {
+void f() {
   var test = 0;
   print(test);
 }
@@ -329,7 +329,7 @@
 
   Future<void> test_zeroLength_start() async {
     addTestFile('''
-main() {
+void f() {
   var test = 0;
   print(test);
 }
diff --git a/pkg/analysis_server/test/analysis/get_signature_test.dart b/pkg/analysis_server/test/analysis/get_signature_test.dart
index 5edf1ad..08cb899 100644
--- a/pkg/analysis_server/test/analysis/get_signature_test.dart
+++ b/pkg/analysis_server/test/analysis/get_signature_test.dart
@@ -51,7 +51,7 @@
   /// MyClass constructor doc
   MyClass(String name, {int length}) {}
 }
-main() {
+void f() {
   var a = new MyClass("Danny", /*^*/);
 }
 ''');
@@ -78,7 +78,7 @@
     return new MyClass._();
   }
 }
-main() {
+void f() {
   var a = new MyClass("Danny", /*^*/);
 }
 ''');
@@ -101,7 +101,7 @@
   /// MyClass.foo constructor doc
   MyClass.foo(String name, {int length}) {}
 }
-main() {
+void f() {
   var a = new MyClass.foo("Danny", /*^*/);
 }
 ''');
@@ -120,7 +120,7 @@
   Future<void> test_does_not_walk_up_over_closure() async {
     newFile(testFilePath, '''
 one(String name, int length) {}
-main() {
+void f() {
   one("Danny", () {
     /*^*/
   });
@@ -169,7 +169,7 @@
     newFile(testFilePath, '''
 /// f doc
 int Function(String) f(String s) => (int i) => int.parse(s) + i;
-main() {
+void f() {
   print(f('3'/*^*/)(2));
 }
 ''');
@@ -187,13 +187,13 @@
     newFile('$testPackageLibPath/other.dart', '''
 /// one doc
 one(String name, int length) {}
-main() {
+void f() {
   one("Danny", /*^*/);
 }
 ''');
     newFile(testFilePath, '''
 import 'other.dart';
-main() {
+void f() {
   one("Danny", /*^*/);
 }
 ''');
@@ -215,7 +215,7 @@
     newFile(testFilePath, '''
 /// one doc
 one(String name, int length) {}
-main() {
+void f() {
   one("Danny", (((1 * 2/*^*/))));
 }
 ''');
@@ -237,7 +237,7 @@
     newFile(testFilePath, '''
 /// one doc
 one(String name, {int length}) {}
-main() {
+void f() {
   one("Danny", /*^*/);
 }
 ''');
@@ -257,7 +257,7 @@
     newFile(testFilePath, '''
 /// one doc
 one(String name, {int length = 1}) {}
-main() {
+void f() {
   one("Danny", /*^*/);
 }
 ''');
@@ -279,7 +279,7 @@
     newFile(testFilePath, '''
 /// one doc
 one(String name, {String email = "a@b.c"}) {}
-main() {
+void f() {
   one("Danny", /*^*/);
 }
 ''');
@@ -304,7 +304,7 @@
 one(String one) {}
 /// two doc
 String two(String two) { return ""; }
-main() {
+void f() {
   one(two(/*^*/));
 }
 ''');
@@ -325,7 +325,7 @@
 one(String one) {}
 /// two doc
 String two(String two) { return ""; }
-main() {
+void f() {
   one(two(),/*^*/);
 }
 ''');
@@ -342,7 +342,7 @@
   Future<void> test_function_no_dart_doc() async {
     newFile(testFilePath, '''
 one(String name, int length) {}
-main() {
+void f() {
   one("Danny", /*^*/);
 }
 ''');
@@ -364,7 +364,7 @@
     newFile(testFilePath, '''
 /// one doc
 one(String name, [int length]) {}
-main() {
+void f() {
   one("Danny", /*^*/);
 }
 ''');
@@ -386,7 +386,7 @@
     newFile(testFilePath, '''
 /// one doc
 one(String name, [int length = 11]) {}
-main() {
+void f() {
   one("Danny", /*^*/);
 }
 ''');
@@ -408,7 +408,7 @@
     newFile(testFilePath, '''
 /// one doc
 one(String name, int length) {}
-main() {
+void f() {
   one("Danny", /*^*/);
 }
 ''');
@@ -430,7 +430,7 @@
     newFile(testFilePath, '''
 /// one doc
 one() {}
-main() {
+void f() {
   one(/*^*/);
 }
 ''');
@@ -471,7 +471,7 @@
   /// MyClass instance method
   myMethod(String name, {int length}) {}
 }
-main() {
+void f() {
   var a = new MyClass("Danny");
   a.myMethod("Danny", /*^*/);
 }
@@ -497,7 +497,7 @@
   /// MyClass static method
   static void myStaticMethod(String name, {int length}) {}
 }
-main() {
+void f() {
   MyClass.myStaticMethod("Danny", /*^*/);
 }
 ''');
diff --git a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
index 3ede9b3..43b7cb6 100644
--- a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
@@ -26,7 +26,7 @@
   Map<File, List<AnalysisError>> filesErrors = {};
 
   final testSource = '''
-main() {
+void f() {
   var x = '';
   int y = x; // Not assignable in strong-mode
   print(y);
@@ -65,7 +65,7 @@
 ''');
 
     addTestFile('''
-main() {
+void f() {
   String unused = "";
 }
 ''');
@@ -90,7 +90,7 @@
 ''');
 
     addTestFile('''
-main() {
+void f() {
   String unused = "";
 }
 ''');
diff --git a/pkg/analysis_server/test/analysis/notification_errors_test.dart b/pkg/analysis_server/test/analysis/notification_errors_test.dart
index 11fbe1b..4c93ced 100644
--- a/pkg/analysis_server/test/analysis/notification_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_errors_test.dart
@@ -347,7 +347,7 @@
     var otherFile = newFile('/other.dart', 'UnknownType V;');
     addTestFile('''
 import '/other.dart';
-main() {
+void f() {
   print(V);
 }
 ''');
diff --git a/pkg/analysis_server/test/analysis/notification_navigation_test.dart b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
index 30aa898..eaa1e0a 100644
--- a/pkg/analysis_server/test/analysis/notification_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
@@ -271,7 +271,7 @@
 class A {
 }
 @A()
-main() {
+void f() {
 }
 ''');
     await prepareNavigation();
@@ -291,7 +291,7 @@
 import 'my_annotation.dart' as man;
 @man.MyAnnotation()
 @man.MyAnnotation.named()
-main() {
+void f() {
 }
 ''');
     await prepareNavigation();
@@ -314,7 +314,7 @@
   const A.named(p);
 }
 @A.named(0)
-main() {
+void f() {
 }
 ''');
     await prepareNavigation();
@@ -334,7 +334,7 @@
   const A();
 }
 @A()
-main() {
+void f() {
 }
 ''');
     await prepareNavigation();
@@ -346,7 +346,7 @@
     addTestFile('''
 const myan = new Object();
 @myan // ref
-main() {
+void f() {
 }
 ''');
     await prepareNavigation();
@@ -362,7 +362,7 @@
     addTestFile('''
 import 'mayn.dart' as man;
 @man.myan // ref
-main() {
+void f() {
 }
 ''');
     await prepareNavigation();
@@ -888,7 +888,7 @@
   Future<void> test_identifier_resolved() async {
     addTestFile('''
 class AAA {}
-main() {
+void f() {
   AAA aaa = null;
   print(aaa);
 }
@@ -896,12 +896,12 @@
     await prepareNavigation();
     assertHasRegionTarget('AAA aaa', 'AAA {}');
     assertHasRegionTarget('aaa);', 'aaa = null');
-    assertHasRegionTarget('main() {', 'main() {');
+    assertHasRegionTarget('f() {', 'f() {');
   }
 
   Future<void> test_identifier_unresolved() async {
     addTestFile('''
-main() {
+void f() {
   print(vvv);
 }
 ''');
@@ -911,7 +911,7 @@
 
   Future<void> test_identifier_whenStrayImportDirective() async {
     addTestFile('''
-main() {
+void f() {
   int aaa = 42;
   print(aaa);
 }
@@ -942,7 +942,7 @@
     addTestFile('''
 class A {
 }
-main() {
+void f() {
   new A();
 }
 ''');
@@ -955,7 +955,7 @@
     addTestFile('''
 class A {}
 class B<T> {}
-main() {
+void f() {
   new B<A>();
 }
 ''');
@@ -975,7 +975,7 @@
 class A {
   A.named() {}
 }
-main() {
+void f() {
   new A.named();
 }
 ''');
@@ -996,7 +996,7 @@
 class B<T> {
   B.named() {}
 }
-main() {
+void f() {
   new B<A>.named();
 }
 ''');
@@ -1020,7 +1020,7 @@
 class A {
   A() {}
 }
-main() {
+void f() {
   new A();
 }
 ''');
@@ -1035,7 +1035,7 @@
 class B<T> {
   B() {}
 }
-main() {
+void f() {
   new B<A>();
 }
 ''');
@@ -1053,7 +1053,7 @@
   Future<void> test_instanceCreation_withImportPrefix_named() async {
     addTestFile('''
 import 'dart:async' as ppp;
-main() {
+void f() {
   new ppp.Future.value(42);
 }
 ''');
@@ -1081,7 +1081,7 @@
     addTestFile('''
 import 'libA.dart';
 import 'libB.dart';
-main() {
+void f() {
   TEST;
 }
 ''');
@@ -1111,7 +1111,7 @@
   A operator *(other) => null;
   A operator /(other) => null;
 }
-main() {
+void f() {
   var a = new A();
   a - 1;
   a + 2;
@@ -1149,7 +1149,7 @@
   A operator [](index) => null;
   operator []=(index, A value) {}
 }
-main() {
+void f() {
   var b = new B();
   b[0] // [];
   b[1] = 1; // []=;
@@ -1399,7 +1399,7 @@
   Future<void> test_targetElement() async {
     addTestFile('''
 class AAA {}
-main() {
+void f() {
   AAA aaa = null;
 }
 ''');
@@ -1432,7 +1432,7 @@
 
   Future<void> test_type_dynamic() async {
     addTestFile('''
-main() {
+void f() {
   dynamic v = null;
 }
 ''');
@@ -1442,7 +1442,7 @@
 
   Future<void> test_type_void() async {
     addTestFile('''
-void main() {
+void f() {
 }
 ''');
     await prepareNavigation();
diff --git a/pkg/analysis_server/test/analysis/notification_occurrences_test.dart b/pkg/analysis_server/test/analysis/notification_occurrences_test.dart
index 8880291..aea54f6 100644
--- a/pkg/analysis_server/test/analysis/notification_occurrences_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_occurrences_test.dart
@@ -96,7 +96,7 @@
 
   Future<void> test_afterAnalysis() async {
     addTestFile('''
-main() {
+void f() {
   var vvv = 42;
   print(vvv);
 }
@@ -222,7 +222,7 @@
 class A {
   int fff;
   A(this.fff); // constructor
-  main() {
+  void f() {
     fff = 42;
     print(fff); // print
   }
@@ -248,7 +248,7 @@
 
   Future<void> test_localVariable() async {
     addTestFile('''
-main() {
+void f() {
   var vvv = 42;
   vvv += 5;
   print(vvv);
@@ -268,7 +268,7 @@
 class A<T> {
   T fff;
 }
-main() {
+void f() {
   var a = new A<int>();
   var b = new A<String>();
   a.fff = 1;
@@ -287,7 +287,7 @@
 class A<T> {
   T mmm() {}
 }
-main() {
+void f() {
   var a = new A<int>();
   var b = new A<String>();
   a.mmm(); // a
@@ -350,7 +350,7 @@
   Future<void> test_topLevelVariable() async {
     addTestFile('''
 var VVV = 1;
-main() {
+void f() {
   VVV = 2;
   print(VVV);
 }
@@ -364,7 +364,7 @@
 
   Future<void> test_type_class() async {
     addTestFile('''
-main() {
+void f() {
   int a = 1;
   int b = 2;
   int c = 3;
@@ -383,7 +383,7 @@
 
   Future<void> test_type_dynamic() async {
     addTestFile('''
-main() {
+void f() {
   dynamic a = 1;
   dynamic b = 2;
 }
@@ -396,11 +396,11 @@
 
   Future<void> test_type_void() async {
     addTestFile('''
-void main() {
+void f() {
 }
 ''');
     await prepareOccurrences();
-    var offset = findOffset('void main()');
+    var offset = findOffset('void f()');
     findRegion(offset, 'void'.length, false);
   }
 }
diff --git a/pkg/analysis_server/test/analysis/update_content_test.dart b/pkg/analysis_server/test/analysis/update_content_test.dart
index a75ac82..b9cd50b 100644
--- a/pkg/analysis_server/test/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/analysis/update_content_test.dart
@@ -97,14 +97,14 @@
 
     var foo = newFile('$workspaceRootPath/foo/lib/foo.dart', r'''
 import 'package:aaa/aaa.dart';
-void main() {
+void g() {
   f();
 }
 ''');
 
     var bar = newFile('$workspaceRootPath/bar/lib/bar.dart', r'''
 import 'package:aaa/aaa.dart';
-void main() {
+void g() {
   f();
 }
 ''');
@@ -206,7 +206,7 @@
     // add an overlay
     await handleSuccessfulRequest(
       AnalysisUpdateContentParams({
-        testFile.path: AddContentOverlay('main() {} main() {}'),
+        testFile.path: AddContentOverlay('void f() {} void f() {}'),
       }).toRequest('0'),
     );
     await waitForTasksFinished();
@@ -215,7 +215,7 @@
     await handleSuccessfulRequest(
       AnalysisUpdateContentParams({
         testFile.path: ChangeContentOverlay([
-          SourceEdit(0, 4, 'main'),
+          SourceEdit(5, 1, 'f'),
         ]),
       }).toRequest('0'),
     );
@@ -233,7 +233,7 @@
     // add an overlay
     await handleSuccessfulRequest(
       AnalysisUpdateContentParams({
-        testFile.path: AddContentOverlay('main() {} main() {}'),
+        testFile.path: AddContentOverlay('void f() {} void f() {}'),
       }).toRequest('0'),
     );
     await waitForTasksFinished();
@@ -242,7 +242,7 @@
     await handleSuccessfulRequest(
       AnalysisUpdateContentParams({
         testFile.path: ChangeContentOverlay([
-          SourceEdit(0, 4, 'main'),
+          SourceEdit(5, 1, 'f'),
         ]),
       }).toRequest('0'),
     );
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index 360bf33..b3f9c9b 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -1525,7 +1525,7 @@
     //
     addTestFile('''
 import 'package:pkgA/libA.dart';
-main() {
+void f() {
   new A();
 }
 ''');
@@ -1548,7 +1548,7 @@
 ''');
     newFile('$pkgA/lib/libB.dart', '''
 import 'package:pkgA/libA.dart';
-main() {
+void f() {
   new A();
 }
 ''');
diff --git a/pkg/analysis_server/test/domain_diagnostic_test.dart b/pkg/analysis_server/test/domain_diagnostic_test.dart
index 892f0b5..c289a3d 100644
--- a/pkg/analysis_server/test/domain_diagnostic_test.dart
+++ b/pkg/analysis_server/test/domain_diagnostic_test.dart
@@ -18,7 +18,7 @@
 class DiagnosticDomainTest extends PubPackageAnalysisServerTest {
   Future<void> test_getDiagnostics() async {
     newPubspecYamlFile(testPackageRootPath, 'name: project');
-    newFile('$testPackageLibPath/test.dart', 'main() {}');
+    newFile('$testPackageLibPath/test.dart', 'void f() {}');
 
     await setRoots(included: [workspaceRootPath], excluded: []);
     await server.onAnalysisComplete;
diff --git a/pkg/analysis_server/test/edit/assists_test.dart b/pkg/analysis_server/test/edit/assists_test.dart
index 7ba7566..1d56d08 100644
--- a/pkg/analysis_server/test/edit/assists_test.dart
+++ b/pkg/analysis_server/test/edit/assists_test.dart
@@ -50,7 +50,7 @@
     var change = plugin.PrioritizedSourceChange(
         5,
         SourceChange(message, edits: <SourceFileEdit>[
-          SourceFileEdit('', 0, edits: <SourceEdit>[SourceEdit(0, 0, 'x')])
+          SourceFileEdit('', 5, edits: <SourceEdit>[SourceEdit(5, 0, 'x')])
         ]));
     var result =
         plugin.EditGetAssistsResult(<plugin.PrioritizedSourceChange>[change]);
@@ -58,10 +58,10 @@
       info: Future.value(result.toResponse('-', 1))
     };
 
-    addTestFile('main() {}');
+    addTestFile('void f() {}');
     await waitForTasksFinished();
-    await prepareAssists('in(');
-    _assertHasChange(message, 'xmain() {}');
+    await prepareAssists('f(');
+    _assertHasChange(message, 'void xf() {}');
   }
 
   Future<void> test_invalidFilePathFormat_notAbsolute() async {
@@ -88,14 +88,14 @@
 
   Future<void> test_removeTypeAnnotation() async {
     addTestFile('''
-main() {
+void f() {
   int v = 1;
 }
 ''');
     await waitForTasksFinished();
     await prepareAssists('v =');
     _assertHasChange('Remove type annotation', '''
-main() {
+void f() {
   var v = 1;
 }
 ''');
@@ -103,14 +103,14 @@
 
   Future<void> test_splitVariableDeclaration() async {
     addTestFile('''
-main() {
+void f() {
   int v = 1;
 }
 ''');
     await waitForTasksFinished();
     await prepareAssists('v =');
     _assertHasChange('Split variable declaration', '''
-main() {
+void f() {
   int v;
   v = 1;
 }
@@ -119,7 +119,7 @@
 
   Future<void> test_surroundWithIf() async {
     addTestFile('''
-main() {
+void f() {
   print(1);
   print(2);
 }
@@ -129,7 +129,7 @@
     var length = findOffset('}') - offset;
     await prepareAssistsAt(offset, length);
     _assertHasChange("Surround with 'if'", '''
-main() {
+void f() {
   if (condition) {
     print(1);
     print(2);
diff --git a/pkg/analysis_server/test/edit/fixes_test.dart b/pkg/analysis_server/test/edit/fixes_test.dart
index c000778..28e40be 100644
--- a/pkg/analysis_server/test/edit/fixes_test.dart
+++ b/pkg/analysis_server/test/edit/fixes_test.dart
@@ -50,7 +50,7 @@
 
   Future<void> test_fixUndefinedClass() async {
     addTestFile('''
-main() {
+void f() {
   Completer<String> x = null;
   print(x);
 }
@@ -79,9 +79,9 @@
       info: Future.value(result.toResponse('-', 1))
     };
 
-    addTestFile('main() {}');
+    addTestFile('void f() {}');
     await waitForTasksFinished();
-    var errorFixes = await _getFixesAt(testFile, 'in(');
+    var errorFixes = await _getFixesAt(testFile, 'f(');
     expect(errorFixes, hasLength(1));
   }
 
@@ -133,7 +133,7 @@
 
   Future<void> test_overlayOnlyFile() async {
     await _addOverlay(testFile.path, '''
-main() {
+void f() {
 print(1)
 }
 ''');
@@ -174,7 +174,7 @@
 
     // Configure the test file.
     final file =
-        newFile('$workspaceRootPath/aaa/main.dart', 'main() { new Foo(); }');
+        newFile('$workspaceRootPath/aaa/main.dart', 'void f() { new Foo(); }');
 
     await waitForTasksFinished();
 
diff --git a/pkg/analysis_server/test/edit/format_test.dart b/pkg/analysis_server/test/edit/format_test.dart
index d3dc46c..623d27b 100644
--- a/pkg/analysis_server/test/edit/format_test.dart
+++ b/pkg/analysis_server/test/edit/format_test.dart
@@ -43,7 +43,7 @@
   Future<void> test_format_noOp() async {
     // Already formatted source
     addTestFile('''
-main() {
+void f() {
   int x = 3;
 }
 ''');
@@ -55,7 +55,7 @@
 
   Future<void> test_format_noSelection() async {
     addTestFile('''
-main() { int x = 3; }
+void f() { int x = 3; }
 ''');
     await waitForTasksFinished();
     var formatResult = await _formatAt(0, 0);
@@ -65,7 +65,7 @@
 
     var edit = formatResult.edits[0];
     expect(edit.replacement, equals('''
-main() {
+void f() {
   int x = 3;
 }
 '''));
@@ -75,7 +75,7 @@
 
   Future<void> test_format_simple() async {
     addTestFile('''
-main() { int x = 3; }
+void f() { int x = 3; }
 ''');
     await waitForTasksFinished();
     var formatResult = await _formatAt(0, 3);
@@ -85,7 +85,7 @@
 
     var edit = formatResult.edits[0];
     expect(edit.replacement, equals('''
-main() {
+void f() {
   int x = 3;
 }
 '''));
@@ -95,7 +95,7 @@
 
   Future<void> test_format_withErrors() async {
     addTestFile('''
-main() { int x =
+void f() { int x =
 ''');
     await waitForTasksFinished();
     var request = EditFormatParams(testFile.path, 0, 3).toRequest('0');
diff --git a/pkg/analysis_server/test/edit/organize_directives_test.dart b/pkg/analysis_server/test/edit/organize_directives_test.dart
index d1909f0..e8ddd30 100644
--- a/pkg/analysis_server/test/edit/organize_directives_test.dart
+++ b/pkg/analysis_server/test/edit/organize_directives_test.dart
@@ -43,7 +43,7 @@
     addTestFile('''
 import 'dart:async'
 
-main() {}
+void f() {}
 ''');
     var request = EditOrganizeDirectivesParams(testFile.path).toRequest('0');
     var response = await handleRequest(request);
@@ -111,7 +111,7 @@
 import 'dart:async' as async;
 import 'dart:async' as async;
 
-main() {
+void f() {
   async.Future f;
 }
 ''');
@@ -120,7 +120,7 @@
 
 import 'dart:async' as async;
 
-main() {
+void f() {
   async.Future f;
 }
 ''');
@@ -135,7 +135,7 @@
 import 'dart:convert';
 import 'dart:collection';
 
-main() {
+void f() {
   print(pi);
   new HashMap();
 }
@@ -146,7 +146,7 @@
 import 'dart:collection';
 import 'dart:math';
 
-main() {
+void f() {
   print(pi);
   new HashMap();
 }
diff --git a/pkg/analysis_server/test/edit/postfix_completion_test.dart b/pkg/analysis_server/test/edit/postfix_completion_test.dart
index 656aa00..3fbf497 100644
--- a/pkg/analysis_server/test/edit/postfix_completion_test.dart
+++ b/pkg/analysis_server/test/edit/postfix_completion_test.dart
@@ -28,14 +28,14 @@
 
   Future<void> test_for() async {
     addTestFile('''
-main() {
+void f() {
   [].for
 }
 ''');
     await waitForTasksFinished();
     await _prepareCompletion('.for');
     _assertHasChange('Expand .for', '''
-main() {
+void f() {
   for (var value in []) {
     /*caret*/
   }
diff --git a/pkg/analysis_server/test/edit/sort_members_test.dart b/pkg/analysis_server/test/edit/sort_members_test.dart
index d92ef71..4d289c7 100644
--- a/pkg/analysis_server/test/edit/sort_members_test.dart
+++ b/pkg/analysis_server/test/edit/sort_members_test.dart
@@ -40,7 +40,7 @@
 
   Future<void> test_BAD_hasParseError() async {
     addTestFile('''
-main() {
+void f() {
   print()
 }
 ''');
@@ -136,7 +136,7 @@
 part 'bbb/bbb.dart';
 part 'aaa/aaa.dart';
 
-main() {
+void f() {
 }
 ''');
     return _assertSorted(r'''
@@ -163,7 +163,7 @@
 part 'aaa/aaa.dart';
 part 'bbb/bbb.dart';
 
-main() {
+void f() {
 }
 ''');
   }
diff --git a/pkg/analysis_server/test/edit/statement_completion_test.dart b/pkg/analysis_server/test/edit/statement_completion_test.dart
index 7fa58d1..eec21ff 100644
--- a/pkg/analysis_server/test/edit/statement_completion_test.dart
+++ b/pkg/analysis_server/test/edit/statement_completion_test.dart
@@ -50,14 +50,14 @@
 
   Future<void> test_plainEnterFromStart() async {
     addTestFile('''
-main() {
+void f() {
   int v = 1;
 }
 ''');
     await waitForTasksFinished();
     await _prepareCompletion('v = 1;', atStart: true);
     _assertHasChange('Insert a newline at the end of the current line', '''
-main() {
+void f() {
   int v = 1;
   /*caret*/
 }
@@ -66,14 +66,14 @@
 
   Future<void> test_plainOleEnter() async {
     addTestFile('''
-main() {
+void f() {
   int v = 1;
 }
 ''');
     await waitForTasksFinished();
     await _prepareCompletion('v = 1;', atEnd: true);
     _assertHasChange('Insert a newline at the end of the current line', '''
-main() {
+void f() {
   int v = 1;
   /*caret*/
 }
@@ -82,7 +82,7 @@
 
   Future<void> test_plainOleEnterWithError() async {
     addTestFile('''
-main() {
+void f() {
   int v =
 }
 ''');
@@ -92,7 +92,7 @@
     _assertHasChange(
         'Insert a newline at the end of the current line',
         '''
-main() {
+void f() {
   int v =
   x
 }
diff --git a/pkg/analysis_server/test/integration/analysis/error_test.dart b/pkg/analysis_server/test/integration/analysis/error_test.dart
index e674a76..d209eee 100644
--- a/pkg/analysis_server/test/integration/analysis/error_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/error_test.dart
@@ -22,7 +22,7 @@
     var packagePath = sourcePath('package');
     var filePath = sourcePath('package/lib/test.dart');
     var content = '''
-main() {
+void f() {
   print(null) // parse error: missing ';'
 }''';
     await sendServerSetSubscriptions([ServerService.STATUS]);
@@ -39,7 +39,7 @@
   Future<void> test_detect_simple_error() {
     var pathname = sourcePath('test.dart');
     writeFile(pathname, '''
-main() {
+void f() {
   print(null) // parse error: missing ';'
 }''');
     standardAnalysisSetup();
diff --git a/pkg/analysis_server/test/integration/analysis/get_errors_test.dart b/pkg/analysis_server/test/integration/analysis/get_errors_test.dart
index 260cb6c..d47f008 100644
--- a/pkg/analysis_server/test/integration/analysis/get_errors_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_errors_test.dart
@@ -18,7 +18,7 @@
   Future<void> test_getErrors() async {
     var pathname = sourcePath('test.dart');
     var text = r'''
-main() {
+void f() {
   var x // parse error: missing ';'
 }''';
     writeFile(pathname, text);
diff --git a/pkg/analysis_server/test/integration/analysis/get_hover_test.dart b/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
index 2c4828c..ba5f9d6 100644
--- a/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
@@ -36,7 +36,7 @@
   topLevelVar.add(localVar);
 }
 
-main() {
+void f() {
   // comment
   func(35);
 }
diff --git a/pkg/analysis_server/test/integration/analysis/navigation_test.dart b/pkg/analysis_server/test/integration/analysis/navigation_test.dart
index 61365b1..8413241 100644
--- a/pkg/analysis_server/test/integration/analysis/navigation_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/navigation_test.dart
@@ -41,7 +41,7 @@
 
 int topLevelVariable = 0;
 
-main() {
+void f() {
   Class<int> localVariable = new Class<int>.constructor(); // usage
   function(() => localVariable.field);
   localVariable.method();
diff --git a/pkg/analysis_server/test/integration/analysis/occurrences_test.dart b/pkg/analysis_server/test/integration/analysis/occurrences_test.dart
index e1b8d1c..ee237c4 100644
--- a/pkg/analysis_server/test/integration/analysis/occurrences_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/occurrences_test.dart
@@ -19,7 +19,7 @@
   Future<void> test_occurrences() async {
     var pathname = sourcePath('test.dart');
     var text = r'''
-main() {
+void f() {
   int sum = 0;
   for (int i = 0; i < 10; i++) {
     for (int j = 0; j < i; j++) {
diff --git a/pkg/analysis_server/test/integration/analysis/package_root_test.dart b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
index 3bb2096..1ee9ea6 100644
--- a/pkg/analysis_server/test/integration/analysis/package_root_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
@@ -29,7 +29,7 @@
 
 import 'package:foo/bar.dart'
 
-main() {
+void f() {
   f();
 }
 """;
diff --git a/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart b/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
index 1a42362..d28f9e0 100644
--- a/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
@@ -28,7 +28,7 @@
 import 'dart:convert';
 import 'dart:async';
 
-main() {}''';
+void f() {}''';
     writeFile(pathname, text);
     standardAnalysisSetup();
     return analysisFinished.then((_) {
diff --git a/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart b/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart
index 6534bab..49e4bf5 100644
--- a/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart
@@ -18,7 +18,7 @@
 class ReanalyzeTest extends AbstractAnalysisServerIntegrationTest {
   Future<void> test_reanalyze() {
     var pathname = sourcePath('test.dart');
-    var text = 'main() {}';
+    var text = 'void f() {}';
     writeFile(pathname, text);
     standardAnalysisSetup();
     return analysisFinished.then((_) {
diff --git a/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart b/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart
index 40c015c..344c4c0 100644
--- a/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart
@@ -19,7 +19,7 @@
   Future<void> test_updateContent_list() {
     var pathname = sourcePath('test.dart');
     var goodText = r'''
-main() {
+void f() {
   print("Hello");
   print("World!");
 }''';
diff --git a/pkg/analysis_server/test/integration/analysis/update_content_test.dart b/pkg/analysis_server/test/integration/analysis/update_content_test.dart
index 524b73c..414ea26 100644
--- a/pkg/analysis_server/test/integration/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/update_content_test.dart
@@ -19,7 +19,7 @@
   Future<void> test_updateContent() async {
     var path = sourcePath('test.dart');
     var goodText = r'''
-main() {
+void f() {
   print("Hello, world!");
 }''';
 
@@ -67,7 +67,7 @@
   String get name => this._name;
   String toString() => "Name: ${name}";
 }
-void main() {
+void f() {
   var p = new Person("Skeletor");
   p.xname = "Faker";
   print(p);
@@ -88,7 +88,7 @@
   String get name => this._name;
   String toString() => "Name: ${name}";
 }
-void main() {
+void f() {
   var p = new Person("Skeletor");
   p.name = "Faker";
   print(p);
diff --git a/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart b/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
index 1a95731..8e1ac58 100644
--- a/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
+++ b/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
@@ -42,7 +42,7 @@
   Future<void> test_getSuggestions() async {
     setTestSource('test.dart', r'''
 String test = '';
-main() {
+void f() {
   test.^
 }
 ''');
@@ -63,7 +63,7 @@
   Future<void> test_getSuggestions_onlyOverlay() async {
     setTestSource('test.dart', r'''
 String test = '';
-main() {
+void f() {
   test.^
 }
 ''');
@@ -86,7 +86,7 @@
   Future<void> test_getSuggestions_onlyOverlay_noWait() async {
     setTestSource('test.dart', r'''
 String test = '';
-main() {
+void f() {
   test.^
 }
 ''');
diff --git a/pkg/analysis_server/test/integration/edit/import_elements_test.dart b/pkg/analysis_server/test/integration/edit/import_elements_test.dart
index 40e370d..e54e426 100644
--- a/pkg/analysis_server/test/integration/edit/import_elements_test.dart
+++ b/pkg/analysis_server/test/integration/edit/import_elements_test.dart
@@ -78,7 +78,7 @@
   }
 
   Future<void> test_importElements_definingUnit() async {
-    writeFile(pathname, 'main() {}');
+    writeFile(pathname, 'void f() {}');
     standardAnalysisSetup();
     await analysisFinished;
     var provider = PhysicalResourceProvider.INSTANCE;
@@ -105,7 +105,7 @@
     var libName = sourcePath('lib.dart');
     writeFile(libName, '''
 part 'test.dart';
-main() {}
+void f() {}
 ''');
     writeFile(pathname, '''
 part of 'lib.dart';
diff --git a/pkg/analysis_server/test/integration/lsp_server/diagnostic_test.dart b/pkg/analysis_server/test/integration/lsp_server/diagnostic_test.dart
index ca65cbd..bc5ee9a4 100644
--- a/pkg/analysis_server/test/integration/lsp_server/diagnostic_test.dart
+++ b/pkg/analysis_server/test/integration/lsp_server/diagnostic_test.dart
@@ -60,7 +60,7 @@
   }
 
   Future<void> test_lints() async {
-    newFile(mainFilePath, '''main() async => await 1;''');
+    newFile(mainFilePath, '''void f() async => await 1;''');
     newFile(analysisOptionsPath, '''
 linter:
   rules:
@@ -74,8 +74,8 @@
     final diagnostic = diagnostics.first;
     expect(diagnostic.code, equals('await_only_futures'));
     expect(diagnostic.range.start.line, equals(0));
-    expect(diagnostic.range.start.character, equals(16));
+    expect(diagnostic.range.start.character, equals(18));
     expect(diagnostic.range.end.line, equals(0));
-    expect(diagnostic.range.end.character, equals(21));
+    expect(diagnostic.range.end.character, equals(23));
   }
 }
diff --git a/pkg/analysis_server/test/integration/search/find_element_references_test.dart b/pkg/analysis_server/test/integration/search/find_element_references_test.dart
index aab63ee..2fd85a7 100644
--- a/pkg/analysis_server/test/integration/search/find_element_references_test.dart
+++ b/pkg/analysis_server/test/integration/search/find_element_references_test.dart
@@ -20,7 +20,7 @@
 
   Future<void> test_badTarget() async {
     var text = r'''
-main() {
+void f() {
   if /* target */ (true) {
     print('Hello');
   }
@@ -38,7 +38,7 @@
 
   Future<void> test_findReferences() async {
     var text = r'''
-main() {
+void f() {
   foo /* target */ ('Hello');
 }
 
@@ -56,7 +56,7 @@
     expect(result.location.file, pathname);
     expect(result.isPotential, isFalse);
     expect(result.kind.name, SearchResultKind.INVOCATION.name);
-    expect(result.path.first.name, 'main');
+    expect(result.path.first.name, 'f');
   }
 
   Future<List<SearchResult>?> _findElementReferences(String text) async {
diff --git a/pkg/analysis_server/test/integration/search/get_type_hierarchy_test.dart b/pkg/analysis_server/test/integration/search/get_type_hierarchy_test.dart
index acc839e..92bbda8 100644
--- a/pkg/analysis_server/test/integration/search/get_type_hierarchy_test.dart
+++ b/pkg/analysis_server/test/integration/search/get_type_hierarchy_test.dart
@@ -22,7 +22,7 @@
 
   Future getTypeHierarchy_badTarget() async {
     var text = r'''
-main() {
+void f() {
   if /* target */ (true) {
     print('Hello');
   }
diff --git a/pkg/analysis_server/test/integration/server/bazel_changes_test.dart b/pkg/analysis_server/test/integration/server/bazel_changes_test.dart
index 5dd8d39..903297e 100644
--- a/pkg/analysis_server/test/integration/server/bazel_changes_test.dart
+++ b/pkg/analysis_server/test/integration/server/bazel_changes_test.dart
@@ -121,7 +121,7 @@
 
     writeFile(testFile, r'''
 import 'generated.dart';
-void main() { my_fun(); }
+void f() { my_fun(); }
 ''');
     standardAnalysisSetup();
 
diff --git a/pkg/analysis_server/test/integration/server/command_line_options_test.dart b/pkg/analysis_server/test/integration/server/command_line_options_test.dart
index 475bf9a..ba051a3 100644
--- a/pkg/analysis_server/test/integration/server/command_line_options_test.dart
+++ b/pkg/analysis_server/test/integration/server/command_line_options_test.dart
@@ -54,7 +54,7 @@
     var pathname = sourcePath('test.dart');
     writeFile(pathname, '''
 import 'package:foo/foo.dart';
-void main() {
+void f() {
   my_foo;
 }
 ''');
diff --git a/pkg/analysis_server/test/integration/server/set_subscriptions_test.dart b/pkg/analysis_server/test/integration/server/set_subscriptions_test.dart
index 9a7078b..2979d30 100644
--- a/pkg/analysis_server/test/integration/server/set_subscriptions_test.dart
+++ b/pkg/analysis_server/test/integration/server/set_subscriptions_test.dart
@@ -50,7 +50,7 @@
 
     var pathname = sourcePath('test.dart');
     writeFile(pathname, '''
-main() {
+void f() {
   var x;
 }''');
     standardAnalysisSetup(subscribeStatus: false);
@@ -63,7 +63,7 @@
 
     // Tickle test.dart just in case analysis has already completed.
     writeFile(pathname, '''
-main() {
+void f() {
   var y;
 }''');
     // Analysis should eventually complete, and we should be notified
diff --git a/pkg/analysis_server/test/integration/server/status_test.dart b/pkg/analysis_server/test/integration/server/status_test.dart
index 0588e16..bdae4e3 100644
--- a/pkg/analysis_server/test/integration/server/status_test.dart
+++ b/pkg/analysis_server/test/integration/server/status_test.dart
@@ -37,7 +37,7 @@
       }
     });
     writeFile(sourcePath('test.dart'), '''
-main() {
+void f() {
   var x;
 }''');
     standardAnalysisSetup();
diff --git a/pkg/analysis_server/test/lsp/cancel_request_test.dart b/pkg/analysis_server/test/lsp/cancel_request_test.dart
index f39dff9..f967928 100644
--- a/pkg/analysis_server/test/lsp/cancel_request_test.dart
+++ b/pkg/analysis_server/test/lsp/cancel_request_test.dart
@@ -19,7 +19,7 @@
 class CancelRequestTest extends AbstractLspAnalysisServerTest {
   Future<void> test_cancel() async {
     final content = '''
-main() {
+void f() {
   InOtherF^
 }
     ''';
diff --git a/pkg/analysis_server/test/lsp/closing_labels_test.dart b/pkg/analysis_server/test/lsp/closing_labels_test.dart
index 4a671a6..211d57d 100644
--- a/pkg/analysis_server/test/lsp/closing_labels_test.dart
+++ b/pkg/analysis_server/test/lsp/closing_labels_test.dart
@@ -16,7 +16,7 @@
 @reflectiveTest
 class ClosingLabelsTest extends AbstractLspAnalysisServerTest {
   Future<void> test_afterChange() async {
-    final initialContent = 'main() {}';
+    final initialContent = 'void f() {}';
     final updatedContent = '''
 Widget build(BuildContext context) {
   return new Row(         // Row       1:9
diff --git a/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart b/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
index a0d3b9f..72ff233 100644
--- a/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
+++ b/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
@@ -324,11 +324,11 @@
     //
     // Expect only the only one nearest to the start of the range to be returned.
     const content = '''
-    main() {
-      var a = [];
-      print(a!!);^
-    }
-    ''';
+void f() {
+  var a = [];
+  print(a!!);^
+}
+''';
 
     newFile(mainFilePath, withoutMarkers(content));
     await initialize(
@@ -621,7 +621,7 @@
   Future<void>
       test_snippets_extractVariable_functionTypeNestedParameters() async {
     const content = '''
-main() {
+void f() {
   useFunction(te^st);
 }
 
@@ -629,7 +629,7 @@
 ''';
 
     const expectedContent = r'''
-main() {
+void f() {
   ${1:int Function(dynamic a, dynamic b)} ${2:test};
   useFunction(test);
 }
diff --git a/pkg/analysis_server/test/lsp/code_actions_refactor_test.dart b/pkg/analysis_server/test/lsp/code_actions_refactor_test.dart
index 6b3ab24..d9b96bf 100644
--- a/pkg/analysis_server/test/lsp/code_actions_refactor_test.dart
+++ b/pkg/analysis_server/test/lsp/code_actions_refactor_test.dart
@@ -35,14 +35,14 @@
   Future<void> test_refactor() async {
     const content = '''
 int get ^test => 42;
-main() {
+void f() {
   var a = test;
   var b = test;
 }
 ''';
     const expectedContent = '''
 int test() => 42;
-main() {
+void f() {
   var a = test();
   var b = test();
 }
@@ -67,14 +67,14 @@
   Future<void> test_refactor() async {
     const content = '''
 int ^test() => 42;
-main() {
+void f() {
   var a = test();
   var b = test();
 }
 ''';
     const expectedContent = '''
 int get test => 42;
-main() {
+void f() {
   var a = test;
   var b = test;
 }
@@ -132,13 +132,13 @@
 
   Future<void> test_appliesCorrectEdits() async {
     const content = '''
-main() {
+void f() {
   print('Test!');
   [[print('Test!');]]
 }
     ''';
     const expectedContent = '''
-main() {
+void f() {
   print('Test!');
   newMethod();
 }
@@ -161,13 +161,13 @@
 
   Future<void> test_cancelsInProgress() async {
     const content = '''
-main() {
+void f() {
   print('Test!');
   [[print('Test!');]]
 }
     ''';
     const expectedContent = '''
-main() {
+void f() {
   print('Test!');
   newMethod();
 }
@@ -215,7 +215,7 @@
 
   Future<void> test_contentModified() async {
     const content = '''
-main() {
+void f() {
   print('Test!');
   [[print('Test!');]]
 }
@@ -239,7 +239,7 @@
 
   Future<void> test_filtersCorrectly() async {
     const content = '''
-main() {
+void f() {
   print('Test!');
   [[print('Test!');]]
 }
@@ -287,7 +287,7 @@
 
   Future<void> test_generatesNames() async {
     const content = '''
-Object main() {
+Object F() {
   return Container([[Text('Test!')]]);
 }
 
@@ -295,7 +295,7 @@
 Object Text(Object text) => null;
     ''';
     const expectedContent = '''
-Object main() {
+Object F() {
   return Container(text());
 }
 
@@ -320,7 +320,7 @@
     const content = '''
 import 'dart:convert';
 ^
-main() {}
+void f() {}
     ''';
     newFile(mainFilePath, content);
     await initialize();
@@ -333,13 +333,13 @@
 
   Future<void> test_progress_clientProvided() async {
     const content = '''
-main() {
+void f() {
   print('Test!');
   [[print('Test!');]]
 }
     ''';
     const expectedContent = '''
-main() {
+void f() {
   print('Test!');
   newMethod();
 }
@@ -369,13 +369,13 @@
 
   Future<void> test_progress_notSupported() async {
     const content = '''
-main() {
+void f() {
   print('Test!');
   [[print('Test!');]]
 }
     ''';
     const expectedContent = '''
-main() {
+void f() {
   print('Test!');
   newMethod();
 }
@@ -405,13 +405,13 @@
 
   Future<void> test_progress_serverGenerated() async {
     const content = '''
-main() {
+void f() {
   print('Test!');
   [[print('Test!');]]
 }
     ''';
     const expectedContent = '''
-main() {
+void f() {
   print('Test!');
   newMethod();
 }
@@ -520,14 +520,14 @@
 
   Future<void> test_appliesCorrectEdits() async {
     const content = '''
-main() {
+void f() {
   foo([[1 + 2]]);
 }
 
 void foo(int arg) {}
     ''';
     const expectedContent = '''
-main() {
+void f() {
   var arg = 1 + 2;
   foo(arg);
 }
@@ -548,7 +548,7 @@
 
   Future<void> test_doesNotCreateNameConflicts() async {
     const content = '''
-main() {
+void f() {
   var arg = "test";
   foo([[1 + 2]]);
 }
@@ -556,7 +556,7 @@
 void foo(int arg) {}
     ''';
     const expectedContent = '''
-main() {
+void f() {
   var arg = "test";
   var arg2 = 1 + 2;
   foo(arg2);
@@ -663,7 +663,7 @@
     const content = '''
 import 'dart:convert';
 ^
-main() {}
+void f() {}
     ''';
     newFile(mainFilePath, content);
     await initialize();
@@ -692,7 +692,7 @@
 
   Future<void> test_appliesCorrectEdits() async {
     const content = '''
-void main() {
+void f() {
   var a^ = 1;
   print(a);
   print(a);
@@ -700,7 +700,7 @@
 }
     ''';
     const expectedContent = '''
-void main() {
+void f() {
   print(1);
   print(1);
   print(1);
diff --git a/pkg/analysis_server/test/lsp/definition_test.dart b/pkg/analysis_server/test/lsp/definition_test.dart
index 33fd27d..3eca8f3 100644
--- a/pkg/analysis_server/test/lsp/definition_test.dart
+++ b/pkg/analysis_server/test/lsp/definition_test.dart
@@ -22,7 +22,7 @@
     final mainContents = '''
     import 'referenced.dart';
 
-    main() {
+    void f() {
       fo^o();
     }
     ''';
@@ -64,7 +64,7 @@
     /// Te^st
     ///
     /// References [String].
-    main() {}
+    void f() {}
     ''';
 
     await initialize();
@@ -144,7 +144,7 @@
     final mainContents = '''
     import 'referenced.dart';
 
-    main() {
+    void f() {
       Icons.[[ad^d]]();
     }
     ''';
@@ -187,7 +187,7 @@
     final mainContents = '''
     import 'referenced.dart';
 
-    main() {
+    void f() {
       [[fo^o]]();
     }
     ''';
@@ -238,7 +238,7 @@
     final mainContents = '''
     import 'lib.dart';
 
-    main() {
+    void f() {
       Icons.[[ad^d]]();
     }
     ''';
diff --git a/pkg/analysis_server/test/lsp/diagnostic_test.dart b/pkg/analysis_server/test/lsp/diagnostic_test.dart
index 0c6572e..553b8fe 100644
--- a/pkg/analysis_server/test/lsp/diagnostic_test.dart
+++ b/pkg/analysis_server/test/lsp/diagnostic_test.dart
@@ -177,7 +177,7 @@
     @deprecated
     int? dep;
 
-    void main() => print(dep);
+    void f() => print(dep);
     ''');
 
     final diagnosticsUpdate = waitForDiagnostics(mainFileUri);
@@ -196,7 +196,7 @@
     @deprecated
     int? dep;
 
-    void main() => print(dep);
+    void f() => print(dep);
     ''');
 
     final diagnosticsUpdate = waitForDiagnostics(mainFileUri);
@@ -210,7 +210,7 @@
 
   Future<void> test_diagnosticTag_unnecessary() async {
     newFile(mainFilePath, '''
-    void main() {
+    void f() {
       return;
       print('unreachable');
     }
diff --git a/pkg/analysis_server/test/lsp/document_highlights_test.dart b/pkg/analysis_server/test/lsp/document_highlights_test.dart
index 68e1200..d8df6ac 100644
--- a/pkg/analysis_server/test/lsp/document_highlights_test.dart
+++ b/pkg/analysis_server/test/lsp/document_highlights_test.dart
@@ -41,7 +41,7 @@
   }
 
   Future<void> test_localVariable() => _testMarkedContent('''
-    main() {
+    void f() {
       var [[f^oo]] = 1;
       print([[foo]]);
       [[foo]] = 2;
@@ -60,19 +60,19 @@
   }
 
   Future<void> test_noResult() => _testMarkedContent('''
-    main() {
+    void f() {
       // This one is in a ^ comment!
     }
     ''');
 
   Future<void> test_onlySelf() => _testMarkedContent('''
-    main() {
+    void f() {
       [[prin^t]]();
     }
     ''');
 
   Future<void> test_shadow_inner() => _testMarkedContent('''
-    main() {
+    void f() {
       var foo = 1;
       func() {
         var [[fo^o]] = 2;
@@ -82,7 +82,7 @@
     ''');
 
   Future<void> test_shadow_outer() => _testMarkedContent('''
-    main() {
+    void f() {
       var [[foo]] = 1;
       func() {
         var foo = 2;
@@ -94,7 +94,7 @@
 
   Future<void> test_topLevelVariable() => _testMarkedContent('''
     String [[foo]] = 'bar';
-    main() {
+    void f() {
       print([[foo]]);
       [[fo^o]] = 2;
     }
diff --git a/pkg/analysis_server/test/lsp/folding_test.dart b/pkg/analysis_server/test/lsp/folding_test.dart
index e984e02..7f17866a8 100644
--- a/pkg/analysis_server/test/lsp/folding_test.dart
+++ b/pkg/analysis_server/test/lsp/folding_test.dart
@@ -199,7 +199,7 @@
 
     /// This is not the file header[[
     /// It's just a comment]]
-    main() {}
+    void f() {}
     ''';
 
     final ranges = rangesFromMarkers(content);
diff --git a/pkg/analysis_server/test/lsp/format_test.dart b/pkg/analysis_server/test/lsp/format_test.dart
index 2683483..69932f3 100644
--- a/pkg/analysis_server/test/lsp/format_test.dart
+++ b/pkg/analysis_server/test/lsp/format_test.dart
@@ -212,7 +212,7 @@
 
   Future<void> test_formatRange_expandsLeadingWhitespaceToNearestLine() async {
     const contents = '''
-void main()
+void f()
 {
 
 [[        print('test'); // line 2
@@ -221,7 +221,7 @@
 }
 ''';
     const expected = '''
-void main()
+void f()
 {
 
   print('test'); // line 2
@@ -355,12 +355,12 @@
 
   Future<void> test_lineLength_outsideWorkspaceFolders() async {
     const contents = '''
-main() {
+void f() {
   print('123456789 ''123456789 ''123456789 ');
 }
 ''';
     const expectedContents = '''
-main() {
+void f() {
   print(
       '123456789 '
       '123456789 '
@@ -385,12 +385,12 @@
 
   Future<void> test_lineLength_workspaceFolderSpecified() async {
     const contents = '''
-main() {
+void f() {
   print('123456789 ''123456789 ''123456789 ');
 }
 ''';
     const expectedContents = '''
-main() {
+void f() {
   print(
       '123456789 '
       '123456789 '
@@ -415,12 +415,12 @@
 
   Future<void> test_lineLength_workspaceFolderUnspecified() async {
     const contents = '''
-main() {
+void f() {
   print('123456789 ''123456789 ''123456789 ');
 }
 ''';
     const expectedContents = '''
-main() {
+void f() {
   print(
       '123456789 '
       '123456789 '
diff --git a/pkg/analysis_server/test/lsp/hover_test.dart b/pkg/analysis_server/test/lsp/hover_test.dart
index f76a5aa..9c06937 100644
--- a/pkg/analysis_server/test/lsp/hover_test.dart
+++ b/pkg/analysis_server/test/lsp/hover_test.dart
@@ -229,7 +229,7 @@
       Foo(String arg1, String arg2, [String arg3]);
     }
 
-    main() {
+    void f() {
       var a = Fo^o();
     }
     ''';
@@ -254,7 +254,7 @@
       Foo(String a, String b);
     }
 
-    main() {
+    void f() {
       var a = Fo^o();
     }
     ''';
diff --git a/pkg/analysis_server/test/lsp/references_test.dart b/pkg/analysis_server/test/lsp/references_test.dart
index a87b1db..36c52bf 100644
--- a/pkg/analysis_server/test/lsp/references_test.dart
+++ b/pkg/analysis_server/test/lsp/references_test.dart
@@ -20,7 +20,7 @@
     final mainContents = '''
     import 'referenced.dart';
 
-    main() {
+    void f() {
       [[foo]]();
     }
     ''';
@@ -68,7 +68,7 @@
     final mainContents = '''
     import 'referenced.dart';
 
-    main() {
+    void f() {
       [[foo]]();
     }
     ''';
diff --git a/pkg/analysis_server/test/lsp/rename_test.dart b/pkg/analysis_server/test/lsp/rename_test.dart
index b032485..ce69a25 100644
--- a/pkg/analysis_server/test/lsp/rename_test.dart
+++ b/pkg/analysis_server/test/lsp/rename_test.dart
@@ -62,7 +62,7 @@
 
   Future<void> test_prepare_invalidRenameLocation() async {
     const content = '''
-    main() {
+    void f() {
       // comm^ent
     }
     ''';
@@ -96,7 +96,7 @@
 
   Future<void> test_prepare_variable() async {
     const content = '''
-    main() {
+    void f() {
       var variable = 0;
       print([[vari^able]]);
     }
@@ -401,7 +401,7 @@
 
   Future<void> test_rename_invalidRenameLocation() {
     const content = '''
-    main() {
+    void f() {
       // comm^ent
     }
     ''';
@@ -591,13 +591,13 @@
 
   Future<void> test_rename_variable() {
     const content = '''
-    main() {
+    void f() {
       var variable = 0;
       print([[vari^able]]);
     }
     ''';
     const expectedContent = '''
-    main() {
+    void f() {
       var foo = 0;
       print(foo);
     }
diff --git a/pkg/analysis_server/test/lsp/semantic_tokens_test.dart b/pkg/analysis_server/test/lsp/semantic_tokens_test.dart
index eb886c8..696b750 100644
--- a/pkg/analysis_server/test/lsp/semantic_tokens_test.dart
+++ b/pkg/analysis_server/test/lsp/semantic_tokens_test.dart
@@ -268,7 +268,7 @@
       static String myStaticField = 'StaticFieldVal';
     }
 
-    main() {
+    void f() {
       final a = MyClass();
       print(a.myField);
       MyClass.myStaticField = 'a';
@@ -293,7 +293,9 @@
       _Token('myStaticField', SemanticTokenTypes.property,
           [SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
       _Token("'StaticFieldVal'", SemanticTokenTypes.string),
-      _Token('main', SemanticTokenTypes.function,
+      _Token(
+          'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
+      _Token('f', SemanticTokenTypes.function,
           [SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
       _Token('final', SemanticTokenTypes.keyword),
       _Token('a', SemanticTokenTypes.variable,
@@ -331,7 +333,7 @@
       static set myStaticSetter(String staticV) {};
     }
 
-    main() {
+    void f() {
       final a = MyClass();
       print(a.myGetter);
       a.mySetter = 'a';
@@ -377,7 +379,9 @@
       _Token('String', SemanticTokenTypes.class_),
       _Token('staticV', SemanticTokenTypes.parameter,
           [SemanticTokenModifiers.declaration]),
-      _Token('main', SemanticTokenTypes.function,
+      _Token(
+          'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
+      _Token('f', SemanticTokenTypes.function,
           [SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
       _Token('final', SemanticTokenTypes.keyword),
       _Token('a', SemanticTokenTypes.variable,
@@ -414,7 +418,7 @@
       }
     }
 
-    main() {
+    void f() {
       final a = MyClass();
       a.myMethod();
       MyClass.myStaticMethod();
@@ -445,7 +449,9 @@
       _Token('myStaticMethod', SemanticTokenTypes.method,
           [SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
       _Token('// static method comment', SemanticTokenTypes.comment),
-      _Token('main', SemanticTokenTypes.function,
+      _Token(
+          'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
+      _Token('f', SemanticTokenTypes.function,
           [SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
       _Token('final', SemanticTokenTypes.keyword),
       _Token('a', SemanticTokenTypes.variable,
@@ -670,7 +676,7 @@
     // "control" keywords should be tagged with a modifier so the client
     // can color them differently to other keywords.
     final content = r'''
-    void main() async {
+    void f() async {
       var a = new Object();
       await null;
       if (false) {
@@ -683,7 +689,7 @@
     final expected = [
       _Token('void', SemanticTokenTypes.keyword,
           [CustomSemanticTokenModifiers.void_]),
-      _Token('main', SemanticTokenTypes.function,
+      _Token('f', SemanticTokenTypes.function,
           [SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
       _Token('async', SemanticTokenTypes.keyword,
           [CustomSemanticTokenModifiers.control]),
@@ -774,14 +780,16 @@
 
   Future<void> test_local() async {
     final content = '''
-    main() {
+    void f() {
       func(String a) => print(a);
       final funcTearOff = func;
     }
     ''';
 
     final expected = [
-      _Token('main', SemanticTokenTypes.function,
+      _Token(
+          'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
+      _Token('f', SemanticTokenTypes.function,
           [SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
       _Token('func', SemanticTokenTypes.function,
           [SemanticTokenModifiers.declaration]),
@@ -1187,7 +1195,7 @@
 
     final funcTearOff = func;
 
-    void main() {
+    void f() {
       strings;
       func;
       abc;
@@ -1228,7 +1236,7 @@
       _Token('func', SemanticTokenTypes.function),
       _Token('void', SemanticTokenTypes.keyword,
           [CustomSemanticTokenModifiers.void_]),
-      _Token('main', SemanticTokenTypes.function,
+      _Token('f', SemanticTokenTypes.function,
           [SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
       _Token('strings', SemanticTokenTypes.property),
       _Token('func', SemanticTokenTypes.function),
@@ -1250,7 +1258,7 @@
     // clients other grammars would show through, losing the benefit from having
     // resolved the code).
     final content = '''
-    main() {
+    void f() {
       int a;
       a.foo().bar.baz();
 
@@ -1260,7 +1268,9 @@
     ''';
 
     final expected = [
-      _Token('main', SemanticTokenTypes.function,
+      _Token(
+          'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
+      _Token('f', SemanticTokenTypes.function,
           [SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
       _Token('int', SemanticTokenTypes.class_),
       _Token('a', SemanticTokenTypes.variable,
diff --git a/pkg/analysis_server/test/plugin/protocol_dart_test.dart b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
index 130ca0d..cccd6c9 100644
--- a/pkg/analysis_server/test/plugin/protocol_dart_test.dart
+++ b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
@@ -419,7 +419,7 @@
 
   Future<void> test_LABEL() async {
     await resolveTestCode('''
-main() {
+void f() {
 myLabel:
   while (true) {
     break myLabel;
@@ -433,7 +433,7 @@
     {
       var location = element.location!;
       expect(location.file, testFile);
-      expect(location.offset, 9);
+      expect(location.offset, 11);
       expect(location.length, 'myLabel'.length);
       expect(location.startLine, 2);
       expect(location.startColumn, 1);
diff --git a/pkg/analysis_server/test/search/member_declarations_test.dart b/pkg/analysis_server/test/search/member_declarations_test.dart
index 9d4a783..33ae643 100644
--- a/pkg/analysis_server/test/search/member_declarations_test.dart
+++ b/pkg/analysis_server/test/search/member_declarations_test.dart
@@ -227,7 +227,7 @@
   Future<void> test_localVariable() async {
     addTestFile('''
 class A {
-  main() {
+  void f() {
     var foo = 42;
   }
 }
@@ -239,7 +239,7 @@
   Future<void> test_localVariable_forIn() async {
     addTestFile('''
 class A {
-  main() {
+  void f() {
     for (int foo in []) {
     }
   }
diff --git a/pkg/analysis_server/test/search/type_hierarchy_test.dart b/pkg/analysis_server/test/search/type_hierarchy_test.dart
index 10f7652..47bdf09 100644
--- a/pkg/analysis_server/test/search/type_hierarchy_test.dart
+++ b/pkg/analysis_server/test/search/type_hierarchy_test.dart
@@ -28,16 +28,16 @@
 
   Future<void> test_bad_function() async {
     addTestFile('''
-main() {
+void f() {
 }
 ''');
-    var items = await _getTypeHierarchyOrNull('main() {');
+    var items = await _getTypeHierarchyOrNull('f() {');
     expect(items, isNull);
   }
 
   Future<void> test_bad_noElement() async {
     addTestFile('''
-main() {
+void f() {
   /* target */
 }
 ''');
diff --git a/pkg/analyzer/lib/src/error/required_parameters_verifier.dart b/pkg/analyzer/lib/src/error/required_parameters_verifier.dart
index 0e553d3..03bd2ed 100644
--- a/pkg/analyzer/lib/src/error/required_parameters_verifier.dart
+++ b/pkg/analyzer/lib/src/error/required_parameters_verifier.dart
@@ -18,6 +18,22 @@
   RequiredParametersVerifier(this._errorReporter);
 
   @override
+  void visitAnnotation(Annotation node) {
+    final element = node.element;
+    final argumentList = node.arguments;
+    if (element is ConstructorElement && argumentList != null) {
+      final errorNode = node.constructorIdentifier ?? node.classIdentifier;
+      if (errorNode != null) {
+        _check(
+          parameters: element.parameters,
+          arguments: argumentList.arguments,
+          errorNode: errorNode,
+        );
+      }
+    }
+  }
+
+  @override
   void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
     _check(
       parameters: node.constructorElement?.parameters,
@@ -201,3 +217,48 @@
     return (value == null || value.isEmpty) ? null : value;
   }
 }
+
+/// The annotation should be a constructor invocation.
+///
+/// TODO(scheglov) This is not ideal.
+/// Ideally when resolving an annotation we should restructure it into
+/// specific components - an import prefix, top-level declaration, getter,
+/// constructor, etc. So that later in the analyzer, or in clients, we
+/// don't have to identify it again and again.
+extension _InstantiatedAnnotation on Annotation {
+  SimpleIdentifier? get classIdentifier {
+    assert(arguments != null);
+    final name = this.name;
+    if (name is SimpleIdentifier) {
+      return _ifClassElement(name);
+    } else if (name is PrefixedIdentifier) {
+      return _ifClassElement(name.identifier);
+    }
+    return null;
+  }
+
+  SimpleIdentifier? get constructorIdentifier {
+    assert(arguments != null);
+    final constructorName = _ifConstructorElement(this.constructorName);
+    if (constructorName != null) {
+      return constructorName;
+    }
+
+    final name = this.name;
+    if (name is SimpleIdentifier) {
+      return _ifConstructorElement(name);
+    } else if (name is PrefixedIdentifier) {
+      return _ifConstructorElement(name.identifier);
+    }
+
+    return null;
+  }
+
+  static SimpleIdentifier? _ifClassElement(SimpleIdentifier? node) {
+    return node?.staticElement is ClassElement ? node : null;
+  }
+
+  static SimpleIdentifier? _ifConstructorElement(SimpleIdentifier? node) {
+    return node?.staticElement is ConstructorElement ? node : null;
+  }
+}
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 039fbff..0963a17 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -311,6 +311,7 @@
   @override
   void visitAnnotation(Annotation node) {
     _checkForInvalidAnnotationFromDeferredLibrary(node);
+    _requiredParametersVerifier.visitAnnotation(node);
     super.visitAnnotation(node);
   }
 
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index 54e6e12..3edee4b 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -27,7 +27,6 @@
   static const _finalizableClassName = 'Finalizable';
   static const _isLeafParamName = 'isLeaf';
   static const _opaqueClassName = 'Opaque';
-  static const _ffiNativeName = 'FfiNative';
 
   static const Set<String> _primitiveIntegerNativeTypesFixedSize = {
     'Int8',
@@ -190,7 +189,12 @@
 
   @override
   void visitFunctionDeclaration(FunctionDeclaration node) {
-    _checkFfiNative(node);
+    _checkFfiNative(
+      errorNode: node,
+      annotations: node.metadata,
+      declarationElement: node.declaredElement as ExecutableElement,
+      formalParameterList: node.functionExpression.parameters,
+    );
     super.visitFunctionDeclaration(node);
   }
 
@@ -237,7 +241,11 @@
 
   @override
   void visitMethodDeclaration(MethodDeclaration node) {
-    _checkFfiNative(node);
+    _checkFfiNative(
+        errorNode: node,
+        annotations: node.metadata,
+        declarationElement: node.declaredElement as ExecutableElement,
+        formalParameterList: node.parameters);
     super.visitMethodDeclaration(node);
   }
 
@@ -302,127 +310,84 @@
     super.visitPropertyAccess(node);
   }
 
-  void _checkFfiNative(Declaration node) {
-    NodeList<Annotation> annotations = node.metadata;
-    if (annotations.isEmpty) {
-      return;
-    }
+  void _checkFfiNative({
+    required Declaration errorNode,
+    required List<Annotation> annotations,
+    required ExecutableElement declarationElement,
+    required FormalParameterList? formalParameterList,
+  }) {
+    final formalParameters =
+        formalParameterList?.parameters ?? <FormalParameter>[];
 
     for (Annotation annotation in annotations) {
-      if (annotation.name.name != _ffiNativeName) {
+      if (!annotation.isFfiNative) {
         continue;
       }
 
-      final NodeList<Expression> arguments = annotation.arguments!.arguments;
-      final NodeList<TypeAnnotation> typeArguments =
-          annotation.typeArguments!.arguments;
+      final typeArguments = annotation.typeArguments?.arguments;
+      final arguments = annotation.arguments?.arguments;
+      if (typeArguments == null || arguments == null) {
+        continue;
+      }
 
       final ffiSignature = typeArguments[0].type! as FunctionType;
 
       // Leaf call FFI Natives can't use Handles.
-      _validateFfiLeafCallUsesNoHandles(arguments, ffiSignature, node);
+      _validateFfiLeafCallUsesNoHandles(arguments, ffiSignature, errorNode);
 
-      if (node is MethodDeclaration) {
-        if (!node.declaredElement!.isExternal) {
-          _errorReporter.reportErrorForNode(
-              FfiCode.FFI_NATIVE_MUST_BE_EXTERNAL, node);
-        }
-
-        List<DartType> ffiParameterTypes;
-        if (!node.isStatic) {
-          // Instance methods must have the receiver as an extra parameter in the
-          // FfiNative annotation.
-          if (node.parameters!.parameters.length + 1 !=
-              ffiSignature.parameters.length) {
-            _errorReporter.reportErrorForNode(
-                FfiCode
-                    .FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS_WITH_RECEIVER,
-                node,
-                [
-                  node.parameters!.parameters.length + 1,
-                  ffiSignature.parameters.length
-                ]);
-            return;
-          }
-
-          // Receiver can only be Pointer if the class extends
-          // NativeFieldWrapperClass1.
-          if (ffiSignature.normalParameterTypes[0].isPointer) {
-            final cls = node.declaredElement!.enclosingElement as ClassElement;
-            if (!_extendsNativeFieldWrapperClass1(cls.thisType)) {
-              _errorReporter.reportErrorForNode(
-                  FfiCode
-                      .FFI_NATIVE_ONLY_CLASSES_EXTENDING_NATIVEFIELDWRAPPERCLASS1_CAN_BE_POINTER,
-                  node);
-            }
-          }
-
-          ffiParameterTypes = ffiSignature.normalParameterTypes.sublist(1);
-        } else {
-          // Number of parameters in the FfiNative annotation must match the
-          // annotated declaration.
-          if (node.parameters!.parameters.length !=
-              ffiSignature.parameters.length) {
-            _errorReporter.reportErrorForNode(
-                FfiCode.FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS, node, [
-              ffiSignature.parameters.length,
-              node.parameters!.parameters.length
-            ]);
-            return;
-          }
-
-          ffiParameterTypes = ffiSignature.normalParameterTypes;
-        }
-
-        // Arguments can only be Pointer if the class extends
-        // NativeFieldWrapperClass1.
-        for (var i = 0; i < node.parameters!.parameters.length; i++) {
-          if (ffiParameterTypes[i].isPointer) {
-            final type = node.parameters!.parameters[i].declaredElement!.type;
-            if (!_extendsNativeFieldWrapperClass1(type as InterfaceType)) {
-              _errorReporter.reportErrorForNode(
-                  FfiCode
-                      .FFI_NATIVE_ONLY_CLASSES_EXTENDING_NATIVEFIELDWRAPPERCLASS1_CAN_BE_POINTER,
-                  node);
-            }
-          }
-        }
-
-        continue;
+      if (!declarationElement.isExternal) {
+        _errorReporter.reportErrorForNode(
+            FfiCode.FFI_NATIVE_MUST_BE_EXTERNAL, errorNode);
       }
 
-      if (node is FunctionDeclaration) {
-        if (!node.declaredElement!.isExternal) {
-          _errorReporter.reportErrorForNode(
-              FfiCode.FFI_NATIVE_MUST_BE_EXTERNAL, node);
-        }
+      var ffiParameterTypes = ffiSignature.normalParameterTypes;
 
-        // Number of parameters in the FfiNative annotation must match the
-        // annotated declaration.
-        if (node.functionExpression.parameters!.parameters.length !=
-            ffiSignature.parameters.length) {
+      if (declarationElement is MethodElement && !declarationElement.isStatic) {
+        // Instance methods must have the receiver as an extra parameter in the
+        // FfiNative annotation.
+        if (formalParameters.length + 1 != ffiSignature.parameters.length) {
           _errorReporter.reportErrorForNode(
-              FfiCode.FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS, node, [
-            ffiSignature.parameters.length,
-            node.functionExpression.parameters!.parameters.length
-          ]);
+              FfiCode.FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS_WITH_RECEIVER,
+              errorNode,
+              [formalParameters.length + 1, ffiSignature.parameters.length]);
           return;
         }
 
-        // Arguments can only be Pointer if the class extends
+        // Receiver can only be Pointer if the class extends
         // NativeFieldWrapperClass1.
-        for (var i = 0;
-            i < node.functionExpression.parameters!.parameters.length;
-            i++) {
-          if (ffiSignature.normalParameterTypes[i].isPointer) {
-            final type = node.functionExpression.parameters!.parameters[i]
-                .declaredElement!.type;
-            if (!_extendsNativeFieldWrapperClass1(type as InterfaceType)) {
-              _errorReporter.reportErrorForNode(
-                  FfiCode
-                      .FFI_NATIVE_ONLY_CLASSES_EXTENDING_NATIVEFIELDWRAPPERCLASS1_CAN_BE_POINTER,
-                  node);
-            }
+        if (ffiSignature.normalParameterTypes[0].isPointer) {
+          final cls = declarationElement.enclosingElement as ClassElement;
+          if (!_extendsNativeFieldWrapperClass1(cls.thisType)) {
+            _errorReporter.reportErrorForNode(
+                FfiCode
+                    .FFI_NATIVE_ONLY_CLASSES_EXTENDING_NATIVEFIELDWRAPPERCLASS1_CAN_BE_POINTER,
+                errorNode);
+          }
+        }
+
+        ffiParameterTypes = ffiParameterTypes.sublist(1);
+      } else {
+        // Number of parameters in the FfiNative annotation must match the
+        // annotated declaration.
+        if (formalParameters.length != ffiSignature.parameters.length) {
+          _errorReporter.reportErrorForNode(
+              FfiCode.FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS,
+              errorNode,
+              [ffiSignature.parameters.length, formalParameters.length]);
+          return;
+        }
+      }
+
+      // Arguments can only be Pointer if the class extends
+      // NativeFieldWrapperClass1.
+      for (var i = 0; i < formalParameters.length; i++) {
+        if (ffiParameterTypes[i].isPointer) {
+          final type = formalParameters[i].declaredElement!.type;
+          if (!_extendsNativeFieldWrapperClass1(type as InterfaceType)) {
+            _errorReporter.reportErrorForNode(
+                FfiCode
+                    .FFI_NATIVE_ONLY_CLASSES_EXTENDING_NATIVEFIELDWRAPPERCLASS1_CAN_BE_POINTER,
+                errorNode);
           }
         }
       }
@@ -1294,6 +1259,13 @@
         element.enclosingElement.name == 'Array';
   }
 
+  bool get isFfiNative {
+    final element = this.element;
+    return element is ConstructorElement &&
+        element.ffiClass != null &&
+        element.enclosingElement.name == 'FfiNative';
+  }
+
   bool get isPacked {
     final element = this.element;
     return element is ConstructorElement &&
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
index fab02b3..5541ef2 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
@@ -2,11 +2,9 @@
 // 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.
 
-import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/error/syntactic_errors.dart';
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/test_utilities/mock_sdk.dart';
-import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import 'context_collection_resolution.dart';
@@ -38,7 +36,12 @@
   }
 }
 ''');
-    assertType(findNode.this_('this;'), 'int');
+    var node = findNode.this_('this;');
+    assertResolvedNodeText(node, r'''
+ThisExpression
+  thisKeyword: this
+  staticType: int
+''');
   }
 
   test_this_type_typeParameter() async {
@@ -49,7 +52,12 @@
   }
 }
 ''');
-    assertType(findNode.this_('this;'), 'T');
+    var node = findNode.this_('this;');
+    assertResolvedNodeText(node, r'''
+ThisExpression
+  thisKeyword: this
+  staticType: T
+''');
   }
 
   test_this_type_typeParameter_withBound() async {
@@ -60,7 +68,12 @@
   }
 }
 ''');
-    assertType(findNode.this_('this;'), 'T');
+    var node = findNode.this_('this;');
+    assertResolvedNodeText(node, r'''
+ThisExpression
+  thisKeyword: this
+  staticType: T
+''');
   }
 }
 
@@ -133,7 +146,15 @@
 extension E on C {}
 ''');
     var annotation = findNode.annotation('@ann');
-    assertElement(annotation, findElement.topVar('ann').getter);
+    assertResolvedNodeText(annotation, r'''
+Annotation
+  atSign: @
+  name: SimpleIdentifier
+    token: ann
+    staticElement: self::@getter::ann
+    staticType: null
+  element: self::@getter::ann
+''');
   }
 
   test_multipleExtensions_noConflict() async {
@@ -152,7 +173,12 @@
   }
 }
 ''');
-    assertType(findNode.this_('this;'), 'int');
+    var node = findNode.this_('this;');
+    assertResolvedNodeText(node, r'''
+ThisExpression
+  thisKeyword: this
+  staticType: int*
+''');
   }
 
   test_this_type_typeParameter() async {
@@ -163,7 +189,12 @@
   }
 }
 ''');
-    assertType(findNode.this_('this;'), 'T');
+    var node = findNode.this_('this;');
+    assertResolvedNodeText(node, r'''
+ThisExpression
+  thisKeyword: this
+  staticType: T*
+''');
   }
 
   test_this_type_typeParameter_withBound() async {
@@ -174,7 +205,12 @@
   }
 }
 ''');
-    assertType(findNode.this_('this;'), 'T');
+    var node = findNode.this_('this;');
+    assertResolvedNodeText(node, r'''
+ThisExpression
+  thisKeyword: this
+  staticType: T*
+''');
   }
 
   test_visibility_hidden() async {
@@ -229,9 +265,20 @@
 }
 ''');
     var access = findNode.prefixed('c.a');
-    var import = findElement.importFind('package:test/lib.dart');
-    assertElement(access, import.extension_('E').getGetter('a'));
-    assertType(access, 'int');
+    assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: c
+    staticElement: c@35
+    staticType: C*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib.dart::@extension::E::@getter::a
+    staticType: int*
+  staticElement: package:test/lib.dart::@extension::E::@getter::a
+  staticType: int*
+''');
   }
 
   test_visibility_shadowed_byImport() async {
@@ -253,9 +300,20 @@
 }
 ''');
     var access = findNode.prefixed('o.a');
-    var import = findElement.importFind('package:test/lib1.dart');
-    assertElement(access, import.extension_('E').getGetter('a'));
-    assertType(access, 'int');
+    assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: o
+    staticElement: o@50
+    staticType: Object*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib1.dart::@extension::E::@getter::a
+    staticType: int*
+  staticElement: package:test/lib1.dart::@extension::E::@getter::a
+  staticType: int*
+''');
   }
 
   test_visibility_shadowed_byLocal_imported() async {
@@ -276,9 +334,20 @@
       error(HintCode.UNUSED_LOCAL_VARIABLE, 38, 1),
     ]);
     var access = findNode.prefixed('c.a');
-    var import = findElement.importFind('package:test/lib.dart');
-    assertElement(access, import.extension_('E').getGetter('a'));
-    assertType(access, 'int');
+    assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: c
+    staticElement: c@24
+    staticType: C*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib.dart::@extension::E::@getter::a
+    staticType: int*
+  staticElement: package:test/lib.dart::@extension::E::@getter::a
+  staticType: int*
+''');
   }
 
   test_visibility_shadowed_byLocal_local() async {
@@ -295,8 +364,20 @@
       error(HintCode.UNUSED_LOCAL_VARIABLE, 68, 1),
     ]);
     var access = findNode.prefixed('c.a');
-    assertElement(access, findElement.getter('a'));
-    assertType(access, 'int');
+    assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: c
+    staticElement: c@54
+    staticType: C*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@getter::a
+    staticType: int*
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
   }
 
   test_visibility_shadowed_byTopLevelVariable() async {
@@ -315,9 +396,20 @@
 }
 ''');
     var access = findNode.prefixed('c.a');
-    var import = findElement.importFind('package:test/lib.dart');
-    assertElement(access, import.extension_('E').getGetter('a'));
-    assertType(access, 'int');
+    assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: c
+    staticElement: c@41
+    staticType: C*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib.dart::@extension::E::@getter::a
+    staticType: int*
+  staticElement: package:test/lib.dart::@extension::E::@getter::a
+  staticType: int*
+''');
   }
 
   test_visibility_shadowed_platformByNonPlatform() async {
@@ -365,8 +457,45 @@
 extension E<S> on C<S> {}
 ''');
     var extendedType = findNode.typeAnnotation('C<S>');
-    assertElement(extendedType, findElement.class_('C'));
-    assertType(extendedType, 'C<S>');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: C
+    staticElement: self::@class::C
+    staticType: null
+  typeArguments: TypeArgumentList
+    leftBracket: <
+    arguments
+      NamedType
+        name: SimpleIdentifier
+          token: S
+          staticElement: S@26
+          staticType: null
+        type: S
+    rightBracket: >
+  type: C<S>
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: C
+    staticElement: self::@class::C
+    staticType: null
+  typeArguments: TypeArgumentList
+    leftBracket: <
+    arguments
+      NamedType
+        name: SimpleIdentifier
+          token: S
+          staticElement: S@26
+          staticType: null
+        type: S*
+    rightBracket: >
+  type: C<S*>*
+''');
+    }
   }
 
   test_named_onDynamic() async {
@@ -374,7 +503,25 @@
 extension E on dynamic {}
 ''');
     var extendedType = findNode.typeAnnotation('dynamic');
-    assertType(extendedType, 'dynamic');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: dynamic
+    staticElement: dynamic@-1
+    staticType: null
+  type: dynamic
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: dynamic
+    staticElement: dynamic@-1
+    staticType: null
+  type: dynamic
+''');
+    }
   }
 
   test_named_onEnum() async {
@@ -383,8 +530,25 @@
 extension E on A {}
 ''');
     var extendedType = findNode.typeAnnotation('A {}');
-    assertElement(extendedType, findElement.enum_('A'));
-    assertType(extendedType, 'A');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: A
+    staticElement: self::@enum::A
+    staticType: null
+  type: A
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: A
+    staticElement: self::@enum::A
+    staticType: null
+  type: A*
+''');
+    }
   }
 
   test_named_onFunctionType() async {
@@ -392,7 +556,69 @@
 extension E on int Function(int) {}
 ''');
     var extendedType = findNode.typeAnnotation('Function');
-    assertType(extendedType, 'int Function(int)');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+GenericFunctionType
+  returnType: NamedType
+    name: SimpleIdentifier
+      token: int
+      staticElement: dart:core::@class::int
+      staticType: null
+    type: int
+  functionKeyword: Function
+  parameters: FormalParameterList
+    leftParenthesis: (
+    parameter: SimpleFormalParameter
+      type: NamedType
+        name: SimpleIdentifier
+          token: int
+          staticElement: dart:core::@class::int
+          staticType: null
+        type: int
+      declaredElement: @-1
+      declaredElementType: int
+    rightParenthesis: )
+  declaredElement: GenericFunctionTypeElement
+    parameters
+      <empty>
+        kind: required positional
+        type: int
+    returnType: int
+    type: int Function(int)
+  type: int Function(int)
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+GenericFunctionType
+  returnType: NamedType
+    name: SimpleIdentifier
+      token: int
+      staticElement: dart:core::@class::int
+      staticType: null
+    type: int*
+  functionKeyword: Function
+  parameters: FormalParameterList
+    leftParenthesis: (
+    parameter: SimpleFormalParameter
+      type: NamedType
+        name: SimpleIdentifier
+          token: int
+          staticElement: dart:core::@class::int
+          staticType: null
+        type: int*
+      declaredElement: @-1
+      declaredElementType: int*
+    rightParenthesis: )
+  declaredElement: GenericFunctionTypeElement
+    parameters
+      <empty>
+        kind: required positional
+        type: int*
+    returnType: int*
+    type: int* Function(int*)*
+  type: int* Function(int*)*
+''');
+    }
   }
 
   test_named_onInterface() async {
@@ -401,8 +627,25 @@
 extension E on C {}
 ''');
     var extendedType = findNode.typeAnnotation('C {}');
-    assertElement(extendedType, findElement.class_('C'));
-    assertType(extendedType, 'C');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: C
+    staticElement: self::@class::C
+    staticType: null
+  type: C
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: C
+    staticElement: self::@class::C
+    staticType: null
+  type: C*
+''');
+    }
   }
 
   test_named_onMixin() async {
@@ -412,8 +655,25 @@
 extension E on M {}
 ''');
     var extendedType = findNode.typeAnnotation('M {}');
-    assertElement(extendedType, findElement.mixin('M'));
-    assertType(extendedType, 'M');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: M
+    staticElement: self::@mixin::M
+    staticType: null
+  type: M
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: M
+    staticElement: self::@mixin::M
+    staticType: null
+  type: M*
+''');
+    }
   }
 
   test_unnamed_generic() async {
@@ -422,8 +682,45 @@
 extension<S> on C<S> {}
 ''');
     var extendedType = findNode.typeAnnotation('C<S>');
-    assertElement(extendedType, findElement.class_('C'));
-    assertType(extendedType, 'C<S>');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: C
+    staticElement: self::@class::C
+    staticType: null
+  typeArguments: TypeArgumentList
+    leftBracket: <
+    arguments
+      NamedType
+        name: SimpleIdentifier
+          token: S
+          staticElement: S@24
+          staticType: null
+        type: S
+    rightBracket: >
+  type: C<S>
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: C
+    staticElement: self::@class::C
+    staticType: null
+  typeArguments: TypeArgumentList
+    leftBracket: <
+    arguments
+      NamedType
+        name: SimpleIdentifier
+          token: S
+          staticElement: S@24
+          staticType: null
+        type: S*
+    rightBracket: >
+  type: C<S*>*
+''');
+    }
   }
 
   test_unnamed_onDynamic() async {
@@ -431,7 +728,25 @@
 extension on dynamic {}
 ''');
     var extendedType = findNode.typeAnnotation('dynamic');
-    assertType(extendedType, 'dynamic');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: dynamic
+    staticElement: dynamic@-1
+    staticType: null
+  type: dynamic
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: dynamic
+    staticElement: dynamic@-1
+    staticType: null
+  type: dynamic
+''');
+    }
   }
 
   test_unnamed_onEnum() async {
@@ -440,8 +755,25 @@
 extension on A {}
 ''');
     var extendedType = findNode.typeAnnotation('A {}');
-    assertElement(extendedType, findElement.enum_('A'));
-    assertType(extendedType, 'A');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: A
+    staticElement: self::@enum::A
+    staticType: null
+  type: A
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: A
+    staticElement: self::@enum::A
+    staticType: null
+  type: A*
+''');
+    }
   }
 
   test_unnamed_onFunctionType() async {
@@ -449,11 +781,69 @@
 extension on int Function(String) {}
 ''');
     var extendedType = findNode.typeAnnotation('Function');
-    assertType(extendedType, 'int Function(String)');
-    var returnType = findNode.typeAnnotation('int');
-    assertType(returnType, 'int');
-    var parameterType = findNode.typeAnnotation('String');
-    assertType(parameterType, 'String');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+GenericFunctionType
+  returnType: NamedType
+    name: SimpleIdentifier
+      token: int
+      staticElement: dart:core::@class::int
+      staticType: null
+    type: int
+  functionKeyword: Function
+  parameters: FormalParameterList
+    leftParenthesis: (
+    parameter: SimpleFormalParameter
+      type: NamedType
+        name: SimpleIdentifier
+          token: String
+          staticElement: dart:core::@class::String
+          staticType: null
+        type: String
+      declaredElement: @-1
+      declaredElementType: String
+    rightParenthesis: )
+  declaredElement: GenericFunctionTypeElement
+    parameters
+      <empty>
+        kind: required positional
+        type: String
+    returnType: int
+    type: int Function(String)
+  type: int Function(String)
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+GenericFunctionType
+  returnType: NamedType
+    name: SimpleIdentifier
+      token: int
+      staticElement: dart:core::@class::int
+      staticType: null
+    type: int*
+  functionKeyword: Function
+  parameters: FormalParameterList
+    leftParenthesis: (
+    parameter: SimpleFormalParameter
+      type: NamedType
+        name: SimpleIdentifier
+          token: String
+          staticElement: dart:core::@class::String
+          staticType: null
+        type: String*
+      declaredElement: @-1
+      declaredElementType: String*
+    rightParenthesis: )
+  declaredElement: GenericFunctionTypeElement
+    parameters
+      <empty>
+        kind: required positional
+        type: String*
+    returnType: int*
+    type: int* Function(String*)*
+  type: int* Function(String*)*
+''');
+    }
   }
 
   test_unnamed_onInterface() async {
@@ -462,8 +852,25 @@
 extension on C {}
 ''');
     var extendedType = findNode.typeAnnotation('C {}');
-    assertElement(extendedType, findElement.class_('C'));
-    assertType(extendedType, 'C');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: C
+    staticElement: self::@class::C
+    staticType: null
+  type: C
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: C
+    staticElement: self::@class::C
+    staticType: null
+  type: C*
+''');
+    }
   }
 
   test_unnamed_onMixin() async {
@@ -473,8 +880,25 @@
 extension on M {}
 ''');
     var extendedType = findNode.typeAnnotation('M {}');
-    assertElement(extendedType, findElement.mixin('M'));
-    assertType(extendedType, 'M');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: M
+    staticElement: self::@mixin::M
+    staticType: null
+  type: M
+''');
+    } else {
+      assertResolvedNodeText(extendedType, r'''
+NamedType
+  name: SimpleIdentifier
+    token: M
+    staticElement: self::@mixin::M
+    staticType: null
+  type: M*
+''');
+    }
   }
 }
 
@@ -499,8 +923,20 @@
 }
 ''');
     var access = findNode.prefixed('a.foo');
-    assertElementNull(access);
-    assertType(access, 'Never');
+    assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: a
+    staticElement: a@54
+    staticType: Never
+  period: .
+  identifier: SimpleIdentifier
+    token: foo
+    staticElement: <null>
+    staticType: Never
+  staticElement: <null>
+  staticType: Never
+''');
   }
 
   test_instance_getter_fromInstance_nullable() async {
@@ -514,8 +950,20 @@
 }
 ''');
     var access = findNode.prefixed('a.foo');
-    assertElement(access, findElement.getter('foo', of: 'E'));
-    assertType(access, 'int');
+    assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: a
+    staticElement: a@52
+    staticType: int?
+  period: .
+  identifier: SimpleIdentifier
+    token: foo
+    staticElement: self::@extension::E::@getter::foo
+    staticType: int
+  staticElement: self::@extension::E::@getter::foo
+  staticType: int
+''');
   }
 
   test_instance_getter_fromInstance_nullAware() async {
@@ -528,9 +976,20 @@
   a?.foo;
 }
 ''');
-    var identifier = findNode.simple('foo;');
-    assertElement(identifier, findElement.getter('foo', of: 'E'));
-    assertType(identifier, 'int');
+    var access = findNode.propertyAccess('foo;');
+    assertResolvedNodeText(access, r'''
+PropertyAccess
+  target: SimpleIdentifier
+    token: a
+    staticElement: a@51
+    staticType: int?
+  operator: ?.
+  propertyName: SimpleIdentifier
+    token: foo
+    staticElement: self::@extension::E::@getter::foo
+    staticType: int
+  staticType: int?
+''');
   }
 
   test_instance_method_fromInstance_Never() async {
@@ -578,8 +1037,23 @@
 }
 ''');
     var invocation = findNode.methodInvocation('a.foo()');
-    assertElement(invocation, findElement.method('foo', of: 'E'));
-    assertInvokeType(invocation, 'void Function()');
+    assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: a
+    staticElement: a@48
+    staticType: int?
+  operator: .
+  methodName: SimpleIdentifier
+    token: foo
+    staticElement: self::@extension::E::@method::foo
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
   }
 
   test_instance_method_fromInstance_nullable_nullLiteral() async {
@@ -593,8 +1067,22 @@
 }
 ''');
     var invocation = findNode.methodInvocation('null.foo()');
-    assertElement(invocation, findElement.method('foo', of: 'E'));
-    assertInvokeType(invocation, 'void Function()');
+    assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: NullLiteral
+    literal: null
+    staticType: Null
+  operator: .
+  methodName: SimpleIdentifier
+    token: foo
+    staticElement: self::@extension::E::@method::foo
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
   }
 
   test_instance_method_fromInstance_nullAware() async {
@@ -608,8 +1096,23 @@
 }
 ''');
     var invocation = findNode.methodInvocation('a?.foo()');
-    assertElement(invocation, findElement.method('foo', of: 'E'));
-    assertInvokeType(invocation, 'void Function()');
+    assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: a
+    staticElement: a@47
+    staticType: int?
+  operator: ?.
+  methodName: SimpleIdentifier
+    token: foo
+    staticElement: self::@extension::E::@method::foo
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
   }
 
   test_instance_method_fromInstance_nullLiteral() async {
@@ -623,12 +1126,24 @@
 }
 ''');
     var invocation = findNode.methodInvocation('null.foo()');
-    assertMember(
-      invocation,
-      findElement.method('foo', of: 'E'),
-      {'T': 'Null'},
-    );
-    assertInvokeType(invocation, 'void Function()');
+    assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: NullLiteral
+    literal: null
+    staticType: Null
+  operator: .
+  methodName: SimpleIdentifier
+    token: foo
+    staticElement: MethodMember
+      base: self::@extension::E::@method::foo
+      substitution: {T: Null}
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
   }
 
   test_instance_operator_binary_fromInstance_nullable() async {
@@ -644,8 +1159,20 @@
 }
 ''');
     var binary = findNode.binary('a + 1');
-    assertElement(binary, findElement.method('+'));
-    assertType(binary, 'int');
+    assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: SimpleIdentifier
+    token: a
+    staticElement: a@70
+    staticType: A?
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 1
+    staticType: int
+  staticElement: self::@extension::E::@method::+
+  staticInvokeType: int Function(int)
+  staticType: int
+''');
   }
 
   test_instance_operator_index_fromInstance_nullable() async {
@@ -659,7 +1186,20 @@
 }
 ''');
     var index = findNode.index('a[0]');
-    assertElement(index, findElement.method('[]'));
+    assertResolvedNodeText(index, r'''
+IndexExpression
+  target: SimpleIdentifier
+    token: a
+    staticElement: a@67
+    staticType: int?
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 0
+    staticType: int
+  rightBracket: ]
+  staticElement: self::@extension::E::@method::[]
+  staticType: int
+''');
   }
 
   test_instance_operator_index_fromInstance_nullAware() async {
@@ -673,7 +1213,20 @@
 }
 ''');
     var index = findNode.index('a?[0]');
-    assertElement(index, findElement.method('[]'));
+    assertResolvedNodeText(index, r'''
+IndexExpression
+  target: SimpleIdentifier
+    token: a
+    staticElement: a@66
+    staticType: int?
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 0
+    staticType: int
+  rightBracket: ]
+  staticElement: self::@extension::E::@method::[]
+  staticType: int?
+''');
   }
 
   test_instance_operator_postfixInc_fromInstance_nullable() async {
@@ -689,8 +1242,20 @@
 }
 ''');
     var expression = findNode.postfix('a++');
-    assertElement(expression, findElement.method('+'));
-    assertType(expression, 'A?');
+    assertResolvedNodeText(expression, r'''
+PostfixExpression
+  operand: SimpleIdentifier
+    token: a
+    staticElement: a@72
+    staticType: null
+  operator: ++
+  readElement: a@72
+  readType: A?
+  writeElement: a@72
+  writeType: A?
+  staticElement: self::@extension::E::@method::+
+  staticType: A?
+''');
   }
 
   test_instance_operator_prefixInc_fromInstance_nullable() async {
@@ -706,8 +1271,20 @@
 }
 ''');
     var expression = findNode.prefix('++a');
-    assertElement(expression, findElement.method('+'));
-    assertType(expression, 'A?');
+    assertResolvedNodeText(expression, r'''
+PrefixExpression
+  operator: ++
+  operand: SimpleIdentifier
+    token: a
+    staticElement: a@72
+    staticType: null
+  readElement: a@72
+  readType: A?
+  writeElement: a@72
+  writeType: A?
+  staticElement: self::@extension::E::@method::+
+  staticType: A?
+''');
   }
 
   test_instance_operator_unaryMinus_fromInstance_nullable() async {
@@ -723,8 +1300,16 @@
 }
 ''');
     var expression = findNode.prefix('-a');
-    assertElement(expression, findElement.method('unary-'));
-    assertType(expression, 'A?');
+    assertResolvedNodeText(expression, r'''
+PrefixExpression
+  operator: -
+  operand: SimpleIdentifier
+    token: a
+    staticElement: a@67
+    staticType: A?
+  staticElement: self::@extension::E::@method::unary-
+  staticType: A?
+''');
   }
 
   test_instance_setter_fromInstance_nullable() async {
@@ -837,13 +1422,43 @@
 }
 ''');
     var invocation = findNode.functionExpressionInvocation('c(2)');
-    assertElement(invocation, findElement.method('call', of: 'C'));
-    assertInvokeType(invocation, 'int Function(int)');
-    assertType(invocation, 'int');
-
-    var cRef = invocation.function as SimpleIdentifier;
-    assertElement(cRef, findElement.parameter('c'));
-    assertType(cRef, 'C');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: SimpleIdentifier
+    token: c
+    staticElement: c@87
+    staticType: C
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 2
+        staticType: int
+    rightParenthesis: )
+  staticElement: self::@class::C::@method::call
+  staticInvokeType: int Function(int)
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: SimpleIdentifier
+    token: c
+    staticElement: c@87
+    staticType: C*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 2
+        staticType: int*
+    rightParenthesis: )
+  staticElement: self::@class::C::@method::call
+  staticInvokeType: int* Function(int*)*
+  staticType: int*
+''');
+    }
   }
 
   test_instance_call_fromExtension() async {
@@ -859,13 +1474,43 @@
 }
 ''');
     var invocation = findNode.functionExpressionInvocation('c(2)');
-    assertElement(invocation, findElement.method('call', of: 'E'));
-    assertInvokeType(invocation, 'int Function(int)');
-    assertType(invocation, 'int');
-
-    var cRef = invocation.function as SimpleIdentifier;
-    assertElement(cRef, findElement.parameter('c'));
-    assertType(cRef, 'C');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: SimpleIdentifier
+    token: c
+    staticElement: c@62
+    staticType: C
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 2
+        staticType: int
+    rightParenthesis: )
+  staticElement: self::@extension::E::@method::call
+  staticInvokeType: int Function(int)
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: SimpleIdentifier
+    token: c
+    staticElement: c@62
+    staticType: C*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 2
+        staticType: int*
+    rightParenthesis: )
+  staticElement: self::@extension::E::@method::call
+  staticInvokeType: int* Function(int*)*
+  staticType: int*
+''');
+    }
   }
 
   test_instance_call_fromExtension_int() async {
@@ -879,11 +1524,41 @@
 }
 ''');
     var invocation = findNode.functionExpressionInvocation('1(2)');
-    expect(
-      invocation.staticElement,
-      same(findElement.method('call', of: 'E')),
-    );
-    assertInvokeType(invocation, 'int Function(int)');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: IntegerLiteral
+    literal: 1
+    staticType: int
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 2
+        staticType: int
+    rightParenthesis: )
+  staticElement: self::@extension::E::@method::call
+  staticInvokeType: int Function(int)
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: IntegerLiteral
+    literal: 1
+    staticType: int*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 2
+        staticType: int*
+    rightParenthesis: )
+  staticElement: self::@extension::E::@method::call
+  staticInvokeType: int* Function(int*)*
+  staticType: int*
+''');
+    }
   }
 
   test_instance_compoundAssignment_fromExtendedType() async {
@@ -899,7 +1574,43 @@
 }
 ''');
     var assignment = findNode.assignment('+=');
-    assertElement(assignment, findElement.method('+', of: 'C'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(assignment, r'''
+AssignmentExpression
+  leftHandSide: SimpleIdentifier
+    token: c
+    staticElement: c@99
+    staticType: null
+  operator: +=
+  rightHandSide: IntegerLiteral
+    literal: 2
+    staticType: int
+  readElement: c@99
+  readType: C
+  writeElement: c@99
+  writeType: C
+  staticElement: self::@class::C::@method::+
+  staticType: C
+''');
+    } else {
+      assertResolvedNodeText(assignment, r'''
+AssignmentExpression
+  leftHandSide: SimpleIdentifier
+    token: c
+    staticElement: c@99
+    staticType: null
+  operator: +=
+  rightHandSide: IntegerLiteral
+    literal: 2
+    staticType: int*
+  readElement: c@99
+  readType: C*
+  writeElement: c@99
+  writeType: C*
+  staticElement: self::@class::C::@method::+
+  staticType: C*
+''');
+    }
   }
 
   test_instance_compoundAssignment_fromExtension() async {
@@ -913,7 +1624,43 @@
 }
 ''');
     var assignment = findNode.assignment('+=');
-    assertElement(assignment, findElement.method('+', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(assignment, r'''
+AssignmentExpression
+  leftHandSide: SimpleIdentifier
+    token: c
+    staticElement: c@67
+    staticType: null
+  operator: +=
+  rightHandSide: IntegerLiteral
+    literal: 2
+    staticType: int
+  readElement: c@67
+  readType: C
+  writeElement: c@67
+  writeType: C
+  staticElement: self::@extension::E::@method::+
+  staticType: C
+''');
+    } else {
+      assertResolvedNodeText(assignment, r'''
+AssignmentExpression
+  leftHandSide: SimpleIdentifier
+    token: c
+    staticElement: c@67
+    staticType: null
+  operator: +=
+  rightHandSide: IntegerLiteral
+    literal: 2
+    staticType: int*
+  readElement: c@67
+  readType: C*
+  writeElement: c@67
+  writeType: C*
+  staticElement: self::@extension::E::@method::+
+  staticType: C*
+''');
+    }
   }
 
   test_instance_getter_fromDifferentExtension_usingBounds() async {
@@ -929,7 +1676,21 @@
 }
 ''');
     var identifier = findNode.simple('g;');
-    assertElement(identifier, findElement.getter('g'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: g
+  staticElement: self::@extension::E1::@getter::g
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: g
+  staticElement: self::@extension::E1::@getter::g
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getter_fromDifferentExtension_withoutTarget() async {
@@ -945,8 +1706,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.getter('a'));
-    assertType(identifier, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E1::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E1::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getter_fromExtendedType_usingBounds() async {
@@ -961,7 +1735,21 @@
 }
 ''');
     var identifier = findNode.simple('g;');
-    assertElement(identifier, findElement.getter('g'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: g
+  staticElement: self::@class::B::@getter::g
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: g
+  staticElement: self::@class::B::@getter::g
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getter_fromExtendedType_withoutTarget() async {
@@ -976,8 +1764,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.getter('a'));
-    assertType(identifier, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getter_fromExtension_functionType() async {
@@ -990,8 +1791,37 @@
 }
 ''');
     var access = findNode.prefixed('f.a');
-    assertElement(access, findElement.getter('a'));
-    assertType(access, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: f
+    staticElement: f@75
+    staticType: int Function(int)
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@getter::a
+    staticType: int
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: f
+    staticElement: f@75
+    staticType: int* Function(int*)*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@getter::a
+    staticType: int*
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getter_fromInstance() async {
@@ -1007,8 +1837,37 @@
 }
 ''');
     var access = findNode.prefixed('c.a');
-    assertElement(access, findElement.getter('a'));
-    assertType(access, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: c
+    staticElement: c@56
+    staticType: C
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@getter::a
+    staticType: int
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: c
+    staticElement: c@56
+    staticType: C*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@getter::a
+    staticType: int*
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getter_methodInvocation() async {
@@ -1024,13 +1883,57 @@
 }
 ''');
     var invocation = findNode.functionExpressionInvocation('c.a(0)');
-    assertElementNull(invocation);
-    assertInvokeType(invocation, 'double Function(int)');
-    assertType(invocation, 'double');
-
-    var function = invocation.function as PropertyAccess;
-    assertElement(function.propertyName, findElement.getter('a', of: 'E'));
-    assertType(function.propertyName, 'double Function(int)');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: PropertyAccess
+    target: SimpleIdentifier
+      token: c
+      staticElement: c@82
+      staticType: C
+    operator: .
+    propertyName: SimpleIdentifier
+      token: a
+      staticElement: self::@extension::E::@getter::a
+      staticType: double Function(int)
+    staticType: double Function(int)
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 0
+        staticType: int
+    rightParenthesis: )
+  staticElement: <null>
+  staticInvokeType: double Function(int)
+  staticType: double
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: PropertyAccess
+    target: SimpleIdentifier
+      token: c
+      staticElement: c@82
+      staticType: C*
+    operator: .
+    propertyName: SimpleIdentifier
+      token: a
+      staticElement: self::@extension::E::@getter::a
+      staticType: double* Function(int*)*
+    staticType: double* Function(int*)*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 0
+        staticType: int*
+    rightParenthesis: )
+  staticElement: <null>
+  staticInvokeType: double* Function(int*)*
+  staticType: double*
+''');
+    }
   }
 
   test_instance_getter_specificSubtypeMatchLocal() async {
@@ -1050,8 +1953,37 @@
 }
 ''');
     var access = findNode.prefixed('b.a');
-    assertElement(access, findElement.getter('a', of: 'B_Ext'));
-    assertType(access, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: b
+    staticElement: b@124
+    staticType: B
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::B_Ext::@getter::a
+    staticType: int
+  staticElement: self::@extension::B_Ext::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(access, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: b
+    staticElement: b@124
+    staticType: B*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::B_Ext::@getter::a
+    staticType: int*
+  staticElement: self::@extension::B_Ext::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getterInvoked_fromExtension_functionType() async {
@@ -1064,13 +1996,49 @@
 }
 ''');
     var invocation = findNode.functionExpressionInvocation('f.a()');
-    assertElementNull(invocation);
-    assertInvokeType(invocation, 'String Function()');
-    assertType(invocation, 'String');
-
-    var function = invocation.function as PropertyAccess;
-    assertElement(function.propertyName, findElement.getter('a', of: 'E'));
-    assertType(function.propertyName, 'String Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: PropertyAccess
+    target: SimpleIdentifier
+      token: f
+      staticElement: f@97
+      staticType: int Function(int)
+    operator: .
+    propertyName: SimpleIdentifier
+      token: a
+      staticElement: self::@extension::E::@getter::a
+      staticType: String Function()
+    staticType: String Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticElement: <null>
+  staticInvokeType: String Function()
+  staticType: String
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: PropertyAccess
+    target: SimpleIdentifier
+      token: f
+      staticElement: f@97
+      staticType: int* Function(int*)*
+    operator: .
+    propertyName: SimpleIdentifier
+      token: a
+      staticElement: self::@extension::E::@getter::a
+      staticType: String* Function()*
+    staticType: String* Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticElement: <null>
+  staticInvokeType: String* Function()*
+  staticType: String*
+''');
+    }
   }
 
   test_instance_method_fromDifferentExtension_usingBounds() async {
@@ -1086,8 +2054,33 @@
 }
 ''');
     var invocation = findNode.methodInvocation('m();');
-    assertElement(invocation, findElement.method('m'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: m
+    staticElement: self::@extension::E1::@method::m
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: m
+    staticElement: self::@extension::E1::@method::m
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_method_fromDifferentExtension_withoutTarget() async {
@@ -1103,8 +2096,33 @@
 }
 ''');
     var invocation = findNode.methodInvocation('a();');
-    assertElement(invocation, findElement.method('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E1::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E1::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_method_fromExtendedType_usingBounds() async {
@@ -1119,8 +2137,33 @@
 }
 ''');
     var invocation = findNode.methodInvocation('m();');
-    assertElement(invocation, findElement.method('m'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: m
+    staticElement: self::@class::B::@method::m
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: m
+    staticElement: self::@class::B::@method::m
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_method_fromExtendedType_withoutTarget() async {
@@ -1135,8 +2178,33 @@
 }
 ''');
     var invocation = findNode.methodInvocation('a();');
-    assertElement(invocation, findElement.method('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_method_fromExtension_functionType() async {
@@ -1149,8 +2217,43 @@
 }
 ''');
     var invocation = findNode.methodInvocation('f.a()');
-    assertElement(invocation, findElement.method('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: f
+    staticElement: f@71
+    staticType: int Function(int)
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: f
+    staticElement: f@71
+    staticType: int* Function(int*)*
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_method_fromInstance() async {
@@ -1166,8 +2269,43 @@
 }
 ''');
     var invocation = findNode.methodInvocation('b.a()');
-    assertElement(invocation, findElement.method('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: b
+    staticElement: b@52
+    staticType: B
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::A::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: b
+    staticElement: b@52
+    staticType: B*
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::A::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_method_specificSubtypeMatchLocal() async {
@@ -1188,8 +2326,43 @@
 ''');
 
     var invocation = findNode.methodInvocation('b.a()');
-    assertElement(invocation, findElement.method('a', of: 'B_Ext'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: b
+    staticElement: b@116
+    staticType: B
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::B_Ext::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: b
+    staticElement: b@116
+    staticType: B*
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::B_Ext::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_method_specificSubtypeMatchLocalGenerics() async {
@@ -1213,12 +2386,57 @@
 }
 ''');
     var invocation = findNode.methodInvocation('x.f(o)');
-    assertMember(
-      invocation,
-      findElement.method('f', of: 'B_Ext'),
-      {'T': 'C'},
-    );
-    assertInvokeType(invocation, 'void Function(C)');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: x
+    staticElement: x@160
+    staticType: B<C>
+  operator: .
+  methodName: SimpleIdentifier
+    token: f
+    staticElement: MethodMember
+      base: self::@extension::B_Ext::@method::f
+      substitution: {T: C}
+    staticType: void Function(C)
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      SimpleIdentifier
+        token: o
+        staticElement: o@165
+        staticType: C
+    rightParenthesis: )
+  staticInvokeType: void Function(C)
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: x
+    staticElement: x@160
+    staticType: B<C*>*
+  operator: .
+  methodName: SimpleIdentifier
+    token: f
+    staticElement: MethodMember
+      base: self::@extension::B_Ext::@method::f
+      substitution: {T: C*}
+    staticType: void Function(C*)*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      SimpleIdentifier
+        token: o
+        staticElement: o@165
+        staticType: C*
+    rightParenthesis: )
+  staticInvokeType: void Function(C*)*
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_binary_fromExtendedType() async {
@@ -1234,7 +2452,37 @@
 }
 ''');
     var binary = findNode.binary('+ ');
-    assertElement(binary, findElement.method('+', of: 'C'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: SimpleIdentifier
+    token: c
+    staticElement: c@93
+    staticType: C
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int
+  staticElement: self::@class::C::@method::+
+  staticInvokeType: void Function(int)
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: SimpleIdentifier
+    token: c
+    staticElement: c@93
+    staticType: C*
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int*
+  staticElement: self::@class::C::@method::+
+  staticInvokeType: void Function(int*)*
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_binary_fromExtension_functionType() async {
@@ -1247,7 +2495,37 @@
 }
 ''');
     var binary = findNode.binary('+ ');
-    assertElement(binary, findElement.method('+', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: SimpleIdentifier
+    token: f
+    staticElement: f@85
+    staticType: int Function(int)
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int
+  staticElement: self::@extension::E::@method::+
+  staticInvokeType: void Function(int)
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: SimpleIdentifier
+    token: f
+    staticElement: f@85
+    staticType: int* Function(int*)*
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int*
+  staticElement: self::@extension::E::@method::+
+  staticInvokeType: void Function(int*)*
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_binary_fromExtension_interfaceType() async {
@@ -1261,7 +2539,37 @@
 }
 ''');
     var binary = findNode.binary('+ ');
-    assertElement(binary, findElement.method('+', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: SimpleIdentifier
+    token: c
+    staticElement: c@64
+    staticType: C
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int
+  staticElement: self::@extension::E::@method::+
+  staticInvokeType: void Function(int)
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: SimpleIdentifier
+    token: c
+    staticElement: c@64
+    staticType: C*
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int*
+  staticElement: self::@extension::E::@method::+
+  staticInvokeType: void Function(int*)*
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_binary_undefinedTarget() async {
@@ -1288,7 +2596,37 @@
 }
 ''');
     var index = findNode.index('c[2]');
-    assertElement(index, findElement.method('[]', of: 'C'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: SimpleIdentifier
+    token: c
+    staticElement: c@103
+    staticType: C
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int
+  rightBracket: ]
+  staticElement: self::@class::C::@method::[]
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: SimpleIdentifier
+    token: c
+    staticElement: c@103
+    staticType: C*
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int*
+  rightBracket: ]
+  staticElement: self::@class::C::@method::[]
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_index_fromExtension_functionType() async {
@@ -1301,7 +2639,37 @@
 }
 ''');
     var index = findNode.index('f[2]');
-    assertElement(index, findElement.method('[]', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: SimpleIdentifier
+    token: f
+    staticElement: f@90
+    staticType: int Function(int)
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int
+  rightBracket: ]
+  staticElement: self::@extension::E::@method::[]
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: SimpleIdentifier
+    token: f
+    staticElement: f@90
+    staticType: int* Function(int*)*
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int*
+  rightBracket: ]
+  staticElement: self::@extension::E::@method::[]
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_index_fromExtension_interfaceType() async {
@@ -1315,7 +2683,37 @@
 }
 ''');
     var index = findNode.index('c[2]');
-    assertElement(index, findElement.method('[]', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: SimpleIdentifier
+    token: c
+    staticElement: c@69
+    staticType: C
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int
+  rightBracket: ]
+  staticElement: self::@extension::E::@method::[]
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: SimpleIdentifier
+    token: c
+    staticElement: c@69
+    staticType: C*
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int*
+  rightBracket: ]
+  staticElement: self::@extension::E::@method::[]
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_indexEquals_fromExtendedType() async {
@@ -1530,7 +2928,37 @@
 }
 ''');
     var postfix = findNode.postfix('++');
-    assertElement(postfix, findElement.method('+', of: 'C'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(postfix, r'''
+PostfixExpression
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@99
+    staticType: null
+  operator: ++
+  readElement: c@99
+  readType: C
+  writeElement: c@99
+  writeType: C
+  staticElement: self::@class::C::@method::+
+  staticType: C
+''');
+    } else {
+      assertResolvedNodeText(postfix, r'''
+PostfixExpression
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@99
+    staticType: null
+  operator: ++
+  readElement: c@99
+  readType: C*
+  writeElement: c@99
+  writeType: C*
+  staticElement: self::@class::C::@method::+
+  staticType: C*
+''');
+    }
   }
 
   test_instance_operator_postfix_fromExtension_functionType() async {
@@ -1543,7 +2971,37 @@
 }
 ''');
     var postfix = findNode.postfix('++');
-    assertElement(postfix, findElement.method('+', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(postfix, r'''
+PostfixExpression
+  operand: SimpleIdentifier
+    token: f
+    staticElement: f@104
+    staticType: null
+  operator: ++
+  readElement: f@104
+  readType: int Function(int)
+  writeElement: f@104
+  writeType: int Function(int)
+  staticElement: self::@extension::E::@method::+
+  staticType: int Function(int)
+''');
+    } else {
+      assertResolvedNodeText(postfix, r'''
+PostfixExpression
+  operand: SimpleIdentifier
+    token: f
+    staticElement: f@104
+    staticType: null
+  operator: ++
+  readElement: f@104
+  readType: int* Function(int*)*
+  writeElement: f@104
+  writeType: int* Function(int*)*
+  staticElement: self::@extension::E::@method::+
+  staticType: int* Function(int*)*
+''');
+    }
   }
 
   test_instance_operator_postfix_fromExtension_interfaceType() async {
@@ -1557,7 +3015,37 @@
 }
 ''');
     var postfix = findNode.postfix('++');
-    assertElement(postfix, findElement.method('+', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(postfix, r'''
+PostfixExpression
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@67
+    staticType: null
+  operator: ++
+  readElement: c@67
+  readType: C
+  writeElement: c@67
+  writeType: C
+  staticElement: self::@extension::E::@method::+
+  staticType: C
+''');
+    } else {
+      assertResolvedNodeText(postfix, r'''
+PostfixExpression
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@67
+    staticType: null
+  operator: ++
+  readElement: c@67
+  readType: C*
+  writeElement: c@67
+  writeType: C*
+  staticElement: self::@extension::E::@method::+
+  staticType: C*
+''');
+    }
   }
 
   test_instance_operator_prefix_fromExtendedType() async {
@@ -1573,7 +3061,37 @@
 }
 ''');
     var prefix = findNode.prefix('++');
-    assertElement(prefix, findElement.method('+', of: 'C'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: ++
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@99
+    staticType: null
+  readElement: c@99
+  readType: C
+  writeElement: c@99
+  writeType: C
+  staticElement: self::@class::C::@method::+
+  staticType: C
+''');
+    } else {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: ++
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@99
+    staticType: null
+  readElement: c@99
+  readType: C*
+  writeElement: c@99
+  writeType: C*
+  staticElement: self::@class::C::@method::+
+  staticType: C*
+''');
+    }
   }
 
   test_instance_operator_prefix_fromExtension_functionType() async {
@@ -1586,7 +3104,37 @@
 }
 ''');
     var prefix = findNode.prefix('++');
-    assertElement(prefix, findElement.method('+', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: ++
+  operand: SimpleIdentifier
+    token: f
+    staticElement: f@104
+    staticType: null
+  readElement: f@104
+  readType: int Function(int)
+  writeElement: f@104
+  writeType: int Function(int)
+  staticElement: self::@extension::E::@method::+
+  staticType: int Function(int)
+''');
+    } else {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: ++
+  operand: SimpleIdentifier
+    token: f
+    staticElement: f@104
+    staticType: null
+  readElement: f@104
+  readType: int* Function(int*)*
+  writeElement: f@104
+  writeType: int* Function(int*)*
+  staticElement: self::@extension::E::@method::+
+  staticType: int* Function(int*)*
+''');
+    }
   }
 
   test_instance_operator_prefix_fromExtension_interfaceType() async {
@@ -1600,7 +3148,37 @@
 }
 ''');
     var prefix = findNode.prefix('++');
-    assertElement(prefix, findElement.method('+', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: ++
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@67
+    staticType: null
+  readElement: c@67
+  readType: C
+  writeElement: c@67
+  writeType: C
+  staticElement: self::@extension::E::@method::+
+  staticType: C
+''');
+    } else {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: ++
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@67
+    staticType: null
+  readElement: c@67
+  readType: C*
+  writeElement: c@67
+  writeType: C*
+  staticElement: self::@extension::E::@method::+
+  staticType: C*
+''');
+    }
   }
 
   test_instance_operator_unary_fromExtendedType() async {
@@ -1616,7 +3194,29 @@
 }
 ''');
     var prefix = findNode.prefix('-c');
-    assertElement(prefix, findElement.method('unary-', of: 'C'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@89
+    staticType: C
+  staticElement: self::@class::C::@method::unary-
+  staticType: C
+''');
+    } else {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@89
+    staticType: C*
+  staticElement: self::@class::C::@method::unary-
+  staticType: C*
+''');
+    }
   }
 
   test_instance_operator_unary_fromExtension_functionType() async {
@@ -1629,7 +3229,29 @@
 }
 ''');
     var prefix = findNode.prefix('-f');
-    assertElement(prefix, findElement.method('unary-', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: SimpleIdentifier
+    token: f
+    staticElement: f@80
+    staticType: int Function(int)
+  staticElement: self::@extension::E::@method::unary-
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: SimpleIdentifier
+    token: f
+    staticElement: f@80
+    staticType: int* Function(int*)*
+  staticElement: self::@extension::E::@method::unary-
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_unary_fromExtension_interfaceType() async {
@@ -1643,7 +3265,29 @@
 }
 ''');
     var prefix = findNode.prefix('-c');
-    assertElement(prefix, findElement.method('unary-', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@62
+    staticType: C
+  staticElement: self::@extension::E::@method::unary-
+  staticType: C
+''');
+    } else {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: SimpleIdentifier
+    token: c
+    staticElement: c@62
+    staticType: C*
+  staticElement: self::@extension::E::@method::unary-
+  staticType: C*
+''');
+    }
   }
 
   test_instance_setter_fromExtension_functionType() async {
@@ -1786,9 +3430,38 @@
 }
 g(int Function(int) f) => f.a;
 ''');
-    var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.method('a'));
-    assertType(identifier, 'void Function(int)');
+    var node = findNode.prefixed('a;');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: f
+    staticElement: f@76
+    staticType: int Function(int)
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function(int)
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int)
+''');
+    } else {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: f
+    staticElement: f@76
+    staticType: int* Function(int*)*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function(int*)*
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int*)*
+''');
+    }
   }
 
   test_instance_tearoff_fromExtension_interfaceType() async {
@@ -1801,9 +3474,38 @@
 
 f(C c) => c.a;
 ''');
-    var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.method('a'));
-    assertType(identifier, 'void Function(int)');
+    var node = findNode.prefixed('a;');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: c
+    staticElement: c@57
+    staticType: C
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function(int)
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int)
+''');
+    } else {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: c
+    staticElement: c@57
+    staticType: C*
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function(int*)*
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int*)*
+''');
+    }
   }
 
   test_static_field_importedWithPrefix() async {
@@ -1821,10 +3523,52 @@
   p.E.a;
 }
 ''');
-    var identifier = findNode.simple('a;');
-    var import = findElement.importFind('package:test/lib.dart');
-    assertElement(identifier, import.extension_('E').getGetter('a'));
-    assertType(identifier, 'int');
+    var node = findNode.propertyAccess('p.E.a;');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(node, r'''
+PropertyAccess
+  target: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: p
+      staticElement: self::@prefix::p
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: E
+      staticElement: package:test/lib.dart::@extension::E
+      staticType: null
+    staticElement: package:test/lib.dart::@extension::E
+    staticType: null
+  operator: .
+  propertyName: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib.dart::@extension::E::@getter::a
+    staticType: int
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(node, r'''
+PropertyAccess
+  target: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: p
+      staticElement: self::@prefix::p
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: E
+      staticElement: package:test/lib.dart::@extension::E
+      staticType: null
+    staticElement: package:test/lib.dart::@extension::E
+    staticType: null
+  operator: .
+  propertyName: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib.dart::@extension::E::@getter::a
+    staticType: int*
+  staticType: int*
+''');
+    }
   }
 
   test_static_field_local() async {
@@ -1839,9 +3583,38 @@
   E.a;
 }
 ''');
-    var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.getter('a'));
-    assertType(identifier, 'int');
+    var node = findNode.prefixed('E.a;');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: E
+    staticElement: self::@extension::E
+    staticType: null
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@getter::a
+    staticType: int
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: E
+    staticElement: self::@extension::E
+    staticType: null
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@getter::a
+    staticType: int*
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_static_getter_importedWithPrefix() async {
@@ -1859,10 +3632,52 @@
   p.E.a;
 }
 ''');
-    var identifier = findNode.simple('a;');
-    var import = findElement.importFind('package:test/lib.dart');
-    assertElement(identifier, import.extension_('E').getGetter('a'));
-    assertType(identifier, 'int');
+    var node = findNode.propertyAccess('p.E.a;');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(node, r'''
+PropertyAccess
+  target: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: p
+      staticElement: self::@prefix::p
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: E
+      staticElement: package:test/lib.dart::@extension::E
+      staticType: null
+    staticElement: package:test/lib.dart::@extension::E
+    staticType: null
+  operator: .
+  propertyName: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib.dart::@extension::E::@getter::a
+    staticType: int
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(node, r'''
+PropertyAccess
+  target: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: p
+      staticElement: self::@prefix::p
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: E
+      staticElement: package:test/lib.dart::@extension::E
+      staticType: null
+    staticElement: package:test/lib.dart::@extension::E
+    staticType: null
+  operator: .
+  propertyName: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib.dart::@extension::E::@getter::a
+    staticType: int*
+  staticType: int*
+''');
+    }
   }
 
   test_static_getter_local() async {
@@ -1877,9 +3692,38 @@
   E.a;
 }
 ''');
-    var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.getter('a'));
-    assertType(identifier, 'int');
+    var node = findNode.prefixed('E.a;');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: E
+    staticElement: self::@extension::E
+    staticType: null
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@getter::a
+    staticType: int
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: E
+    staticElement: self::@extension::E
+    staticType: null
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@getter::a
+    staticType: int*
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_static_method_importedWithPrefix() async {
@@ -1898,9 +3742,59 @@
 }
 ''');
     var invocation = findNode.methodInvocation('E.a()');
-    var import = findElement.importFind('package:test/lib.dart');
-    assertElement(invocation, import.extension_('E').getMethod('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: p
+      staticElement: self::@prefix::p
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: E
+      staticElement: package:test/lib.dart::@extension::E
+      staticType: null
+    staticElement: package:test/lib.dart::@extension::E
+    staticType: null
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib.dart::@extension::E::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: p
+      staticElement: self::@prefix::p
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: E
+      staticElement: package:test/lib.dart::@extension::E
+      staticType: null
+    staticElement: package:test/lib.dart::@extension::E
+    staticType: null
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: package:test/lib.dart::@extension::E::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_static_method_local() async {
@@ -1916,8 +3810,43 @@
 }
 ''');
     var invocation = findNode.methodInvocation('E.a()');
-    assertElement(invocation, findElement.method('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: E
+    staticElement: self::@extension::E
+    staticType: null
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: SimpleIdentifier
+    token: E
+    staticElement: self::@extension::E
+    staticType: null
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_static_setter_importedWithPrefix() async {
@@ -2083,9 +4012,38 @@
 
 f() => E.a;
 ''');
-    var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.method('a'));
-    assertType(identifier, 'void Function(int)');
+    var node = findNode.prefixed('E.a;');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: E
+    staticElement: self::@extension::E
+    staticType: null
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function(int)
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int)
+''');
+    } else {
+      assertResolvedNodeText(node, r'''
+PrefixedIdentifier
+  prefix: SimpleIdentifier
+    token: E
+    staticElement: self::@extension::E
+    staticType: null
+  period: .
+  identifier: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function(int*)*
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int*)*
+''');
+    }
   }
 
   test_thisAccessOnDynamic() async {
@@ -2140,8 +4098,41 @@
 }
 ''');
     var invocation = findNode.functionExpressionInvocation('this(2)');
-    assertElement(invocation, findElement.method('call', of: 'E'));
-    assertType(invocation, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: ThisExpression
+    thisKeyword: this
+    staticType: C
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 2
+        staticType: int
+    rightParenthesis: )
+  staticElement: self::@extension::E::@method::call
+  staticInvokeType: int Function(int)
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+FunctionExpressionInvocation
+  function: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 2
+        staticType: int*
+    rightParenthesis: )
+  staticElement: self::@extension::E::@method::call
+  staticInvokeType: int* Function(int*)*
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getter_asSetter() async {
@@ -2211,8 +4202,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.getter('a', of: 'E'));
-    assertType(identifier, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getter_fromThis_fromExtendedType() async {
@@ -2227,7 +4231,33 @@
 }
 ''');
     var access = findNode.propertyAccess('this.a');
-    assertPropertyAccess(access, findElement.getter('a', of: 'C'), 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(access, r'''
+PropertyAccess
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C
+  operator: .
+  propertyName: SimpleIdentifier
+    token: a
+    staticElement: self::@class::C::@getter::a
+    staticType: int
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(access, r'''
+PropertyAccess
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  operator: .
+  propertyName: SimpleIdentifier
+    token: a
+    staticElement: self::@class::C::@getter::a
+    staticType: int*
+  staticType: int*
+''');
+    }
   }
 
   test_instance_getter_fromThis_fromExtension() async {
@@ -2254,8 +4284,33 @@
 }
 ''');
     var invocation = findNode.methodInvocation('a();');
-    assertElement(invocation, findElement.method('a', of: 'E'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_method_fromThis_fromExtendedType() async {
@@ -2269,8 +4324,41 @@
 }
 ''');
     var invocation = findNode.methodInvocation('this.a');
-    assertElement(invocation, findElement.method('a', of: 'C'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@class::C::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@class::C::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_method_fromThis_fromExtension() async {
@@ -2282,8 +4370,41 @@
 }
 ''');
     var invocation = findNode.methodInvocation('this.a');
-    assertElement(invocation, findElement.method('a', of: 'E'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  operator: .
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_binary_fromThis_fromExtendedType() async {
@@ -2297,7 +4418,35 @@
 }
 ''');
     var binary = findNode.binary('+ ');
-    assertElement(binary, findElement.method('+', of: 'C'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: ThisExpression
+    thisKeyword: this
+    staticType: C
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int
+  staticElement: self::@class::C::@method::+
+  staticInvokeType: void Function(int)
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int*
+  staticElement: self::@class::C::@method::+
+  staticInvokeType: void Function(int*)*
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_binary_fromThis_fromExtension() async {
@@ -2309,7 +4458,35 @@
 }
 ''');
     var binary = findNode.binary('+ ');
-    assertElement(binary, findElement.method('+', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: ThisExpression
+    thisKeyword: this
+    staticType: C
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int
+  staticElement: self::@extension::E::@method::+
+  staticInvokeType: void Function(int)
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(binary, r'''
+BinaryExpression
+  leftOperand: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  operator: +
+  rightOperand: IntegerLiteral
+    literal: 2
+    staticType: int*
+  staticElement: self::@extension::E::@method::+
+  staticInvokeType: void Function(int*)*
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_index_fromThis_fromExtendedType() async {
@@ -2323,7 +4500,35 @@
 }
 ''');
     var index = findNode.index('this[2]');
-    assertElement(index, findElement.method('[]', of: 'C'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int
+  rightBracket: ]
+  staticElement: self::@class::C::@method::[]
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int*
+  rightBracket: ]
+  staticElement: self::@class::C::@method::[]
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_index_fromThis_fromExtension() async {
@@ -2335,7 +4540,35 @@
 }
 ''');
     var index = findNode.index('this[2]');
-    assertElement(index, findElement.method('[]', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int
+  rightBracket: ]
+  staticElement: self::@extension::E::@method::[]
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(index, r'''
+IndexExpression
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  leftBracket: [
+  index: IntegerLiteral
+    literal: 2
+    staticType: int*
+  rightBracket: ]
+  staticElement: self::@extension::E::@method::[]
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_indexEquals_fromThis_fromExtendedType() async {
@@ -2475,7 +4708,27 @@
 }
 ''');
     var prefix = findNode.prefix('-this');
-    assertElement(prefix, findElement.method('unary-', of: 'C'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: ThisExpression
+    thisKeyword: this
+    staticType: C
+  staticElement: self::@class::C::@method::unary-
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  staticElement: self::@class::C::@method::unary-
+  staticType: void
+''');
+    }
   }
 
   test_instance_operator_unary_fromThis_fromExtension() async {
@@ -2487,7 +4740,27 @@
 }
 ''');
     var prefix = findNode.prefix('-this');
-    assertElement(prefix, findElement.method('unary-', of: 'E'));
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: ThisExpression
+    thisKeyword: this
+    staticType: C
+  staticElement: self::@extension::E::@method::unary-
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(prefix, r'''
+PrefixExpression
+  operator: -
+  operand: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  staticElement: self::@extension::E::@method::unary-
+  staticType: void
+''');
+    }
   }
 
   test_instance_setter_asGetter() async {
@@ -2505,11 +4778,22 @@
 ''', [
       error(CompileTimeErrorCode.UNDEFINED_IDENTIFIER, 104, 3),
     ]);
-    assertSimpleIdentifier(
-      findNode.simple('foo;'),
-      element: null,
-      type: 'dynamic',
-    );
+    var node = findNode.simple('foo;');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(node, r'''
+SimpleIdentifier
+  token: foo
+  staticElement: <null>
+  staticType: dynamic
+''');
+    } else {
+      assertResolvedNodeText(node, r'''
+SimpleIdentifier
+  token: foo
+  staticElement: <null>
+  staticType: dynamic
+''');
+    }
   }
 
   test_instance_setter_fromInstance() async {
@@ -2703,8 +4987,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.method('a'));
-    assertType(identifier, 'void Function(int)');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int)
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int*)*
+''');
+    }
   }
 
   test_instance_tearoff_fromThis() async {
@@ -2716,9 +5013,34 @@
   get c => this.a;
 }
 ''');
-    var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.method('a'));
-    assertType(identifier, 'void Function(int)');
+    var identifier = findNode.propertyAccess('this.a;');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+PropertyAccess
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C
+  operator: .
+  propertyName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function(int)
+  staticType: void Function(int)
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+PropertyAccess
+  target: ThisExpression
+    thisKeyword: this
+    staticType: C*
+  operator: .
+  propertyName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function(int*)*
+  staticType: void Function(int*)*
+''');
+    }
   }
 
   test_static_field_fromInstance() async {
@@ -2731,8 +5053,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.getter('a'));
-    assertType(identifier, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_static_field_fromStatic() async {
@@ -2745,8 +5080,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.getter('a'));
-    assertType(identifier, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_static_getter_fromInstance() async {
@@ -2759,8 +5107,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.getter('a'));
-    assertType(identifier, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_static_getter_fromStatic() async {
@@ -2773,8 +5134,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.getter('a'));
-    assertType(identifier, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_static_method_fromInstance() async {
@@ -2786,8 +5160,33 @@
 }
 ''');
     var invocation = findNode.methodInvocation('a();');
-    assertElement(invocation, findElement.method('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_static_method_fromStatic() async {
@@ -2799,8 +5198,33 @@
 }
 ''');
     var invocation = findNode.methodInvocation('a();');
-    assertElement(invocation, findElement.method('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@extension::E::@method::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_static_setter_fromInstance() async {
@@ -2915,8 +5339,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.method('a'));
-    assertType(identifier, 'void Function(int)');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int)
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int*)*
+''');
+    }
   }
 
   test_static_tearoff_fromStatic() async {
@@ -2929,8 +5366,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.method('a'));
-    assertType(identifier, 'void Function(int)');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int)
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@extension::E::@method::a
+  staticType: void Function(int*)*
+''');
+    }
   }
 
   test_topLevel_function_fromInstance() async {
@@ -2948,8 +5398,33 @@
 }
 ''');
     var invocation = findNode.methodInvocation('a();');
-    assertElement(invocation, findElement.topFunction('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@function::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@function::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_topLevel_function_fromStatic() async {
@@ -2967,8 +5442,33 @@
 }
 ''');
     var invocation = findNode.methodInvocation('a();');
-    assertElement(invocation, findElement.topFunction('a'));
-    assertInvokeType(invocation, 'void Function()');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@function::a
+    staticType: void Function()
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()
+  staticType: void
+''');
+    } else {
+      assertResolvedNodeText(invocation, r'''
+MethodInvocation
+  methodName: SimpleIdentifier
+    token: a
+    staticElement: self::@function::a
+    staticType: void Function()*
+  argumentList: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  staticInvokeType: void Function()*
+  staticType: void
+''');
+    }
   }
 
   test_topLevel_getter_fromInstance() async {
@@ -2986,8 +5486,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.topGet('a'));
-    assertType(identifier, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_topLevel_getter_fromStatic() async {
@@ -3005,8 +5518,21 @@
 }
 ''');
     var identifier = findNode.simple('a;');
-    assertElement(identifier, findElement.topGet('a'));
-    assertType(identifier, 'int');
+    if (isNullSafetyEnabled) {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@getter::a
+  staticType: int
+''');
+    } else {
+      assertResolvedNodeText(identifier, r'''
+SimpleIdentifier
+  token: a
+  staticElement: self::@getter::a
+  staticType: int*
+''');
+    }
   }
 
   test_topLevel_setter_fromInstance() async {
diff --git a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
index 25ad587..7a787e3 100644
--- a/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/metadata_test.dart
@@ -54,10 +54,15 @@
 ''');
 
     var annotation = findNode.annotation('@foo');
-    assertElement2(
-      annotation,
-      declaration: findElement.topGet('foo'),
-    );
+    assertResolvedNodeText(annotation, r'''
+Annotation
+  atSign: @
+  name: SimpleIdentifier
+    token: foo
+    staticElement: self::@getter::foo
+    staticType: null
+  element: self::@getter::foo
+''');
 
     var annotationElement = annotation.elementAnnotation!;
     _assertElementAnnotationValueText(annotationElement, r'''
@@ -84,10 +89,15 @@
     assertNoErrorsInResult();
 
     var annotation = findNode.annotation('@foo');
-    assertElement2(
-      annotation,
-      declaration: findElement.topGet('foo'),
-    );
+    assertResolvedNodeText(annotation, r'''
+Annotation
+  atSign: @
+  name: SimpleIdentifier
+    token: foo
+    staticElement: package:test/lib.dart::@getter::foo
+    staticType: null
+  element: package:test/lib.dart::@getter::foo
+''');
 
     var annotationElement = annotation.elementAnnotation!;
     _assertElementAnnotationValueText(annotationElement, r'''
@@ -226,16 +236,24 @@
 void f() {}
 ''');
 
-    assertElement2(
-      findNode.simple('A('),
-      declaration: import_a.class_('A'),
-    );
-
-    assertElement2(
-      findNode.annotation('@A'),
-      declaration: import_a.unnamedConstructor('A'),
-      isLegacy: true,
-    );
+    assertResolvedNodeText(findNode.annotation('@A'), r'''
+Annotation
+  atSign: @
+  name: SimpleIdentifier
+    token: A
+    staticElement: package:test/a.dart::@class::A
+    staticType: null
+  arguments: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 0
+        staticType: int*
+    rightParenthesis: )
+  element: ConstructorMember
+    base: package:test/a.dart::@class::A::@constructor::•
+    isLegacy: true
+''');
   }
 
   test_optIn_fromOptOut_class_constructor() async {
@@ -254,16 +272,37 @@
 void f() {}
 ''');
 
-    assertElement2(
-      findNode.simple('A.named('),
-      declaration: import_a.class_('A'),
-    );
-
-    assertElement2(
-      findNode.annotation('@A'),
-      declaration: import_a.constructor('named', of: 'A'),
-      isLegacy: true,
-    );
+    var annotation = findNode.annotation('@A');
+    assertResolvedNodeText(annotation, r'''
+Annotation
+  atSign: @
+  name: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: A
+      staticElement: package:test/a.dart::@class::A
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: named
+      staticElement: ConstructorMember
+        base: package:test/a.dart::@class::A::@constructor::named
+        isLegacy: true
+      staticType: null
+    staticElement: ConstructorMember
+      base: package:test/a.dart::@class::A::@constructor::named
+      isLegacy: true
+    staticType: null
+  arguments: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 42
+        staticType: int*
+    rightParenthesis: )
+  element: ConstructorMember
+    base: package:test/a.dart::@class::A::@constructor::named
+    isLegacy: true
+''');
 
     _assertElementAnnotationValueText(
         findElement.function('f').metadata[0], r'''
@@ -288,16 +327,33 @@
 void f() {}
 ''');
 
-    assertElement2(
-      findNode.simple('A.named('),
-      declaration: import_a.class_('A'),
-    );
-
-    assertElement2(
-      findNode.annotation('@A'),
-      declaration: import_a.constructor('named', of: 'A'),
-      isLegacy: true,
-    );
+    var annotation = findNode.annotation('@A');
+    assertResolvedNodeText(annotation, r'''
+Annotation
+  atSign: @
+  name: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: A
+      staticElement: package:test/a.dart::@class::A
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: named
+      staticElement: ConstructorMember
+        base: package:test/a.dart::@class::A::@constructor::named
+        isLegacy: true
+      staticType: null
+    staticElement: ConstructorMember
+      base: package:test/a.dart::@class::A::@constructor::named
+      isLegacy: true
+    staticType: null
+  arguments: ArgumentList
+    leftParenthesis: (
+    rightParenthesis: )
+  element: ConstructorMember
+    base: package:test/a.dart::@class::A::@constructor::named
+    isLegacy: true
+''');
 
     _assertElementAnnotationValueText(
         findElement.function('f').metadata[0], r'''
@@ -321,16 +377,29 @@
 void f() {}
 ''');
 
-    assertElement2(
-      findNode.simple('A.foo'),
-      declaration: import_a.class_('A'),
-    );
-
-    assertElement2(
-      findNode.annotation('@A.foo'),
-      declaration: import_a.getter('foo'),
-      isLegacy: true,
-    );
+    assertResolvedNodeText(findNode.annotation('@A'), r'''
+Annotation
+  atSign: @
+  name: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: A
+      staticElement: package:test/a.dart::@class::A
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: foo
+      staticElement: PropertyAccessorMember
+        base: package:test/a.dart::@class::A::@getter::foo
+        isLegacy: true
+      staticType: null
+    staticElement: PropertyAccessorMember
+      base: package:test/a.dart::@class::A::@getter::foo
+      isLegacy: true
+    staticType: null
+  element: PropertyAccessorMember
+    base: package:test/a.dart::@class::A::@getter::foo
+    isLegacy: true
+''');
 
     _assertElementAnnotationValueText(
         findElement.function('f').metadata[0], r'''
@@ -351,11 +420,19 @@
 void f() {}
 ''');
 
-    assertElement2(
-      findNode.annotation('@foo'),
-      declaration: import_a.topGet('foo'),
-      isLegacy: true,
-    );
+    assertResolvedNodeText(findNode.annotation('@foo'), r'''
+Annotation
+  atSign: @
+  name: SimpleIdentifier
+    token: foo
+    staticElement: PropertyAccessorMember
+      base: package:test/a.dart::@getter::foo
+      isLegacy: true
+    staticType: null
+  element: PropertyAccessorMember
+    base: package:test/a.dart::@getter::foo
+    isLegacy: true
+''');
 
     _assertElementAnnotationValueText(
         findElement.function('f').metadata[0], r'''
@@ -378,16 +455,32 @@
 void f() {}
 ''');
 
-    assertElement2(
-      findNode.simple('A('),
-      declaration: import_a.class_('A'),
-    );
-
-    assertElement2(
-      findNode.annotation('@a.A'),
-      declaration: import_a.unnamedConstructor('A'),
-      isLegacy: true,
-    );
+    assertResolvedNodeText(findNode.annotation('@a.A'), r'''
+Annotation
+  atSign: @
+  name: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: a
+      staticElement: self::@prefix::a
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: A
+      staticElement: package:test/a.dart::@class::A
+      staticType: null
+    staticElement: package:test/a.dart::@class::A
+    staticType: null
+  arguments: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 0
+        staticType: int*
+    rightParenthesis: )
+  element: ConstructorMember
+    base: package:test/a.dart::@class::A::@constructor::•
+    isLegacy: true
+''');
   }
 
   test_optIn_fromOptOut_prefix_class_constructor() async {
@@ -405,16 +498,39 @@
 void f() {}
 ''');
 
-    assertElement2(
-      findNode.simple('A.named('),
-      declaration: import_a.class_('A'),
-    );
-
-    assertElement2(
-      findNode.annotation('@a.A'),
-      declaration: import_a.constructor('named', of: 'A'),
-      isLegacy: true,
-    );
+    assertResolvedNodeText(findNode.annotation('@a.A'), r'''
+Annotation
+  atSign: @
+  name: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: a
+      staticElement: self::@prefix::a
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: A
+      staticElement: package:test/a.dart::@class::A
+      staticType: null
+    staticElement: package:test/a.dart::@class::A
+    staticType: null
+  period: .
+  constructorName: SimpleIdentifier
+    token: named
+    staticElement: ConstructorMember
+      base: package:test/a.dart::@class::A::@constructor::named
+      isLegacy: true
+    staticType: null
+  arguments: ArgumentList
+    leftParenthesis: (
+    arguments
+      IntegerLiteral
+        literal: 0
+        staticType: int*
+    rightParenthesis: )
+  element: ConstructorMember
+    base: package:test/a.dart::@class::A::@constructor::named
+    isLegacy: true
+''');
   }
 
   test_optIn_fromOptOut_prefix_class_getter() async {
@@ -432,16 +548,32 @@
 void f() {}
 ''');
 
-    assertElement2(
-      findNode.simple('A.foo'),
-      declaration: import_a.class_('A'),
-    );
-
-    assertElement2(
-      findNode.annotation('@a.A'),
-      declaration: import_a.getter('foo'),
-      isLegacy: true,
-    );
+    assertResolvedNodeText(findNode.annotation('@a.A'), r'''
+Annotation
+  atSign: @
+  name: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: a
+      staticElement: self::@prefix::a
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: A
+      staticElement: package:test/a.dart::@class::A
+      staticType: null
+    staticElement: package:test/a.dart::@class::A
+    staticType: null
+  period: .
+  constructorName: SimpleIdentifier
+    token: foo
+    staticElement: PropertyAccessorMember
+      base: package:test/a.dart::@class::A::@getter::foo
+      isLegacy: true
+    staticType: null
+  element: PropertyAccessorMember
+    base: package:test/a.dart::@class::A::@getter::foo
+    isLegacy: true
+''');
   }
 
   test_optIn_fromOptOut_prefix_getter() async {
@@ -457,11 +589,29 @@
 void f() {}
 ''');
 
-    assertElement2(
-      findNode.annotation('@a.foo'),
-      declaration: import_a.topGet('foo'),
-      isLegacy: true,
-    );
+    assertResolvedNodeText(findNode.annotation('@a'), r'''
+Annotation
+  atSign: @
+  name: PrefixedIdentifier
+    prefix: SimpleIdentifier
+      token: a
+      staticElement: self::@prefix::a
+      staticType: null
+    period: .
+    identifier: SimpleIdentifier
+      token: foo
+      staticElement: PropertyAccessorMember
+        base: package:test/a.dart::@getter::foo
+        isLegacy: true
+      staticType: null
+    staticElement: PropertyAccessorMember
+      base: package:test/a.dart::@getter::foo
+      isLegacy: true
+    staticType: null
+  element: PropertyAccessorMember
+    base: package:test/a.dart::@getter::foo
+    isLegacy: true
+''');
   }
 
   test_value_class_inference_namedConstructor() async {
diff --git a/pkg/analyzer/test/src/diagnostics/ffi_leaf_call_must_not_use_handle_test.dart b/pkg/analyzer/test/src/diagnostics/ffi_leaf_call_must_not_use_handle_test.dart
index 55320ad..e3e4c63 100644
--- a/pkg/analyzer/test/src/diagnostics/ffi_leaf_call_must_not_use_handle_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/ffi_leaf_call_must_not_use_handle_test.dart
@@ -46,6 +46,19 @@
     ]);
   }
 
+  test_class_getter() async {
+    await assertErrorsInCode(r'''
+import 'dart:ffi';
+
+class A {
+  @FfiNative<Handle Function()>('foo', isLeaf:true)
+  external Object get foo;
+}
+''', [
+      error(FfiCode.LEAF_CALL_MUST_NOT_RETURN_HANDLE, 32, 76),
+    ]);
+  }
+
   test_LookupFunctionReturnsHandle() async {
     await assertErrorsInCode(r'''
 import 'dart:ffi';
@@ -74,4 +87,15 @@
       error(FfiCode.LEAF_CALL_MUST_NOT_TAKE_HANDLE, 216, 17),
     ]);
   }
+
+  test_unit_getter() async {
+    await assertErrorsInCode(r'''
+import 'dart:ffi';
+
+@FfiNative<Handle Function()>('foo', isLeaf:true)
+external Object get foo;
+''', [
+      error(FfiCode.LEAF_CALL_MUST_NOT_RETURN_HANDLE, 20, 74),
+    ]);
+  }
 }
diff --git a/pkg/analyzer/test/src/diagnostics/ffi_native_test.dart b/pkg/analyzer/test/src/diagnostics/ffi_native_test.dart
index 834d565..9b23e47 100644
--- a/pkg/analyzer/test/src/diagnostics/ffi_native_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/ffi_native_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:analyzer/src/dart/error/ffi_code.dart';
+import 'package:analyzer/src/error/codes.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import '../dart/resolution/context_collection_resolution.dart';
@@ -15,6 +16,28 @@
 
 @reflectiveTest
 class FfiNativeTest extends PubPackageResolutionTest {
+  test_annotation_FfiNative_noArguments() async {
+    await assertErrorsInCode(r'''
+import 'dart:ffi';
+
+@FfiNative
+external int foo();
+''', [
+      error(CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS, 20, 10),
+    ]);
+  }
+
+  test_annotation_FfiNative_noTypeArguments() async {
+    await assertErrorsInCode(r'''
+import 'dart:ffi';
+
+@FfiNative()
+external int foo();
+''', [
+      error(CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS, 30, 2),
+    ]);
+  }
+
   test_FfiNativeCanUseHandles() async {
     await assertErrorsInCode(r'''
 import 'dart:ffi';
diff --git a/pkg/analyzer/test/src/diagnostics/missing_required_param_test.dart b/pkg/analyzer/test/src/diagnostics/missing_required_param_test.dart
index e91a7a3..7ef82a2 100644
--- a/pkg/analyzer/test/src/diagnostics/missing_required_param_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/missing_required_param_test.dart
@@ -17,6 +17,66 @@
 
 @reflectiveTest
 class MissingRequiredParamTest extends PubPackageResolutionTest {
+  test_annotation_noImportPrefix_named() async {
+    await assertErrorsInCode(r'''
+class A {
+  const A.named({required int a});
+}
+
+@A.named()
+void f() {}
+''', [
+      error(CompileTimeErrorCode.MISSING_REQUIRED_ARGUMENT, 51, 5),
+    ]);
+  }
+
+  test_annotation_noImportPrefix_unnamed() async {
+    await assertErrorsInCode(r'''
+class A {
+  const A({required int a});
+}
+
+@A()
+void f() {}
+''', [
+      error(CompileTimeErrorCode.MISSING_REQUIRED_ARGUMENT, 43, 1),
+    ]);
+  }
+
+  test_annotation_withImportPrefix_named() async {
+    newFile('$testPackageLibPath/a.dart', r'''
+class A {
+  const A.named({required int a});
+}
+''');
+
+    await assertErrorsInCode(r'''
+import 'a.dart' as a;
+
+@a.A.named()
+void f() {}
+''', [
+      error(CompileTimeErrorCode.MISSING_REQUIRED_ARGUMENT, 28, 5),
+    ]);
+  }
+
+  test_annotation_withImportPrefix_unnamed() async {
+    newFile('$testPackageLibPath/a.dart', r'''
+class A {
+  const A({required int a});
+}
+''');
+
+    await assertErrorsInCode(r'''
+import 'a.dart' as a;
+
+@a.A()
+void f() {}
+''', [
+      error(CompileTimeErrorCode.MISSING_REQUIRED_ARGUMENT, 26, 1),
+    ]);
+  }
+
   test_constructor_legacy_argumentGiven() async {
     newFile('$testPackageLibPath/a.dart', r'''
 class A {
diff --git a/pkg/compiler/lib/src/common/elements.dart b/pkg/compiler/lib/src/common/elements.dart
index 8872c1a..482fe9a 100644
--- a/pkg/compiler/lib/src/common/elements.dart
+++ b/pkg/compiler/lib/src/common/elements.dart
@@ -375,6 +375,7 @@
   /// The `Type` type defined in 'dart:core'.
   InterfaceType get typeType => _getRawType(typeClass);
 
+  @override
   InterfaceType get typeLiteralType => _getRawType(typeLiteralClass);
 
   /// The `StackTrace` type defined in 'dart:core';
@@ -384,6 +385,7 @@
   /// [elementType] as its type argument.
   ///
   /// If no type argument is provided, the canonical raw type is returned.
+  @override
   InterfaceType listType([DartType elementType]) {
     if (elementType == null) {
       return _getRawType(listClass);
@@ -406,6 +408,7 @@
   /// [keyType] and [valueType] as its type arguments.
   ///
   /// If no type arguments are provided, the canonical raw type is returned.
+  @override
   InterfaceType mapType([DartType keyType, DartType valueType]) {
     if (keyType == null && valueType == null) {
       return _getRawType(mapClass);
@@ -487,11 +490,13 @@
     return _env.createInterfaceType(cls, typeArguments);
   }
 
+  @override
   InterfaceType getConstantListTypeFor(InterfaceType sourceType) =>
       dartTypes.treatAsRawType(sourceType)
           ? _env.getRawType(jsArrayClass)
           : _env.createInterfaceType(jsArrayClass, sourceType.typeArguments);
 
+  @override
   InterfaceType getConstantMapTypeFor(InterfaceType sourceType,
       {bool onlyStringKeys = false}) {
     ClassEntity classElement =
@@ -503,6 +508,7 @@
     }
   }
 
+  @override
   InterfaceType getConstantSetTypeFor(InterfaceType sourceType) =>
       dartTypes.treatAsRawType(sourceType)
           ? _env.getRawType(constSetLiteralClass)
@@ -511,10 +517,12 @@
 
   /// Returns the field that holds the internal name in the implementation class
   /// for `Symbol`.
+  @override
   FieldEntity get symbolField => _symbolImplementationField ??=
       _env.lookupLocalClassMember(symbolImplementationClass, '_name',
           required: true);
 
+  @override
   InterfaceType get symbolImplementationType =>
       _env.getRawType(symbolImplementationClass);
 
diff --git a/pkg/compiler/lib/src/constants/common_elements_for_constants.dart b/pkg/compiler/lib/src/constants/common_elements_for_constants.dart
index 1d07407..7aee2af 100644
--- a/pkg/compiler/lib/src/constants/common_elements_for_constants.dart
+++ b/pkg/compiler/lib/src/constants/common_elements_for_constants.dart
@@ -2,6 +2,7 @@
 // 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.
 
+import '../elements/entities.dart';
 import '../elements/types.dart';
 
 /// This is a facade interface for the members of CommonElements that are
@@ -16,4 +17,15 @@
   DartType get stringType;
 
   DartTypes get dartTypes;
+
+  InterfaceType getConstantListTypeFor(InterfaceType sourceType);
+  InterfaceType getConstantMapTypeFor(InterfaceType sourceType,
+      {bool onlyStringKeys = false});
+  InterfaceType getConstantSetTypeFor(InterfaceType sourceType);
+  InterfaceType listType([DartType? elementType]);
+  InterfaceType mapType([DartType? keyType, DartType? valueType]);
+  InterfaceType get symbolImplementationType;
+  InterfaceType get typeLiteralType;
+
+  FieldEntity get symbolField;
 }
diff --git a/pkg/compiler/lib/src/constants/constant_system.dart b/pkg/compiler/lib/src/constants/constant_system.dart
index 9c68b0d..cca2b93 100644
--- a/pkg/compiler/lib/src/constants/constant_system.dart
+++ b/pkg/compiler/lib/src/constants/constant_system.dart
@@ -2,19 +2,16 @@
 // 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.
 
-// @dart = 2.10
-
 /// Constant system following the semantics for Dart code that has been
 /// compiled to JavaScript.
 library dart2js.constant_system;
 
-import '../common/elements.dart' show CommonElements;
+//import '../common/elements.dart' show CommonElements;
+import 'common_elements_for_constants.dart';
 import '../elements/entities.dart';
 import '../elements/types.dart';
 import 'values.dart';
 
-final _BITS32 = BigInt.from(0xFFFFFFFF);
-
 const add = AddOperation();
 const bitAnd = BitAndOperation();
 const bitNot = BitNotOperation();
@@ -54,21 +51,19 @@
 }
 
 NumConstantValue _convertToJavaScriptConstant(NumConstantValue constant) {
-  if (constant.isInt) {
-    IntConstantValue intConstant = constant;
-    BigInt intValue = intConstant.intValue;
+  if (constant is IntConstantValue) {
+    BigInt intValue = constant.intValue;
     if (_integerBecomesNanOrInfinity(intValue)) {
       return DoubleConstantValue(intValue.toDouble());
     }
     // If the integer loses precision with JavaScript numbers, use
-    // the floored version JavaScript will use.
+    // the floored value JavaScript will use.
     BigInt floorValue = BigInt.from(intValue.toDouble());
     if (floorValue != intValue) {
       return IntConstantValue(floorValue);
     }
-  } else if (constant.isDouble) {
-    DoubleConstantValue doubleResult = constant;
-    double doubleValue = doubleResult.doubleValue;
+  } else if (constant is DoubleConstantValue) {
+    double doubleValue = constant.doubleValue;
     if (!doubleValue.isInfinite &&
         !doubleValue.isNaN &&
         !constant.isMinusZero) {
@@ -83,12 +78,18 @@
 
 NumConstantValue createInt(BigInt i) =>
     _convertToJavaScriptConstant(IntConstantValue(i));
+
 NumConstantValue createIntFromInt(int i) => createInt(BigInt.from(i));
-NumConstantValue _createInt32(BigInt i) => IntConstantValue(i & _BITS32);
+
+NumConstantValue _createInt32(BigInt i) => IntConstantValue(i.toUnsigned(32));
+
 NumConstantValue createDouble(double d) =>
     _convertToJavaScriptConstant(DoubleConstantValue(d));
+
 StringConstantValue createString(String string) => StringConstantValue(string);
+
 BoolConstantValue createBool(bool value) => BoolConstantValue(value);
+
 NullConstantValue createNull() => NullConstantValue();
 
 ListConstantValue createList(CommonElements commonElements,
@@ -190,12 +191,12 @@
 
 abstract class UnaryOperation extends Operation {
   /// Returns [:null:] if it was unable to fold the operation.
-  ConstantValue fold(ConstantValue constant);
+  ConstantValue? fold(ConstantValue constant);
 }
 
 abstract class BinaryOperation extends Operation {
   /// Returns [:null:] if it was unable to fold the operation.
-  ConstantValue fold(ConstantValue left, ConstantValue right);
+  ConstantValue? fold(ConstantValue left, ConstantValue right);
   apply(left, right);
 }
 
@@ -206,15 +207,16 @@
   const BitNotOperation();
 
   @override
-  ConstantValue fold(ConstantValue constant) {
+  ConstantValue? fold(ConstantValue constant) {
     if (isInt(constant)) {
       // In JavaScript we don't check for -0 and treat it as if it was zero.
       if (constant.isMinusZero) {
         constant = createInt(BigInt.zero);
       }
-      IntConstantValue intConstant = constant;
-      // We convert the result of bit-operations to 32 bit unsigned integers.
-      return _createInt32(~intConstant.intValue);
+      if (constant is IntConstantValue) {
+        // Bit-operations yield 32-bit unsigned integers.
+        return _createInt32(~constant.intValue);
+      }
     }
     return null;
   }
@@ -227,22 +229,19 @@
   const NegateOperation();
 
   @override
-  ConstantValue fold(ConstantValue constant) {
-    ConstantValue _fold(ConstantValue constant) {
-      if (constant.isInt) {
-        IntConstantValue intConstant = constant;
-        return createInt(-intConstant.intValue);
+  ConstantValue? fold(ConstantValue constant) {
+    ConstantValue? _fold(ConstantValue constant) {
+      if (constant is IntConstantValue) {
+        return createInt(-constant.intValue);
       }
-      if (constant.isDouble) {
-        DoubleConstantValue doubleConstant = constant;
-        return createDouble(-doubleConstant.doubleValue);
+      if (constant is DoubleConstantValue) {
+        return createDouble(-constant.doubleValue);
       }
       return null;
     }
 
-    if (constant.isInt) {
-      IntConstantValue intConstant = constant;
-      if (intConstant.intValue == BigInt.zero) {
+    if (constant is IntConstantValue) {
+      if (constant.intValue == BigInt.zero) {
         return createDouble(-0.0);
       }
     }
@@ -257,10 +256,9 @@
   const NotOperation();
 
   @override
-  ConstantValue fold(ConstantValue constant) {
-    if (constant.isBool) {
-      BoolConstantValue boolConstant = constant;
-      return createBool(!boolConstant.boolValue);
+  ConstantValue? fold(ConstantValue constant) {
+    if (constant is BoolConstantValue) {
+      return createBool(!constant.boolValue);
     }
     return null;
   }
@@ -271,14 +269,12 @@
   const BinaryBitOperation();
 
   @override
-  ConstantValue fold(ConstantValue left, ConstantValue right) {
-    ConstantValue _fold(ConstantValue left, ConstantValue right) {
-      if (left.isInt && right.isInt) {
-        IntConstantValue leftInt = left;
-        IntConstantValue rightInt = right;
-        BigInt resultValue = foldInts(leftInt.intValue, rightInt.intValue);
+  ConstantValue? fold(ConstantValue left, ConstantValue right) {
+    IntConstantValue? _fold(ConstantValue left, ConstantValue right) {
+      if (left is IntConstantValue && right is IntConstantValue) {
+        BigInt? resultValue = foldInts(left.intValue, right.intValue);
         if (resultValue == null) return null;
-        return createInt(resultValue);
+        return createInt(resultValue) as IntConstantValue;
       }
       return null;
     }
@@ -290,7 +286,7 @@
     if (right.isMinusZero) {
       right = createInt(BigInt.zero);
     }
-    IntConstantValue result = _fold(left, right);
+    IntConstantValue? result = _fold(left, right);
     if (result != null) {
       // We convert the result of bit-operations to 32 bit unsigned integers.
       return _createInt32(result.intValue);
@@ -298,7 +294,7 @@
     return result;
   }
 
-  BigInt foldInts(BigInt left, BigInt right);
+  BigInt? foldInts(BigInt left, BigInt right);
 }
 
 class BitAndOperation extends BinaryBitOperation {
@@ -347,7 +343,7 @@
   const ShiftLeftOperation();
 
   @override
-  BigInt foldInts(BigInt left, BigInt right) {
+  BigInt? foldInts(BigInt left, BigInt right) {
     // TODO(floitsch): find a better way to guard against excessive shifts to
     // the left.
     if (right > BigInt.from(100) || right < BigInt.zero) return null;
@@ -365,35 +361,24 @@
   const ShiftRightOperation();
 
   @override
-  ConstantValue fold(ConstantValue left, ConstantValue right) {
-    // Truncate the input value to 32 bits if necessary.
-    if (left.isInt) {
-      IntConstantValue intConstant = left;
-      BigInt value = intConstant.intValue;
-      BigInt truncatedValue = value & _BITS32;
-      if (value < BigInt.zero) {
-        // Sign-extend if the input was negative. The current semantics don't
-        // make much sense, since we only look at bit 31.
-        // TODO(floitsch): we should treat the input to right shifts as
-        // unsigned.
-
-        // A 32 bit complement-two value x can be computed by:
-        //    x_u - 2^32 (where x_u is its unsigned representation).
-        // Example: 0xFFFFFFFF - 0x100000000 => -1.
-        // We simply and with the sign-bit and multiply by two. If the sign-bit
-        // was set, then the result is 0. Otherwise it will become 2^32.
-        final BigInt SIGN_BIT = BigInt.from(0x80000000);
-        truncatedValue -= BigInt.two * (truncatedValue & SIGN_BIT);
-      }
-      if (value != truncatedValue) {
-        left = createInt(truncatedValue);
+  ConstantValue? fold(ConstantValue left, ConstantValue right) {
+    // Truncate the input value to 32 bits. The web implementation of '>>' is a
+    // signed shift for negative values, and an unsigned for shift for
+    // non-negative values.
+    ConstantValue adjustedLeft = left;
+    if (left is IntConstantValue) {
+      BigInt value = left.intValue;
+      BigInt truncated =
+          value.isNegative ? value.toSigned(32) : value.toUnsigned(32);
+      if (value != truncated) {
+        adjustedLeft = createInt(truncated);
       }
     }
-    return super.fold(left, right);
+    return super.fold(adjustedLeft, right);
   }
 
   @override
-  BigInt foldInts(BigInt left, BigInt right) {
+  BigInt? foldInts(BigInt left, BigInt right) {
     if (right < BigInt.zero) return null;
     return left >> right.toInt();
   }
@@ -409,7 +394,7 @@
   const ShiftRightUnsignedOperation();
 
   @override
-  BigInt foldInts(BigInt left, BigInt right) {
+  BigInt? foldInts(BigInt left, BigInt right) {
     if (right < BigInt.zero) return null;
     return left.toUnsigned(32) >> right.toInt();
   }
@@ -424,11 +409,9 @@
   const BinaryBoolOperation();
 
   @override
-  ConstantValue fold(ConstantValue left, ConstantValue right) {
-    if (left.isBool && right.isBool) {
-      BoolConstantValue leftBool = left;
-      BoolConstantValue rightBool = right;
-      bool resultValue = foldBools(leftBool.boolValue, rightBool.boolValue);
+  ConstantValue? fold(ConstantValue left, ConstantValue right) {
+    if (left is BoolConstantValue && right is BoolConstantValue) {
+      bool resultValue = foldBools(left.boolValue, right.boolValue);
       return createBool(resultValue);
     }
     return null;
@@ -467,22 +450,21 @@
   const ArithmeticNumOperation();
 
   @override
-  ConstantValue fold(ConstantValue left, ConstantValue right) {
-    ConstantValue _fold(ConstantValue left, ConstantValue right) {
-      if (left.isNum && right.isNum) {
-        NumConstantValue leftNum = left;
-        NumConstantValue rightNum = right;
+  ConstantValue? fold(ConstantValue left, ConstantValue right) {
+    NumConstantValue? _fold(ConstantValue left, ConstantValue right) {
+      if (left is NumConstantValue && right is NumConstantValue) {
         var foldedValue;
-        if (left.isInt && right.isInt) {
-          IntConstantValue leftInt = leftNum;
-          IntConstantValue rightInt = rightNum;
-          foldedValue = foldInts(leftInt.intValue, rightInt.intValue);
+        if (left is IntConstantValue && right is IntConstantValue) {
+          foldedValue = foldInts(left.intValue, right.intValue);
         } else {
-          foldedValue = foldNums(leftNum.doubleValue, rightNum.doubleValue);
+          foldedValue = foldNums(left.doubleValue, right.doubleValue);
         }
         // A division by 0 means that we might not have a folded value.
         if (foldedValue == null) return null;
-        if (left.isInt && right.isInt && !isDivide() || isTruncatingDivide()) {
+        if (left is IntConstantValue &&
+                right is IntConstantValue &&
+                !isDivide() ||
+            isTruncatingDivide()) {
           assert(foldedValue is BigInt);
           return createInt(foldedValue);
         } else {
@@ -492,7 +474,7 @@
       return null;
     }
 
-    ConstantValue result = _fold(left, right);
+    NumConstantValue? result = _fold(left, right);
     if (result == null) return result;
     return _convertToJavaScriptConstant(result);
   }
@@ -542,7 +524,7 @@
   const ModuloOperation();
 
   @override
-  BigInt foldInts(BigInt left, BigInt right) {
+  BigInt? foldInts(BigInt left, BigInt right) {
     if (right == BigInt.zero) return null;
     return left % right;
   }
@@ -561,7 +543,7 @@
   const RemainderOperation();
 
   @override
-  BigInt foldInts(BigInt left, BigInt right) {
+  BigInt? foldInts(BigInt left, BigInt right) {
     if (right == BigInt.zero) return null;
     return left.remainder(right);
   }
@@ -580,13 +562,13 @@
   const TruncatingDivideOperation();
 
   @override
-  BigInt foldInts(BigInt left, BigInt right) {
+  BigInt? foldInts(BigInt left, BigInt right) {
     if (right == BigInt.zero) return null;
     return left ~/ right;
   }
 
   @override
-  BigInt foldNums(num left, num right) {
+  BigInt? foldNums(num left, num right) {
     num ratio = left / right;
     if (ratio.isNaN || ratio.isInfinite) return null;
     return BigInt.from(ratio.truncateToDouble());
@@ -625,30 +607,24 @@
   const AddOperation();
 
   @override
-  ConstantValue fold(ConstantValue left, ConstantValue right) {
-    ConstantValue _fold(ConstantValue left, ConstantValue right) {
-      if (left.isInt && right.isInt) {
-        IntConstantValue leftInt = left;
-        IntConstantValue rightInt = right;
-        BigInt result = leftInt.intValue + rightInt.intValue;
+  ConstantValue? fold(ConstantValue left, ConstantValue right) {
+    ConstantValue? _fold(ConstantValue left, ConstantValue right) {
+      if (left is IntConstantValue && right is IntConstantValue) {
+        BigInt result = left.intValue + right.intValue;
         return createInt(result);
-      } else if (left.isNum && right.isNum) {
-        NumConstantValue leftNum = left;
-        NumConstantValue rightNum = right;
-        double result = leftNum.doubleValue + rightNum.doubleValue;
+      } else if (left is NumConstantValue && right is NumConstantValue) {
+        double result = left.doubleValue + right.doubleValue;
         return createDouble(result);
-      } else if (left.isString && right.isString) {
-        StringConstantValue leftString = left;
-        StringConstantValue rightString = right;
-        String result = leftString.stringValue + rightString.stringValue;
+      } else if (left is StringConstantValue && right is StringConstantValue) {
+        String result = left.stringValue + right.stringValue;
         return createString(result);
       } else {
         return null;
       }
     }
 
-    ConstantValue result = _fold(left, right);
-    if (result != null && result.isNum) {
+    ConstantValue? result = _fold(left, right);
+    if (result is NumConstantValue) {
       return _convertToJavaScriptConstant(result);
     }
     return result;
@@ -662,20 +638,18 @@
   const RelationalNumOperation();
 
   @override
-  ConstantValue fold(ConstantValue left, ConstantValue right) {
-    if (!left.isNum || !right.isNum) return null;
-    bool foldedValue;
-    if (left.isInt && right.isInt) {
-      IntConstantValue leftInt = left;
-      IntConstantValue rightInt = right;
-      foldedValue = foldInts(leftInt.intValue, rightInt.intValue);
-    } else {
-      NumConstantValue leftNum = left;
-      NumConstantValue rightNum = right;
-      foldedValue = foldNums(leftNum.doubleValue, rightNum.doubleValue);
+  ConstantValue? fold(ConstantValue left, ConstantValue right) {
+    if (left is NumConstantValue && right is NumConstantValue) {
+      bool foldedValue;
+      if (left is IntConstantValue && right is IntConstantValue) {
+        foldedValue = foldInts(left.intValue, right.intValue);
+      } else {
+        foldedValue = foldNums(left.doubleValue, right.doubleValue);
+      }
+      assert((foldedValue as dynamic) != null);
+      return createBool(foldedValue);
     }
-    assert(foldedValue != null);
-    return createBool(foldedValue);
+    return null;
   }
 
   bool foldInts(BigInt left, BigInt right);
@@ -753,20 +727,16 @@
   const EqualsOperation();
 
   @override
-  ConstantValue fold(ConstantValue left, ConstantValue right) {
+  ConstantValue? fold(ConstantValue left, ConstantValue right) {
     // Numbers need to be treated specially because: NaN != NaN, -0.0 == 0.0,
     // and 1 == 1.0.
-    if (left.isInt && right.isInt) {
-      IntConstantValue leftInt = left;
-      IntConstantValue rightInt = right;
-      bool result = leftInt.intValue == rightInt.intValue;
+    if (left is IntConstantValue && right is IntConstantValue) {
+      bool result = left.intValue == right.intValue;
       return createBool(result);
     }
 
-    if (left.isNum && right.isNum) {
-      NumConstantValue leftNum = left;
-      NumConstantValue rightNum = right;
-      bool result = leftNum.doubleValue == rightNum.doubleValue;
+    if (left is NumConstantValue && right is NumConstantValue) {
+      bool result = left.doubleValue == right.doubleValue;
       return createBool(result);
     }
 
@@ -794,31 +764,24 @@
 
   @override
   BoolConstantValue fold(ConstantValue left, ConstantValue right) {
-    BoolConstantValue _fold(ConstantValue left, ConstantValue right) {
-      // In order to preserve runtime semantics which says that NaN !== NaN
-      // don't constant fold NaN === NaN. Otherwise the output depends on
-      // inlined variables and other optimizations.
-      if (left.isNaN && right.isNaN) return FalseConstantValue();
-      return createBool(left == right);
-    }
+    // NaNs are not identical to anything. This is a web platform departure from
+    // standard Dart. If we make `identical(double.nan, double.nan)` be `true`,
+    // this constant folding will be incorrect. TODOs below for cross-reference.
+    // TODO(11551): Keep constant-folding consistent with `identical`.
+    // TODO(42224): Keep constant-folding consistent with `identical`.
+    if (left.isNaN || right.isNaN) return FalseConstantValue();
 
-    BoolConstantValue result = _fold(left, right);
-    if (result == null || result.boolValue) return result;
     // In JavaScript -0.0 === 0 and all doubles are equal to their integer
-    // values. Furthermore NaN !== NaN.
-    if (left.isInt && right.isInt) {
-      IntConstantValue leftInt = left;
-      IntConstantValue rightInt = right;
-      return BoolConstantValue(leftInt.intValue == rightInt.intValue);
+    // values.
+    if (left is IntConstantValue && right is IntConstantValue) {
+      return createBool(left.intValue == right.intValue);
     }
-    if (left.isNum && right.isNum) {
-      NumConstantValue leftNum = left;
-      NumConstantValue rightNum = right;
-      double leftDouble = leftNum.doubleValue;
-      double rightDouble = rightNum.doubleValue;
-      return BoolConstantValue(leftDouble == rightDouble);
+    if (left is NumConstantValue && right is NumConstantValue) {
+      return createBool(left.doubleValue == right.doubleValue);
     }
-    return result;
+    // For the remaining constants, if they are the same constant, they are
+    // identical, otherwise not.
+    return createBool(left == right);
   }
 
   @override
@@ -848,12 +811,10 @@
   const CodeUnitAtOperation();
 
   @override
-  IntConstantValue fold(ConstantValue left, ConstantValue right) {
-    if (left.isString && right.isInt) {
-      StringConstantValue stringConstant = left;
-      IntConstantValue indexConstant = right;
-      String string = stringConstant.stringValue;
-      int index = indexConstant.intValue.toInt();
+  ConstantValue? fold(ConstantValue left, ConstantValue right) {
+    if (left is StringConstantValue && right is IntConstantValue) {
+      String string = left.stringValue;
+      int index = right.intValue.toInt();
       if (index < 0 || index >= string.length) return null;
       int value = string.codeUnitAt(index);
       return createIntFromInt(value);
@@ -872,10 +833,10 @@
   const RoundOperation();
 
   @override
-  ConstantValue fold(ConstantValue constant) {
+  ConstantValue? fold(ConstantValue constant) {
     // Be careful to round() only values that do not throw on either the host or
     // target platform.
-    ConstantValue tryToRound(double value) {
+    ConstantValue? tryToRound(double value) {
       // Due to differences between browsers, only 'round' easy cases. Avoid
       // cases where nudging the value up or down changes the answer.
       // 13 digits is safely within the ~15 digit precision of doubles.
@@ -889,16 +850,14 @@
           IntConstantValue(BigInt.from(value.round())));
     }
 
-    if (constant.isInt) {
-      IntConstantValue intConstant = constant;
-      double value = intConstant.intValue.toDouble();
+    if (constant is IntConstantValue) {
+      double value = constant.intValue.toDouble();
       if (value >= -double.maxFinite && value <= double.maxFinite) {
         return tryToRound(value);
       }
     }
-    if (constant.isDouble) {
-      DoubleConstantValue doubleConstant = constant;
-      double value = doubleConstant.doubleValue;
+    if (constant is DoubleConstantValue) {
+      double value = constant.doubleValue;
       // NaN and infinities will throw.
       if (value.isNaN) return null;
       if (value.isInfinite) return null;
@@ -915,7 +874,7 @@
   const ToIntOperation();
 
   @override
-  ConstantValue fold(ConstantValue constant) {
+  ConstantValue? fold(ConstantValue constant) {
     if (constant is IntConstantValue) {
       double value = constant.doubleValue;
       // The code below is written to work for any `double`, even though
@@ -941,7 +900,7 @@
   const _IndexOperation();
 
   @override
-  ConstantValue fold(ConstantValue left, ConstantValue right) {
+  ConstantValue? fold(ConstantValue left, ConstantValue right) {
     if (left is ListConstantValue) {
       if (right is IntConstantValue) {
         List<ConstantValue> entries = left.entries;
@@ -954,7 +913,7 @@
       }
     }
     if (left is MapConstantValue) {
-      ConstantValue value = left.lookup(right);
+      ConstantValue? value = left.lookup(right);
       if (value != null) return value;
       return const NullConstantValue();
     }
@@ -973,7 +932,7 @@
   const UnfoldedUnaryOperation(this.name);
 
   @override
-  ConstantValue fold(ConstantValue constant) {
+  ConstantValue? fold(ConstantValue constant) {
     return null;
   }
 }
diff --git a/pkg/compiler/lib/src/constants/values.dart b/pkg/compiler/lib/src/constants/values.dart
index e6d286a..f2b364a 100644
--- a/pkg/compiler/lib/src/constants/values.dart
+++ b/pkg/compiler/lib/src/constants/values.dart
@@ -74,6 +74,7 @@
   /// `true` if this is a valid constant value.
   bool get isConstant => true;
 
+  // TODO(48974): Clean up all these predicate getters.
   bool get isNull => false;
   bool get isBool => false;
   bool get isTrue => false;
diff --git a/sdk/lib/async/async_error.dart b/sdk/lib/async/async_error.dart
index 2340a41..cc8ac20 100644
--- a/sdk/lib/async/async_error.dart
+++ b/sdk/lib/async/async_error.dart
@@ -31,17 +31,3 @@
 
   String toString() => '$error';
 }
-
-// Helper function used by stream method implementations.
-_invokeErrorHandler(
-    Function errorHandler, Object error, StackTrace stackTrace) {
-  var handler = errorHandler; // Rename to avoid promotion.
-  if (handler is ZoneBinaryCallback<dynamic, Never, Never>) {
-    // Dynamic invocation because we don't know the actual type of the
-    // first argument or the error object, but we should successfully call
-    // the handler if they match up.
-    return errorHandler(error, stackTrace);
-  } else {
-    return errorHandler(error);
-  }
-}
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 509faf2..7d1e4b1 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -870,15 +870,21 @@
   /// // 4
   /// ```
   Stream<T> handleError(Function onError, {bool test(error)?}) {
-    if (onError is! void Function(Object, StackTrace) &&
-        onError is! void Function(Object)) {
+    final void Function(Object, StackTrace) callback;
+    if (onError is void Function(Object, StackTrace)) {
+      callback = onError;
+    } else if (onError is void Function(Object)) {
+      callback = (Object error, StackTrace _) {
+        onError(error);
+      };
+    } else {
       throw ArgumentError.value(
           onError,
           "onError",
           "Error handler must accept one Object or one Object and a StackTrace"
               " as arguments.");
     }
-    return new _HandleErrorStream<T>(this, onError, test);
+    return new _HandleErrorStream<T>(this, callback, test);
   }
 
   /// Transforms each element of this stream into a sequence of elements.
diff --git a/sdk/lib/async/stream_pipe.dart b/sdk/lib/async/stream_pipe.dart
index 4533043..cd707be 100644
--- a/sdk/lib/async/stream_pipe.dart
+++ b/sdk/lib/async/stream_pipe.dart
@@ -243,7 +243,7 @@
 /// A stream pipe that converts or disposes error events
 /// before passing them on.
 class _HandleErrorStream<T> extends _ForwardingStream<T, T> {
-  final Function _onError;
+  final void Function(Object, StackTrace) _onError;
   final bool Function(Object)? _test;
 
   _HandleErrorStream(Stream<T> source, this._onError, this._test)
@@ -266,7 +266,7 @@
     }
     if (matches) {
       try {
-        _invokeErrorHandler(_onError, error, stackTrace);
+        _onError(error, stackTrace);
       } catch (e, s) {
         if (identical(e, error)) {
           sink._addError(error, stackTrace);
diff --git a/sdk/lib/internal/cast.dart b/sdk/lib/internal/cast.dart
index e3e0dae..5bd1f44 100644
--- a/sdk/lib/internal/cast.dart
+++ b/sdk/lib/internal/cast.dart
@@ -186,8 +186,6 @@
 
   CastSet(this._source, this._emptySet);
 
-  static Set<R> _defaultEmptySet<R>() => new Set<R>();
-
   Set<R> cast<R>() => new CastSet<S, R>(_source, _emptySet);
   bool add(T value) => _source.add(value as S);
 
diff --git a/tools/VERSION b/tools/VERSION
index 8377cf9..a24d4e0 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 18
 PATCH 0
-PRERELEASE 94
+PRERELEASE 95
 PRERELEASE_PATCH 0
\ No newline at end of file