Version 2.17.0-249.0.dev
Merge commit '4247bcbbdc58884776c9cdde15d7a052d6350a69' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index acdb3ff..3c521f6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -114,8 +114,9 @@
#### Linter
-Updated the Linter to `1.21.2`, which includes changes that
+Updated the Linter to `1.22.0`, which includes changes that
+- fixes null-safe variance exceptions in `invariant_booleans`
- updates `depend_on_referenced_packages` to treat `flutter_gen` as a virtual
package, not needing an explicit dependency.
- updates `unnecessary_null_checks` and
diff --git a/DEPS b/DEPS
index 98aeeab..7447d02 100644
--- a/DEPS
+++ b/DEPS
@@ -39,14 +39,14 @@
# Checked-in SDK version. The checked-in SDK is a Dart SDK distribution in a
# cipd package used to run Dart scripts in the build and test infrastructure.
- "sdk_tag": "version:2.15.1",
+ "sdk_tag": "version:2.16.2",
# co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
# hashes. It requires access to the dart-build-access group, which EngProd
# has.
- "co19_rev": "74ba459aecc908d5db91531f020a3f74e9aa1b4d",
+ "co19_rev": "7baaec7cf49188b92ceed2af98beb1caf8939756",
# This line prevents conflicts when both packages are rolled simultaneously.
- "co19_2_rev": "995745937abffe9fc3a6441f9f0db27b2d706e4c",
+ "co19_2_rev": "b2034a17609472e374623f3dbe0efd9f5cb258af",
# The internal benchmarks to use. See go/dart-benchmarks-internal
"benchmarks_internal_rev": "076df10d9b77af337f2d8029725787155eb1cd52",
@@ -77,7 +77,7 @@
# Revisions of /third_party/* dependencies.
"args_rev": "3b3f55766af13d895d2020ec001a28e8dc147f91",
- "async_rev": "80886150a5e6c58006c8ae5a6c2aa7108638e2a9",
+ "async_rev": "b18c73e981ca5f533fdc19a5b5c9db0aaf21eccf",
"bazel_worker_rev": "ceeba0982d4ff40d32371c9d35f3d2dc1868de20",
"benchmark_harness_rev": "c546dbd9f639f75cd2f75de8df2eb9f8ea15e8e7",
"boolean_selector_rev": "437e7f06c7e416bed91e16ae1df453555897e945",
@@ -124,7 +124,7 @@
"intl_tag": "9669926609e7efc17dfd74fbb44ec719a7e573cc", # 0.17.0-nullsafety
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"json_rpc_2_rev": "7e00f893440a72de0637970325e4ea44bd1e8c8e",
- "linter_tag": "582986b8b029f6730a5591621ce05eab39e56f4c", # 1.21.2
+ "linter_tag": "14c916a16e78315e212cf79e7ccf4c19159a1bda", # 1.22.0
"lints_tag": "8294e5648ab49474541527e2911e72e4c5aefe55", #2.0.0
"logging_rev": "dfbe88b890c3b4f7bc06da5a7b3b43e9e263b688",
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index c1b807a..e65f669 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -2161,6 +2161,7 @@
+
<h3>Requests</h3><dl><dt class="request"><a name="request_edit.format">edit.format</a></dt><dd><div class="box"><pre>request: {
"id": String
"method": "edit.format"
diff --git a/pkg/analysis_server/lib/protocol/protocol_constants.dart b/pkg/analysis_server/lib/protocol/protocol_constants.dart
index e8a4e7e..0a14c4f 100644
--- a/pkg/analysis_server/lib/protocol/protocol_constants.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_constants.dart
@@ -194,6 +194,8 @@
const String EDIT_REQUEST_BULK_FIXES_IN_TEST_MODE = 'inTestMode';
const String EDIT_REQUEST_FORMAT = 'edit.format';
const String EDIT_REQUEST_FORMAT_FILE = 'file';
+const String EDIT_REQUEST_FORMAT_IF_ENABLED = 'edit.formatIfEnabled';
+const String EDIT_REQUEST_FORMAT_IF_ENABLED_DIRECTORIES = 'directories';
const String EDIT_REQUEST_FORMAT_LINE_LENGTH = 'lineLength';
const String EDIT_REQUEST_FORMAT_SELECTION_LENGTH = 'selectionLength';
const String EDIT_REQUEST_FORMAT_SELECTION_OFFSET = 'selectionOffset';
@@ -242,6 +244,7 @@
const String EDIT_RESPONSE_BULK_FIXES_DETAILS = 'details';
const String EDIT_RESPONSE_BULK_FIXES_EDITS = 'edits';
const String EDIT_RESPONSE_FORMAT_EDITS = 'edits';
+const String EDIT_RESPONSE_FORMAT_IF_ENABLED_EDITS = 'edits';
const String EDIT_RESPONSE_FORMAT_SELECTION_LENGTH = 'selectionLength';
const String EDIT_RESPONSE_FORMAT_SELECTION_OFFSET = 'selectionOffset';
const String EDIT_RESPONSE_GET_ASSISTS_ASSISTS = 'assists';
diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart
index dc2c12a..37339ee 100644
--- a/pkg/analysis_server/lib/protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart
@@ -6258,6 +6258,140 @@
);
}
+/// edit.formatIfEnabled params
+///
+/// {
+/// "directories": List<FilePath>
+/// }
+///
+/// Clients may not extend, implement or mix-in this class.
+class EditFormatIfEnabledParams implements RequestParams {
+ /// The paths of the directories containing the code to be formatted.
+ List<String> directories;
+
+ EditFormatIfEnabledParams(this.directories);
+
+ factory EditFormatIfEnabledParams.fromJson(
+ JsonDecoder jsonDecoder, String jsonPath, Object? json) {
+ json ??= {};
+ if (json is Map) {
+ List<String> directories;
+ if (json.containsKey('directories')) {
+ directories = jsonDecoder.decodeList(jsonPath + '.directories',
+ json['directories'], jsonDecoder.decodeString);
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, 'directories');
+ }
+ return EditFormatIfEnabledParams(directories);
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, 'edit.formatIfEnabled params', json);
+ }
+ }
+
+ factory EditFormatIfEnabledParams.fromRequest(Request request) {
+ return EditFormatIfEnabledParams.fromJson(
+ RequestDecoder(request), 'params', request.params);
+ }
+
+ @override
+ Map<String, Object> toJson() {
+ var result = <String, Object>{};
+ result['directories'] = directories;
+ return result;
+ }
+
+ @override
+ Request toRequest(String id) {
+ return Request(id, 'edit.formatIfEnabled', toJson());
+ }
+
+ @override
+ String toString() => json.encode(toJson());
+
+ @override
+ bool operator ==(other) {
+ if (other is EditFormatIfEnabledParams) {
+ return listEqual(
+ directories, other.directories, (String a, String b) => a == b);
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => directories.hashCode;
+}
+
+/// edit.formatIfEnabled result
+///
+/// {
+/// "edits": List<SourceFileEdit>
+/// }
+///
+/// Clients may not extend, implement or mix-in this class.
+class EditFormatIfEnabledResult implements ResponseResult {
+ /// The edit(s) to be applied in order to format the code. The list will be
+ /// empty if none of the files were formatted, whether because they were not
+ /// eligible to be formatted or because they were already formatted.
+ List<SourceFileEdit> edits;
+
+ EditFormatIfEnabledResult(this.edits);
+
+ factory EditFormatIfEnabledResult.fromJson(
+ JsonDecoder jsonDecoder, String jsonPath, Object? json) {
+ json ??= {};
+ if (json is Map) {
+ List<SourceFileEdit> edits;
+ if (json.containsKey('edits')) {
+ edits = jsonDecoder.decodeList(
+ jsonPath + '.edits',
+ json['edits'],
+ (String jsonPath, Object? json) =>
+ SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, 'edits');
+ }
+ return EditFormatIfEnabledResult(edits);
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, 'edit.formatIfEnabled result', json);
+ }
+ }
+
+ factory EditFormatIfEnabledResult.fromResponse(Response response) {
+ return EditFormatIfEnabledResult.fromJson(
+ ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
+ 'result',
+ response.result);
+ }
+
+ @override
+ Map<String, Object> toJson() {
+ var result = <String, Object>{};
+ result['edits'] =
+ edits.map((SourceFileEdit value) => value.toJson()).toList();
+ return result;
+ }
+
+ @override
+ Response toResponse(String id) {
+ return Response(id, result: toJson());
+ }
+
+ @override
+ String toString() => json.encode(toJson());
+
+ @override
+ bool operator ==(other) {
+ if (other is EditFormatIfEnabledResult) {
+ return listEqual(
+ edits, other.edits, (SourceFileEdit a, SourceFileEdit b) => a == b);
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => edits.hashCode;
+}
+
/// edit.format params
///
/// {
diff --git a/pkg/analysis_server/lib/src/cider/document_symbols.dart b/pkg/analysis_server/lib/src/cider/document_symbols.dart
index 48aec9f..f8c77758 100644
--- a/pkg/analysis_server/lib/src/cider/document_symbols.dart
+++ b/pkg/analysis_server/lib/src/cider/document_symbols.dart
@@ -15,10 +15,9 @@
CiderDocumentSymbolsComputer(this._fileResolver);
- @Deprecated('Use compute2() instead')
- List<DocumentSymbol> compute(String filePath) {
+ Future<List<DocumentSymbol>> compute2(String filePath) async {
var result = <DocumentSymbol>[];
- var resolvedUnit = _fileResolver.resolve(path: filePath);
+ var resolvedUnit = await _fileResolver.resolve2(path: filePath);
final computer = DartUnitOutlineComputer(resolvedUnit);
final outline = computer.compute();
@@ -36,11 +35,6 @@
return result;
}
- Future<List<DocumentSymbol>> compute2(String filePath) async {
- // ignore: deprecated_member_use_from_same_package
- return compute(filePath);
- }
-
DocumentSymbol _asDocumentSymbol(
Set<SymbolKind> supportedKinds,
LineInfo lineInfo,
diff --git a/pkg/analysis_server/lib/src/cider/rename.dart b/pkg/analysis_server/lib/src/cider/rename.dart
index dd17833..34e97b2 100644
--- a/pkg/analysis_server/lib/src/cider/rename.dart
+++ b/pkg/analysis_server/lib/src/cider/rename.dart
@@ -81,8 +81,7 @@
String get oldName => canRename.refactoringElement.element.displayName;
- @Deprecated('Use computeRenameRanges2() instead')
- RenameResponse? computeRenameRanges() {
+ Future<RenameResponse?> computeRenameRanges2() async {
var elements = <Element>[];
var element = canRename.refactoringElement.element;
if (element is PropertyInducingElement && element.isSynthetic) {
@@ -94,23 +93,19 @@
} else {
elements.add(element);
}
+ var fileResolver = canRename._fileResolver;
var matches = <CiderSearchMatch>[];
for (var element in elements) {
- matches.addAll(canRename._fileResolver.findReferences(element));
+ matches.addAll(await fileResolver.findReferences2(element));
}
FlutterWidgetRename? flutterRename;
if (canRename._flutterWidgetState != null) {
var stateWidget = canRename._flutterWidgetState!;
- var match = canRename._fileResolver.findReferences(stateWidget.state);
+ var match = await fileResolver.findReferences2(stateWidget.state);
flutterRename = FlutterWidgetRename(stateWidget.newName, match);
}
return RenameResponse(matches, this, flutterWidgetRename: flutterRename);
}
-
- Future<RenameResponse?> computeRenameRanges2() async {
- // ignore: deprecated_member_use_from_same_package
- return computeRenameRanges();
- }
}
class CiderRenameComputer {
@@ -120,9 +115,9 @@
/// Check if the identifier at the [line], [column] for the file at the
/// [filePath] can be renamed.
- @Deprecated('Use canRename2() instead')
- CanRenameResponse? canRename(String filePath, int line, int column) {
- var resolvedUnit = _fileResolver.resolve(path: filePath);
+ Future<CanRenameResponse?> canRename2(
+ String filePath, int line, int column) async {
+ var resolvedUnit = await _fileResolver.resolve2(path: filePath);
var lineInfo = resolvedUnit.lineInfo;
var offset = lineInfo.getOffsetOfLine(line) + column;
@@ -151,14 +146,6 @@
return null;
}
- /// Check if the identifier at the [line], [column] for the file at the
- /// [filePath] can be renamed.
- Future<CanRenameResponse?> canRename2(
- String filePath, int line, int column) async {
- // ignore: deprecated_member_use_from_same_package
- return canRename(filePath, line, column);
- }
-
bool _canRenameElement(Element element) {
var enclosingElement = element.enclosingElement;
if (element is ConstructorElement) {
diff --git a/pkg/analysis_server/lib/src/cider/signature_help.dart b/pkg/analysis_server/lib/src/cider/signature_help.dart
index 4bf5e60..107060e 100644
--- a/pkg/analysis_server/lib/src/cider/signature_help.dart
+++ b/pkg/analysis_server/lib/src/cider/signature_help.dart
@@ -15,9 +15,9 @@
CiderSignatureHelpComputer(this._fileResolver);
- @Deprecated('Use compute2() instead')
- SignatureHelpResponse? compute(String filePath, int line, int column) {
- var resolvedUnit = _fileResolver.resolve(path: filePath);
+ Future<SignatureHelpResponse?> compute2(
+ String filePath, int line, int column) async {
+ var resolvedUnit = await _fileResolver.resolve2(path: filePath);
var lineInfo = resolvedUnit.lineInfo;
var offset = lineInfo.getOffsetOfLine(line) + column;
final formats = <MarkupKind>{MarkupKind.Markdown};
@@ -45,12 +45,6 @@
}
return null;
}
-
- Future<SignatureHelpResponse?> compute2(
- String filePath, int line, int column) async {
- // ignore: deprecated_member_use_from_same_package
- return compute(filePath, line, column);
- }
}
class SignatureHelpResponse {
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
index 303ffc6..299f79a 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
@@ -681,6 +681,7 @@
node.externalKeyword, HighlightRegionType.BUILT_IN);
computer._addRegion_token(
node.factoryKeyword, HighlightRegionType.BUILT_IN);
+ computer._addRegion_token(node.constKeyword, HighlightRegionType.KEYWORD);
super.visitConstructorDeclaration(node);
}
diff --git a/pkg/analysis_server/lib/src/domain_analysis.dart b/pkg/analysis_server/lib/src/domain_analysis.dart
index 128de8d..6874ce4 100644
--- a/pkg/analysis_server/lib/src/domain_analysis.dart
+++ b/pkg/analysis_server/lib/src/domain_analysis.dart
@@ -12,8 +12,9 @@
import 'package:analysis_server/src/handler/legacy/analysis_get_signature.dart';
import 'package:analysis_server/src/handler/legacy/analysis_reanalyze.dart';
import 'package:analysis_server/src/handler/legacy/analysis_set_analysis_roots.dart';
+import 'package:analysis_server/src/handler/legacy/analysis_set_subscriptions.dart';
+import 'package:analysis_server/src/handler/legacy/unsupported_request.dart';
import 'package:analysis_server/src/plugin/request_converter.dart';
-import 'package:analysis_server/src/protocol/protocol_internal.dart';
import 'package:analysis_server/src/protocol_server.dart';
import 'package:analysis_server/src/utilities/progress.dart';
import 'package:analyzer/src/generated/engine.dart' as engine;
@@ -25,43 +26,6 @@
/// [server].
AnalysisDomainHandler(AnalysisServer server) : super(server);
- /// Implement the `analysis.getLibraryDependencies` request.
- Response getLibraryDependencies(Request request) {
- return Response.unsupportedFeature(request.id,
- 'Please contact the Dart analyzer team if you need this request.');
-// server.onAnalysisComplete.then((_) {
-// LibraryDependencyCollector collector =
-// new LibraryDependencyCollector(server.analysisContexts);
-// Set<String> libraries = collector.collectLibraryDependencies();
-// Map<String, Map<String, List<String>>> packageMap =
-// collector.calculatePackageMap(server.folderMap);
-// server.sendResponse(new AnalysisGetLibraryDependenciesResult(
-// libraries.toList(growable: false), packageMap)
-// .toResponse(request.id));
-// }).catchError((error, st) {
-// server.sendResponse(new Response.serverError(request, error, st));
-// });
-// // delay response
-// return Response.DELAYED_RESPONSE;
- }
-
- /// Implement the `analysis.getReachableSources` request.
- Response getReachableSources(Request request) {
- return Response.unsupportedFeature(request.id,
- 'Please contact the Dart analyzer team if you need this request.');
-// AnalysisGetReachableSourcesParams params =
-// new AnalysisGetReachableSourcesParams.fromRequest(request);
-// ContextSourcePair pair = server.getContextSourcePair(params.file);
-// if (pair.context == null || pair.source == null) {
-// return new Response.getReachableSourcesInvalidFile(request);
-// }
-// Map<String, List<String>> sources =
-// new ReachableSourceCollector(pair.source, pair.context)
-// .collectSources();
-// return new AnalysisGetReachableSourcesResult(sources)
-// .toResponse(request.id);
- }
-
@override
Response? handleRequest(
Request request, CancellationToken cancellationToken) {
@@ -78,13 +42,15 @@
.handle();
return Response.DELAYED_RESPONSE;
} else if (requestName == ANALYSIS_REQUEST_GET_LIBRARY_DEPENDENCIES) {
- return getLibraryDependencies(request);
+ UnsupportedRequestHandler(server, request, cancellationToken).handle();
+ return Response.DELAYED_RESPONSE;
} else if (requestName == ANALYSIS_REQUEST_GET_NAVIGATION) {
AnalysisGetNavigationHandler(server, request, cancellationToken)
.handle();
return Response.DELAYED_RESPONSE;
} else if (requestName == ANALYSIS_REQUEST_GET_REACHABLE_SOURCES) {
- return getReachableSources(request);
+ UnsupportedRequestHandler(server, request, cancellationToken).handle();
+ return Response.DELAYED_RESPONSE;
} else if (requestName == ANALYSIS_REQUEST_GET_SIGNATURE) {
AnalysisGetSignatureHandler(server, request, cancellationToken)
.handle();
@@ -101,7 +67,9 @@
} else if (requestName == ANALYSIS_REQUEST_SET_PRIORITY_FILES) {
return setPriorityFiles(request);
} else if (requestName == ANALYSIS_REQUEST_SET_SUBSCRIPTIONS) {
- return setSubscriptions(request);
+ AnalysisSetSubscriptionsHandler(server, request, cancellationToken)
+ .handle();
+ return Response.DELAYED_RESPONSE;
} else if (requestName == ANALYSIS_REQUEST_UPDATE_CONTENT) {
return updateContent(request);
} else if (requestName == ANALYSIS_REQUEST_UPDATE_OPTIONS) {
@@ -143,37 +111,6 @@
return AnalysisSetPriorityFilesResult().toResponse(request.id);
}
- /// Implement the 'analysis.setSubscriptions' request.
- Response setSubscriptions(Request request) {
- var params = AnalysisSetSubscriptionsParams.fromRequest(request);
-
- for (var fileList in params.subscriptions.values) {
- for (var file in fileList) {
- if (!server.isAbsoluteAndNormalized(file)) {
- return Response.invalidFilePathFormat(request, file);
- }
- }
- }
-
- // parse subscriptions
- var subMap =
- mapMap<AnalysisService, List<String>, AnalysisService, Set<String>>(
- params.subscriptions,
- valueCallback: (List<String> subscriptions) =>
- subscriptions.toSet());
- server.setAnalysisSubscriptions(subMap);
- //
- // Forward the request to the plugins.
- //
- var converter = RequestConverter();
- server.pluginManager.setAnalysisSetSubscriptionsParams(
- converter.convertAnalysisSetSubscriptionsParams(params));
- //
- // Send the response.
- //
- return AnalysisSetSubscriptionsResult().toResponse(request.id);
- }
-
/// Implement the 'analysis.updateContent' request.
Response updateContent(Request request) {
var params = AnalysisUpdateContentParams.fromRequest(request);
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 86bffa8..be22f29 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -9,6 +9,7 @@
import 'package:analysis_server/src/collections.dart';
import 'package:analysis_server/src/domain_abstract.dart';
import 'package:analysis_server/src/handler/legacy/edit_bulk_fixes.dart';
+import 'package:analysis_server/src/handler/legacy/edit_format_if_enabled.dart';
import 'package:analysis_server/src/handler/legacy/edit_get_assists.dart';
import 'package:analysis_server/src/handler/legacy/edit_get_fixes.dart';
import 'package:analysis_server/src/handler/legacy/edit_get_postfix_completion.dart';
@@ -119,6 +120,9 @@
var requestName = request.method;
if (requestName == EDIT_REQUEST_FORMAT) {
return format(request);
+ } else if (requestName == EDIT_REQUEST_FORMAT_IF_ENABLED) {
+ EditFormatIfEnabledHandler(server, request, cancellationToken).handle();
+ return Response.DELAYED_RESPONSE;
} else if (requestName == EDIT_REQUEST_GET_ASSISTS) {
EditGetAssistsHandler(server, request, cancellationToken).handle();
return Response.DELAYED_RESPONSE;
diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_set_subscriptions.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_subscriptions.dart
new file mode 100644
index 0000000..bce48cf
--- /dev/null
+++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_subscriptions.dart
@@ -0,0 +1,53 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// 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 'dart:async';
+
+import 'package:analysis_server/protocol/protocol.dart';
+import 'package:analysis_server/protocol/protocol_generated.dart';
+import 'package:analysis_server/src/analysis_server.dart';
+import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
+import 'package:analysis_server/src/plugin/request_converter.dart';
+import 'package:analysis_server/src/protocol/protocol_internal.dart';
+import 'package:analysis_server/src/utilities/progress.dart';
+
+/// The handler for the `analysis.setSubscriptions` request.
+class AnalysisSetSubscriptionsHandler extends LegacyHandler {
+ /// Initialize a newly created handler to be able to service requests for the
+ /// [server].
+ AnalysisSetSubscriptionsHandler(AnalysisServer server, Request request,
+ CancellationToken cancellationToken)
+ : super(server, request, cancellationToken);
+
+ @override
+ Future<void> handle() async {
+ var params = AnalysisSetSubscriptionsParams.fromRequest(request);
+
+ for (var fileList in params.subscriptions.values) {
+ for (var file in fileList) {
+ if (!server.isAbsoluteAndNormalized(file)) {
+ sendResponse(Response.invalidFilePathFormat(request, file));
+ }
+ }
+ }
+
+ // parse subscriptions
+ var subMap =
+ mapMap<AnalysisService, List<String>, AnalysisService, Set<String>>(
+ params.subscriptions,
+ valueCallback: (List<String> subscriptions) =>
+ subscriptions.toSet());
+ server.setAnalysisSubscriptions(subMap);
+ //
+ // Forward the request to the plugins.
+ //
+ var converter = RequestConverter();
+ server.pluginManager.setAnalysisSetSubscriptionsParams(
+ converter.convertAnalysisSetSubscriptionsParams(params));
+ //
+ // Send the response.
+ //
+ sendResult(AnalysisSetSubscriptionsResult());
+ }
+}
diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_format_if_enabled.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_format_if_enabled.dart
new file mode 100644
index 0000000..5e404d4
--- /dev/null
+++ b/pkg/analysis_server/lib/src/handler/legacy/edit_format_if_enabled.dart
@@ -0,0 +1,87 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// 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 'dart:async';
+
+import 'package:analysis_server/src/analysis_server.dart';
+import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
+import 'package:analysis_server/src/protocol_server.dart';
+import 'package:analysis_server/src/utilities/progress.dart';
+import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart';
+import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
+import 'package:analyzer/src/util/file_paths.dart' as file_paths;
+import 'package:dart_style/src/dart_formatter.dart';
+import 'package:dart_style/src/exceptions.dart';
+import 'package:dart_style/src/source_code.dart';
+
+/// The handler for the `edit.formatIfEnabled` request.
+class EditFormatIfEnabledHandler extends LegacyHandler {
+ /// Initialize a newly created handler to be able to service requests for the
+ /// [server].
+ EditFormatIfEnabledHandler(AnalysisServer server, Request request,
+ CancellationToken cancellationToken)
+ : super(server, request, cancellationToken);
+
+ /// Format the file at the given [filePath].
+ ///
+ /// Throws a [FileSystemException] if the file doesn't exist or can't be read.
+ /// Throws a [FormatterException] if the code could not be formatted.
+ List<SourceEdit> formatFile(String filePath) {
+ // TODO(brianwilkerson) Move this to a superclass when `edit.format` is
+ // implemented by a handler class so the code can be shared.
+ var resource = server.resourceProvider.getFile(filePath);
+ var originalContent = resource.readAsStringSync();
+ var code = SourceCode(originalContent, uri: null, isCompilationUnit: true);
+
+ var formatter = DartFormatter();
+ var formatResult = formatter.formatSource(code);
+ var formattedContent = formatResult.text;
+
+ var edits = <SourceEdit>[];
+ if (formattedContent != originalContent) {
+ // TODO(brianwilkerson) Replace full replacements with smaller, more
+ // targeted edits.
+ var edit = SourceEdit(0, originalContent.length, formattedContent);
+ edits.add(edit);
+ }
+ return edits;
+ }
+
+ @override
+ Future<void> handle() async {
+ var params = EditFormatIfEnabledParams.fromRequest(request);
+ var collection = AnalysisContextCollectionImpl(
+ includedPaths: params.directories,
+ resourceProvider: server.resourceProvider,
+ sdkPath: server.sdkPath,
+ );
+ var sourceFileEdits = <SourceFileEdit>[];
+ for (var context in collection.contexts) {
+ if (context.analysisOptions.codeStyleOptions.useFormatter) {
+ _formatInContext(context, sourceFileEdits);
+ }
+ }
+ sendResult(EditFormatIfEnabledResult(sourceFileEdits));
+ }
+
+ /// Format all of the files in the given [context], adding the edits to the
+ /// list of [sourceFileEdits].
+ void _formatInContext(DriverBasedAnalysisContext context,
+ List<SourceFileEdit> sourceFileEdits) {
+ for (var filePath in context.contextRoot.analyzedFiles()) {
+ var pathContext = context.resourceProvider.pathContext;
+ if (file_paths.isDart(pathContext, filePath)) {
+ try {
+ var sourceEdits = formatFile(filePath);
+ if (sourceEdits.isNotEmpty) {
+ sourceFileEdits
+ .add(SourceFileEdit(filePath, 0, edits: sourceEdits));
+ }
+ } catch (exception) {
+ // Ignore files that can't be formatted.
+ }
+ }
+ }
+ }
+}
diff --git a/pkg/analysis_server/lib/src/handler/legacy/unsupported_request.dart b/pkg/analysis_server/lib/src/handler/legacy/unsupported_request.dart
new file mode 100644
index 0000000..03dc5a5
--- /dev/null
+++ b/pkg/analysis_server/lib/src/handler/legacy/unsupported_request.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// 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 'dart:async';
+
+import 'package:analysis_server/protocol/protocol.dart';
+import 'package:analysis_server/src/analysis_server.dart';
+import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
+import 'package:analysis_server/src/utilities/progress.dart';
+
+/// The handler used for the request that are no longer supported.
+class UnsupportedRequestHandler extends LegacyHandler {
+ /// Initialize a newly created handler to be able to service requests for the
+ /// [server].
+ UnsupportedRequestHandler(AnalysisServer server, Request request,
+ CancellationToken cancellationToken)
+ : super(server, request, cancellationToken);
+
+ @override
+ Future<void> handle() async {
+ sendResponse(Response.unsupportedFeature(request.id,
+ 'Please contact the Dart analyzer team if you need this request.'));
+ }
+}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart
index 6d3c100..8d092f4 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart
@@ -5,6 +5,7 @@
import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
import 'package:analysis_server/src/services/correction/fix.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/precedence.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
@@ -39,11 +40,21 @@
nullableExpression = node.thenExpression;
defaultExpression = node.elseExpression;
}
+
+ var parentheses = defaultExpression.precedence <
+ Precedence.forTokenType(TokenType.QUESTION_QUESTION);
+
await builder.addDartFileEdit(file, (builder) {
builder.addReplacement(range.node(node), (builder) {
builder.write(utils.getNodeText(nullableExpression));
builder.write(' ?? ');
+ if (parentheses) {
+ builder.write('(');
+ }
builder.write(utils.getNodeText(defaultExpression));
+ if (parentheses) {
+ builder.write(')');
+ }
});
});
}
diff --git a/pkg/analysis_server/test/analysis/get_errors_test.dart b/pkg/analysis_server/test/analysis/get_errors_test.dart
index 8310a89..db72005 100644
--- a/pkg/analysis_server/test/analysis/get_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/get_errors_test.dart
@@ -4,13 +4,11 @@
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol_generated.dart';
-import 'package:analysis_server/src/domain_analysis.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../analysis_abstract.dart';
-import '../mocks.dart';
+import '../analysis_server_base.dart';
void main() {
defineReflectiveSuite(() {
@@ -19,123 +17,117 @@
}
@reflectiveTest
-class GetErrorsTest extends AbstractAnalysisTest {
- static const String requestId = 'test-getError';
+class GetErrorsTest extends PubPackageAnalysisServerTest {
+ static const String _requestId = 'test-getError';
@override
Future<void> setUp() async {
super.setUp();
- server.handlers = [
- AnalysisDomainHandler(server),
- ];
- await createProject();
+ await setRoots(included: [workspaceRootPath], excluded: []);
}
Future<void> test_afterAnalysisComplete() async {
- addTestFile('''
+ newFile2(testFilePath, '''
main() {
print(42)
}
''');
- await waitForTasksFinished();
- var errors = await _getErrors(testFile);
+
+ await server.onAnalysisComplete;
+
+ var errors = await _getErrors(testFile.path);
expect(errors, hasLength(1));
}
Future<void> test_errorInPart() async {
- var libPath = join(testFolder, 'main.dart');
- var partPath = join(testFolder, 'main_part.dart');
- newFile2(libPath, r'''
-library main;
-part 'main_part.dart';
+ var libraryFile = newFile2('$testPackageLibPath/a.dart', r'''
+part 'b.dart';
class A {}
''');
- newFile2(partPath, r'''
-part of main;
+
+ var partFile = newFile2('$testPackageLibPath/b.dart', r'''
+part of 'a.dart';
class A {}
''');
- await waitForTasksFinished();
+
{
- var libErrors = await _getErrors(libPath);
+ var libErrors = await _getErrors(libraryFile.path);
expect(libErrors, isEmpty);
}
{
- var partErrors = await _getErrors(partPath);
+ var partErrors = await _getErrors(partFile.path);
expect(partErrors, hasLength(1));
}
}
- @failingTest
Future<void> test_fileWithoutContext() async {
- // Broken under the new driver.
- var file = convertPath('/outside.dart');
- newFile2(file, '''
-main() {
- print(42);
-}
-''');
- await _checkInvalid(file);
+ await setRoots(included: [], excluded: []);
+
+ var request = _createGetErrorsRequest(testFile.path);
+ var response = await serverChannel.sendRequest(request);
+ assertResponseFailure(
+ response,
+ requestId: _requestId,
+ errorCode: RequestErrorCode.GET_ERRORS_INVALID_FILE,
+ );
}
Future<void> test_hasErrors() async {
- addTestFile('''
+ newFile2(testFilePath, '''
main() {
print(42)
}
''');
- var errors = await _getErrors(testFile);
+
+ var errors = await _getErrors(testFile.path);
expect(errors, hasLength(1));
{
var error = errors[0];
expect(error.severity, AnalysisErrorSeverity.ERROR);
expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR);
- expect(error.location.file, testFile);
+ expect(error.location.file, testFilePathPlatform);
expect(error.location.startLine, 2);
}
}
Future<void> test_invalidFilePathFormat_notAbsolute() async {
var request = _createGetErrorsRequest('test.dart');
- var response = await waitResponse(request);
- expect(
+ var response = await handleRequest(request);
+ assertResponseFailure(
response,
- isResponseFailure(requestId, RequestErrorCode.INVALID_FILE_PATH_FORMAT),
+ requestId: _requestId,
+ errorCode: RequestErrorCode.INVALID_FILE_PATH_FORMAT,
);
}
Future<void> test_invalidFilePathFormat_notNormalized() async {
var request = _createGetErrorsRequest(convertPath('/foo/../bar/test.dart'));
- var response = await waitResponse(request);
- expect(
+ var response = await handleRequest(request);
+ assertResponseFailure(
response,
- isResponseFailure(requestId, RequestErrorCode.INVALID_FILE_PATH_FORMAT),
+ requestId: _requestId,
+ errorCode: RequestErrorCode.INVALID_FILE_PATH_FORMAT,
);
}
Future<void> test_noErrors() async {
- addTestFile('''
+ newFile2(testFilePath, '''
main() {
print(42);
}
''');
- var errors = await _getErrors(testFile);
+
+ var errors = await _getErrors(testFile.path);
expect(errors, isEmpty);
}
- Future<void> _checkInvalid(String file) async {
- var request = _createGetErrorsRequest(file);
- var response = await serverChannel.sendRequest(request);
- expect(response.error, isNotNull);
- expect(response.error!.code, RequestErrorCode.GET_ERRORS_INVALID_FILE);
+ Request _createGetErrorsRequest(String path) {
+ return AnalysisGetErrorsParams(path).toRequest(_requestId);
}
- Request _createGetErrorsRequest(String file) {
- return AnalysisGetErrorsParams(file).toRequest(requestId);
- }
-
- Future<List<AnalysisError>> _getErrors(String file) async {
- var request = _createGetErrorsRequest(file);
- var response = await serverChannel.sendRequest(request);
+ Future<List<AnalysisError>> _getErrors(String path) async {
+ var request = _createGetErrorsRequest(path);
+ var response = await handleSuccessfulRequest(request);
return AnalysisGetErrorsResult.fromResponse(response).errors;
}
}
diff --git a/pkg/analysis_server/test/analysis/get_hover_test.dart b/pkg/analysis_server/test/analysis/get_hover_test.dart
index 96b7f7f..9120539 100644
--- a/pkg/analysis_server/test/analysis/get_hover_test.dart
+++ b/pkg/analysis_server/test/analysis/get_hover_test.dart
@@ -8,7 +8,7 @@
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../analysis_abstract.dart';
-import '../mocks.dart';
+import '../analysis_server_base.dart';
void main() {
defineReflectiveSuite(() {
@@ -42,15 +42,15 @@
}
@reflectiveTest
-class AnalysisHoverTest extends AbstractAnalysisTest {
+class AnalysisHoverTest extends PubPackageAnalysisServerTest {
Future<HoverInformation> prepareHover(String search) async {
return (await prepareHoverOrNull(search))!;
}
Future<HoverInformation?> prepareHoverAt(int offset) async {
- await waitForTasksFinished();
- var request = AnalysisGetHoverParams(testFile, offset).toRequest('0');
- var response = await waitResponse(request);
+ await server.onAnalysisComplete;
+ var request = AnalysisGetHoverParams(testFile.path, offset).toRequest('0');
+ var response = await handleSuccessfulRequest(request);
var result = AnalysisGetHoverResult.fromResponse(response);
var hovers = result.hovers;
return hovers.isNotEmpty ? hovers.first : null;
@@ -64,11 +64,11 @@
@override
Future<void> setUp() async {
super.setUp();
- await createProject();
+ await setRoots(included: [workspaceRootPath], excluded: []);
}
Future<void> test_class_constructor_named() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A {
/// my doc
@@ -99,7 +99,7 @@
}
Future<void> test_class_constructor_noKeyword_const() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A {
const A(int i);
@@ -113,8 +113,8 @@
expect(hover.offset, findOffset('A(0)'));
expect(hover.length, 'A'.length);
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.dartdoc, isNull);
expect(hover.elementDescription, '(const) A A(int i)');
expect(hover.elementKind, 'constructor');
@@ -126,7 +126,7 @@
}
Future<void> test_class_constructor_noKeyword_new() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A {}
void f() {
@@ -138,8 +138,8 @@
expect(hover.offset, findOffset('A()'));
expect(hover.length, 'A'.length);
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.dartdoc, isNull);
expect(hover.elementDescription, '(new) A A()');
expect(hover.elementKind, 'constructor');
@@ -151,7 +151,7 @@
}
Future<void> test_class_constructor_synthetic() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A {
}
@@ -164,8 +164,8 @@
expect(hover.offset, findOffset('new A') + 'new '.length);
expect(hover.length, 'A'.length);
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.dartdoc, isNull);
expect(hover.elementDescription, 'A A()');
expect(hover.elementKind, 'constructor');
@@ -177,7 +177,7 @@
}
Future<void> test_class_constructor_synthetic_withTypeArgument() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A<T> {}
void f() {
@@ -189,8 +189,8 @@
expect(hover.offset, findOffset('A<String>'));
expect(hover.length, 'A<String>'.length);
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.dartdoc, isNull);
expect(hover.elementDescription, 'A<String> A()');
expect(hover.elementKind, 'constructor');
@@ -219,7 +219,7 @@
}
Future<void> test_class_constructorReference_named() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A<T> {
/// doc aaa
/// doc bbb
@@ -232,8 +232,8 @@
''');
var hover = await prepareHover('named;');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'A');
expect(hover.dartdoc, 'doc aaa\ndoc bbb');
expect(hover.elementDescription, 'A<double> A.named()');
@@ -246,7 +246,7 @@
}
Future<void> test_class_constructorReference_unnamed_declared() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A<T> {
/// doc aaa
/// doc bbb
@@ -259,8 +259,8 @@
''');
var hover = await prepareHover('new;');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'A');
expect(hover.dartdoc, 'doc aaa\ndoc bbb');
expect(hover.elementDescription, 'A<double> A()');
@@ -273,7 +273,7 @@
}
Future<void> test_class_constructorReference_unnamed_declared_new() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A<T> {
/// doc aaa
/// doc bbb
@@ -286,8 +286,8 @@
''');
var hover = await prepareHover('new;');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'A');
expect(hover.dartdoc, 'doc aaa\ndoc bbb');
expect(hover.elementDescription, 'A<double> A()');
@@ -300,7 +300,7 @@
}
Future<void> test_class_constructorReference_unnamed_synthetic() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A<T> {}
void f() {
@@ -309,8 +309,8 @@
''');
var hover = await prepareHover('new;');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'A');
expect(hover.dartdoc, isNull);
expect(hover.elementDescription, 'A<double> A()');
@@ -323,7 +323,7 @@
}
Future<void> test_class_declaration() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A<E> {}
class I1<K, V> {}
class I2<E> {}
@@ -342,7 +342,7 @@
}
Future<void> test_class_declaration_abstract() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {}
abstract class B extends A {}
''');
@@ -354,7 +354,7 @@
}
Future<void> test_class_getter_synthetic() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A {
/// doc aaa
@@ -367,8 +367,8 @@
''');
var hover = await prepareHover('fff);');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'A');
expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
expect(hover.elementDescription, 'String fff');
@@ -379,7 +379,7 @@
}
Future<void> test_class_method_declaration() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A {
/// doc aaa
@@ -390,8 +390,8 @@
''');
var hover = await prepareHover('mmm(int a');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'A');
expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
expect(hover.elementDescription, 'List<String> mmm(int a, String b)');
@@ -404,7 +404,7 @@
}
Future<void> test_class_method_reference() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A {
List<String> mmm(int a, String b) {
@@ -419,8 +419,8 @@
expect(hover.offset, findOffset('mmm(42, '));
expect(hover.length, 'mmm'.length);
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.elementDescription, 'List<String> mmm(int a, String b)');
expect(hover.elementKind, 'method');
expect(hover.isDeprecated, isFalse);
@@ -432,7 +432,7 @@
}
Future<void> test_class_method_reference_deprecated() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
@deprecated
static void test() {}
@@ -443,14 +443,14 @@
''');
var hover = await prepareHover('test();');
// element
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.elementDescription, 'void test()');
expect(hover.elementKind, 'method');
expect(hover.isDeprecated, isTrue);
}
Future<void> test_class_method_reference_genericMethod() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
abstract class Stream<T> {
@@ -467,8 +467,8 @@
expect(hover.offset, findOffset('transform(n'));
expect(hover.length, 'transform'.length);
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.elementDescription,
'Stream<S> transform<S>(StreamTransformer<int, S> streamTransformer)');
expect(hover.elementKind, 'method');
@@ -482,7 +482,7 @@
}
Future<void> test_class_setter_hasDocumentation() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// getting
int get foo => 42;
@@ -501,7 +501,7 @@
}
Future<void> test_class_setter_noDocumentation() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// getting
int get foo => 42;
@@ -519,7 +519,7 @@
}
Future<void> test_class_setter_super_hasDocumentation() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// pgetting
int get foo => 42;
@@ -543,7 +543,7 @@
}
Future<void> test_class_setter_super_noDocumentation() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// pgetting
int get foo => 42;
@@ -566,7 +566,7 @@
@failingTest
Future<void> test_class_setter_super_noSetter() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// pgetting
int get foo => 42;
@@ -586,7 +586,7 @@
}
Future<void> test_dartdoc_block() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/**
* doc aaa
* doc bbb
@@ -599,7 +599,7 @@
}
Future<void> test_dartdoc_inherited_fromInterface() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// my doc
m() {} // in A
@@ -614,7 +614,7 @@
}
Future<void> test_dartdoc_inherited_fromSuper_direct() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// my doc
m() {} // in A
@@ -629,7 +629,7 @@
}
Future<void> test_dartdoc_inherited_fromSuper_indirect() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// my doc
m() {}
@@ -645,7 +645,7 @@
}
Future<void> test_dartdoc_inherited_preferSuper() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// my doc
m() {}
@@ -664,7 +664,7 @@
}
Future<void> test_dartdoc_line() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// doc aaa
/// doc bbb
void f() {
@@ -675,7 +675,7 @@
}
Future<void> test_enum_declaration() async {
- addTestFile('''
+ newFile2(testFilePath, '''
enum MyEnum {AAA, BBB, CCC}
''');
var hover = await prepareHover('MyEnum');
@@ -686,7 +686,7 @@
}
Future<void> test_enum_getter() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
enum E {
v;
@@ -700,8 +700,8 @@
''');
var hover = await prepareHover('foo);');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'E');
expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
expect(hover.elementDescription, 'int get foo');
@@ -709,7 +709,7 @@
}
Future<void> test_enum_getter_synthetic() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
enum E {
v;
@@ -723,8 +723,8 @@
''');
var hover = await prepareHover('fff);');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'E');
expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
expect(hover.elementDescription, 'String fff');
@@ -735,7 +735,7 @@
}
Future<void> test_enum_method_declaration() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
enum E {
v;
@@ -747,8 +747,8 @@
''');
var hover = await prepareHover('mmm(int a');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'E');
expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
expect(hover.elementDescription, 'List<String> mmm(int a, String b)');
@@ -761,7 +761,7 @@
}
Future<void> test_enum_method_reference() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
enum E {
v;
@@ -777,8 +777,8 @@
expect(hover.offset, findOffset('mmm(42, '));
expect(hover.length, 'mmm'.length);
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'E');
expect(hover.elementDescription, 'List<String> mmm(int a, String b)');
expect(hover.elementKind, 'method');
@@ -791,7 +791,7 @@
}
Future<void> test_enum_setter_hasDocumentation() async {
- addTestFile('''
+ newFile2(testFilePath, '''
enum E {
v;
/// getting
@@ -811,7 +811,7 @@
}
Future<void> test_extensionDeclaration() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {}
/// Comment
extension E on A {}
@@ -827,7 +827,7 @@
Future<void> test_function_multilineElementDescription() async {
// Functions with at least 3 params will have element descriptions formatted
// across multiple lines.
- addTestFile('''
+ newFile2(testFilePath, '''
List<String> fff(int a, [String b = 'b', String c = 'c']) {
}
''');
@@ -841,7 +841,7 @@
}
Future<void> test_function_topLevel_declaration() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
/// doc aaa
/// doc bbb
@@ -850,8 +850,8 @@
''');
var hover = await prepareHover('fff(int a');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, isNull);
expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
expect(
@@ -865,7 +865,7 @@
}
Future<void> test_functionReference_classMethod_instance() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A<T> {
/// doc aaa
/// doc bbb
@@ -878,8 +878,8 @@
''');
var hover = await prepareHover('foo<double>');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'A');
expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
expect(hover.elementDescription, 'int foo<U>(int t, U u)');
@@ -892,7 +892,7 @@
}
Future<void> test_functionReference_classMethod_static() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A<T> {
/// doc aaa
/// doc bbb
@@ -905,8 +905,8 @@
''');
var hover = await prepareHover('foo<double>');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, 'A');
expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
expect(hover.elementDescription, 'int foo<U>(U u)');
@@ -919,7 +919,7 @@
}
Future<void> test_functionReference_topLevelFunction() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// doc aaa
/// doc bbb
int foo<T>(T a) => 0;
@@ -930,8 +930,8 @@
''');
var hover = await prepareHover('foo<double>');
// element
- expect(hover.containingLibraryName, 'bin/test.dart');
- expect(hover.containingLibraryPath, testFile);
+ expect(hover.containingLibraryName, 'package:test/test.dart');
+ expect(hover.containingLibraryPath, testFile.path);
expect(hover.containingClassDescription, isNull);
expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
expect(hover.elementDescription, 'int foo<T>(T a)');
@@ -944,7 +944,7 @@
}
Future<void> test_integerLiteral() async {
- addTestFile('''
+ newFile2(testFilePath, '''
void f() {
foo(123);
}
@@ -969,7 +969,7 @@
}
Future<void> test_integerLiteral_promoted() async {
- addTestFile('''
+ newFile2(testFilePath, '''
void f() {
foo(123);
}
@@ -995,10 +995,11 @@
Future<void> test_invalidFilePathFormat_notAbsolute() async {
var request = AnalysisGetHoverParams('test.dart', 0).toRequest('0');
- var response = await waitResponse(request);
- expect(
+ var response = await handleRequest(request);
+ assertResponseFailure(
response,
- isResponseFailure('0', RequestErrorCode.INVALID_FILE_PATH_FORMAT),
+ requestId: '0',
+ errorCode: RequestErrorCode.INVALID_FILE_PATH_FORMAT,
);
}
@@ -1006,15 +1007,16 @@
var request =
AnalysisGetHoverParams(convertPath('/foo/../bar/test.dart'), 0)
.toRequest('0');
- var response = await waitResponse(request);
- expect(
+ var response = await handleRequest(request);
+ assertResponseFailure(
response,
- isResponseFailure('0', RequestErrorCode.INVALID_FILE_PATH_FORMAT),
+ requestId: '0',
+ errorCode: RequestErrorCode.INVALID_FILE_PATH_FORMAT,
);
}
Future<void> test_localVariable_declaration() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A {
m() {
@@ -1038,7 +1040,7 @@
}
Future<void> test_localVariable_reference_withPropagatedType() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
void f() {
var vvv = 123;
@@ -1059,7 +1061,7 @@
}
Future<void> test_mixin_declaration() async {
- addTestFile('''
+ newFile2(testFilePath, '''
mixin A on B, C implements D, E {}
class B {}
class C {}
@@ -1074,7 +1076,7 @@
@failingTest
Future<void> test_mixin_reference() async {
- addTestFile('''
+ newFile2(testFilePath, '''
mixin A {}
abstract class B {}
class C with A implements B {}
@@ -1086,7 +1088,7 @@
}
Future<void> test_noHoverInfo() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
void f() {
// nothing
@@ -1097,7 +1099,7 @@
}
Future<void> test_nonNullable() async {
- addTestFile('''
+ newFile2(testFilePath, '''
int? f(double? a) => null;
void f() {
@@ -1110,7 +1112,7 @@
}
Future<void> test_parameter_declaration_fieldFormal() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// The field documentation.
final int fff;
@@ -1131,7 +1133,7 @@
}
Future<void> test_parameter_declaration_required() async {
- addTestFile('''
+ newFile2(testFilePath, '''
library my.library;
class A {
/// The method documentation.
@@ -1155,7 +1157,7 @@
}
Future<void> test_parameter_defaultValue() async {
- addTestFile('void b([int a=123]) { }');
+ newFile2(testFilePath, 'void b([int a=123]) { }');
var hover = await prepareHover('a=');
// element
expect(hover.elementDescription, '[int a = 123]');
@@ -1164,7 +1166,7 @@
Future<void>
test_parameter_ofConstructor_optionalPositional_super_defaultValue_explicit() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
A([int a = 1]);
}
@@ -1180,7 +1182,7 @@
Future<void>
test_parameter_ofConstructor_optionalPositional_super_defaultValue_inherited() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
A([int a = 1]);
}
@@ -1196,7 +1198,7 @@
Future<void>
test_parameter_ofConstructor_optionalPositional_super_defaultValue_inherited2() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
A([num a = 1.2]);
}
@@ -1211,7 +1213,7 @@
}
Future<void> test_parameter_reference_fieldFormal() async {
- addTestFile('''
+ newFile2(testFilePath, '''
class A {
/// The field documentation.
final int fff;
@@ -1232,7 +1234,7 @@
}
Future<void> test_simpleIdentifier_typedef_functionType() async {
- addTestFile('''
+ newFile2(testFilePath, '''
typedef A = void Function(int);
''');
var hover = await prepareHover('A');
@@ -1244,7 +1246,7 @@
}
Future<void> test_simpleIdentifier_typedef_interfaceType() async {
- addTestFile('''
+ newFile2(testFilePath, '''
typedef A = Map<int, String>;
''');
var hover = await prepareHover('A');
@@ -1256,7 +1258,7 @@
}
Future<void> test_simpleIdentifier_typedef_legacy() async {
- addTestFile('''
+ newFile2(testFilePath, '''
typedef void A(int a);
''');
var hover = await prepareHover('A');
@@ -1275,10 +1277,10 @@
required String elementKind,
bool isDeprecated = false,
}) {
- containingLibraryName ??= 'bin/test.dart';
+ containingLibraryName ??= 'package:test/test.dart';
expect(hover.containingLibraryName, containingLibraryName);
- containingLibraryPath ??= testFile;
+ containingLibraryPath ??= testFile.path;
expect(hover.containingLibraryPath, containingLibraryPath);
expect(hover.elementDescription, elementDescription);
diff --git a/pkg/analysis_server/test/analysis/get_navigation_test.dart b/pkg/analysis_server/test/analysis/get_navigation_test.dart
index 3450000..2a70304 100644
--- a/pkg/analysis_server/test/analysis/get_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/get_navigation_test.dart
@@ -89,32 +89,33 @@
class Foo {
// ...
// ...
- Foo() {
- print('');
- }
+ Foo() {}
+ Foo.named() {}
// ...
}
final a = Foo();
-final b = new Foo();
+final b = new Foo.named();
''');
await waitForTasksFinished();
- // Without `new`
+ // Without `new` / unnamed
await _getNavigation(testFile, testCode.indexOf('Foo();'), 0);
expect(regions, hasLength(1));
expect(regions.first.targets, hasLength(1));
var target = targets[regions.first.targets.first];
expect(target.kind, ElementKind.CONSTRUCTOR);
expect(target.offset, testCode.indexOf('Foo() {'));
+ expect(target.length, 3);
- // With `new`
- await _getNavigation(testFile, testCode.indexOf('new Foo();') + 4, 0);
+ // With `new` / named
+ await _getNavigation(testFile, testCode.indexOf('new Foo.named();') + 8, 0);
expect(regions, hasLength(1));
expect(regions.first.targets, hasLength(1));
target = targets[regions.first.targets.first];
expect(target.kind, ElementKind.CONSTRUCTOR);
- expect(target.offset, testCode.indexOf('Foo() {'));
+ expect(target.offset, testCode.indexOf('named() {'));
+ expect(target.length, 5);
}
Future<void> test_fieldType() async {
diff --git a/pkg/analysis_server/test/analysis/get_signature_test.dart b/pkg/analysis_server/test/analysis/get_signature_test.dart
index ba5a920..3d14e5d 100644
--- a/pkg/analysis_server/test/analysis/get_signature_test.dart
+++ b/pkg/analysis_server/test/analysis/get_signature_test.dart
@@ -6,8 +6,7 @@
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../analysis_abstract.dart';
-import '../mocks.dart';
+import '../analysis_server_base.dart';
void main() {
defineReflectiveSuite(() {
@@ -16,17 +15,16 @@
}
@reflectiveTest
-class AnalysisSignatureTest extends AbstractAnalysisTest {
+class AnalysisSignatureTest extends PubPackageAnalysisServerTest {
Future<Response> prepareRawSignature(String search) {
var offset = findOffset(search);
return prepareRawSignatureAt(offset);
}
Future<Response> prepareRawSignatureAt(int offset, {String? file}) async {
- await waitForTasksFinished();
- var request =
- AnalysisGetSignatureParams(file ?? testFile, offset).toRequest('0');
- return waitResponse(request);
+ var request = AnalysisGetSignatureParams(file ?? testFile.path, offset)
+ .toRequest('0');
+ return handleRequest(request);
}
Future<AnalysisGetSignatureResult> prepareSignature(String search) {
@@ -43,11 +41,11 @@
@override
Future<void> setUp() async {
super.setUp();
- await createProject();
+ await setRoots(included: [workspaceRootPath], excluded: []);
}
Future<void> test_constructor() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// MyClass doc
class MyClass {
/// MyClass constructor doc
@@ -70,7 +68,7 @@
}
Future<void> test_constructor_factory() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// MyClass doc
class MyClass {
/// MyClass private constructor doc
@@ -97,7 +95,7 @@
}
Future<void> test_constructor_named() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// MyClass doc
class MyClass {
/// MyClass.foo constructor doc
@@ -120,7 +118,7 @@
}
Future<void> test_does_not_walk_up_over_closure() async {
- addTestFile('''
+ newFile2(testFilePath, '''
one(String name, int length) {}
main() {
one("Danny", () {
@@ -128,38 +126,47 @@
});
}
''');
- var result = await prepareRawSignature('/*^*/');
- var error = result.error!;
- expect(error.code, equals(RequestErrorCode.GET_SIGNATURE_UNKNOWN_FUNCTION));
+ var response = await prepareRawSignature('/*^*/');
+ assertResponseFailure(
+ response,
+ requestId: '0',
+ errorCode: RequestErrorCode.GET_SIGNATURE_UNKNOWN_FUNCTION,
+ );
}
Future<void> test_error_file_not_analyzed() async {
- var result = await prepareRawSignatureAt(0,
+ var response = await prepareRawSignatureAt(0,
file: convertPath('/not/in/project.dart'));
- var error = result.error!;
+ var error = response.error!;
expect(error.code, equals(RequestErrorCode.GET_SIGNATURE_INVALID_FILE));
}
Future<void> test_error_function_unknown() async {
- addTestFile('''
+ newFile2(testFilePath, '''
someFunc(/*^*/);
''');
- var result = await prepareRawSignature('/*^*/');
- var error = result.error!;
- expect(error.code, equals(RequestErrorCode.GET_SIGNATURE_UNKNOWN_FUNCTION));
+ var response = await prepareRawSignature('/*^*/');
+ assertResponseFailure(
+ response,
+ requestId: '0',
+ errorCode: RequestErrorCode.GET_SIGNATURE_UNKNOWN_FUNCTION,
+ );
}
Future<void> test_error_offset_invalid() async {
- addTestFile('''
+ newFile2(testFilePath, '''
a() {}
''');
- var result = await prepareRawSignatureAt(1000);
- var error = result.error!;
- expect(error.code, equals(RequestErrorCode.GET_SIGNATURE_INVALID_OFFSET));
+ var response = await prepareRawSignatureAt(1000);
+ assertResponseFailure(
+ response,
+ requestId: '0',
+ errorCode: RequestErrorCode.GET_SIGNATURE_INVALID_OFFSET,
+ );
}
Future<void> test_function_expression() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// f doc
int Function(String) f(String s) => (int i) => int.parse(s) + i;
main() {
@@ -177,14 +184,14 @@
}
Future<void> test_function_from_other_file() async {
- newFile2('/project/bin/other.dart', '''
+ newFile2('$testPackageLibPath/other.dart', '''
/// one doc
one(String name, int length) {}
main() {
one("Danny", /*^*/);
}
''');
- addTestFile('''
+ newFile2(testFilePath, '''
import 'other.dart';
main() {
one("Danny", /*^*/);
@@ -205,7 +212,7 @@
}
Future<void> test_function_irrelevant_parens() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one(String name, int length) {}
main() {
@@ -227,7 +234,7 @@
}
Future<void> test_function_named() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one(String name, {int length}) {}
main() {
@@ -247,7 +254,7 @@
}
Future<void> test_function_named_with_default_int() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one(String name, {int length = 1}) {}
main() {
@@ -269,7 +276,7 @@
}
Future<void> test_function_named_with_default_string() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one(String name, {String email = "a@b.c"}) {}
main() {
@@ -292,7 +299,7 @@
Future<void> test_function_nested_call_inner() async {
// eg. foo(bar(1, 2));
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one(String one) {}
/// two doc
@@ -313,7 +320,7 @@
Future<void> test_function_nested_call_outer() async {
// eg. foo(bar(1, 2));
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one(String one) {}
/// two doc
@@ -333,7 +340,7 @@
}
Future<void> test_function_no_dart_doc() async {
- addTestFile('''
+ newFile2(testFilePath, '''
one(String name, int length) {}
main() {
one("Danny", /*^*/);
@@ -354,7 +361,7 @@
}
Future<void> test_function_optional() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one(String name, [int length]) {}
main() {
@@ -376,7 +383,7 @@
}
Future<void> test_function_optional_with_default() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one(String name, [int length = 11]) {}
main() {
@@ -398,7 +405,7 @@
}
Future<void> test_function_required() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one(String name, int length) {}
main() {
@@ -420,7 +427,7 @@
}
Future<void> test_function_zero_arguments() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// one doc
one() {}
main() {
@@ -435,10 +442,11 @@
Future<void> test_invalidFilePathFormat_notAbsolute() async {
var request = AnalysisGetSignatureParams('test.dart', 0).toRequest('0');
- var response = await waitResponse(request);
- expect(
+ var response = await handleRequest(request);
+ assertResponseFailure(
response,
- isResponseFailure('0', RequestErrorCode.INVALID_FILE_PATH_FORMAT),
+ requestId: '0',
+ errorCode: RequestErrorCode.INVALID_FILE_PATH_FORMAT,
);
}
@@ -446,15 +454,16 @@
var request =
AnalysisGetSignatureParams(convertPath('/foo/../bar/test.dart'), 0)
.toRequest('0');
- var response = await waitResponse(request);
- expect(
+ var response = await handleRequest(request);
+ assertResponseFailure(
response,
- isResponseFailure('0', RequestErrorCode.INVALID_FILE_PATH_FORMAT),
+ requestId: '0',
+ errorCode: RequestErrorCode.INVALID_FILE_PATH_FORMAT,
);
}
Future<void> test_method_instance() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// MyClass doc
class MyClass {
/// MyClass constructor doc
@@ -480,7 +489,7 @@
}
Future<void> test_method_static() async {
- addTestFile('''
+ newFile2(testFilePath, '''
/// MyClass doc
class MyClass {
/// MyClass constructor doc
diff --git a/pkg/analysis_server/test/analysis/notification_closing_labels_test.dart b/pkg/analysis_server/test/analysis/notification_closing_labels_test.dart
index b61849e..42537b1 100644
--- a/pkg/analysis_server/test/analysis/notification_closing_labels_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_closing_labels_test.dart
@@ -60,8 +60,8 @@
await createProject();
}
- void subscribeForLabels() {
- addAnalysisSubscription(AnalysisService.CLOSING_LABELS, testFile);
+ Future<void> subscribeForLabels() async {
+ await addAnalysisSubscription(AnalysisService.CLOSING_LABELS, testFile);
}
Future<void> test_afterAnalysis() async {
@@ -69,7 +69,7 @@
await waitForTasksFinished();
expect(lastLabels, isNull);
- await waitForLabels(() => subscribeForLabels());
+ await waitForLabels(() async => await subscribeForLabels());
expect(lastLabels, expectedResults);
}
@@ -84,18 +84,18 @@
expect(lastLabels, isNull);
// With no content, there should be zero labels.
- await waitForLabels(() => subscribeForLabels());
+ await waitForLabels(() async => await subscribeForLabels());
expect(lastLabels, hasLength(0));
// With sample code there will be labels.
- await waitForLabels(() => modifyTestFile(sampleCode));
+ await waitForLabels(() async => modifyTestFile(sampleCode));
expect(lastLabels, expectedResults);
}
- Future waitForLabels(void Function() action) {
+ Future<void> waitForLabels(Future<void> Function() action) async {
_labelsReceived = Completer();
- action();
+ await action();
return _labelsReceived.future;
}
}
diff --git a/pkg/analysis_server/test/analysis/notification_folding_test.dart b/pkg/analysis_server/test/analysis/notification_folding_test.dart
index bc1ed96..add62cf 100644
--- a/pkg/analysis_server/test/analysis/notification_folding_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_folding_test.dart
@@ -56,8 +56,8 @@
await createProject();
}
- void subscribeForFolding() {
- addAnalysisSubscription(AnalysisService.FOLDING, testFile);
+ Future<void> subscribeForFolding() async {
+ await addAnalysisSubscription(AnalysisService.FOLDING, testFile);
}
Future<void> test_afterAnalysis() async {
@@ -65,7 +65,7 @@
await waitForTasksFinished();
expect(lastRegions, isNull);
- await waitForFolding(() => subscribeForFolding());
+ await waitForFolding(() async => await subscribeForFolding());
expect(lastRegions, expectedResults);
}
@@ -80,18 +80,18 @@
expect(lastRegions, isNull);
// With no content, there should be zero regions.
- await waitForFolding(() => subscribeForFolding());
+ await waitForFolding(() async => await subscribeForFolding());
expect(lastRegions, hasLength(0));
// With sample code there will be folding regions.
- await waitForFolding(() => modifyTestFile(sampleCode));
+ await waitForFolding(() async => modifyTestFile(sampleCode));
expect(lastRegions, expectedResults);
}
- Future waitForFolding(void Function() action) {
+ Future<void> waitForFolding(Future<void> Function() action) async {
_regionsReceived = Completer();
- action();
+ await action();
return _regionsReceived.future;
}
}
diff --git a/pkg/analysis_server/test/analysis/notification_highlights2_test.dart b/pkg/analysis_server/test/analysis/notification_highlights2_test.dart
index f74517f..6b6ebd6 100644
--- a/pkg/analysis_server/test/analysis/notification_highlights2_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_highlights2_test.dart
@@ -1041,6 +1041,19 @@
assertHasRegion(HighlightRegionType.KEYWORD, 'with A;');
}
+ Future<void> test_KEYWORD_const_constructor() async {
+ addTestFile('''
+class A {
+ const A(); // 1
+}
+const a = const A(); // 2
+''');
+ await prepareHighlights();
+ assertHasRegion(HighlightRegionType.KEYWORD, 'const A(); // 1');
+ assertHasRegion(HighlightRegionType.KEYWORD, 'const a =');
+ assertHasRegion(HighlightRegionType.KEYWORD, 'const A(); // 2');
+ }
+
Future<void> test_KEYWORD_const_list() async {
addTestFile('''
var v = const [];
@@ -1649,8 +1662,8 @@
return length;
}
- Future prepareHighlights() {
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
+ Future<void> prepareHighlights() async {
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
return _resultsAvailable.future;
}
diff --git a/pkg/analysis_server/test/analysis/notification_implemented_test.dart b/pkg/analysis_server/test/analysis/notification_implemented_test.dart
index c7e6989..0544f28 100644
--- a/pkg/analysis_server/test/analysis/notification_implemented_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_implemented_test.dart
@@ -85,8 +85,8 @@
}
/// Subscribe for `IMPLEMENTED` and wait for the notification.
- Future prepareImplementedElements() {
- subscribeForImplemented();
+ Future<void> prepareImplementedElements() async {
+ await subscribeForImplemented();
return waitForImplementedElements();
}
@@ -107,9 +107,9 @@
await createProject();
}
- void subscribeForImplemented() {
+ Future<void> subscribeForImplemented() async {
setPriorityFiles([testFile]);
- addAnalysisSubscription(AnalysisService.IMPLEMENTED, testFile);
+ await addAnalysisSubscription(AnalysisService.IMPLEMENTED, testFile);
}
Future<void> test_afterAnalysis() async {
@@ -123,7 +123,7 @@
}
Future<void> test_afterIncrementalResolution() async {
- subscribeForImplemented();
+ await subscribeForImplemented();
addTestFile('''
class A {}
class B extends A {}
diff --git a/pkg/analysis_server/test/analysis/notification_navigation_test.dart b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
index fc40e2d..71a606a 100644
--- a/pkg/analysis_server/test/analysis/notification_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
@@ -178,8 +178,8 @@
class AnalysisNotificationNavigationTest extends AbstractNavigationTest {
final Completer<void> _resultsAvailable = Completer();
- Future prepareNavigation() async {
- addAnalysisSubscription(AnalysisService.NAVIGATION, testFile);
+ Future<void> prepareNavigation() async {
+ await addAnalysisSubscription(AnalysisService.NAVIGATION, testFile);
await _resultsAvailable.future;
assertRegionsSorted();
}
@@ -257,7 +257,7 @@
''');
await prepareNavigation();
assertHasRegionString('A<int>(0)', 'A'.length);
- assertHasTarget('A(_);', 0);
+ assertHasTarget('A(_);');
}
Future<void> test_annotationConstructor_implicit() async {
@@ -333,7 +333,7 @@
''');
await prepareNavigation();
assertHasRegionString('A()', 'A'.length);
- assertHasTarget('A();', 0);
+ assertHasTarget('A();');
}
Future<void> test_annotationField() async {
@@ -391,7 +391,7 @@
await prepareNavigation();
// has region for complete "A.named"
assertHasRegion('A(BBB');
- assertHasTarget('A(BBB', 0);
+ assertHasTarget('A(BBB');
// validate that we don't forget to resolve parameters
assertHasRegionTarget('BBB p', 'BBB {}');
}
@@ -422,8 +422,8 @@
}
''');
await prepareNavigation();
- assertHasRegionTarget('A.new;', 'A();', targetLength: 0);
- assertHasRegionTarget('new;', 'A();', targetLength: 0);
+ assertHasRegionTarget('A.new;', 'A();');
+ assertHasRegionTarget('new;', 'A();');
}
Future<void> test_class_constructorReference_unnamed_declared_new() async {
@@ -542,7 +542,7 @@
''');
await prepareNavigation();
assertHasRegion('B;');
- assertHasTarget('B() {}', 0);
+ assertHasTarget('B() {}');
}
Future<void>
@@ -559,7 +559,7 @@
await prepareNavigation();
{
assertHasRegion('C<A>');
- assertHasTarget('C() {}', 0);
+ assertHasTarget('C() {}');
}
{
assertHasRegion('A>;');
@@ -652,10 +652,10 @@
''');
await prepareNavigation();
- assertHasRegionTarget('v1', 'E();', targetLength: 0);
- assertHasRegionTarget('v2()', 'E();', targetLength: 0);
- assertHasRegionTarget('v3', 'E();', targetLength: 0);
- assertHasRegionTarget('new()', 'E();', targetLength: 0);
+ assertHasRegionTarget('v1', 'E();');
+ assertHasRegionTarget('v2()', 'E();');
+ assertHasRegionTarget('v3', 'E();');
+ assertHasRegionTarget('new()', 'E();');
}
Future<void> test_enum_field() async {
@@ -1020,7 +1020,7 @@
''');
await prepareNavigation();
assertHasRegionString('A();', 'A'.length);
- assertHasTarget('A() {}', 0);
+ assertHasTarget('A() {}');
}
Future<void> test_instanceCreation_unnamed_withTypeArgument() async {
@@ -1036,7 +1036,7 @@
await prepareNavigation();
{
assertHasRegionString('B<A>();', 'B'.length);
- assertHasTarget('B() {}', 0);
+ assertHasTarget('B() {}');
}
{
assertHasRegion('A>();');
@@ -1208,7 +1208,7 @@
await prepareNavigation();
{
assertHasRegion('this();');
- assertHasTarget('A() {}', 0);
+ assertHasTarget('A() {}');
}
{
assertHasRegion('this.foo');
@@ -1308,7 +1308,7 @@
await prepareNavigation();
{
assertHasRegionString('super');
- assertHasTarget('A() {}', 0);
+ assertHasTarget('A() {}');
}
{
assertHasRegion('super.named');
diff --git a/pkg/analysis_server/test/analysis/notification_occurrences_test.dart b/pkg/analysis_server/test/analysis/notification_occurrences_test.dart
index 5bf1c3b..ca7d1e2 100644
--- a/pkg/analysis_server/test/analysis/notification_occurrences_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_occurrences_test.dart
@@ -71,8 +71,8 @@
}
}
- Future prepareOccurrences() {
- addAnalysisSubscription(AnalysisService.OCCURRENCES, testFile);
+ Future<void> prepareOccurrences() async {
+ await addAnalysisSubscription(AnalysisService.OCCURRENCES, testFile);
return _resultsAvailable.future;
}
diff --git a/pkg/analysis_server/test/analysis/notification_outline_test.dart b/pkg/analysis_server/test/analysis/notification_outline_test.dart
index 8db0451..14dc697 100644
--- a/pkg/analysis_server/test/analysis/notification_outline_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_outline_test.dart
@@ -28,8 +28,8 @@
final Completer<void> _outlineReceived = Completer();
Completer? _highlightsReceived = Completer();
- Future prepareOutline() {
- addAnalysisSubscription(AnalysisService.OUTLINE, testFile);
+ Future<void> prepareOutline() async {
+ await addAnalysisSubscription(AnalysisService.OUTLINE, testFile);
return _outlineReceived.future;
}
@@ -125,7 +125,7 @@
// Make the file a priority one and subscribe for other notification.
// This will pre-cache the analysis result for the file.
setPriorityFiles([testFile]);
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
await _highlightsReceived!.future;
// Now subscribe for outline notification, we must get it even though
diff --git a/pkg/analysis_server/test/analysis/notification_overrides_test.dart b/pkg/analysis_server/test/analysis/notification_overrides_test.dart
index 2e10b24..77b9230 100644
--- a/pkg/analysis_server/test/analysis/notification_overrides_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_overrides_test.dart
@@ -104,8 +104,8 @@
}
}
- Future prepareOverrides() {
- addAnalysisSubscription(AnalysisService.OVERRIDES, testFile);
+ Future<void> prepareOverrides() async {
+ await addAnalysisSubscription(AnalysisService.OVERRIDES, testFile);
return _resultsAvailable.future;
}
diff --git a/pkg/analysis_server/test/analysis_abstract.dart b/pkg/analysis_server/test/analysis_abstract.dart
index b6014a5..1bf61f7 100644
--- a/pkg/analysis_server/test/analysis_abstract.dart
+++ b/pkg/analysis_server/test/analysis_abstract.dart
@@ -63,7 +63,8 @@
AnalysisDriver get testDiver => server.getAnalysisDriver(testFile)!;
- void addAnalysisSubscription(AnalysisService service, String file) {
+ Future<void> addAnalysisSubscription(
+ AnalysisService service, String file) async {
// add file to subscription
var files = analysisSubscriptions[service];
if (files == null) {
@@ -74,7 +75,7 @@
// set subscriptions
var request =
AnalysisSetSubscriptionsParams(analysisSubscriptions).toRequest('0');
- handleSuccessfulRequest(request);
+ await waitResponse(request);
}
void addGeneralAnalysisSubscription(GeneralAnalysisService service) {
@@ -211,7 +212,7 @@
}
/// Returns a [Future] that completes when the server's analysis is complete.
- Future waitForTasksFinished() {
+ Future<void> waitForTasksFinished() {
return server.onAnalysisComplete;
}
diff --git a/pkg/analysis_server/test/analysis_server_base.dart b/pkg/analysis_server/test/analysis_server_base.dart
new file mode 100644
index 0000000..6d6a1bf
--- /dev/null
+++ b/pkg/analysis_server/test/analysis_server_base.dart
@@ -0,0 +1,236 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// 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 'dart:async';
+
+import 'package:analysis_server/src/analysis_server.dart';
+import 'package:analysis_server/src/domain_analysis.dart';
+import 'package:analysis_server/src/domain_completion.dart';
+import 'package:analysis_server/src/protocol_server.dart';
+import 'package:analysis_server/src/server/crash_reporting_attachments.dart';
+import 'package:analysis_server/src/utilities/mocks.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/instrumentation/service.dart';
+import 'package:analyzer/src/dart/analysis/experiments.dart';
+import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer/src/test_utilities/mock_sdk.dart';
+import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
+import 'package:meta/meta.dart';
+import 'package:test/test.dart';
+
+import 'mocks.dart';
+
+/// TODO(scheglov) this is duplicate
+class AnalysisOptionsFileConfig {
+ final List<String> experiments;
+ final bool implicitCasts;
+ final bool implicitDynamic;
+ final List<String> lints;
+ final bool strictCasts;
+ final bool strictInference;
+ final bool strictRawTypes;
+
+ AnalysisOptionsFileConfig({
+ this.experiments = const [],
+ this.implicitCasts = true,
+ this.implicitDynamic = true,
+ this.lints = const [],
+ this.strictCasts = false,
+ this.strictInference = false,
+ this.strictRawTypes = false,
+ });
+
+ String toContent() {
+ var buffer = StringBuffer();
+
+ buffer.writeln('analyzer:');
+ buffer.writeln(' enable-experiment:');
+ for (var experiment in experiments) {
+ buffer.writeln(' - $experiment');
+ }
+ buffer.writeln(' language:');
+ buffer.writeln(' strict-casts: $strictCasts');
+ buffer.writeln(' strict-inference: $strictInference');
+ buffer.writeln(' strict-raw-types: $strictRawTypes');
+ buffer.writeln(' strong-mode:');
+ buffer.writeln(' implicit-casts: $implicitCasts');
+ buffer.writeln(' implicit-dynamic: $implicitDynamic');
+
+ buffer.writeln('linter:');
+ buffer.writeln(' rules:');
+ for (var lint in lints) {
+ buffer.writeln(' - $lint');
+ }
+
+ return buffer.toString();
+ }
+}
+
+class PubPackageAnalysisServerTest with ResourceProviderMixin {
+ late final MockServerChannel serverChannel;
+ late final AnalysisServer server;
+
+ AnalysisDomainHandler get analysisDomain {
+ return server.handlers.whereType<AnalysisDomainHandler>().single;
+ }
+
+ CompletionDomainHandler get completionDomain {
+ return server.handlers.whereType<CompletionDomainHandler>().single;
+ }
+
+ List<String> get experiments => [
+ EnableString.enhanced_enums,
+ EnableString.named_arguments_anywhere,
+ EnableString.super_parameters,
+ ];
+
+ File get testFile => getFile(testFilePath);
+
+ String get testFileContent => testFile.readAsStringSync();
+
+ String get testFilePath => '$testPackageLibPath/test.dart';
+
+ String get testFilePathPlatform => convertPath(testFilePath);
+
+ String get testPackageLibPath => '$testPackageRootPath/lib';
+
+ Folder get testPackageRoot => getFolder(testPackageRootPath);
+
+ String get testPackageRootPath => '$workspaceRootPath/test';
+
+ String get testPackageTestPath => '$testPackageRootPath/test';
+
+ String get workspaceRootPath => '/home';
+
+ void assertResponseFailure(
+ Response response, {
+ required String requestId,
+ required RequestErrorCode errorCode,
+ }) {
+ expect(
+ response,
+ isResponseFailure(requestId, errorCode),
+ );
+ }
+
+ void deleteTestPackageAnalysisOptionsFile() {
+ deleteAnalysisOptionsYamlFile(testPackageRootPath);
+ }
+
+ void deleteTestPackageConfigJsonFile() {
+ deletePackageConfigJsonFile(testPackageRootPath);
+ }
+
+ /// Returns the offset of [search] in [testFileContent].
+ /// Fails if not found.
+ /// TODO(scheglov) Rename it.
+ int findOffset(String search) {
+ var offset = testFileContent.indexOf(search);
+ expect(offset, isNot(-1));
+ return offset;
+ }
+
+ Future<Response> handleRequest(Request request) async {
+ return await serverChannel.sendRequest(request);
+ }
+
+ /// Validates that the given [request] is handled successfully.
+ Future<Response> handleSuccessfulRequest(Request request) async {
+ var response = await handleRequest(request);
+ expect(response, isResponseSuccess(request.id));
+ return response;
+ }
+
+ void processNotification(Notification notification) {}
+
+ Future<void> setRoots({
+ required List<String> included,
+ required List<String> excluded,
+ }) async {
+ var includedConverted = included.map(convertPath).toList();
+ var excludedConverted = excluded.map(convertPath).toList();
+ await handleSuccessfulRequest(
+ AnalysisSetAnalysisRootsParams(
+ includedConverted,
+ excludedConverted,
+ packageRoots: {},
+ ).toRequest('0'),
+ );
+ }
+
+ @mustCallSuper
+ void setUp() {
+ serverChannel = MockServerChannel();
+
+ var sdkRoot = newFolder('/sdk');
+ createMockSdk(
+ resourceProvider: resourceProvider,
+ root: sdkRoot,
+ );
+
+ writeTestPackageConfig();
+
+ writeTestPackageAnalysisOptionsFile(
+ AnalysisOptionsFileConfig(
+ experiments: experiments,
+ ),
+ );
+
+ serverChannel.notifications.listen(processNotification);
+
+ server = AnalysisServer(
+ serverChannel,
+ resourceProvider,
+ AnalysisServerOptions(),
+ DartSdkManager(sdkRoot.path),
+ CrashReportingAttachmentsBuilder.empty,
+ InstrumentationService.NULL_SERVICE,
+ );
+
+ server.pendingFilesRemoveOverlayDelay = const Duration(milliseconds: 10);
+ completionDomain.budgetDuration = const Duration(seconds: 30);
+ }
+
+ Future<void> tearDown() async {
+ await server.dispose();
+ }
+
+ void writePackageConfig(Folder root, PackageConfigFileBuilder config) {
+ newPackageConfigJsonFile(
+ root.path,
+ config.toContent(toUriStr: toUriStr),
+ );
+ }
+
+ void writeTestPackageAnalysisOptionsFile(AnalysisOptionsFileConfig config) {
+ newAnalysisOptionsYamlFile2(
+ testPackageRootPath,
+ config.toContent(),
+ );
+ }
+
+ void writeTestPackageConfig({
+ PackageConfigFileBuilder? config,
+ String? languageVersion,
+ }) {
+ if (config == null) {
+ config = PackageConfigFileBuilder();
+ } else {
+ config = config.copy();
+ }
+
+ config.add(
+ name: 'test',
+ rootPath: testPackageRootPath,
+ languageVersion: languageVersion,
+ );
+
+ writePackageConfig(testPackageRoot, config);
+ }
+
+ void writeTestPackagePubspecYamlFile(String content) {
+ newPubspecYamlFile(testPackageRootPath, content);
+ }
+}
diff --git a/pkg/analysis_server/test/client/completion_driver_test.dart b/pkg/analysis_server/test/client/completion_driver_test.dart
index 9cb255d..7090fc1 100644
--- a/pkg/analysis_server/test/client/completion_driver_test.dart
+++ b/pkg/analysis_server/test/client/completion_driver_test.dart
@@ -8,7 +8,7 @@
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../domain_completion_test.dart';
+import '../analysis_server_base.dart';
import '../services/completion/dart/completion_check.dart';
import '../services/completion/dart/completion_contributor_util.dart';
import 'impl/completion_driver.dart';
diff --git a/pkg/analysis_server/test/client/impl/completion_driver.dart b/pkg/analysis_server/test/client/impl/completion_driver.dart
index 3383e6c..df8faf3 100644
--- a/pkg/analysis_server/test/client/impl/completion_driver.dart
+++ b/pkg/analysis_server/test/client/impl/completion_driver.dart
@@ -13,8 +13,8 @@
import 'package:matcher/matcher.dart';
import 'package:meta/meta.dart';
+import '../../analysis_server_base.dart';
import '../../constants.dart';
-import '../../domain_completion_test.dart';
import 'expect_mixin.dart';
CompletionSuggestion _createCompletionSuggestionFromAvailableSuggestion(
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index 5c2c45e..8fce9e5 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -14,7 +14,7 @@
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'analysis_abstract.dart';
-import 'domain_completion_test.dart';
+import 'analysis_server_base.dart';
import 'mocks.dart';
void main() {
@@ -1433,7 +1433,7 @@
await waitForTasksFinished();
expect(filesHighlights[testFile], isNull);
// subscribe
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
await _resultsAvailable.future;
// there are results
expect(filesHighlights[testFile], isNotEmpty);
@@ -1447,7 +1447,7 @@
await waitForTasksFinished();
expect(filesHighlights[testFile], isNull);
// subscribe
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, file);
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, file);
await _resultsAvailable.future;
// there are results
expect(filesHighlights[file], isEmpty);
@@ -1476,7 +1476,7 @@
await waitForTasksFinished();
expect(filesHighlights[pkgFile], isNull);
// subscribe
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, pkgFile);
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, pkgFile);
await _resultsAvailable.future;
// there are results
expect(filesHighlights[pkgFile], isNotEmpty);
@@ -1502,7 +1502,7 @@
await waitForTasksFinished();
expect(filesHighlights[pkgFileA], isNull);
// subscribe
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, pkgFileA);
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, pkgFileA);
await _resultsAvailable.future;
// there are results
expect(filesHighlights[pkgFileA], isNotEmpty);
@@ -1528,7 +1528,7 @@
// make it a priority file, so make analyzable
server.setPriorityFiles('0', [pkgFile]);
// subscribe
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, pkgFile);
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, pkgFile);
await _resultsAvailable.future;
// there are results
expect(filesHighlights[pkgFile], isNotEmpty);
@@ -1542,7 +1542,7 @@
await waitForTasksFinished();
expect(filesHighlights[file], isNull);
// subscribe
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, file);
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, file);
await _resultsAvailable.future;
// there are results
expect(filesHighlights[file], isNotEmpty);
@@ -1552,7 +1552,7 @@
addTestFile('int V = 42;');
await createProject();
// subscribe
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
// wait for analysis
await waitForTasksFinished();
expect(filesHighlights[testFile], isNotEmpty);
@@ -1562,7 +1562,7 @@
addTestFile('int V = 42;');
await createProject();
// subscribe
- addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
+ await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
// wait for analysis
await waitForTasksFinished();
var params = pluginManager.analysisSetSubscriptionsParams!;
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index 816c714..ab580d0 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -4,21 +4,11 @@
import 'dart:async';
-import 'package:analysis_server/src/analysis_server.dart';
-import 'package:analysis_server/src/domain_analysis.dart';
-import 'package:analysis_server/src/domain_completion.dart';
import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:analysis_server/src/protocol_server.dart';
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
-import 'package:analysis_server/src/server/crash_reporting_attachments.dart';
-import 'package:analysis_server/src/utilities/mocks.dart';
-import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/instrumentation/service.dart';
-import 'package:analyzer/src/dart/analysis/experiments.dart';
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:analyzer/src/test_utilities/mock_sdk.dart';
import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
-import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
import 'package:analyzer_utilities/check/check.dart';
@@ -26,6 +16,7 @@
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
+import 'analysis_server_base.dart';
import 'domain_completion_util.dart';
import 'mocks.dart';
import 'services/completion/dart/completion_check.dart';
@@ -40,52 +31,6 @@
});
}
-/// TODO(scheglov) this is duplicate
-class AnalysisOptionsFileConfig {
- final List<String> experiments;
- final bool implicitCasts;
- final bool implicitDynamic;
- final List<String> lints;
- final bool strictCasts;
- final bool strictInference;
- final bool strictRawTypes;
-
- AnalysisOptionsFileConfig({
- this.experiments = const [],
- this.implicitCasts = true,
- this.implicitDynamic = true,
- this.lints = const [],
- this.strictCasts = false,
- this.strictInference = false,
- this.strictRawTypes = false,
- });
-
- String toContent() {
- var buffer = StringBuffer();
-
- buffer.writeln('analyzer:');
- buffer.writeln(' enable-experiment:');
- for (var experiment in experiments) {
- buffer.writeln(' - $experiment');
- }
- buffer.writeln(' language:');
- buffer.writeln(' strict-casts: $strictCasts');
- buffer.writeln(' strict-inference: $strictInference');
- buffer.writeln(' strict-raw-types: $strictRawTypes');
- buffer.writeln(' strong-mode:');
- buffer.writeln(' implicit-casts: $implicitCasts');
- buffer.writeln(' implicit-dynamic: $implicitDynamic');
-
- buffer.writeln('linter:');
- buffer.writeln(' rules:');
- for (var lint in lints) {
- buffer.writeln(' - $lint');
- }
-
- return buffer.toString();
- }
-}
-
@reflectiveTest
class CompletionDomainHandlerGetSuggestionDetails2Test
extends PubPackageAnalysisServerTest {
@@ -212,6 +157,11 @@
expect(response.error?.code, RequestErrorCode.INVALID_FILE_PATH_FORMAT);
}
+ Future<void> _configureWithWorkspaceRoot() async {
+ await setRoots(included: [workspaceRootPath], excluded: []);
+ await server.onAnalysisComplete;
+ }
+
Future<CompletionGetSuggestionDetails2Result> _getCodeDetails({
required String path,
required String content,
@@ -1961,6 +1911,11 @@
]);
}
+ Future<void> _configureWithWorkspaceRoot() async {
+ await setRoots(included: [workspaceRootPath], excluded: []);
+ await server.onAnalysisComplete;
+ }
+
Future<CompletionResponseForTesting> _getCodeSuggestions({
required String path,
required String content,
@@ -2940,156 +2895,6 @@
}
}
-class PubPackageAnalysisServerTest with ResourceProviderMixin {
- late final MockServerChannel serverChannel;
- late final AnalysisServer server;
-
- AnalysisDomainHandler get analysisDomain {
- return server.handlers.whereType<AnalysisDomainHandler>().single;
- }
-
- CompletionDomainHandler get completionDomain {
- return server.handlers.whereType<CompletionDomainHandler>().single;
- }
-
- List<String> get experiments => [
- EnableString.enhanced_enums,
- EnableString.named_arguments_anywhere,
- EnableString.super_parameters,
- ];
-
- String get testFileContent => getFile(testFilePath).readAsStringSync();
-
- String get testFilePath => '$testPackageLibPath/test.dart';
-
- String get testFilePathPlatform => convertPath(testFilePath);
-
- String get testPackageLibPath => '$testPackageRootPath/lib';
-
- Folder get testPackageRoot => getFolder(testPackageRootPath);
-
- String get testPackageRootPath => '$workspaceRootPath/test';
-
- String get testPackageTestPath => '$testPackageRootPath/test';
-
- String get workspaceRootPath => '/home';
-
- void deleteTestPackageAnalysisOptionsFile() {
- deleteAnalysisOptionsYamlFile(testPackageRootPath);
- }
-
- void deleteTestPackageConfigJsonFile() {
- deletePackageConfigJsonFile(testPackageRootPath);
- }
-
- Future<Response> handleRequest(Request request) async {
- return await serverChannel.sendRequest(request);
- }
-
- /// Validates that the given [request] is handled successfully.
- Future<Response> handleSuccessfulRequest(Request request) async {
- var response = await handleRequest(request);
- expect(response, isResponseSuccess(request.id));
- return response;
- }
-
- void processNotification(Notification notification) {}
-
- Future<void> setRoots({
- required List<String> included,
- required List<String> excluded,
- }) async {
- var includedConverted = included.map(convertPath).toList();
- var excludedConverted = excluded.map(convertPath).toList();
- await handleSuccessfulRequest(
- AnalysisSetAnalysisRootsParams(
- includedConverted,
- excludedConverted,
- packageRoots: {},
- ).toRequest('0'),
- );
- }
-
- @mustCallSuper
- void setUp() {
- serverChannel = MockServerChannel();
-
- var sdkRoot = newFolder('/sdk');
- createMockSdk(
- resourceProvider: resourceProvider,
- root: sdkRoot,
- );
-
- writeTestPackageConfig();
-
- writeTestPackageAnalysisOptionsFile(
- AnalysisOptionsFileConfig(
- experiments: experiments,
- ),
- );
-
- serverChannel.notifications.listen(processNotification);
-
- server = AnalysisServer(
- serverChannel,
- resourceProvider,
- AnalysisServerOptions(),
- DartSdkManager(sdkRoot.path),
- CrashReportingAttachmentsBuilder.empty,
- InstrumentationService.NULL_SERVICE,
- );
-
- server.pendingFilesRemoveOverlayDelay = const Duration(milliseconds: 10);
- completionDomain.budgetDuration = const Duration(seconds: 30);
- }
-
- Future<void> tearDown() async {
- await server.dispose();
- }
-
- void writePackageConfig(Folder root, PackageConfigFileBuilder config) {
- newPackageConfigJsonFile(
- root.path,
- config.toContent(toUriStr: toUriStr),
- );
- }
-
- void writeTestPackageAnalysisOptionsFile(AnalysisOptionsFileConfig config) {
- newAnalysisOptionsYamlFile2(
- testPackageRootPath,
- config.toContent(),
- );
- }
-
- void writeTestPackageConfig({
- PackageConfigFileBuilder? config,
- String? languageVersion,
- }) {
- if (config == null) {
- config = PackageConfigFileBuilder();
- } else {
- config = config.copy();
- }
-
- config.add(
- name: 'test',
- rootPath: testPackageRootPath,
- languageVersion: languageVersion,
- );
-
- writePackageConfig(testPackageRoot, config);
- }
-
- void writeTestPackagePubspecYamlFile(String content) {
- newPubspecYamlFile(testPackageRootPath, content);
- }
-
- Future<void> _configureWithWorkspaceRoot() async {
- await setRoots(included: [workspaceRootPath], excluded: []);
- await server.onAnalysisComplete;
- }
-}
-
class RequestWithFutureResponse {
final int offset;
final Request request;
diff --git a/pkg/analysis_server/test/edit/format_if_enabled_test.dart b/pkg/analysis_server/test/edit/format_if_enabled_test.dart
new file mode 100644
index 0000000..df10b41
--- /dev/null
+++ b/pkg/analysis_server/test/edit/format_if_enabled_test.dart
@@ -0,0 +1,68 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// 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:analysis_server/protocol/protocol_generated.dart';
+import 'package:analysis_server/src/edit/edit_domain.dart';
+import 'package:analyzer_plugin/protocol/protocol_common.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../analysis_abstract.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(FormatIfEnabledTest);
+ });
+}
+
+@reflectiveTest
+class FormatIfEnabledTest extends AbstractAnalysisTest {
+ @override
+ Future<void> setUp() async {
+ super.setUp();
+ await createProject();
+ handler = EditDomainHandler(server);
+ }
+
+ Future<void> test_enabled() async {
+ newAnalysisOptionsYamlFile2(testFolder, '''
+code-style:
+ format: true
+''');
+ addTestFile('''
+void f() { int x = 3; }
+''');
+ newFile2('$testFolder/a.dart', '''
+class A { A(); }
+''');
+ var edits = await _format();
+ expect(edits, isNotNull);
+ expect(edits, hasLength(2));
+ }
+
+ Future<void> test_notEnabled() async {
+ addTestFile('''
+void f() { int x = 3; }
+''');
+ var edits = await _format();
+ expect(edits, isNotNull);
+ expect(edits, hasLength(0));
+ }
+
+ Future<void> test_withErrors() async {
+ addTestFile('''
+void f() { int x =
+''');
+ var edits = await _format();
+ expect(edits, isNotNull);
+ expect(edits, hasLength(0));
+ }
+
+ Future<List<SourceFileEdit>> _format() async {
+ await waitForTasksFinished();
+ var request = EditFormatIfEnabledParams([testFolder]).toRequest('0');
+ var response = await waitResponse(request);
+ return EditFormatIfEnabledResult.fromResponse(response).edits;
+ }
+}
diff --git a/pkg/analysis_server/test/edit/test_all.dart b/pkg/analysis_server/test/edit/test_all.dart
index 21cf0bc..69ec29c 100644
--- a/pkg/analysis_server/test/edit/test_all.dart
+++ b/pkg/analysis_server/test/edit/test_all.dart
@@ -7,6 +7,7 @@
import 'assists_test.dart' as assists;
import 'bulk_fixes_test.dart' as bulk_fixes;
import 'fixes_test.dart' as fixes;
+import 'format_if_enabled_test.dart' as format_if_enabled;
import 'format_test.dart' as format;
import 'organize_directives_test.dart' as organize_directives;
import 'postfix_completion_test.dart' as postfix_completion;
@@ -20,6 +21,7 @@
bulk_fixes.main();
fixes.main();
format.main();
+ format_if_enabled.main();
organize_directives.main();
postfix_completion.main();
refactoring.main();
diff --git a/pkg/analysis_server/test/integration/coverage.md b/pkg/analysis_server/test/integration/coverage.md
index 9cd7a76..c8b21e4 100644
--- a/pkg/analysis_server/test/integration/coverage.md
+++ b/pkg/analysis_server/test/integration/coverage.md
@@ -47,6 +47,7 @@
## edit domain
- [x] edit.bulkFixes
- [x] edit.format
+- [ ] edit.formatIfEnabled
- [x] edit.getAssists
- [x] edit.getAvailableRefactorings
- [x] edit.getFixes
diff --git a/pkg/analysis_server/test/integration/support/integration_test_methods.dart b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
index bf671b2..e577b4f 100644
--- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
@@ -1610,6 +1610,36 @@
return EditFormatResult.fromJson(decoder, 'result', result);
}
+ /// Format the contents of the files in one or more directories, but only if
+ /// the analysis options file for those files has enabled the 'format'
+ /// option.
+ ///
+ /// If any of the specified directories does not exist, that directory will
+ /// be ignored. If any of the files that are eligible for being formatted
+ /// cannot be formatted because of a syntax error in the file, that file will
+ /// be ignored.
+ ///
+ /// Parameters
+ ///
+ /// directories: List<FilePath>
+ ///
+ /// The paths of the directories containing the code to be formatted.
+ ///
+ /// Returns
+ ///
+ /// edits: List<SourceFileEdit>
+ ///
+ /// The edit(s) to be applied in order to format the code. The list will be
+ /// empty if none of the files were formatted, whether because they were
+ /// not eligible to be formatted or because they were already formatted.
+ Future<EditFormatIfEnabledResult> sendEditFormatIfEnabled(
+ List<String> directories) async {
+ var params = EditFormatIfEnabledParams(directories).toJson();
+ var result = await server.send('edit.formatIfEnabled', params);
+ var decoder = ResponseDecoder(null);
+ return EditFormatIfEnabledResult.fromJson(decoder, 'result', result);
+ }
+
/// Return the set of assists that are available at the given location. An
/// assist is distinguished from a refactoring primarily by the fact that it
/// affects a single file and does not require user input in order to be
diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
index ddf2b9b..84aeaf6 100644
--- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
@@ -2314,6 +2314,22 @@
'edit.bulkFixes result',
{'edits': isListOf(isSourceFileEdit), 'details': isListOf(isBulkFix)}));
+/// edit.formatIfEnabled params
+///
+/// {
+/// "directories": List<FilePath>
+/// }
+final Matcher isEditFormatIfEnabledParams = LazyMatcher(() => MatchesJsonObject(
+ 'edit.formatIfEnabled params', {'directories': isListOf(isFilePath)}));
+
+/// edit.formatIfEnabled result
+///
+/// {
+/// "edits": List<SourceFileEdit>
+/// }
+final Matcher isEditFormatIfEnabledResult = LazyMatcher(() => MatchesJsonObject(
+ 'edit.formatIfEnabled result', {'edits': isListOf(isSourceFileEdit)}));
+
/// edit.format params
///
/// {
diff --git a/pkg/analysis_server/test/lsp/definition_test.dart b/pkg/analysis_server/test/lsp/definition_test.dart
index 1a5e7ee..c8762403 100644
--- a/pkg/analysis_server/test/lsp/definition_test.dart
+++ b/pkg/analysis_server/test/lsp/definition_test.dart
@@ -75,6 +75,34 @@
expect(res, hasLength(0));
}
+ Future<void> test_constructor() async {
+ final contents = '''
+f() {
+ final a = A^();
+}
+
+class A {
+ [[A]]();
+}
+''';
+
+ await testContents(contents);
+ }
+
+ Future<void> test_constructor_named() async {
+ final contents = '''
+f() {
+ final a = A.named^();
+}
+
+class A {
+ A.[[named]]();
+}
+''';
+
+ await testContents(contents);
+ }
+
Future<void> test_fromPlugins() async {
final pluginAnalyzedFilePath = join(projectFolderPath, 'lib', 'foo.foo');
final pluginAnalyzedFileUri = Uri.file(pluginAnalyzedFilePath);
@@ -102,6 +130,16 @@
expect(loc.uri, equals(pluginAnalyzedFileUri.toString()));
}
+ Future<void> test_function() async {
+ final contents = '''
+[[foo]]() {
+ fo^o();
+}
+''';
+
+ await testContents(contents);
+ }
+
Future<void> test_locationLink_field() async {
final mainContents = '''
import 'referenced.dart';
@@ -248,54 +286,33 @@
Future<void> test_sameLine() async {
final contents = '''
- int plusOne(int [[value]]) => 1 + val^ue;
- ''';
+int plusOne(int [[value]]) => 1 + val^ue;
+''';
- await initialize();
- await openFile(mainFileUri, withoutMarkers(contents));
- final res = await getDefinitionAsLocation(
- mainFileUri, positionFromMarker(contents));
-
- expect(res, hasLength(1));
- var loc = res.single;
- expect(loc.range, equals(rangeFromMarkers(contents)));
- expect(loc.uri, equals(mainFileUri.toString()));
+ await testContents(contents);
}
- Future<void> test_singleFile() async {
+ Future<void> test_type() async {
final contents = '''
- [[foo]]() {
- fo^o();
- }
- ''';
+f() {
+ final a = A^;
+}
- await initialize();
- await openFile(mainFileUri, withoutMarkers(contents));
- final res = await getDefinitionAsLocation(
- mainFileUri, positionFromMarker(contents));
+class [[A]] {}
+''';
- expect(res, hasLength(1));
- var loc = res.single;
- expect(loc.range, equals(rangeFromMarkers(contents)));
- expect(loc.uri, equals(mainFileUri.toString()));
+ await testContents(contents);
}
Future<void> test_unopenFile() async {
final contents = '''
- [[foo]]() {
- fo^o();
- }
- ''';
+[[foo]]() {
+ fo^o();
+}
+''';
newFile2(mainFilePath, withoutMarkers(contents));
- await initialize();
- final res = await getDefinitionAsLocation(
- mainFileUri, positionFromMarker(contents));
-
- expect(res, hasLength(1));
- var loc = res.single;
- expect(loc.range, equals(rangeFromMarkers(contents)));
- expect(loc.uri, equals(mainFileUri.toString()));
+ await testContents(contents, inOpenFile: false);
}
Future<void> test_varKeyword() async {
@@ -305,8 +322,16 @@
class [[MyClass]] {}
''';
+ await testContents(contents);
+ }
+
+ /// Expects definitions at the location of `^` in [contents] will navigate to
+ /// the range in `[[` brackets `]]` in `[contents].
+ Future<void> testContents(String contents, {bool inOpenFile = true}) async {
await initialize();
- await openFile(mainFileUri, withoutMarkers(contents));
+ if (inOpenFile) {
+ await openFile(mainFileUri, withoutMarkers(contents));
+ }
final res = await getDefinitionAsLocation(
mainFileUri, positionFromMarker(contents));
diff --git a/pkg/analysis_server/test/lsp/semantic_tokens_test.dart b/pkg/analysis_server/test/lsp/semantic_tokens_test.dart
index 3b99787..65ddf2f 100644
--- a/pkg/analysis_server/test/lsp/semantic_tokens_test.dart
+++ b/pkg/analysis_server/test/lsp/semantic_tokens_test.dart
@@ -192,7 +192,7 @@
Future<void> test_class_constructors() async {
final content = '''
class MyClass {
- MyClass();
+ const MyClass();
MyClass.named();
factory MyClass.factory() => MyClass();
}
@@ -201,11 +201,13 @@
final b = MyClass.named();
final c = MyClass.factory();
final d = MyClass.named;
+ const e = const MyClass();
''';
final expected = [
_Token('class', SemanticTokenTypes.keyword),
_Token('MyClass', SemanticTokenTypes.class_),
+ _Token('const', SemanticTokenTypes.keyword),
_Token('MyClass', SemanticTokenTypes.class_),
_Token('MyClass', SemanticTokenTypes.class_),
_Token('named', SemanticTokenTypes.method,
@@ -241,6 +243,12 @@
_Token('MyClass', SemanticTokenTypes.class_),
_Token('named', SemanticTokenTypes.method,
[CustomSemanticTokenModifiers.constructor]),
+ _Token('const', SemanticTokenTypes.keyword),
+ _Token('e', SemanticTokenTypes.property,
+ [SemanticTokenModifiers.declaration]),
+ _Token('const', SemanticTokenTypes.keyword),
+ _Token('MyClass', SemanticTokenTypes.class_,
+ [CustomSemanticTokenModifiers.constructor]),
];
await initialize();
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_null_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_null_test.dart
index 94cd67f..0c4eaa4 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_null_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_null_test.dart
@@ -46,6 +46,23 @@
@override
String get lintCode => LintNames.prefer_if_null_operators;
+ Future<void> test_conditional_expression() async {
+ await resolveTestCode('''
+void f(bool multiline, int? maxLines) {
+ var lines = maxLines != null
+ ? maxLines
+ : multiline ? 5 : 1;
+ print(lines);
+}
+''');
+ await assertHasFix('''
+void f(bool multiline, int? maxLines) {
+ var lines = maxLines ?? (multiline ? 5 : 1);
+ print(lines);
+}
+''');
+ }
+
Future<void> test_equalEqual() async {
await resolveTestCode('''
void f(String? s) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test_support.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test_support.dart
index 4da84b2..de94b4b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test_support.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test_support.dart
@@ -30,6 +30,14 @@
content);
}
+ /// Add the file in the SDK containing the data used by the data-driven fix
+ /// with the given [content].
+ void addSdkDataFile(String content) {
+ newFile2(
+ '${sdkRoot.path}/lib/_internal/${TransformSetManager.dataFileName}',
+ content);
+ }
+
/// Return a code template that will produce the given [text].
CodeTemplate codeTemplate(String text) {
return CodeTemplate(
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/end_to_end_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/end_to_end_test.dart
index eb13dcf..a9fac6c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/end_to_end_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/end_to_end_test.dart
@@ -163,4 +163,36 @@
void f(New o) {}
''', errorFilter: ignoreUnusedImport);
}
+
+ Future<void> test_replaceBy() async {
+ addSdkDataFile('''
+version: 1
+transforms:
+ - title: "Replace with 'FileMode.read'"
+ date: 2021-09-21
+ element:
+ uris: [ 'dart:io' ]
+ variable: 'READ'
+ changes:
+ - kind: 'replacedBy'
+ newElement:
+ uris: [ 'dart:io' ]
+ inClass: 'FileMode'
+ field: 'read'
+''');
+ await resolveTestCode('''
+import 'dart:io';
+
+int f() {
+ return READ;
+}
+''');
+ await assertHasFix('''
+import 'dart:io';
+
+int f() {
+ return FileMode.read;
+}
+''', errorFilter: ignoreUnusedImport);
+ }
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/sdk_fix_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/sdk_fix_test.dart
index 49604dc..181cf6d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/sdk_fix_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/sdk_fix_test.dart
@@ -2,7 +2,6 @@
// 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:analysis_server/src/services/correction/fix/data_driven/transform_set_manager.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'data_driven_test_support.dart';
@@ -16,12 +15,6 @@
}
class AbstractSdkFixTest extends DataDrivenFixProcessorTest {
- void addSdkDataFile(String content) {
- newFile2(
- '${sdkRoot.path}/lib/_internal/${TransformSetManager.dataFileName}',
- content);
- }
-
@override
void setUp() {
addSdkDataFile('''
diff --git a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
index d2dda69..d8f6a6c 100644
--- a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
+++ b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
@@ -542,6 +542,20 @@
public void edit_format(String file, int selectionOffset, int selectionLength, int lineLength, FormatConsumer consumer);
/**
+ * {@code edit.formatIfEnabled}
+ *
+ * Format the contents of the files in one or more directories, but only if the analysis options
+ * file for those files has enabled the 'format' option.
+ *
+ * If any of the specified directories does not exist, that directory will be ignored. If any of
+ * the files that are eligible for being formatted cannot be formatted because of a syntax error in
+ * the file, that file will be ignored.
+ *
+ * @param directories The paths of the directories containing the code to be formatted.
+ */
+ public void edit_formatIfEnabled(List<String> directories, FormatIfEnabledConsumer consumer);
+
+ /**
* {@code edit.getAssists}
*
* Return the set of assists that are available at the given location. An assist is distinguished
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index 5c07676..d1dbf063 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -2272,6 +2272,41 @@
</field>
</result>
</request>
+ <request method="formatIfEnabled" experimental="true">
+ <p>
+ Format the contents of the files in one or more directories, but only if
+ the analysis options file for those files has enabled the 'format' option.
+ </p>
+ <p>
+ If any of the specified directories does not exist, that directory will be
+ ignored. If any of the files that are eligible for being formatted cannot
+ be formatted because of a syntax error in the file, that file will be
+ ignored.
+ </p>
+ <params>
+ <field name="directories">
+ <list>
+ <ref>FilePath</ref>
+ </list>
+ <p>
+ The paths of the directories containing the code to be formatted.
+ </p>
+ </field>
+ </params>
+ <result>
+ <field name="edits">
+ <list>
+ <ref>SourceFileEdit</ref>
+ </list>
+ <p>
+ The edit(s) to be applied in order to format the code. The list will
+ be empty if none of the files were formatted, whether because they
+ were not eligible to be formatted or because they were already
+ formatted.
+ </p>
+ </field>
+ </result>
+ </request>
<request method="getAssists">
<p>
Return the set of assists that are available at the given
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart
index e8a4e7e..0a14c4f 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart
@@ -194,6 +194,8 @@
const String EDIT_REQUEST_BULK_FIXES_IN_TEST_MODE = 'inTestMode';
const String EDIT_REQUEST_FORMAT = 'edit.format';
const String EDIT_REQUEST_FORMAT_FILE = 'file';
+const String EDIT_REQUEST_FORMAT_IF_ENABLED = 'edit.formatIfEnabled';
+const String EDIT_REQUEST_FORMAT_IF_ENABLED_DIRECTORIES = 'directories';
const String EDIT_REQUEST_FORMAT_LINE_LENGTH = 'lineLength';
const String EDIT_REQUEST_FORMAT_SELECTION_LENGTH = 'selectionLength';
const String EDIT_REQUEST_FORMAT_SELECTION_OFFSET = 'selectionOffset';
@@ -242,6 +244,7 @@
const String EDIT_RESPONSE_BULK_FIXES_DETAILS = 'details';
const String EDIT_RESPONSE_BULK_FIXES_EDITS = 'edits';
const String EDIT_RESPONSE_FORMAT_EDITS = 'edits';
+const String EDIT_RESPONSE_FORMAT_IF_ENABLED_EDITS = 'edits';
const String EDIT_RESPONSE_FORMAT_SELECTION_LENGTH = 'selectionLength';
const String EDIT_RESPONSE_FORMAT_SELECTION_OFFSET = 'selectionOffset';
const String EDIT_RESPONSE_GET_ASSISTS_ASSISTS = 'assists';
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
index 58d9f35..f4bb221 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
@@ -6258,6 +6258,140 @@
);
}
+/// edit.formatIfEnabled params
+///
+/// {
+/// "directories": List<FilePath>
+/// }
+///
+/// Clients may not extend, implement or mix-in this class.
+class EditFormatIfEnabledParams implements RequestParams {
+ /// The paths of the directories containing the code to be formatted.
+ List<String> directories;
+
+ EditFormatIfEnabledParams(this.directories);
+
+ factory EditFormatIfEnabledParams.fromJson(
+ JsonDecoder jsonDecoder, String jsonPath, Object? json) {
+ json ??= {};
+ if (json is Map) {
+ List<String> directories;
+ if (json.containsKey('directories')) {
+ directories = jsonDecoder.decodeList(jsonPath + '.directories',
+ json['directories'], jsonDecoder.decodeString);
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, 'directories');
+ }
+ return EditFormatIfEnabledParams(directories);
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, 'edit.formatIfEnabled params', json);
+ }
+ }
+
+ factory EditFormatIfEnabledParams.fromRequest(Request request) {
+ return EditFormatIfEnabledParams.fromJson(
+ RequestDecoder(request), 'params', request.params);
+ }
+
+ @override
+ Map<String, Object> toJson() {
+ var result = <String, Object>{};
+ result['directories'] = directories;
+ return result;
+ }
+
+ @override
+ Request toRequest(String id) {
+ return Request(id, 'edit.formatIfEnabled', toJson());
+ }
+
+ @override
+ String toString() => json.encode(toJson());
+
+ @override
+ bool operator ==(other) {
+ if (other is EditFormatIfEnabledParams) {
+ return listEqual(
+ directories, other.directories, (String a, String b) => a == b);
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => directories.hashCode;
+}
+
+/// edit.formatIfEnabled result
+///
+/// {
+/// "edits": List<SourceFileEdit>
+/// }
+///
+/// Clients may not extend, implement or mix-in this class.
+class EditFormatIfEnabledResult implements ResponseResult {
+ /// The edit(s) to be applied in order to format the code. The list will be
+ /// empty if none of the files were formatted, whether because they were not
+ /// eligible to be formatted or because they were already formatted.
+ List<SourceFileEdit> edits;
+
+ EditFormatIfEnabledResult(this.edits);
+
+ factory EditFormatIfEnabledResult.fromJson(
+ JsonDecoder jsonDecoder, String jsonPath, Object? json) {
+ json ??= {};
+ if (json is Map) {
+ List<SourceFileEdit> edits;
+ if (json.containsKey('edits')) {
+ edits = jsonDecoder.decodeList(
+ jsonPath + '.edits',
+ json['edits'],
+ (String jsonPath, Object? json) =>
+ SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, 'edits');
+ }
+ return EditFormatIfEnabledResult(edits);
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, 'edit.formatIfEnabled result', json);
+ }
+ }
+
+ factory EditFormatIfEnabledResult.fromResponse(Response response) {
+ return EditFormatIfEnabledResult.fromJson(
+ ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
+ 'result',
+ response.result);
+ }
+
+ @override
+ Map<String, Object> toJson() {
+ var result = <String, Object>{};
+ result['edits'] =
+ edits.map((SourceFileEdit value) => value.toJson()).toList();
+ return result;
+ }
+
+ @override
+ Response toResponse(String id) {
+ return Response(id, result: toJson());
+ }
+
+ @override
+ String toString() => json.encode(toJson());
+
+ @override
+ bool operator ==(other) {
+ if (other is EditFormatIfEnabledResult) {
+ return listEqual(
+ edits, other.edits, (SourceFileEdit a, SourceFileEdit b) => a == b);
+ }
+ return false;
+ }
+
+ @override
+ int get hashCode => edits.hashCode;
+}
+
/// edit.format params
///
/// {
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index c138f7c..627f80a 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -1367,7 +1367,7 @@
@override
int get nameLength {
final nameEnd = this.nameEnd;
- if (nameEnd == null || periodOffset == null) {
+ if (nameEnd == null) {
return 0;
} else {
return nameEnd - nameOffset;
diff --git a/pkg/analyzer/lib/src/dart/element/scope.dart b/pkg/analyzer/lib/src/dart/element/scope.dart
index 7287b59..bf0f7e8 100644
--- a/pkg/analyzer/lib/src/dart/element/scope.dart
+++ b/pkg/analyzer/lib/src/dart/element/scope.dart
@@ -45,7 +45,10 @@
}
void _addGetter(Element element) {
- _addTo(_getters, element);
+ var id = element.name;
+ if (id != null) {
+ _getters[id] ??= element;
+ }
}
void _addPropertyAccessor(PropertyAccessorElement element) {
@@ -57,12 +60,11 @@
}
void _addSetter(Element element) {
- _addTo(_setters, element);
- }
-
- void _addTo(Map<String, Element> map, Element element) {
- var id = element.displayName;
- map[id] ??= element;
+ var name = element.name;
+ if (name != null && name.endsWith('=')) {
+ var id = name.substring(0, name.length - 1);
+ _setters[id] ??= element;
+ }
}
}
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
index ed7b814..5670310 100644
--- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -180,16 +180,15 @@
/// Looks for references to the given Element. All the files currently
/// cached by the resolver are searched, generated files are ignored.
- @Deprecated('Use findReferences2() instead')
- List<CiderSearchMatch> findReferences(Element element,
- {OperationPerformanceImpl? performance}) {
- return logger.run('findReferences for ${element.name}', () {
+ Future<List<CiderSearchMatch>> findReferences2(Element element,
+ {OperationPerformanceImpl? performance}) async {
+ return logger.runAsync('findReferences for ${element.name}', () async {
var references = <CiderSearchMatch>[];
- void collectReferences(
- String path, OperationPerformanceImpl performance) {
- performance.run('collectReferences', (_) {
- var resolved = resolve(path: path);
+ Future<void> collectReferences2(
+ String path, OperationPerformanceImpl performance) async {
+ await performance.runAsync('collectReferences', (_) async {
+ var resolved = await resolve2(path: path);
var collector = ReferencesCollector(element);
resolved.unit.accept(collector);
var offsets = collector.offsets;
@@ -208,40 +207,28 @@
// TODO(keertip): check if element is named constructor.
if (element is LocalVariableElement ||
(element is ParameterElement && !element.isNamed)) {
- collectReferences(element.source!.fullName, performance!);
+ await collectReferences2(element.source!.fullName, performance!);
} else {
var result = performance!.run('getFilesContaining', (performance) {
return fsState!.getFilesContaining(element.displayName);
});
for (var filePath in result) {
- collectReferences(filePath, performance!);
+ await collectReferences2(filePath, performance!);
}
}
return references;
});
}
- /// Looks for references to the given Element. All the files currently
- /// cached by the resolver are searched, generated files are ignored.
- Future<List<CiderSearchMatch>> findReferences2(Element element,
- {OperationPerformanceImpl? performance}) async {
- // ignore: deprecated_member_use_from_same_package
- return findReferences(
- element,
- performance: performance,
- );
- }
-
- @Deprecated('Use getErrors2() instead')
- ErrorsResult getErrors({
+ Future<ErrorsResult> getErrors2({
required String path,
OperationPerformanceImpl? performance,
- }) {
+ }) async {
_throwIfNotAbsoluteNormalizedPath(path);
performance ??= OperationPerformanceImpl('<default>');
- return logger.run('Get errors for $path', () {
+ return logger.runAsync('Get errors for $path', () async {
var fileContext = getFileContext(
path: path,
performance: performance!,
@@ -264,7 +251,7 @@
}
if (errors == null) {
- var unitResult = resolve(
+ var unitResult = await resolve2(
path: path,
performance: performance,
);
@@ -288,17 +275,6 @@
});
}
- Future<ErrorsResult> getErrors2({
- required String path,
- OperationPerformanceImpl? performance,
- }) async {
- // ignore: deprecated_member_use_from_same_package
- return getErrors(
- path: path,
- performance: performance,
- );
- }
-
FileContext getFileContext({
required String path,
required OperationPerformanceImpl performance,
@@ -335,11 +311,10 @@
return fsState.getFilesWithTopLevelDeclarations(name);
}
- @Deprecated('Use getLibraryByUri2() instead')
- LibraryElement getLibraryByUri({
+ Future<LibraryElement> getLibraryByUri2({
required String uriStr,
OperationPerformanceImpl? performance,
- }) {
+ }) async {
performance ??= OperationPerformanceImpl('<default>');
var uri = Uri.parse(uriStr);
@@ -359,8 +334,8 @@
throw ArgumentError('$uri is not a library.');
}
- performance.run('libraryContext', (performance) {
- libraryContext!.load2(
+ await performance.runAsync('libraryContext', (performance) async {
+ await libraryContext!.load(
targetLibrary: file,
performance: performance,
);
@@ -369,17 +344,6 @@
return libraryContext!.elementFactory.libraryOfUri2(uriStr);
}
- Future<LibraryElement> getLibraryByUri2({
- required String uriStr,
- OperationPerformanceImpl? performance,
- }) async {
- // ignore: deprecated_member_use_from_same_package
- return getLibraryByUri(
- uriStr: uriStr,
- performance: performance,
- );
- }
-
String getLibraryLinkedSignature({
required String path,
required OperationPerformanceImpl performance,
@@ -411,12 +375,11 @@
///
/// This method ensures that we discard the libraries context, with all its
/// partially resynthesized data, and so prepare for loading linked summaries
- /// from bytes, which will be done by [getErrors]. It is OK for it to
+ /// from bytes, which will be done by [getErrors2]. It is OK for it to
/// spend some more time on this.
- @Deprecated('Use linkLibraries2() instead')
- void linkLibraries({
+ Future<void> linkLibraries2({
required String path,
- }) {
+ }) async {
_throwIfNotAbsoluteNormalizedPath(path);
var performance = OperationPerformanceImpl('<unused>');
@@ -428,7 +391,7 @@
var file = fileContext.file;
var libraryFile = file.partOfLibrary ?? file;
- libraryContext!.load2(
+ await libraryContext!.load(
targetLibrary: libraryFile,
performance: performance,
);
@@ -436,32 +399,6 @@
_resetContextObjects();
}
- /// Ensure that libraries necessary for resolving [path] are linked.
- ///
- /// Libraries are linked in library cycles, from the bottom to top, so that
- /// when we link a cycle, everything it transitively depends is ready. We
- /// load newly linked libraries from bytes, and when we link a new library
- /// cycle we partially resynthesize AST and elements from previously
- /// loaded libraries.
- ///
- /// But when we are done linking libraries, and want to resolve just the
- /// very top library that transitively depends on the whole dependency
- /// tree, this library will not reference as many elements in the
- /// dependencies as we needed for linking. Most probably it references
- /// elements from directly imported libraries, and a couple of layers below.
- /// So, keeping all previously resynthesized data is usually a waste.
- ///
- /// This method ensures that we discard the libraries context, with all its
- /// partially resynthesized data, and so prepare for loading linked summaries
- /// from bytes, which will be done by [getErrors2]. It is OK for it to
- /// spend some more time on this.
- Future<void> linkLibraries2({
- required String path,
- }) async {
- // ignore: deprecated_member_use_from_same_package
- linkLibraries(path: path);
- }
-
/// Update the cache with list of invalidated ids and clears [removedCacheIds].
void releaseAndClearRemovedIds() {
byteStore.release(removedCacheIds);
@@ -480,18 +417,17 @@
}
/// The [completionLine] and [completionColumn] are zero based.
- @Deprecated('Use resolve2() instead')
- ResolvedUnitResult resolve({
+ Future<ResolvedUnitResult> resolve2({
int? completionLine,
int? completionColumn,
required String path,
OperationPerformanceImpl? performance,
- }) {
+ }) async {
_throwIfNotAbsoluteNormalizedPath(path);
performance ??= OperationPerformanceImpl('<default>');
- return logger.run('Resolve $path', () {
+ return logger.runAsync('Resolve $path', () async {
var fileContext = getFileContext(
path: path,
performance: performance!,
@@ -508,7 +444,7 @@
}
}
- var libraryResult = resolveLibrary(
+ var libraryResult = await resolveLibrary2(
completionLine: completionLine,
completionColumn: completionColumn,
path: libraryFile.path,
@@ -522,30 +458,13 @@
}
/// The [completionLine] and [completionColumn] are zero based.
- Future<ResolvedUnitResult> resolve2({
- int? completionLine,
- int? completionColumn,
- required String path,
- OperationPerformanceImpl? performance,
- }) async {
- // ignore: deprecated_member_use_from_same_package
- return resolve(
- completionLine: completionLine,
- completionColumn: completionColumn,
- path: path,
- performance: performance,
- );
- }
-
- /// The [completionLine] and [completionColumn] are zero based.
- @Deprecated('Use resolveLibrary2() instead')
- ResolvedLibraryResult resolveLibrary({
+ Future<ResolvedLibraryResult> resolveLibrary2({
int? completionLine,
int? completionColumn,
String? completionPath,
required String path,
OperationPerformanceImpl? performance,
- }) {
+ }) async {
_throwIfNotAbsoluteNormalizedPath(path);
performance ??= OperationPerformanceImpl('<default>');
@@ -555,7 +474,7 @@
return cachedResult;
}
- return logger.run('Resolve $path', () {
+ return logger.runAsync('Resolve $path', () async {
var fileContext = getFileContext(
path: path,
performance: performance!,
@@ -578,8 +497,8 @@
completionOffset = lineOffset + completionColumn;
}
- performance.run('libraryContext', (performance) {
- libraryContext!.load2(
+ await performance.runAsync('libraryContext', (performance) async {
+ await libraryContext!.load(
targetLibrary: libraryFile,
performance: performance,
);
@@ -651,24 +570,6 @@
});
}
- /// The [completionLine] and [completionColumn] are zero based.
- Future<ResolvedLibraryResult> resolveLibrary2({
- int? completionLine,
- int? completionColumn,
- String? completionPath,
- required String path,
- OperationPerformanceImpl? performance,
- }) async {
- // ignore: deprecated_member_use_from_same_package
- return resolveLibrary(
- completionLine: completionLine,
- completionColumn: completionColumn,
- completionPath: completionPath,
- path: path,
- performance: performance,
- );
- }
-
/// Make sure that [fsState], [contextObjects], and [libraryContext] are
/// created and configured with the given [fileAnalysisOptions].
///
@@ -909,21 +810,23 @@
}
/// Load data required to access elements of the given [targetLibrary].
- void load2({
+ Future<void> load({
required FileState targetLibrary,
required OperationPerformanceImpl performance,
- }) {
+ }) async {
var librariesLinked = 0;
var librariesLinkedTimer = Stopwatch();
var inputsTimer = Stopwatch();
- void loadBundle(LibraryCycle cycle) {
+ Future<void> loadBundle(LibraryCycle cycle) async {
if (!loadedBundles.add(cycle)) return;
performance.getDataInt('cycleCount').increment();
performance.getDataInt('libraryCount').add(cycle.libraries.length);
- cycle.directDependencies.forEach(loadBundle);
+ for (var directDependency in cycle.directDependencies) {
+ await loadBundle(directDependency);
+ }
var resolutionKey = '${cycle.cyclePathsHash}.resolution';
var resolutionData = byteStore.get(resolutionKey, cycle.signature);
@@ -986,9 +889,7 @@
}
inputsTimer.stop();
- // TODO(scheglov) Migrate when we are ready to switch to async.
- // ignore: deprecated_member_use_from_same_package
- var linkResult = link2.link(elementFactory, inputLibraries);
+ var linkResult = await link2.link2(elementFactory, inputLibraries);
librariesLinked += cycle.libraries.length;
resolutionBytes = linkResult.resolutionBytes;
@@ -1015,9 +916,9 @@
_createElementFactoryTypeProvider();
}
- logger.run('Prepare linked bundles', () {
+ await logger.runAsync('Prepare linked bundles', () async {
var libraryCycle = targetLibrary.libraryCycle;
- loadBundle(libraryCycle);
+ await loadBundle(libraryCycle);
logger.writeln(
'[inputsTimer: ${inputsTimer.elapsedMilliseconds} ms]'
'[librariesLinked: $librariesLinked]'
diff --git a/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
index 2c9c197..f43c056 100644
--- a/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
@@ -105,21 +105,21 @@
constructorElement = _resolver.toLegacyElement(constructorElement);
constructorName?.staticElement = constructorElement;
node.element = constructorElement;
- var annotationInferrer =
- AnnotationInferrer(constructorName: constructorName);
if (constructorElement == null) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.INVALID_ANNOTATION,
node,
);
- annotationInferrer.resolveInvocation(
- resolver: _resolver,
- node: node,
- argumentList: argumentList,
- rawType: null,
- contextType: null,
- whyNotPromotedList: whyNotPromotedList);
+ AnnotationInferrer(
+ resolver: _resolver,
+ node: node,
+ argumentList: argumentList,
+ rawType: null,
+ contextType: null,
+ whyNotPromotedList: whyNotPromotedList,
+ constructorName: constructorName)
+ .resolveInvocation();
return;
}
@@ -129,13 +129,15 @@
);
var constructorRawType = elementToInfer.asType;
- annotationInferrer.resolveInvocation(
- resolver: _resolver,
- node: node,
- argumentList: argumentList,
- rawType: constructorRawType,
- contextType: null,
- whyNotPromotedList: whyNotPromotedList);
+ AnnotationInferrer(
+ resolver: _resolver,
+ node: node,
+ argumentList: argumentList,
+ rawType: constructorRawType,
+ contextType: null,
+ whyNotPromotedList: whyNotPromotedList,
+ constructorName: constructorName)
+ .resolveInvocation();
}
void _extensionGetter(
@@ -401,13 +403,15 @@
AnnotationImpl node, List<WhyNotPromotedGetter> whyNotPromotedList) {
var arguments = node.arguments;
if (arguments != null) {
- AnnotationInferrer(constructorName: null).resolveInvocation(
- resolver: _resolver,
- node: node,
- argumentList: arguments,
- rawType: null,
- contextType: null,
- whyNotPromotedList: whyNotPromotedList);
+ AnnotationInferrer(
+ resolver: _resolver,
+ node: node,
+ argumentList: arguments,
+ rawType: null,
+ contextType: null,
+ whyNotPromotedList: whyNotPromotedList,
+ constructorName: null)
+ .resolveInvocation();
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
index d345b15..03d4601 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
@@ -115,15 +115,14 @@
void _resolve(FunctionExpressionInvocationImpl node, FunctionType rawType,
List<WhyNotPromotedGetter> whyNotPromotedList,
{required DartType? contextType}) {
- var returnType =
- const FunctionExpressionInvocationInferrer().resolveInvocation(
+ var returnType = FunctionExpressionInvocationInferrer(
resolver: _resolver,
node: node,
argumentList: node.argumentList,
rawType: rawType,
whyNotPromotedList: whyNotPromotedList,
contextType: contextType,
- );
+ ).resolveInvocation();
_inferenceHelper.recordStaticType(node, returnType,
contextType: contextType);
@@ -206,13 +205,14 @@
List<WhyNotPromotedGetter> whyNotPromotedList,
{required DartType? contextType}) {
_setExplicitTypeArgumentTypes(node);
- const FunctionExpressionInvocationInferrer().resolveInvocation(
- resolver: _resolver,
- node: node,
- argumentList: node.argumentList,
- rawType: null,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ FunctionExpressionInvocationInferrer(
+ resolver: _resolver,
+ node: node,
+ argumentList: node.argumentList,
+ rawType: null,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList)
+ .resolveInvocation();
node.staticInvokeType = DynamicTypeImpl.instance;
node.staticType = type;
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
index 74c6873..7445573 100644
--- a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
@@ -62,13 +62,14 @@
constructorName: constructorName,
definingLibrary: _resolver.definingLibrary,
);
- const InstanceCreationInferrer().resolveInvocation(
- resolver: _resolver,
- node: node,
- argumentList: node.argumentList,
- rawType: elementToInfer?.asType,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ InstanceCreationInferrer(
+ resolver: _resolver,
+ node: node,
+ argumentList: node.argumentList,
+ rawType: elementToInfer?.asType,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList)
+ .resolveInvocation();
_resolver.inferenceHelper.recordStaticType(
node, node.constructorName.type.type!,
contextType: contextType);
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
index 4112fcde..495866a 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
@@ -170,14 +170,14 @@
required List<WhyNotPromotedGetter> whyNotPromotedList,
required DartType? contextType,
}) {
- var returnType = const MethodInvocationInferrer().resolveInvocation(
+ var returnType = MethodInvocationInferrer(
resolver: _resolver,
node: node,
argumentList: node.argumentList,
rawType: rawType,
contextType: contextType,
whyNotPromotedList: whyNotPromotedList,
- );
+ ).resolveInvocation();
recordStaticType(node, returnType, contextType: contextType);
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
index 128c1cf..9026999 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
@@ -26,28 +26,40 @@
/// arguments filled in.
final SimpleIdentifierImpl? constructorName;
- AnnotationInferrer({required this.constructorName}) : super._();
+ AnnotationInferrer(
+ {required ResolverVisitor resolver,
+ required AnnotationImpl node,
+ required ArgumentListImpl argumentList,
+ required FunctionType? rawType,
+ required DartType? contextType,
+ required List<WhyNotPromotedGetter> whyNotPromotedList,
+ required this.constructorName})
+ : super._(
+ resolver: resolver,
+ node: node,
+ argumentList: argumentList,
+ rawType: rawType,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList);
+
+ @override
+ bool get _isConst => true;
+
+ @override
+ bool get _isGenericInferenceDisabled => !resolver.genericMetadataIsEnabled;
@override
bool get _needsTypeArgumentBoundsCheck => true;
@override
+ TypeArgumentListImpl? get _typeArguments => node.typeArguments;
+
+ @override
ErrorCode get _wrongNumberOfTypeArgumentsErrorCode =>
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS;
@override
- bool _getIsConst(AnnotationImpl node) => true;
-
- @override
- TypeArgumentListImpl? _getTypeArguments(AnnotationImpl node) =>
- node.typeArguments;
-
- @override
- bool _isGenericInferenceDisabled(ResolverVisitor resolver) =>
- !resolver.genericMetadataIsEnabled;
-
- @override
- List<ParameterElement>? _storeResult(AnnotationImpl node,
+ List<ParameterElement>? _storeResult(
List<DartType>? typeArgumentTypes, FunctionType? invokeType) {
if (invokeType != null) {
var constructorElement = ConstructorMember.from(
@@ -66,28 +78,43 @@
/// nodes that require full downward and upward inference.
abstract class FullInvocationInferrer<Node extends AstNodeImpl>
extends InvocationInferrer<Node> {
- const FullInvocationInferrer._();
+ FullInvocationInferrer._(
+ {required ResolverVisitor resolver,
+ required Node node,
+ required ArgumentListImpl argumentList,
+ required FunctionType? rawType,
+ required DartType? contextType,
+ required List<WhyNotPromotedGetter> whyNotPromotedList})
+ : super(
+ resolver: resolver,
+ node: node,
+ argumentList: argumentList,
+ rawType: rawType,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList);
+
+ AstNode get _errorNode => node;
+
+ bool get _isConst => false;
+
+ bool get _isGenericInferenceDisabled => false;
bool get _needsTypeArgumentBoundsCheck => false;
+ TypeArgumentListImpl? get _typeArguments;
+
ErrorCode get _wrongNumberOfTypeArgumentsErrorCode =>
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD;
@override
- DartType resolveInvocation({
- required ResolverVisitor resolver,
- required Node node,
- required ArgumentListImpl argumentList,
- required FunctionType? rawType,
- required DartType? contextType,
- required List<WhyNotPromotedGetter> whyNotPromotedList,
- }) {
- var typeArgumentList = _getTypeArguments(node);
+ DartType resolveInvocation() {
+ var typeArgumentList = _typeArguments;
+ var rawType = this.rawType;
List<DartType>? typeArgumentTypes;
GenericInferrer? inferrer;
Substitution? substitution;
- if (_isGenericInferenceDisabled(resolver)) {
+ if (_isGenericInferenceDisabled) {
if (rawType != null && rawType.typeFormals.isNotEmpty) {
typeArgumentTypes = List.filled(
rawType.typeFormals.length,
@@ -103,7 +130,7 @@
typeArgumentList.arguments.length != rawType.typeFormals.length) {
var typeParameters = rawType.typeFormals;
_reportWrongNumberOfTypeArguments(
- resolver, typeArgumentList, rawType, typeParameters);
+ typeArgumentList, rawType, typeParameters);
typeArgumentTypes = List.filled(
typeParameters.length,
DynamicTypeImpl.instance,
@@ -151,9 +178,9 @@
typeParameters: rawType.typeFormals,
declaredReturnType: rawType.returnType,
contextReturnType: contextType,
- isConst: _getIsConst(node),
+ isConst: _isConst,
errorReporter: resolver.errorReporter,
- errorNode: _getErrorNode(node),
+ errorNode: _errorNode,
genericMetadataIsEnabled: resolver.genericMetadataIsEnabled,
);
@@ -162,14 +189,9 @@
}
List<EqualityInfo<PromotableElement, DartType>?>? identicalInfo =
- _isIdentical(node) ? [] : null;
+ _isIdentical ? [] : null;
var deferredClosures = _visitArguments(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
rawType: rawType,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList,
identicalInfo: identicalInfo,
substitution: substitution,
inferrer: inferrer);
@@ -179,11 +201,7 @@
rawType!.typeFormals, inferrer.partialInfer());
}
_resolveDeferredClosures(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
rawType: rawType,
- contextType: contextType,
deferredClosures: deferredClosures,
identicalInfo: identicalInfo,
substitution: substitution,
@@ -197,7 +215,7 @@
? rawType?.instantiate(typeArgumentTypes)
: rawType;
- var parameters = _storeResult(node, typeArgumentTypes, invokeType);
+ var parameters = _storeResult(typeArgumentTypes, invokeType);
if (parameters != null) {
argumentList.correspondingStaticParameters =
ResolverVisitor.resolveArgumentsToParameters(
@@ -207,32 +225,15 @@
);
}
var returnType = _refineReturnType(
- resolver, node, InvocationInferrer.computeInvokeReturnType(invokeType));
- _recordIdenticalInfo(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
- identicalInfo: identicalInfo);
+ InvocationInferrer.computeInvokeReturnType(invokeType));
+ _recordIdenticalInfo(identicalInfo);
return returnType;
}
- AstNode _getErrorNode(Node node) => node;
+ DartType _refineReturnType(DartType returnType) => returnType;
- bool _getIsConst(Node node) => false;
-
- TypeArgumentListImpl? _getTypeArguments(Node node);
-
- bool _isGenericInferenceDisabled(ResolverVisitor resolver) => false;
-
- DartType _refineReturnType(
- ResolverVisitor resolver, Node node, DartType returnType) =>
- returnType;
-
- void _reportWrongNumberOfTypeArguments(
- ResolverVisitor resolver,
- TypeArgumentList typeArgumentList,
- FunctionType rawType,
- List<TypeParameterElement> typeParameters) {
+ void _reportWrongNumberOfTypeArguments(TypeArgumentList typeArgumentList,
+ FunctionType rawType, List<TypeParameterElement> typeParameters) {
resolver.errorReporter.reportErrorForNode(
_wrongNumberOfTypeArgumentsErrorCode,
typeArgumentList,
@@ -245,7 +246,7 @@
}
List<ParameterElement>? _storeResult(
- Node node, List<DartType>? typeArgumentTypes, FunctionType? invokeType) {
+ List<DartType>? typeArgumentTypes, FunctionType? invokeType) {
return invokeType?.parameters;
}
}
@@ -254,47 +255,68 @@
/// nodes of type [FunctionExpressionInvocation].
class FunctionExpressionInvocationInferrer
extends InvocationExpressionInferrer<FunctionExpressionInvocationImpl> {
- const FunctionExpressionInvocationInferrer() : super._();
+ FunctionExpressionInvocationInferrer(
+ {required ResolverVisitor resolver,
+ required FunctionExpressionInvocationImpl node,
+ required ArgumentListImpl argumentList,
+ required FunctionType? rawType,
+ required DartType? contextType,
+ required List<WhyNotPromotedGetter> whyNotPromotedList})
+ : super._(
+ resolver: resolver,
+ node: node,
+ argumentList: argumentList,
+ rawType: rawType,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList);
@override
- ExpressionImpl _getErrorNode(FunctionExpressionInvocationImpl node) =>
- node.function;
+ ExpressionImpl get _errorNode => node.function;
}
/// Specialization of [InvocationInferrer] for performing type inference on AST
/// nodes of type [InstanceCreationExpression].
class InstanceCreationInferrer
extends FullInvocationInferrer<InstanceCreationExpressionImpl> {
- const InstanceCreationInferrer() : super._();
+ InstanceCreationInferrer(
+ {required ResolverVisitor resolver,
+ required InstanceCreationExpressionImpl node,
+ required ArgumentListImpl argumentList,
+ required FunctionType? rawType,
+ required DartType? contextType,
+ required List<WhyNotPromotedGetter> whyNotPromotedList})
+ : super._(
+ resolver: resolver,
+ node: node,
+ argumentList: argumentList,
+ rawType: rawType,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList);
+
+ @override
+ ConstructorNameImpl get _errorNode => node.constructorName;
+
+ @override
+ bool get _isConst => node.isConst;
@override
bool get _needsTypeArgumentBoundsCheck => true;
@override
- ConstructorNameImpl _getErrorNode(InstanceCreationExpressionImpl node) =>
- node.constructorName;
-
- @override
- bool _getIsConst(InstanceCreationExpressionImpl node) => node.isConst;
-
- @override
- TypeArgumentListImpl? _getTypeArguments(InstanceCreationExpressionImpl node) {
+ TypeArgumentListImpl? get _typeArguments {
// For an instance creation expression the type arguments are on the
// constructor name.
return node.constructorName.type.typeArguments;
}
@override
- void _reportWrongNumberOfTypeArguments(
- ResolverVisitor resolver,
- TypeArgumentList typeArgumentList,
- FunctionType rawType,
- List<TypeParameterElement> typeParameters) {
+ void _reportWrongNumberOfTypeArguments(TypeArgumentList typeArgumentList,
+ FunctionType rawType, List<TypeParameterElement> typeParameters) {
// Error reporting for instance creations is done elsewhere.
}
@override
- List<ParameterElement>? _storeResult(InstanceCreationExpressionImpl node,
+ List<ParameterElement>? _storeResult(
List<DartType>? typeArgumentTypes, FunctionType? invokeType) {
if (invokeType != null) {
var constructedType = invokeType.returnType;
@@ -315,20 +337,33 @@
abstract class InvocationExpressionInferrer<
Node extends InvocationExpressionImpl>
extends FullInvocationInferrer<Node> {
- const InvocationExpressionInferrer._() : super._();
+ InvocationExpressionInferrer._(
+ {required ResolverVisitor resolver,
+ required Node node,
+ required ArgumentListImpl argumentList,
+ required FunctionType? rawType,
+ required DartType? contextType,
+ required List<WhyNotPromotedGetter> whyNotPromotedList})
+ : super._(
+ resolver: resolver,
+ node: node,
+ argumentList: argumentList,
+ rawType: rawType,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList);
@override
- Expression _getErrorNode(Node node) => node.function;
+ Expression get _errorNode => node.function;
@override
- TypeArgumentListImpl? _getTypeArguments(Node node) => node.typeArguments;
+ TypeArgumentListImpl? get _typeArguments => node.typeArguments;
@override
List<ParameterElement>? _storeResult(
- Node node, List<DartType>? typeArgumentTypes, FunctionType? invokeType) {
+ List<DartType>? typeArgumentTypes, FunctionType? invokeType) {
node.typeArgumentTypes = typeArgumentTypes;
node.staticInvokeType = invokeType ?? DynamicTypeImpl.instance;
- return super._storeResult(node, typeArgumentTypes, invokeType);
+ return super._storeResult(typeArgumentTypes, invokeType);
}
}
@@ -338,34 +373,34 @@
/// This class may be used directly for inference of [ExtensionOverride],
/// [RedirectingConstructorInvocation], or [SuperConstructorInvocation].
class InvocationInferrer<Node extends AstNodeImpl> {
- const InvocationInferrer();
+ final ResolverVisitor resolver;
+ final Node node;
+ final ArgumentListImpl argumentList;
+ final FunctionType? rawType;
+ final DartType? contextType;
+ final List<WhyNotPromotedGetter> whyNotPromotedList;
- /// Performs type inference on an invocation expression of type [Node].
- /// [rawType] should be the type of the function the invocation is resolved to
- /// (with type arguments not applied yet).
- void resolveInvocation({
- required ResolverVisitor resolver,
- required Node node,
- required ArgumentListImpl argumentList,
- required FunctionType? rawType,
- required DartType? contextType,
- required List<WhyNotPromotedGetter> whyNotPromotedList,
- }) {
- var deferredClosures = _visitArguments(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
- rawType: rawType,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ /// Prepares to perform type inference on an invocation expression of type
+ /// [Node]. [rawType] should be the type of the function the invocation is
+ /// resolved to (with type arguments not applied yet).
+ InvocationInferrer(
+ {required this.resolver,
+ required this.node,
+ required this.argumentList,
+ required this.rawType,
+ required this.contextType,
+ required this.whyNotPromotedList});
+
+ /// Determines whether [node] is an invocation of the core function
+ /// `identical` (which needs special flow analysis treatment).
+ bool get _isIdentical => false;
+
+ /// Performs type inference on the invocation expression.
+ void resolveInvocation() {
+ var deferredClosures = _visitArguments(rawType: rawType);
if (deferredClosures != null) {
_resolveDeferredClosures(
- resolver: resolver,
- node: node,
- argumentList: argumentList,
- rawType: rawType,
- contextType: contextType,
- deferredClosures: deferredClosures);
+ rawType: rawType, deferredClosures: deferredClosures);
}
}
@@ -373,22 +408,12 @@
/// argument of the invocation. Usually this is just the type of the
/// corresponding parameter, but it can be different for certain primitive
/// numeric operations.
- DartType? _computeContextForArgument(ResolverVisitor resolver, Node node,
- DartType parameterType, DartType? methodInvocationContext) =>
- parameterType;
-
- /// Determines whether [node] is an invocation of the core function
- /// `identical` (which needs special flow analysis treatment).
- bool _isIdentical(Node node) => false;
+ DartType? _computeContextForArgument(DartType parameterType) => parameterType;
/// If the invocation being processed is a call to `identical`, informs flow
/// analysis about it, so that it can do appropriate promotions.
void _recordIdenticalInfo(
- {required ResolverVisitor resolver,
- required Node node,
- required ArgumentListImpl argumentList,
- required List<EqualityInfo<PromotableElement, DartType>?>?
- identicalInfo}) {
+ List<EqualityInfo<PromotableElement, DartType>?>? identicalInfo) {
var flow = resolver.flowAnalysis.flow;
if (identicalInfo != null) {
flow?.equalityOperation_end(argumentList.parent as Expression,
@@ -398,11 +423,7 @@
/// Resolves any closures that were deferred by [_visitArguments].
void _resolveDeferredClosures(
- {required ResolverVisitor resolver,
- required Node node,
- required ArgumentListImpl argumentList,
- required FunctionType? rawType,
- required DartType? contextType,
+ {required FunctionType? rawType,
required List<_DeferredClosure> deferredClosures,
List<EqualityInfo<PromotableElement, DartType>?>? identicalInfo,
Substitution? substitution,
@@ -417,8 +438,7 @@
if (substitution != null) {
parameterType = substitution.substituteType(parameterType);
}
- parameterContextType = _computeContextForArgument(
- resolver, node, parameterType, contextType);
+ parameterContextType = _computeContextForArgument(parameterType);
}
var argument = arguments[deferredArgument.index];
resolver.analyzeExpression(argument, parameterContextType);
@@ -439,12 +459,7 @@
/// be deferred due to the `inference-update-1` feature, a list of them is
/// returned.
List<_DeferredClosure>? _visitArguments(
- {required ResolverVisitor resolver,
- required Node node,
- required ArgumentListImpl argumentList,
- required FunctionType? rawType,
- required DartType? contextType,
- required List<WhyNotPromotedGetter> whyNotPromotedList,
+ {required FunctionType? rawType,
List<EqualityInfo<PromotableElement, DartType>?>? identicalInfo,
Substitution? substitution,
GenericInferrer? inferrer}) {
@@ -498,8 +513,7 @@
if (substitution != null) {
parameterType = substitution.substituteType(parameterType);
}
- parameterContextType = _computeContextForArgument(
- resolver, node, parameterType, contextType);
+ parameterContextType = _computeContextForArgument(parameterType);
}
resolver.analyzeExpression(argument, parameterContextType);
// In case of rewrites, we need to grab the argument again.
@@ -533,29 +547,23 @@
/// nodes of type [MethodInvocation].
class MethodInvocationInferrer
extends InvocationExpressionInferrer<MethodInvocationImpl> {
- const MethodInvocationInferrer() : super._();
+ MethodInvocationInferrer(
+ {required ResolverVisitor resolver,
+ required MethodInvocationImpl node,
+ required ArgumentListImpl argumentList,
+ required FunctionType? rawType,
+ required DartType? contextType,
+ required List<WhyNotPromotedGetter> whyNotPromotedList})
+ : super._(
+ resolver: resolver,
+ node: node,
+ argumentList: argumentList,
+ rawType: rawType,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList);
@override
- DartType? _computeContextForArgument(
- ResolverVisitor resolver,
- MethodInvocationImpl node,
- DartType parameterType,
- DartType? methodInvocationContext) {
- var contextType = super._computeContextForArgument(
- resolver, node, parameterType, methodInvocationContext);
- var targetType = node.realTarget?.staticType;
- if (targetType != null) {
- contextType = resolver.typeSystem.refineNumericInvocationContext(
- targetType,
- node.methodName.staticElement,
- methodInvocationContext,
- parameterType);
- }
- return contextType;
- }
-
- @override
- bool _isIdentical(MethodInvocationImpl node) {
+ bool get _isIdentical {
var invokedMethod = node.methodName.staticElement;
return invokedMethod is FunctionElement &&
invokedMethod.isDartCoreIdentical &&
@@ -563,8 +571,21 @@
}
@override
- DartType _refineReturnType(ResolverVisitor resolver,
- MethodInvocationImpl node, DartType returnType) {
+ DartType? _computeContextForArgument(DartType parameterType) {
+ var argumentContextType = super._computeContextForArgument(parameterType);
+ var targetType = node.realTarget?.staticType;
+ if (targetType != null) {
+ argumentContextType = resolver.typeSystem.refineNumericInvocationContext(
+ targetType,
+ node.methodName.staticElement,
+ contextType,
+ parameterType);
+ }
+ return argumentContextType;
+ }
+
+ @override
+ DartType _refineReturnType(DartType returnType) {
var targetType = node.realTarget?.staticType;
if (targetType != null) {
returnType = resolver.typeSystem.refineNumericInvocationType(
diff --git a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
index ebfd7d4..081bb5d 100644
--- a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
@@ -328,14 +328,14 @@
MethodInvocationImpl node, List<WhyNotPromotedGetter> whyNotPromotedList,
{required DartType? contextType}) {
var rawType = node.methodName.staticType;
- DartType staticStaticType = const MethodInvocationInferrer()
- .resolveInvocation(
+ DartType staticStaticType = MethodInvocationInferrer(
resolver: _resolver,
node: node,
argumentList: node.argumentList,
rawType: rawType is FunctionType ? rawType : null,
contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ whyNotPromotedList: whyNotPromotedList)
+ .resolveInvocation();
_inferenceHelper.recordStaticType(node, staticStaticType,
contextType: contextType);
}
@@ -474,13 +474,14 @@
}
_setExplicitTypeArgumentTypes();
- const MethodInvocationInferrer().resolveInvocation(
- resolver: _resolver,
- node: node,
- argumentList: node.argumentList,
- rawType: rawType,
- whyNotPromotedList: whyNotPromotedList,
- contextType: contextType);
+ MethodInvocationInferrer(
+ resolver: _resolver,
+ node: node,
+ argumentList: node.argumentList,
+ rawType: rawType,
+ whyNotPromotedList: whyNotPromotedList,
+ contextType: contextType)
+ .resolveInvocation();
}
void _resolveReceiverFunctionBounded(
@@ -548,13 +549,14 @@
node.staticInvokeType = _dynamicType;
node.staticType = NeverTypeImpl.instance;
- const MethodInvocationInferrer().resolveInvocation(
- resolver: _resolver,
- node: node,
- argumentList: node.argumentList,
- rawType: null,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ MethodInvocationInferrer(
+ resolver: _resolver,
+ node: node,
+ argumentList: node.argumentList,
+ rawType: null,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList)
+ .resolveInvocation();
_resolver.errorReporter.reportErrorForNode(
HintCode.RECEIVER_OF_TYPE_NEVER,
@@ -568,13 +570,14 @@
node.staticInvokeType = _dynamicType;
node.staticType = _dynamicType;
- const MethodInvocationInferrer().resolveInvocation(
- resolver: _resolver,
- node: node,
- argumentList: node.argumentList,
- rawType: null,
- contextType: contextType,
- whyNotPromotedList: whyNotPromotedList);
+ MethodInvocationInferrer(
+ resolver: _resolver,
+ node: node,
+ argumentList: node.argumentList,
+ rawType: null,
+ contextType: contextType,
+ whyNotPromotedList: whyNotPromotedList)
+ .resolveInvocation();
return;
}
}
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 3c61b28..78180a7 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -1543,22 +1543,23 @@
var receiverContextType =
ExtensionMemberResolver(this).computeOverrideReceiverContextType(node);
- const InvocationInferrer<ExtensionOverrideImpl>().resolveInvocation(
- resolver: this,
- node: node,
- argumentList: node.argumentList,
- rawType: receiverContextType == null
- ? null
- : FunctionTypeImpl(
- typeFormals: const [],
- parameters: [
- ParameterElementImpl.synthetic(
- null, receiverContextType, ParameterKind.REQUIRED)
- ],
- returnType: DynamicTypeImpl.instance,
- nullabilitySuffix: NullabilitySuffix.none),
- contextType: null,
- whyNotPromotedList: whyNotPromotedList);
+ InvocationInferrer<ExtensionOverrideImpl>(
+ resolver: this,
+ node: node,
+ argumentList: node.argumentList,
+ rawType: receiverContextType == null
+ ? null
+ : FunctionTypeImpl(
+ typeFormals: const [],
+ parameters: [
+ ParameterElementImpl.synthetic(
+ null, receiverContextType, ParameterKind.REQUIRED)
+ ],
+ returnType: DynamicTypeImpl.instance,
+ nullabilitySuffix: NullabilitySuffix.none),
+ contextType: null,
+ whyNotPromotedList: whyNotPromotedList)
+ .resolveInvocation();
extensionResolver.resolveOverride(node, whyNotPromotedList);
}
@@ -2167,14 +2168,14 @@
var whyNotPromotedList = <Map<DartType, NonPromotionReason> Function()>[];
elementResolver.visitRedirectingConstructorInvocation(
node as RedirectingConstructorInvocationImpl);
- const InvocationInferrer<RedirectingConstructorInvocationImpl>()
- .resolveInvocation(
+ InvocationInferrer<RedirectingConstructorInvocationImpl>(
resolver: this,
node: node,
argumentList: node.argumentList,
rawType: node.staticElement?.type,
contextType: null,
- whyNotPromotedList: whyNotPromotedList);
+ whyNotPromotedList: whyNotPromotedList)
+ .resolveInvocation();
checkForArgumentTypesNotAssignableInList(
node.argumentList, whyNotPromotedList);
}
@@ -2277,14 +2278,14 @@
var whyNotPromotedList = <Map<DartType, NonPromotionReason> Function()>[];
elementResolver.visitSuperConstructorInvocation(
node as SuperConstructorInvocationImpl);
- const InvocationInferrer<SuperConstructorInvocationImpl>()
- .resolveInvocation(
+ InvocationInferrer<SuperConstructorInvocationImpl>(
resolver: this,
node: node,
argumentList: node.argumentList,
rawType: node.staticElement?.type,
contextType: null,
- whyNotPromotedList: whyNotPromotedList);
+ whyNotPromotedList: whyNotPromotedList)
+ .resolveInvocation();
checkForArgumentTypesNotAssignableInList(
node.argumentList, whyNotPromotedList);
}
diff --git a/pkg/analyzer/test/generated/invalid_code_test.dart b/pkg/analyzer/test/generated/invalid_code_test.dart
index a3f6f3d..96e8861 100644
--- a/pkg/analyzer/test/generated/invalid_code_test.dart
+++ b/pkg/analyzer/test/generated/invalid_code_test.dart
@@ -402,6 +402,19 @@
''');
}
+ test_issue_48688() async {
+ // During parsing we recover as `<synthetic>.bar.baz()`.
+ // So, we have a synthetic empty identifier.
+ // There was a bug - we considered it a reference to the unnamed extension.
+ await _assertCanBeAnalyzed(r'''
+void f() {
+ final foo.bar.baz();
+}
+
+extension on int {}
+''');
+ }
+
test_keywordInConstructorInitializer_assert() async {
await _assertCanBeAnalyzed('''
class C {
diff --git a/pkg/analyzer/test/src/dart/resolution/library_element_test.dart b/pkg/analyzer/test/src/dart/resolution/library_element_test.dart
index 61f0885..27de8e9 100644
--- a/pkg/analyzer/test/src/dart/resolution/library_element_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/library_element_test.dart
@@ -191,6 +191,18 @@
);
}
+ test_lookup_extension_unnamed() async {
+ await assertNoErrorsInCode(r'''
+extension on int {}
+''');
+
+ var scope = result.libraryElement.scope;
+
+ assertElementNull(
+ scope.lookup('').getter,
+ );
+ }
+
test_lookup_implicitCoreImport() async {
await assertNoErrorsInCode('');
diff --git a/pkg/analyzer_plugin/lib/utilities/analyzer_converter.dart b/pkg/analyzer_plugin/lib/utilities/analyzer_converter.dart
index 32445d5..eb3d905 100644
--- a/pkg/analyzer_plugin/lib/utilities/analyzer_converter.dart
+++ b/pkg/analyzer_plugin/lib/utilities/analyzer_converter.dart
@@ -187,7 +187,7 @@
analyzer.ErrorSeverity severity) =>
plugin.AnalysisErrorSeverity(severity.name);
- ///Convert the error [type] from the 'analyzer' package to an analysis error
+ /// Convert the error [type] from the 'analyzer' package to an analysis error
/// type defined by the plugin API.
plugin.AnalysisErrorType convertErrorType(analyzer.ErrorType type) =>
plugin.AnalysisErrorType(type.name);
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 54d8b99..ccae7f7 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -27,7 +27,7 @@
import 'diagnostics/messages.dart' show Message;
import 'dump_info.dart' show DumpInfoTask;
import 'elements/entities.dart';
-import 'enqueue.dart' show Enqueuer, ResolutionEnqueuer;
+import 'enqueue.dart' show Enqueuer;
import 'environment.dart';
import 'inferrer/abstract_value_domain.dart' show AbstractValueStrategy;
import 'inferrer/trivial.dart' show TrivialAbstractValueStrategy;
@@ -50,6 +50,7 @@
import 'options.dart' show CompilerOptions;
import 'phase/load_kernel.dart' as load_kernel;
import 'phase/modular_analysis.dart' as modular_analysis;
+import 'resolution/enqueuer.dart';
import 'serialization/task.dart';
import 'serialization/serialization.dart';
import 'serialization/strategies.dart';
@@ -78,8 +79,8 @@
// These internal flags are used to stop compilation after a specific phase.
// Used only for debugging and testing purposes only.
- bool stopAfterClosedWorld = false;
- bool stopAfterTypeInference = false;
+ bool stopAfterClosedWorldForTesting = false;
+ bool stopAfterGlobalTypeInferenceForTesting = false;
/// Output provider from user of Compiler API.
api.CompilerOutput _outputProvider;
@@ -240,16 +241,6 @@
return success;
});
- bool get onlyPerformGlobalTypeInference {
- return options.readClosedWorldUri != null &&
- options.readDataUri == null &&
- options.readCodegenUri == null;
- }
-
- bool get onlyPerformCodegen {
- return options.readClosedWorldUri != null && options.readDataUri != null;
- }
-
/// Dumps a list of unused [ir.Library]'s in the [KernelResult]. This *must*
/// be called before [setMainAndTrimComponent], because that method will
/// discard the unused [ir.Library]s.
@@ -315,90 +306,8 @@
await runLoadKernel();
} else if (options.modularMode) {
await runModularAnalysis();
- } else if (onlyPerformGlobalTypeInference) {
- ir.Component component =
- await serializationTask.deserializeComponentAndUpdateOptions();
- var closedWorldAndIndices =
- await serializationTask.deserializeClosedWorld(
- environment, abstractValueStrategy, component);
- if (retainDataForTesting) {
- closedWorldIndicesForTesting = closedWorldAndIndices.indices;
- }
- GlobalTypeInferenceResults globalTypeInferenceResults =
- performGlobalTypeInference(closedWorldAndIndices.closedWorld);
- var indices = closedWorldAndIndices.indices;
- if (options.writeDataUri != null) {
- serializationTask.serializeGlobalTypeInference(
- globalTypeInferenceResults, indices);
- return;
- }
- await generateJavaScriptCode(globalTypeInferenceResults,
- indices: indices);
- } else if (onlyPerformCodegen) {
- GlobalTypeInferenceResults globalTypeInferenceResults;
- ir.Component component =
- await serializationTask.deserializeComponentAndUpdateOptions();
- var closedWorldAndIndices =
- await serializationTask.deserializeClosedWorld(
- environment, abstractValueStrategy, component);
- globalTypeInferenceResults =
- await serializationTask.deserializeGlobalTypeInferenceResults(
- environment,
- abstractValueStrategy,
- component,
- closedWorldAndIndices);
- await generateJavaScriptCode(globalTypeInferenceResults,
- indices: closedWorldAndIndices.indices);
} else {
- load_kernel.Output output = await runLoadKernel();
- if (output == null || compilationFailed) return;
-
- ir.Component component = output.component;
- List<Uri> libraries = output.libraries;
- frontendStrategy.registerLoadedLibraries(component, libraries);
- List<ModuleData> data;
- if (options.hasModularAnalysisInputs) {
- data = await serializationTask.deserializeModuleData(component);
- }
- frontendStrategy.registerModuleData(data);
-
- // After we've deserialized modular data, we trim the component of any
- // unnecessary dependencies.
- // Note: It is critical we wait to trim the dill until after we've
- // deserialized modular data because some of this data may reference
- // 'trimmed' elements.
- dumpUnusedLibrariesAndTrimComponent(component, libraries);
- await compileFromKernel(output.rootLibraryUri, libraries);
- }
- }
-
- void generateJavaScriptCode(
- GlobalTypeInferenceResults globalTypeInferenceResults,
- {DataSourceIndices indices}) async {
- JClosedWorld closedWorld = globalTypeInferenceResults.closedWorld;
- backendStrategy.registerJClosedWorld(closedWorld);
- phase = PHASE_COMPILING;
- CodegenInputs codegenInputs =
- backendStrategy.onCodegenStart(globalTypeInferenceResults);
-
- if (options.readCodegenUri != null) {
- CodegenResults codegenResults =
- await serializationTask.deserializeCodegen(backendStrategy,
- globalTypeInferenceResults, codegenInputs, indices);
- reporter.log('Compiling methods');
- runCodegenEnqueuer(codegenResults);
- } else {
- reporter.log('Compiling methods');
- CodegenResults codegenResults = OnDemandCodegenResults(
- globalTypeInferenceResults,
- codegenInputs,
- backendStrategy.functionCompiler);
- if (options.writeCodegenUri != null) {
- serializationTask.serializeCodegen(
- backendStrategy, codegenResults, indices);
- } else {
- runCodegenEnqueuer(codegenResults);
- }
+ await runSequentialPhases();
}
}
@@ -547,6 +456,7 @@
}
_codegenWorldBuilder = codegenEnqueuer.worldBuilder;
+ reporter.log('Compiling methods');
FunctionEntity mainFunction = closedWorld.elementEnvironment.mainFunction;
processQueue(closedWorld.elementEnvironment, codegenEnqueuer, mainFunction,
onProgress: showCodegenProgress);
@@ -597,32 +507,140 @@
globalTypeInferenceResultsData);
}
- void compileFromKernel(Uri rootLibraryUri, Iterable<Uri> libraries) {
- _userCodeLocations.add(CodeLocation(rootLibraryUri));
- selfTask.measureSubtask("compileFromKernel", () {
- JsClosedWorld closedWorld = selfTask.measureSubtask("computeClosedWorld",
- () => computeClosedWorld(rootLibraryUri, libraries));
- if (closedWorld == null) return;
+ Future<load_kernel.Output> loadComponent() async {
+ load_kernel.Output output = await runLoadKernel();
+ if (output == null || compilationFailed) return null;
- if (retainDataForTesting) {
- backendClosedWorldForTesting = closedWorld;
- }
+ ir.Component component = output.component;
+ List<Uri> libraries = output.libraries;
+ frontendStrategy.registerLoadedLibraries(component, libraries);
+ List<ModuleData> data;
+ if (options.hasModularAnalysisInputs) {
+ data = await serializationTask.deserializeModuleData(component);
+ }
+ frontendStrategy.registerModuleData(data);
- if (options.writeClosedWorldUri != null) {
- serializationTask.serializeComponent(
- closedWorld.elementMap.programEnv.mainComponent);
- serializationTask.serializeClosedWorld(closedWorld);
- return;
+ // After we've deserialized modular data, we trim the component of any
+ // unnecessary dependencies.
+ // Note: It is critical we wait to trim the dill until after we've
+ // deserialized modular data because some of this data may reference
+ // 'trimmed' elements.
+ dumpUnusedLibrariesAndTrimComponent(component, libraries);
+ return output;
+ }
+
+ Future<ClosedWorldAndIndices> produceClosedWorld() async {
+ ClosedWorldAndIndices closedWorldAndIndices;
+ if (options.readClosedWorldUri == null) {
+ load_kernel.Output loadKernelOutput = await loadComponent();
+ if (loadKernelOutput != null) {
+ Uri rootLibraryUri = loadKernelOutput.rootLibraryUri;
+ Iterable<Uri> libraries = loadKernelOutput.libraries;
+ _userCodeLocations.add(CodeLocation(rootLibraryUri));
+ JsClosedWorld closedWorld =
+ computeClosedWorld(rootLibraryUri, libraries);
+ closedWorldAndIndices = ClosedWorldAndIndices(closedWorld, null);
+ if (options.writeClosedWorldUri != null) {
+ serializationTask.serializeComponent(
+ closedWorld.elementMap.programEnv.mainComponent);
+ serializationTask.serializeClosedWorld(closedWorld);
+ }
}
- if (stopAfterClosedWorld || options.stopAfterProgramSplit) return;
- GlobalTypeInferenceResults globalInferenceResults =
- performGlobalTypeInference(closedWorld);
- if (options.testMode) {
- globalInferenceResults =
- globalTypeInferenceResultsTestMode(globalInferenceResults);
+ } else {
+ ir.Component component =
+ await serializationTask.deserializeComponentAndUpdateOptions();
+ closedWorldAndIndices = await serializationTask.deserializeClosedWorld(
+ environment, abstractValueStrategy, component);
+ }
+ if (closedWorldAndIndices != null && retainDataForTesting) {
+ backendClosedWorldForTesting = closedWorldAndIndices.closedWorld;
+ closedWorldIndicesForTesting = closedWorldAndIndices.indices;
+ }
+ return closedWorldAndIndices;
+ }
+
+ bool shouldStopAfterClosedWorld(
+ ClosedWorldAndIndices closedWorldAndIndices) =>
+ closedWorldAndIndices == null ||
+ closedWorldAndIndices.closedWorld == null ||
+ stopAfterClosedWorldForTesting ||
+ options.stopAfterProgramSplit ||
+ options.writeClosedWorldUri != null;
+
+ Future<GlobalTypeInferenceResults> produceGlobalTypeInferenceResults(
+ ClosedWorldAndIndices closedWorldAndIndices) async {
+ JsClosedWorld closedWorld = closedWorldAndIndices.closedWorld;
+ GlobalTypeInferenceResults globalTypeInferenceResults;
+ if (options.readDataUri == null) {
+ globalTypeInferenceResults = performGlobalTypeInference(closedWorld);
+ if (options.writeDataUri != null) {
+ serializationTask.serializeGlobalTypeInference(
+ globalTypeInferenceResults, closedWorldAndIndices.indices);
+ } else if (options.testMode) {
+ globalTypeInferenceResults =
+ globalTypeInferenceResultsTestMode(globalTypeInferenceResults);
}
- if (stopAfterTypeInference) return;
- generateJavaScriptCode(globalInferenceResults);
+ } else {
+ globalTypeInferenceResults =
+ await serializationTask.deserializeGlobalTypeInferenceResults(
+ environment,
+ abstractValueStrategy,
+ closedWorld.elementMap.programEnv.mainComponent,
+ closedWorldAndIndices);
+ }
+ return globalTypeInferenceResults;
+ }
+
+ bool get shouldStopAfterGlobalTypeInference =>
+ options.writeDataUri != null || stopAfterGlobalTypeInferenceForTesting;
+
+ CodegenInputs initializeCodegen(
+ GlobalTypeInferenceResults globalTypeInferenceResults) {
+ backendStrategy
+ .registerJClosedWorld(globalTypeInferenceResults.closedWorld);
+ phase = PHASE_COMPILING;
+ return backendStrategy.onCodegenStart(globalTypeInferenceResults);
+ }
+
+ Future<CodegenResults> produceCodegenResults(
+ GlobalTypeInferenceResults globalTypeInferenceResults,
+ DataSourceIndices indices) async {
+ CodegenInputs codegenInputs = initializeCodegen(globalTypeInferenceResults);
+ CodegenResults codegenResults;
+ if (options.readCodegenUri == null) {
+ codegenResults = OnDemandCodegenResults(globalTypeInferenceResults,
+ codegenInputs, backendStrategy.functionCompiler);
+ if (options.writeCodegenUri != null) {
+ serializationTask.serializeCodegen(
+ backendStrategy, codegenResults, indices);
+ }
+ } else {
+ codegenResults = await serializationTask.deserializeCodegen(
+ backendStrategy, globalTypeInferenceResults, codegenInputs, indices);
+ }
+ return codegenResults;
+ }
+
+ bool get shouldStopAfterCodegen => options.writeCodegenUri != null;
+
+ void runSequentialPhases() async {
+ await selfTask.measureSubtask("compileFromKernel", () async {
+ // Load kernel and compute closed world.
+ ClosedWorldAndIndices closedWorldAndIndices = await produceClosedWorld();
+ if (shouldStopAfterClosedWorld(closedWorldAndIndices)) return;
+
+ // Run global analysis.
+ GlobalTypeInferenceResults globalTypeInferenceResults =
+ await produceGlobalTypeInferenceResults(closedWorldAndIndices);
+ if (shouldStopAfterGlobalTypeInference) return;
+
+ // Run codegen.
+ CodegenResults codegenResults = await produceCodegenResults(
+ globalTypeInferenceResults, closedWorldAndIndices.indices);
+ if (shouldStopAfterCodegen) return;
+
+ // Link.
+ runCodegenEnqueuer(codegenResults);
});
}
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index c95ad1b..075a591 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -4,29 +4,14 @@
library dart2js.enqueue;
-import 'dart:collection' show Queue;
-
-import 'common.dart';
import 'common/elements.dart' show ElementEnvironment;
import 'common/tasks.dart' show CompilerTask;
import 'common/work.dart' show WorkItem;
import 'constants/values.dart';
import 'elements/entities.dart';
import 'elements/types.dart';
-import 'js_backend/annotations.dart';
-import 'universe/member_usage.dart';
-import 'universe/resolution_world_builder.dart';
-import 'universe/use.dart'
- show
- ConstantUse,
- DynamicUse,
- StaticUse,
- StaticUseKind,
- TypeUse,
- TypeUseKind;
+import 'universe/use.dart' show ConstantUse, DynamicUse, StaticUse, TypeUse;
import 'universe/world_impact.dart' show WorldImpact, WorldImpactVisitor;
-import 'util/enumset.dart';
-import 'util/util.dart' show Setlet;
abstract class EnqueuerListener {
/// Called to instruct to the backend that [type] has been instantiated.
@@ -152,292 +137,6 @@
}
}
-/// [Enqueuer] which is specific to resolution.
-class ResolutionEnqueuer extends Enqueuer {
- @override
- final CompilerTask task;
- final String name;
- @override
- final EnqueuerListener listener;
-
- final Set<ClassEntity> _recentClasses = Setlet<ClassEntity>();
- bool _recentConstants = false;
- final ResolutionWorldBuilder worldBuilder;
- WorkItemBuilder _workItemBuilder;
- final DiagnosticReporter _reporter;
- final AnnotationsData _annotationsData;
-
- @override
- bool queueIsClosed = false;
-
- @override
- WorldImpactVisitor impactVisitor;
-
- final Queue<WorkItem> _queue = Queue<WorkItem>();
-
- // If not `null` this is called when the queue has been emptied. It allows for
- // applying additional impacts before re-emptying the queue.
- void Function() onEmptyForTesting;
-
- ResolutionEnqueuer(this.task, this._reporter, this.listener,
- this.worldBuilder, this._workItemBuilder, this._annotationsData,
- [this.name = 'resolution enqueuer']) {
- impactVisitor = EnqueuerImpactVisitor(this);
- }
-
- @override
- Iterable<ClassEntity> get directlyInstantiatedClasses =>
- worldBuilder.directlyInstantiatedClasses;
-
- @override
- bool get queueIsEmpty => _queue.isEmpty;
-
- @override
- void checkQueueIsEmpty() {
- if (_queue.isNotEmpty) {
- failedAt(_queue.first.element, "$name queue is not empty.");
- }
- }
-
- void _registerInstantiatedType(InterfaceType type,
- {ConstructorEntity constructor,
- bool nativeUsage = false,
- bool globalDependency = false}) {
- task.measureSubtask('resolution.typeUse', () {
- worldBuilder.registerTypeInstantiation(type, _applyClassUse,
- constructor: constructor);
- listener.registerInstantiatedType(type,
- isGlobal: globalDependency, nativeUsage: nativeUsage);
- });
- }
-
- @override
- bool checkNoEnqueuedInvokedInstanceMethods(
- ElementEnvironment elementEnvironment) {
- if (Enqueuer.skipEnqueuerCheckForTesting) return true;
- return checkEnqueuerConsistency(elementEnvironment);
- }
-
- @override
- void checkClass(ClassEntity cls) {
- worldBuilder.processClassMembers(cls,
- (MemberEntity member, EnumSet<MemberUse> useSet) {
- if (useSet.isNotEmpty) {
- _reporter.internalError(member,
- 'Unenqueued use of $member: ${useSet.iterable(MemberUse.values)}');
- }
- }, checkEnqueuerConsistency: true);
- }
-
- /// Callback for applying the use of a [member].
- void _applyMemberUse(Entity member, EnumSet<MemberUse> useSet) {
- if (useSet.contains(MemberUse.NORMAL)) {
- _addToWorkList(member);
- }
- if (useSet.contains(MemberUse.CLOSURIZE_INSTANCE)) {
- _registerClosurizedMember(member);
- }
- if (useSet.contains(MemberUse.CLOSURIZE_STATIC)) {
- applyImpact(listener.registerGetOfStaticFunction());
- }
- }
-
- /// Callback for applying the use of a [cls].
- void _applyClassUse(ClassEntity cls, EnumSet<ClassUse> useSet) {
- if (useSet.contains(ClassUse.INSTANTIATED)) {
- _recentClasses.add(cls);
- worldBuilder.processClassMembers(cls, _applyMemberUse);
- // We only tell the backend once that [cls] was instantiated, so
- // any additional dependencies must be treated as global
- // dependencies.
- applyImpact(listener.registerInstantiatedClass(cls));
- }
- if (useSet.contains(ClassUse.IMPLEMENTED)) {
- applyImpact(listener.registerImplementedClass(cls));
- }
- }
-
- @override
- void processDynamicUse(DynamicUse dynamicUse) {
- task.measureSubtask('resolution.dynamicUse', () {
- worldBuilder.registerDynamicUse(dynamicUse, _applyMemberUse);
- });
- }
-
- @override
- void processConstantUse(ConstantUse constantUse) {
- task.measureSubtask('resolution.constantUse', () {
- if (worldBuilder.registerConstantUse(constantUse)) {
- applyImpact(listener.registerUsedConstant(constantUse.value));
- _recentConstants = true;
- }
- });
- }
-
- @override
- void processStaticUse(MemberEntity member, StaticUse staticUse) {
- task.measureSubtask('resolution.staticUse', () {
- worldBuilder.registerStaticUse(staticUse, _applyMemberUse);
- // TODO(johnniwinther): Add `ResolutionWorldBuilder.registerConstructorUse`
- // for these:
- switch (staticUse.kind) {
- case StaticUseKind.CONSTRUCTOR_INVOKE:
- case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
- _registerInstantiatedType(staticUse.type,
- constructor: staticUse.element, globalDependency: false);
- break;
- default:
- break;
- }
- });
- }
-
- @override
- void processTypeUse(MemberEntity member, TypeUse typeUse) {
- DartType type = typeUse.type;
- switch (typeUse.kind) {
- case TypeUseKind.INSTANTIATION:
- case TypeUseKind.CONST_INSTANTIATION:
- _registerInstantiatedType(type, globalDependency: false);
- break;
- case TypeUseKind.NATIVE_INSTANTIATION:
- _registerInstantiatedType(type,
- nativeUsage: true, globalDependency: true);
- break;
- case TypeUseKind.IS_CHECK:
- case TypeUseKind.CATCH_TYPE:
- _registerIsCheck(type);
- break;
- case TypeUseKind.AS_CAST:
- if (_annotationsData.getExplicitCastCheckPolicy(member).isEmitted) {
- _registerIsCheck(type);
- }
- break;
- case TypeUseKind.IMPLICIT_CAST:
- if (_annotationsData.getImplicitDowncastCheckPolicy(member).isEmitted) {
- _registerIsCheck(type);
- }
- break;
- case TypeUseKind.PARAMETER_CHECK:
- case TypeUseKind.TYPE_VARIABLE_BOUND_CHECK:
- if (_annotationsData.getParameterCheckPolicy(member).isEmitted) {
- _registerIsCheck(type);
- }
- break;
- case TypeUseKind.TYPE_LITERAL:
- if (type is TypeVariableType) {
- worldBuilder.registerTypeVariableTypeLiteral(type);
- }
- break;
- case TypeUseKind.RTI_VALUE:
- case TypeUseKind.TYPE_ARGUMENT:
- case TypeUseKind.CONSTRUCTOR_REFERENCE:
- failedAt(CURRENT_ELEMENT_SPANNABLE, "Unexpected type use: $typeUse.");
- break;
- case TypeUseKind.NAMED_TYPE_VARIABLE_NEW_RTI:
- assert(type is TypeVariableType);
- _registerNamedTypeVariableNewRti(type);
- break;
- }
- }
-
- void _registerIsCheck(DartType type) {
- worldBuilder.registerIsCheck(type);
- }
-
- void _registerNamedTypeVariableNewRti(TypeVariableType type) {
- worldBuilder.registerNamedTypeVariableNewRti(type);
- }
-
- void _registerClosurizedMember(MemberEntity element) {
- assert(element.isInstanceMember);
- applyImpact(listener.registerClosurizedMember(element));
- worldBuilder.registerClosurizedMember(element);
- }
-
- void _forEach(void f(WorkItem work)) {
- do {
- while (_queue.isNotEmpty) {
- // TODO(johnniwinther): Find an optimal process order.
- WorkItem work = _queue.removeLast();
- if (!worldBuilder.isMemberProcessed(work.element)) {
- f(work);
- worldBuilder.registerProcessedMember(work.element);
- }
- }
- List<ClassEntity> recents = _recentClasses.toList(growable: false);
- _recentClasses.clear();
- _recentConstants = false;
- if (!_onQueueEmpty(recents)) {
- _recentClasses.addAll(recents);
- }
- } while (
- _queue.isNotEmpty || _recentClasses.isNotEmpty || _recentConstants);
- }
-
- @override
- void forEach(void f(WorkItem work)) {
- _forEach(f);
- if (onEmptyForTesting != null) {
- onEmptyForTesting();
- _forEach(f);
- }
- }
-
- @override
- void logSummary(void log(String message)) {
- log('Resolved ${processedEntities.length} elements.');
- listener.logSummary(log);
- }
-
- @override
- String toString() => 'Enqueuer($name)';
-
- @override
- Iterable<MemberEntity> get processedEntities => worldBuilder.processedMembers;
-
- @override
- void close() {
- super.close();
- // Null out _workItemBuilder to release memory (it internally holds large
- // data-structures unnecessary after resolution.)
- _workItemBuilder = null;
- }
-
- /// Registers [entity] as processed by the resolution enqueuer. Used only for
- /// testing.
- void registerProcessedElementInternal(MemberEntity entity) {
- worldBuilder.registerProcessedMember(entity);
- }
-
- /// Create a [WorkItem] for [entity] and add it to the work list if it has not
- /// already been processed.
- void _addToWorkList(MemberEntity entity) {
- if (worldBuilder.isMemberProcessed(entity)) return;
- WorkItem workItem = _workItemBuilder.createWorkItem(entity);
- if (workItem == null) return;
-
- if (queueIsClosed) {
- failedAt(
- entity, "Resolution work list is closed. Trying to add $entity.");
- }
-
- applyImpact(listener.registerUsedElement(entity));
- worldBuilder.registerUsedElement(entity);
- _queue.add(workItem);
- }
-
- /// [_onQueueEmpty] is called whenever the queue is drained. [recentClasses]
- /// contains the set of all classes seen for the first time since
- /// [_onQueueEmpty] was called last. A return value of [true] indicates that
- /// the [recentClasses] have been processed and may be cleared. If [false] is
- /// returned, [_onQueueEmpty] will be called once the queue is empty again (or
- /// still empty) and [recentClasses] will be a superset of the current value.
- bool _onQueueEmpty(Iterable<ClassEntity> recentClasses) {
- return listener.onQueueEmpty(this, recentClasses);
- }
-}
-
class EnqueuerImpactVisitor implements WorldImpactVisitor {
final Enqueuer enqueuer;
diff --git a/pkg/compiler/lib/src/ir/impact.dart b/pkg/compiler/lib/src/ir/impact.dart
index c68ffeb..1ea8f86 100644
--- a/pkg/compiler/lib/src/ir/impact.dart
+++ b/pkg/compiler/lib/src/ir/impact.dart
@@ -3,18 +3,14 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:kernel/ast.dart' as ir;
-import 'package:kernel/class_hierarchy.dart' as ir;
import 'package:kernel/type_environment.dart' as ir;
-import '../common.dart';
import '../serialization/serialization.dart';
import 'constants.dart';
import 'impact_data.dart';
import 'runtime_type_analysis.dart';
-import 'scope.dart';
import 'static_type.dart';
import 'static_type_cache.dart';
-import 'util.dart';
/// Interface for collecting world impact data.
///
@@ -193,501 +189,6 @@
void registerConstConstructorInvocationNode(ir.ConstructorInvocation node);
}
-abstract class ImpactBuilderBase extends StaticTypeVisitor
- implements ImpactRegistry {
- @override
- final VariableScopeModel variableScopeModel;
-
- @override
- final ir.StaticTypeContext staticTypeContext;
-
- ImpactBuilderBase(this.staticTypeContext, StaticTypeCacheImpl staticTypeCache,
- ir.ClassHierarchy classHierarchy, this.variableScopeModel)
- : super(
- staticTypeContext.typeEnvironment, classHierarchy, staticTypeCache);
-
- @override
- void handleIntLiteral(ir.IntLiteral node) {
- registerIntLiteral(node.value);
- }
-
- @override
- void handleDoubleLiteral(ir.DoubleLiteral node) {
- registerDoubleLiteral(node.value);
- }
-
- @override
- void handleBoolLiteral(ir.BoolLiteral node) {
- registerBoolLiteral(node.value);
- }
-
- @override
- void handleStringLiteral(ir.StringLiteral node) {
- registerStringLiteral(node.value);
- }
-
- @override
- void handleSymbolLiteral(ir.SymbolLiteral node) {
- registerSymbolLiteral(node.value);
- }
-
- @override
- void handleNullLiteral(ir.NullLiteral node) {
- registerNullLiteral();
- }
-
- @override
- void handleListLiteral(ir.ListLiteral node) {
- registerListLiteral(node.typeArgument,
- isConst: node.isConst, isEmpty: node.expressions.isEmpty);
- }
-
- @override
- void handleSetLiteral(ir.SetLiteral node) {
- registerSetLiteral(node.typeArgument,
- isConst: node.isConst, isEmpty: node.expressions.isEmpty);
- }
-
- @override
- void handleMapLiteral(ir.MapLiteral node) {
- registerMapLiteral(node.keyType, node.valueType,
- isConst: node.isConst, isEmpty: node.entries.isEmpty);
- }
-
- @override
- void handleStaticGet(
- ir.Expression node, ir.Member target, ir.DartType resultType) {
- assert(!(target is ir.Procedure && target.kind == ir.ProcedureKind.Method),
- "Static tear off registered as static get: $node");
- registerStaticGet(target, getDeferredImport(node));
- }
-
- @override
- void handleStaticTearOff(
- ir.Expression node, ir.Member target, ir.DartType resultType) {
- assert(target is ir.Procedure && target.kind == ir.ProcedureKind.Method,
- "Static get registered as static tear off: $node");
- registerStaticTearOff(target, getDeferredImport(node));
- }
-
- @override
- void handleStaticSet(ir.StaticSet node, ir.DartType valueType) {
- registerStaticSet(node.target, getDeferredImport(node));
- }
-
- @override
- void handleAssertStatement(ir.AssertStatement node) {
- registerAssert(withMessage: node.message != null);
- }
-
- @override
- void handleInstantiation(ir.Instantiation node,
- ir.FunctionType expressionType, ir.DartType resultType) {
- registerGenericInstantiation(expressionType, node.typeArguments);
- }
-
- void handleAsyncMarker(ir.FunctionNode function) {
- ir.AsyncMarker asyncMarker = function.asyncMarker;
- ir.DartType returnType = function.returnType;
-
- switch (asyncMarker) {
- case ir.AsyncMarker.Sync:
- break;
- case ir.AsyncMarker.SyncStar:
- ir.DartType elementType = const ir.DynamicType();
- if (returnType is ir.InterfaceType) {
- if (returnType.classNode == typeEnvironment.coreTypes.iterableClass) {
- elementType = returnType.typeArguments.first;
- }
- }
- registerSyncStar(elementType);
- break;
-
- case ir.AsyncMarker.Async:
- ir.DartType elementType = const ir.DynamicType();
- if (returnType is ir.InterfaceType &&
- returnType.classNode == typeEnvironment.coreTypes.futureClass) {
- elementType = returnType.typeArguments.first;
- } else if (returnType is ir.FutureOrType) {
- elementType = returnType.typeArgument;
- }
- registerAsync(elementType);
- break;
-
- case ir.AsyncMarker.AsyncStar:
- ir.DartType elementType = const ir.DynamicType();
- if (returnType is ir.InterfaceType) {
- if (returnType.classNode == typeEnvironment.coreTypes.streamClass) {
- elementType = returnType.typeArguments.first;
- }
- }
- registerAsyncStar(elementType);
- break;
-
- case ir.AsyncMarker.SyncYielding:
- failedAt(CURRENT_ELEMENT_SPANNABLE,
- "Unexpected async marker: ${asyncMarker}");
- }
- }
-
- @override
- void handleStringConcatenation(ir.StringConcatenation node) {
- registerStringConcatenation();
- }
-
- @override
- Null handleFunctionDeclaration(ir.FunctionDeclaration node) {
- registerLocalFunction(node);
- handleAsyncMarker(node.function);
- }
-
- @override
- void handleFunctionExpression(ir.FunctionExpression node) {
- registerLocalFunction(node);
- handleAsyncMarker(node.function);
- }
-
- @override
- void handleVariableDeclaration(ir.VariableDeclaration node) {
- if (node.initializer == null) {
- registerLocalWithoutInitializer();
- }
- }
-
- @override
- void handleIsExpression(ir.IsExpression node) {
- registerIsCheck(node.type);
- }
-
- @override
- void handleAsExpression(ir.AsExpression node, ir.DartType operandType) {
- if (typeEnvironment.isSubtypeOf(
- operandType, node.type, ir.SubtypeCheckMode.ignoringNullabilities)) {
- // Skip unneeded casts.
- return;
- }
- if (node.isTypeError) {
- registerImplicitCast(node.type);
- } else {
- registerAsCast(node.type);
- }
- }
-
- @override
- void handleThrow(ir.Throw node) {
- registerThrow();
- }
-
- @override
- void handleForInStatement(ir.ForInStatement node, ir.DartType iterableType,
- ir.DartType iteratorType) {
- if (node.isAsync) {
- registerAsyncForIn(iterableType, iteratorType,
- computeClassRelationFromType(iteratorType));
- } else {
- registerSyncForIn(iterableType, iteratorType,
- computeClassRelationFromType(iteratorType));
- }
- }
-
- @override
- void handleCatch(ir.Catch node) {
- registerCatch();
- if (node.stackTrace != null) {
- registerStackTrace();
- }
- if (node.guard is! ir.DynamicType) {
- registerCatchType(node.guard);
- }
- }
-
- @override
- void handleTypeLiteral(ir.TypeLiteral node) {
- registerTypeLiteral(node.type, getDeferredImport(node));
- }
-
- @override
- void handleFieldInitializer(ir.FieldInitializer node) {
- registerFieldInitialization(node.field);
- }
-
- @override
- void handleLoadLibrary(ir.LoadLibrary node) {
- registerLoadLibrary();
- }
-
- @override
- void handleRedirectingInitializer(
- ir.RedirectingInitializer node, ArgumentTypes argumentTypes) {
- registerRedirectingInitializer(
- node.target,
- node.arguments.positional.length,
- _getNamedArguments(node.arguments),
- node.arguments.types);
- }
-
- @override
- void handleParameter(ir.VariableDeclaration parameter) {
- registerParameterCheck(parameter.type);
- }
-
- @override
- void handleSignature(ir.FunctionNode node) {
- for (ir.TypeParameter parameter in node.typeParameters) {
- registerParameterCheck(parameter.bound);
- }
- }
-
- @override
- void handleConstructor(ir.Constructor node) {
- registerConstructorNode(node);
- }
-
- @override
- void handleField(ir.Field field) {
- registerParameterCheck(field.type);
- if (field.initializer != null) {
- if (!field.isInstanceMember &&
- !field.isConst &&
- field.initializer is! ir.NullLiteral) {
- registerLazyField();
- }
- } else {
- registerNullLiteral();
- }
- registerFieldNode(field);
- }
-
- @override
- void handleProcedure(ir.Procedure procedure) {
- handleAsyncMarker(procedure.function);
- registerProcedureNode(procedure);
- }
-
- @override
- void handleConstructorInvocation(ir.ConstructorInvocation node,
- ArgumentTypes argumentTypes, ir.DartType resultType) {
- registerNew(
- node.target,
- node.constructedType,
- node.arguments.positional.length,
- _getNamedArguments(node.arguments),
- node.arguments.types,
- getDeferredImport(node),
- isConst: node.isConst);
- if (node.isConst) {
- registerConstConstructorInvocationNode(node);
- }
- }
-
- @override
- void handleStaticInvocation(ir.StaticInvocation node,
- ArgumentTypes argumentTypes, ir.DartType returnType) {
- int positionArguments = node.arguments.positional.length;
- List<String> namedArguments = _getNamedArguments(node.arguments);
- List<ir.DartType> typeArguments = node.arguments.types;
- if (node.target.kind == ir.ProcedureKind.Factory) {
- // TODO(johnniwinther): We should not mark the type as instantiated but
- // rather follow the type arguments directly.
- //
- // Consider this:
- //
- // abstract class A<T> {
- // factory A.regular() => new B<T>();
- // factory A.redirect() = B<T>;
- // }
- //
- // class B<T> implements A<T> {}
- //
- // main() {
- // print(new A<int>.regular() is B<int>);
- // print(new A<String>.redirect() is B<String>);
- // }
- //
- // To track that B is actually instantiated as B<int> and B<String> we
- // need to follow the type arguments passed to A.regular and A.redirect
- // to B. Currently, we only do this soundly if we register A<int> and
- // A<String> as instantiated. We should instead register that A.T is
- // instantiated as int and String.
- registerNew(
- node.target,
- ir.InterfaceType(node.target.enclosingClass,
- node.target.enclosingLibrary.nonNullable, typeArguments),
- positionArguments,
- namedArguments,
- node.arguments.types,
- getDeferredImport(node),
- isConst: node.isConst);
- } else {
- registerStaticInvocation(node.target, positionArguments, namedArguments,
- typeArguments, getDeferredImport(node));
- }
- registerStaticInvocationNode(node);
- }
-
- @override
- void handleDynamicInvocation(
- ir.InvocationExpression node,
- ir.DartType receiverType,
- ArgumentTypes argumentTypes,
- ir.DartType returnType) {
- int positionArguments = node.arguments.positional.length;
- List<String> namedArguments = _getNamedArguments(node.arguments);
- List<ir.DartType> typeArguments = node.arguments.types;
- ClassRelation relation = computeClassRelationFromType(receiverType);
- registerDynamicInvocation(receiverType, relation, node.name,
- positionArguments, namedArguments, typeArguments);
- }
-
- @override
- void handleFunctionInvocation(
- ir.InvocationExpression node,
- ir.DartType receiverType,
- ArgumentTypes argumentTypes,
- ir.DartType returnType) {
- int positionArguments = node.arguments.positional.length;
- List<String> namedArguments = _getNamedArguments(node.arguments);
- List<ir.DartType> typeArguments = node.arguments.types;
- registerFunctionInvocation(
- receiverType, positionArguments, namedArguments, typeArguments);
- }
-
- @override
- void handleInstanceInvocation(
- ir.InvocationExpression node,
- ir.DartType receiverType,
- ir.Member interfaceTarget,
- ArgumentTypes argumentTypes) {
- int positionArguments = node.arguments.positional.length;
- List<String> namedArguments = _getNamedArguments(node.arguments);
- List<ir.DartType> typeArguments = node.arguments.types;
- ClassRelation relation = computeClassRelationFromType(receiverType);
-
- if (interfaceTarget is ir.Field ||
- interfaceTarget is ir.Procedure &&
- interfaceTarget.kind == ir.ProcedureKind.Getter) {
- registerInstanceInvocation(receiverType, relation, interfaceTarget,
- positionArguments, namedArguments, typeArguments);
- registerFunctionInvocation(interfaceTarget.getterType, positionArguments,
- namedArguments, typeArguments);
- } else {
- registerInstanceInvocation(receiverType, relation, interfaceTarget,
- positionArguments, namedArguments, typeArguments);
- }
- }
-
- @override
- void handleLocalFunctionInvocation(
- ir.InvocationExpression node,
- ir.FunctionDeclaration function,
- ArgumentTypes argumentTypes,
- ir.DartType returnType) {
- int positionArguments = node.arguments.positional.length;
- List<String> namedArguments = _getNamedArguments(node.arguments);
- List<ir.DartType> typeArguments = node.arguments.types;
- registerLocalFunctionInvocation(
- function, positionArguments, namedArguments, typeArguments);
- }
-
- @override
- void handleEqualsCall(ir.Expression left, ir.DartType leftType,
- ir.Expression right, ir.DartType rightType, ir.Member interfaceTarget) {
- ClassRelation relation = computeClassRelationFromType(leftType);
- registerInstanceInvocation(leftType, relation, interfaceTarget, 1,
- const <String>[], const <ir.DartType>[]);
- }
-
- @override
- void handleEqualsNull(ir.EqualsNull node, ir.DartType expressionType) {
- registerNullLiteral();
- }
-
- @override
- void handleDynamicGet(ir.Expression node, ir.DartType receiverType,
- ir.Name name, ir.DartType resultType) {
- ClassRelation relation = computeClassRelationFromType(receiverType);
- registerDynamicGet(receiverType, relation, name);
- }
-
- @override
- void handleInstanceGet(ir.Expression node, ir.DartType receiverType,
- ir.Member interfaceTarget, ir.DartType resultType) {
- ClassRelation relation = computeClassRelationFromType(receiverType);
- registerInstanceGet(receiverType, relation, interfaceTarget);
- }
-
- @override
- void handleDynamicSet(ir.Expression node, ir.DartType receiverType,
- ir.Name name, ir.DartType valueType) {
- ClassRelation relation = computeClassRelationFromType(receiverType);
- registerDynamicSet(receiverType, relation, name);
- }
-
- @override
- void handleInstanceSet(ir.Expression node, ir.DartType receiverType,
- ir.Member interfaceTarget, ir.DartType valueType) {
- ClassRelation relation = computeClassRelationFromType(receiverType);
- registerInstanceSet(receiverType, relation, interfaceTarget);
- }
-
- @override
- void handleSuperMethodInvocation(ir.SuperMethodInvocation node,
- ArgumentTypes argumentTypes, ir.DartType returnType) {
- registerSuperInvocation(
- getEffectiveSuperTarget(node.interfaceTarget),
- node.arguments.positional.length,
- _getNamedArguments(node.arguments),
- node.arguments.types);
- }
-
- @override
- void handleSuperPropertyGet(
- ir.SuperPropertyGet node, ir.DartType resultType) {
- registerSuperGet(getEffectiveSuperTarget(node.interfaceTarget));
- }
-
- @override
- void handleSuperPropertySet(ir.SuperPropertySet node, ir.DartType valueType) {
- registerSuperSet(getEffectiveSuperTarget(node.interfaceTarget));
- }
-
- @override
- void handleSuperInitializer(
- ir.SuperInitializer node, ArgumentTypes argumentTypes) {
- registerSuperInitializer(
- node.parent,
- node.target,
- node.arguments.positional.length,
- _getNamedArguments(node.arguments),
- node.arguments.types);
- }
-
- @override
- Null visitSwitchStatement(ir.SwitchStatement node) {
- registerSwitchStatementNode(node);
- return super.visitSwitchStatement(node);
- }
-
- // TODO(johnniwinther): Change [node] `InstanceGet` when the old method
- // invocation encoding is no longer used.
- @override
- void handleRuntimeTypeUse(ir.Expression node, RuntimeTypeUseKind kind,
- ir.DartType receiverType, ir.DartType argumentType) {
- registerRuntimeTypeUse(node, kind, receiverType, argumentType);
- }
-
- @override
- void handleConstantExpression(ir.ConstantExpression node) {
- ir.LibraryDependency import = getDeferredImport(node);
- ConstantImpactVisitor(this, import, node, staticTypeContext)
- .visitConstant(node.constant);
- }
-}
-
-/// Return the named arguments names as a list of strings.
-List<String> _getNamedArguments(ir.Arguments arguments) =>
- arguments.named.map((n) => n.name).toList();
-
class ImpactBuilderData {
static const String tag = 'ImpactBuilderData';
diff --git a/pkg/compiler/lib/src/ir/impact_data.dart b/pkg/compiler/lib/src/ir/impact_data.dart
index eb3f407..a17c61d 100644
--- a/pkg/compiler/lib/src/ir/impact_data.dart
+++ b/pkg/compiler/lib/src/ir/impact_data.dart
@@ -14,26 +14,33 @@
import 'impact.dart';
import 'runtime_type_analysis.dart';
import 'static_type.dart';
+import 'util.dart';
/// Visitor that builds an [ImpactData] object for the world impact.
-class ImpactBuilder extends ImpactBuilderBase {
+class ImpactBuilder extends StaticTypeVisitor implements ImpactRegistry {
final ImpactData _data = ImpactData();
@override
+ final VariableScopeModel variableScopeModel;
+
+ @override
+ final ir.StaticTypeContext staticTypeContext;
+
+ @override
final bool useAsserts;
@override
final inferEffectivelyFinalVariableTypes;
- ImpactBuilder(
- ir.StaticTypeContext staticTypeContext,
- StaticTypeCacheImpl staticTypeCache,
- ir.ClassHierarchy classHierarchy,
- VariableScopeModel variableScopeModel,
- {this.useAsserts = false,
- this.inferEffectivelyFinalVariableTypes = true})
- : super(staticTypeContext, staticTypeCache, classHierarchy,
- variableScopeModel);
+ ImpactBuilder(this.staticTypeContext, StaticTypeCacheImpl staticTypeCache,
+ ir.ClassHierarchy classHierarchy, this.variableScopeModel,
+ {this.useAsserts = false, this.inferEffectivelyFinalVariableTypes = true})
+ : super(
+ staticTypeContext.typeEnvironment, classHierarchy, staticTypeCache);
+
+ /// Return the named arguments names as a list of strings.
+ List<String> _getNamedArguments(ir.Arguments arguments) =>
+ arguments.named.map((n) => n.name).toList();
ImpactBuilderData computeImpact(ir.Member node) {
if (retainDataForTesting) {
@@ -46,6 +53,483 @@
ImpactData get impactData => _data;
+ @override
+ void handleIntLiteral(ir.IntLiteral node) {
+ registerIntLiteral(node.value);
+ }
+
+ @override
+ void handleDoubleLiteral(ir.DoubleLiteral node) {
+ registerDoubleLiteral(node.value);
+ }
+
+ @override
+ void handleBoolLiteral(ir.BoolLiteral node) {
+ registerBoolLiteral(node.value);
+ }
+
+ @override
+ void handleStringLiteral(ir.StringLiteral node) {
+ registerStringLiteral(node.value);
+ }
+
+ @override
+ void handleSymbolLiteral(ir.SymbolLiteral node) {
+ registerSymbolLiteral(node.value);
+ }
+
+ @override
+ void handleNullLiteral(ir.NullLiteral node) {
+ registerNullLiteral();
+ }
+
+ @override
+ void handleListLiteral(ir.ListLiteral node) {
+ registerListLiteral(node.typeArgument,
+ isConst: node.isConst, isEmpty: node.expressions.isEmpty);
+ }
+
+ @override
+ void handleSetLiteral(ir.SetLiteral node) {
+ registerSetLiteral(node.typeArgument,
+ isConst: node.isConst, isEmpty: node.expressions.isEmpty);
+ }
+
+ @override
+ void handleMapLiteral(ir.MapLiteral node) {
+ registerMapLiteral(node.keyType, node.valueType,
+ isConst: node.isConst, isEmpty: node.entries.isEmpty);
+ }
+
+ @override
+ void handleStaticGet(
+ ir.Expression node, ir.Member target, ir.DartType resultType) {
+ assert(!(target is ir.Procedure && target.kind == ir.ProcedureKind.Method),
+ "Static tear off registered as static get: $node");
+ registerStaticGet(target, getDeferredImport(node));
+ }
+
+ @override
+ void handleStaticTearOff(
+ ir.Expression node, ir.Member target, ir.DartType resultType) {
+ assert(target is ir.Procedure && target.kind == ir.ProcedureKind.Method,
+ "Static get registered as static tear off: $node");
+ registerStaticTearOff(target, getDeferredImport(node));
+ }
+
+ @override
+ void handleStaticSet(ir.StaticSet node, ir.DartType valueType) {
+ registerStaticSet(node.target, getDeferredImport(node));
+ }
+
+ @override
+ void handleAssertStatement(ir.AssertStatement node) {
+ registerAssert(withMessage: node.message != null);
+ }
+
+ @override
+ void handleInstantiation(ir.Instantiation node,
+ ir.FunctionType expressionType, ir.DartType resultType) {
+ registerGenericInstantiation(expressionType, node.typeArguments);
+ }
+
+ void handleAsyncMarker(ir.FunctionNode function) {
+ ir.AsyncMarker asyncMarker = function.asyncMarker;
+ ir.DartType returnType = function.returnType;
+
+ switch (asyncMarker) {
+ case ir.AsyncMarker.Sync:
+ break;
+ case ir.AsyncMarker.SyncStar:
+ ir.DartType elementType = const ir.DynamicType();
+ if (returnType is ir.InterfaceType) {
+ if (returnType.classNode == typeEnvironment.coreTypes.iterableClass) {
+ elementType = returnType.typeArguments.first;
+ }
+ }
+ registerSyncStar(elementType);
+ break;
+
+ case ir.AsyncMarker.Async:
+ ir.DartType elementType = const ir.DynamicType();
+ if (returnType is ir.InterfaceType &&
+ returnType.classNode == typeEnvironment.coreTypes.futureClass) {
+ elementType = returnType.typeArguments.first;
+ } else if (returnType is ir.FutureOrType) {
+ elementType = returnType.typeArgument;
+ }
+ registerAsync(elementType);
+ break;
+
+ case ir.AsyncMarker.AsyncStar:
+ ir.DartType elementType = const ir.DynamicType();
+ if (returnType is ir.InterfaceType) {
+ if (returnType.classNode == typeEnvironment.coreTypes.streamClass) {
+ elementType = returnType.typeArguments.first;
+ }
+ }
+ registerAsyncStar(elementType);
+ break;
+
+ case ir.AsyncMarker.SyncYielding:
+ failedAt(CURRENT_ELEMENT_SPANNABLE,
+ "Unexpected async marker: ${asyncMarker}");
+ }
+ }
+
+ @override
+ void handleStringConcatenation(ir.StringConcatenation node) {
+ registerStringConcatenation();
+ }
+
+ @override
+ Null handleFunctionDeclaration(ir.FunctionDeclaration node) {
+ registerLocalFunction(node);
+ handleAsyncMarker(node.function);
+ }
+
+ @override
+ void handleFunctionExpression(ir.FunctionExpression node) {
+ registerLocalFunction(node);
+ handleAsyncMarker(node.function);
+ }
+
+ @override
+ void handleVariableDeclaration(ir.VariableDeclaration node) {
+ if (node.initializer == null) {
+ registerLocalWithoutInitializer();
+ }
+ }
+
+ @override
+ void handleIsExpression(ir.IsExpression node) {
+ registerIsCheck(node.type);
+ }
+
+ @override
+ void handleAsExpression(ir.AsExpression node, ir.DartType operandType) {
+ if (typeEnvironment.isSubtypeOf(
+ operandType, node.type, ir.SubtypeCheckMode.ignoringNullabilities)) {
+ // Skip unneeded casts.
+ return;
+ }
+ if (node.isTypeError) {
+ registerImplicitCast(node.type);
+ } else {
+ registerAsCast(node.type);
+ }
+ }
+
+ @override
+ void handleThrow(ir.Throw node) {
+ registerThrow();
+ }
+
+ @override
+ void handleForInStatement(ir.ForInStatement node, ir.DartType iterableType,
+ ir.DartType iteratorType) {
+ if (node.isAsync) {
+ registerAsyncForIn(iterableType, iteratorType,
+ computeClassRelationFromType(iteratorType));
+ } else {
+ registerSyncForIn(iterableType, iteratorType,
+ computeClassRelationFromType(iteratorType));
+ }
+ }
+
+ @override
+ void handleCatch(ir.Catch node) {
+ registerCatch();
+ if (node.stackTrace != null) {
+ registerStackTrace();
+ }
+ if (node.guard is! ir.DynamicType) {
+ registerCatchType(node.guard);
+ }
+ }
+
+ @override
+ void handleTypeLiteral(ir.TypeLiteral node) {
+ registerTypeLiteral(node.type, getDeferredImport(node));
+ }
+
+ @override
+ void handleFieldInitializer(ir.FieldInitializer node) {
+ registerFieldInitialization(node.field);
+ }
+
+ @override
+ void handleLoadLibrary(ir.LoadLibrary node) {
+ registerLoadLibrary();
+ }
+
+ @override
+ void handleRedirectingInitializer(
+ ir.RedirectingInitializer node, ArgumentTypes argumentTypes) {
+ registerRedirectingInitializer(
+ node.target,
+ node.arguments.positional.length,
+ _getNamedArguments(node.arguments),
+ node.arguments.types);
+ }
+
+ @override
+ void handleParameter(ir.VariableDeclaration parameter) {
+ registerParameterCheck(parameter.type);
+ }
+
+ @override
+ void handleSignature(ir.FunctionNode node) {
+ for (ir.TypeParameter parameter in node.typeParameters) {
+ registerParameterCheck(parameter.bound);
+ }
+ }
+
+ @override
+ void handleConstructor(ir.Constructor node) {
+ registerConstructorNode(node);
+ }
+
+ @override
+ void handleField(ir.Field field) {
+ registerParameterCheck(field.type);
+ if (field.initializer != null) {
+ if (!field.isInstanceMember &&
+ !field.isConst &&
+ field.initializer is! ir.NullLiteral) {
+ registerLazyField();
+ }
+ } else {
+ registerNullLiteral();
+ }
+ registerFieldNode(field);
+ }
+
+ @override
+ void handleProcedure(ir.Procedure procedure) {
+ handleAsyncMarker(procedure.function);
+ registerProcedureNode(procedure);
+ }
+
+ @override
+ void handleConstructorInvocation(ir.ConstructorInvocation node,
+ ArgumentTypes argumentTypes, ir.DartType resultType) {
+ registerNew(
+ node.target,
+ node.constructedType,
+ node.arguments.positional.length,
+ _getNamedArguments(node.arguments),
+ node.arguments.types,
+ getDeferredImport(node),
+ isConst: node.isConst);
+ if (node.isConst) {
+ registerConstConstructorInvocationNode(node);
+ }
+ }
+
+ @override
+ void handleStaticInvocation(ir.StaticInvocation node,
+ ArgumentTypes argumentTypes, ir.DartType returnType) {
+ int positionArguments = node.arguments.positional.length;
+ List<String> namedArguments = _getNamedArguments(node.arguments);
+ List<ir.DartType> typeArguments = node.arguments.types;
+ if (node.target.kind == ir.ProcedureKind.Factory) {
+ // TODO(johnniwinther): We should not mark the type as instantiated but
+ // rather follow the type arguments directly.
+ //
+ // Consider this:
+ //
+ // abstract class A<T> {
+ // factory A.regular() => new B<T>();
+ // factory A.redirect() = B<T>;
+ // }
+ //
+ // class B<T> implements A<T> {}
+ //
+ // main() {
+ // print(new A<int>.regular() is B<int>);
+ // print(new A<String>.redirect() is B<String>);
+ // }
+ //
+ // To track that B is actually instantiated as B<int> and B<String> we
+ // need to follow the type arguments passed to A.regular and A.redirect
+ // to B. Currently, we only do this soundly if we register A<int> and
+ // A<String> as instantiated. We should instead register that A.T is
+ // instantiated as int and String.
+ registerNew(
+ node.target,
+ ir.InterfaceType(node.target.enclosingClass,
+ node.target.enclosingLibrary.nonNullable, typeArguments),
+ positionArguments,
+ namedArguments,
+ node.arguments.types,
+ getDeferredImport(node),
+ isConst: node.isConst);
+ } else {
+ registerStaticInvocation(node.target, positionArguments, namedArguments,
+ typeArguments, getDeferredImport(node));
+ }
+ registerStaticInvocationNode(node);
+ }
+
+ @override
+ void handleDynamicInvocation(
+ ir.InvocationExpression node,
+ ir.DartType receiverType,
+ ArgumentTypes argumentTypes,
+ ir.DartType returnType) {
+ int positionArguments = node.arguments.positional.length;
+ List<String> namedArguments = _getNamedArguments(node.arguments);
+ List<ir.DartType> typeArguments = node.arguments.types;
+ ClassRelation relation = computeClassRelationFromType(receiverType);
+ registerDynamicInvocation(receiverType, relation, node.name,
+ positionArguments, namedArguments, typeArguments);
+ }
+
+ @override
+ void handleFunctionInvocation(
+ ir.InvocationExpression node,
+ ir.DartType receiverType,
+ ArgumentTypes argumentTypes,
+ ir.DartType returnType) {
+ int positionArguments = node.arguments.positional.length;
+ List<String> namedArguments = _getNamedArguments(node.arguments);
+ List<ir.DartType> typeArguments = node.arguments.types;
+ registerFunctionInvocation(
+ receiverType, positionArguments, namedArguments, typeArguments);
+ }
+
+ @override
+ void handleInstanceInvocation(
+ ir.InvocationExpression node,
+ ir.DartType receiverType,
+ ir.Member interfaceTarget,
+ ArgumentTypes argumentTypes) {
+ int positionArguments = node.arguments.positional.length;
+ List<String> namedArguments = _getNamedArguments(node.arguments);
+ List<ir.DartType> typeArguments = node.arguments.types;
+ ClassRelation relation = computeClassRelationFromType(receiverType);
+
+ if (interfaceTarget is ir.Field ||
+ interfaceTarget is ir.Procedure &&
+ interfaceTarget.kind == ir.ProcedureKind.Getter) {
+ registerInstanceInvocation(receiverType, relation, interfaceTarget,
+ positionArguments, namedArguments, typeArguments);
+ registerFunctionInvocation(interfaceTarget.getterType, positionArguments,
+ namedArguments, typeArguments);
+ } else {
+ registerInstanceInvocation(receiverType, relation, interfaceTarget,
+ positionArguments, namedArguments, typeArguments);
+ }
+ }
+
+ @override
+ void handleLocalFunctionInvocation(
+ ir.InvocationExpression node,
+ ir.FunctionDeclaration function,
+ ArgumentTypes argumentTypes,
+ ir.DartType returnType) {
+ int positionArguments = node.arguments.positional.length;
+ List<String> namedArguments = _getNamedArguments(node.arguments);
+ List<ir.DartType> typeArguments = node.arguments.types;
+ registerLocalFunctionInvocation(
+ function, positionArguments, namedArguments, typeArguments);
+ }
+
+ @override
+ void handleEqualsCall(ir.Expression left, ir.DartType leftType,
+ ir.Expression right, ir.DartType rightType, ir.Member interfaceTarget) {
+ ClassRelation relation = computeClassRelationFromType(leftType);
+ registerInstanceInvocation(leftType, relation, interfaceTarget, 1,
+ const <String>[], const <ir.DartType>[]);
+ }
+
+ @override
+ void handleEqualsNull(ir.EqualsNull node, ir.DartType expressionType) {
+ registerNullLiteral();
+ }
+
+ @override
+ void handleDynamicGet(ir.Expression node, ir.DartType receiverType,
+ ir.Name name, ir.DartType resultType) {
+ ClassRelation relation = computeClassRelationFromType(receiverType);
+ registerDynamicGet(receiverType, relation, name);
+ }
+
+ @override
+ void handleInstanceGet(ir.Expression node, ir.DartType receiverType,
+ ir.Member interfaceTarget, ir.DartType resultType) {
+ ClassRelation relation = computeClassRelationFromType(receiverType);
+ registerInstanceGet(receiverType, relation, interfaceTarget);
+ }
+
+ @override
+ void handleDynamicSet(ir.Expression node, ir.DartType receiverType,
+ ir.Name name, ir.DartType valueType) {
+ ClassRelation relation = computeClassRelationFromType(receiverType);
+ registerDynamicSet(receiverType, relation, name);
+ }
+
+ @override
+ void handleInstanceSet(ir.Expression node, ir.DartType receiverType,
+ ir.Member interfaceTarget, ir.DartType valueType) {
+ ClassRelation relation = computeClassRelationFromType(receiverType);
+ registerInstanceSet(receiverType, relation, interfaceTarget);
+ }
+
+ @override
+ void handleSuperMethodInvocation(ir.SuperMethodInvocation node,
+ ArgumentTypes argumentTypes, ir.DartType returnType) {
+ registerSuperInvocation(
+ getEffectiveSuperTarget(node.interfaceTarget),
+ node.arguments.positional.length,
+ _getNamedArguments(node.arguments),
+ node.arguments.types);
+ }
+
+ @override
+ void handleSuperPropertyGet(
+ ir.SuperPropertyGet node, ir.DartType resultType) {
+ registerSuperGet(getEffectiveSuperTarget(node.interfaceTarget));
+ }
+
+ @override
+ void handleSuperPropertySet(ir.SuperPropertySet node, ir.DartType valueType) {
+ registerSuperSet(getEffectiveSuperTarget(node.interfaceTarget));
+ }
+
+ @override
+ void handleSuperInitializer(
+ ir.SuperInitializer node, ArgumentTypes argumentTypes) {
+ registerSuperInitializer(
+ node.parent,
+ node.target,
+ node.arguments.positional.length,
+ _getNamedArguments(node.arguments),
+ node.arguments.types);
+ }
+
+ @override
+ Null visitSwitchStatement(ir.SwitchStatement node) {
+ registerSwitchStatementNode(node);
+ return super.visitSwitchStatement(node);
+ }
+
+ // TODO(johnniwinther): Change [node] `InstanceGet` when the old method
+ // invocation encoding is no longer used.
+ @override
+ void handleRuntimeTypeUse(ir.Expression node, RuntimeTypeUseKind kind,
+ ir.DartType receiverType, ir.DartType argumentType) {
+ registerRuntimeTypeUse(node, kind, receiverType, argumentType);
+ }
+
+ @override
+ void handleConstantExpression(ir.ConstantExpression node) {
+ ir.LibraryDependency import = getDeferredImport(node);
+ ConstantImpactVisitor(this, import, node, staticTypeContext)
+ .visitConstant(node.constant);
+ }
+
void _registerFeature(_Feature feature) {
_data._features ??= EnumSet<_Feature>();
_data._features.add(feature);
diff --git a/pkg/compiler/lib/src/kernel/kernel_strategy.dart b/pkg/compiler/lib/src/kernel/kernel_strategy.dart
index cd466b2..d45d1bd 100644
--- a/pkg/compiler/lib/src/kernel/kernel_strategy.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_strategy.dart
@@ -38,6 +38,7 @@
import '../native/enqueue.dart' show NativeResolutionEnqueuer;
import '../native/resolver.dart';
import '../options.dart';
+import '../resolution/enqueuer.dart';
import '../universe/class_hierarchy.dart';
import '../universe/resolution_world_builder.dart';
import '../universe/world_builder.dart';
diff --git a/pkg/compiler/lib/src/resolution/enqueuer.dart b/pkg/compiler/lib/src/resolution/enqueuer.dart
new file mode 100644
index 0000000..89fcb44
--- /dev/null
+++ b/pkg/compiler/lib/src/resolution/enqueuer.dart
@@ -0,0 +1,313 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// 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 'dart:collection' show Queue;
+
+import '../common.dart';
+import '../common/elements.dart' show ElementEnvironment;
+import '../common/tasks.dart' show CompilerTask;
+import '../common/work.dart' show WorkItem;
+import '../enqueue.dart';
+import '../elements/entities.dart';
+import '../elements/types.dart';
+import '../js_backend/annotations.dart';
+import '../universe/member_usage.dart';
+import '../universe/resolution_world_builder.dart';
+import '../universe/use.dart'
+ show
+ ConstantUse,
+ DynamicUse,
+ StaticUse,
+ StaticUseKind,
+ TypeUse,
+ TypeUseKind;
+import '../universe/world_impact.dart' show WorldImpactVisitor;
+import '../util/enumset.dart';
+import '../util/util.dart' show Setlet;
+
+/// [Enqueuer] which is specific to resolution.
+class ResolutionEnqueuer extends Enqueuer {
+ @override
+ final CompilerTask task;
+ final String name;
+ @override
+ final EnqueuerListener listener;
+
+ final Set<ClassEntity> _recentClasses = Setlet<ClassEntity>();
+ bool _recentConstants = false;
+ final ResolutionWorldBuilder worldBuilder;
+ WorkItemBuilder _workItemBuilder;
+ final DiagnosticReporter _reporter;
+ final AnnotationsData _annotationsData;
+
+ @override
+ bool queueIsClosed = false;
+
+ @override
+ WorldImpactVisitor impactVisitor;
+
+ final Queue<WorkItem> _queue = Queue<WorkItem>();
+
+ // If not `null` this is called when the queue has been emptied. It allows for
+ // applying additional impacts before re-emptying the queue.
+ void Function() onEmptyForTesting;
+
+ ResolutionEnqueuer(this.task, this._reporter, this.listener,
+ this.worldBuilder, this._workItemBuilder, this._annotationsData,
+ [this.name = 'resolution enqueuer']) {
+ impactVisitor = EnqueuerImpactVisitor(this);
+ }
+
+ @override
+ Iterable<ClassEntity> get directlyInstantiatedClasses =>
+ worldBuilder.directlyInstantiatedClasses;
+
+ @override
+ bool get queueIsEmpty => _queue.isEmpty;
+
+ @override
+ void checkQueueIsEmpty() {
+ if (_queue.isNotEmpty) {
+ failedAt(_queue.first.element, "$name queue is not empty.");
+ }
+ }
+
+ void _registerInstantiatedType(InterfaceType type,
+ {ConstructorEntity constructor,
+ bool nativeUsage = false,
+ bool globalDependency = false}) {
+ task.measureSubtask('resolution.typeUse', () {
+ worldBuilder.registerTypeInstantiation(type, _applyClassUse,
+ constructor: constructor);
+ listener.registerInstantiatedType(type,
+ isGlobal: globalDependency, nativeUsage: nativeUsage);
+ });
+ }
+
+ @override
+ bool checkNoEnqueuedInvokedInstanceMethods(
+ ElementEnvironment elementEnvironment) {
+ if (Enqueuer.skipEnqueuerCheckForTesting) return true;
+ return checkEnqueuerConsistency(elementEnvironment);
+ }
+
+ @override
+ void checkClass(ClassEntity cls) {
+ worldBuilder.processClassMembers(cls,
+ (MemberEntity member, EnumSet<MemberUse> useSet) {
+ if (useSet.isNotEmpty) {
+ _reporter.internalError(member,
+ 'Unenqueued use of $member: ${useSet.iterable(MemberUse.values)}');
+ }
+ }, checkEnqueuerConsistency: true);
+ }
+
+ /// Callback for applying the use of a [member].
+ void _applyMemberUse(Entity member, EnumSet<MemberUse> useSet) {
+ if (useSet.contains(MemberUse.NORMAL)) {
+ _addToWorkList(member);
+ }
+ if (useSet.contains(MemberUse.CLOSURIZE_INSTANCE)) {
+ _registerClosurizedMember(member);
+ }
+ if (useSet.contains(MemberUse.CLOSURIZE_STATIC)) {
+ applyImpact(listener.registerGetOfStaticFunction());
+ }
+ }
+
+ /// Callback for applying the use of a [cls].
+ void _applyClassUse(ClassEntity cls, EnumSet<ClassUse> useSet) {
+ if (useSet.contains(ClassUse.INSTANTIATED)) {
+ _recentClasses.add(cls);
+ worldBuilder.processClassMembers(cls, _applyMemberUse);
+ // We only tell the backend once that [cls] was instantiated, so
+ // any additional dependencies must be treated as global
+ // dependencies.
+ applyImpact(listener.registerInstantiatedClass(cls));
+ }
+ if (useSet.contains(ClassUse.IMPLEMENTED)) {
+ applyImpact(listener.registerImplementedClass(cls));
+ }
+ }
+
+ @override
+ void processDynamicUse(DynamicUse dynamicUse) {
+ task.measureSubtask('resolution.dynamicUse', () {
+ worldBuilder.registerDynamicUse(dynamicUse, _applyMemberUse);
+ });
+ }
+
+ @override
+ void processConstantUse(ConstantUse constantUse) {
+ task.measureSubtask('resolution.constantUse', () {
+ if (worldBuilder.registerConstantUse(constantUse)) {
+ applyImpact(listener.registerUsedConstant(constantUse.value));
+ _recentConstants = true;
+ }
+ });
+ }
+
+ @override
+ void processStaticUse(MemberEntity member, StaticUse staticUse) {
+ task.measureSubtask('resolution.staticUse', () {
+ worldBuilder.registerStaticUse(staticUse, _applyMemberUse);
+ // TODO(johnniwinther): Add `ResolutionWorldBuilder.registerConstructorUse`
+ // for these:
+ switch (staticUse.kind) {
+ case StaticUseKind.CONSTRUCTOR_INVOKE:
+ case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
+ _registerInstantiatedType(staticUse.type,
+ constructor: staticUse.element, globalDependency: false);
+ break;
+ default:
+ break;
+ }
+ });
+ }
+
+ @override
+ void processTypeUse(MemberEntity member, TypeUse typeUse) {
+ DartType type = typeUse.type;
+ switch (typeUse.kind) {
+ case TypeUseKind.INSTANTIATION:
+ case TypeUseKind.CONST_INSTANTIATION:
+ _registerInstantiatedType(type, globalDependency: false);
+ break;
+ case TypeUseKind.NATIVE_INSTANTIATION:
+ _registerInstantiatedType(type,
+ nativeUsage: true, globalDependency: true);
+ break;
+ case TypeUseKind.IS_CHECK:
+ case TypeUseKind.CATCH_TYPE:
+ _registerIsCheck(type);
+ break;
+ case TypeUseKind.AS_CAST:
+ if (_annotationsData.getExplicitCastCheckPolicy(member).isEmitted) {
+ _registerIsCheck(type);
+ }
+ break;
+ case TypeUseKind.IMPLICIT_CAST:
+ if (_annotationsData.getImplicitDowncastCheckPolicy(member).isEmitted) {
+ _registerIsCheck(type);
+ }
+ break;
+ case TypeUseKind.PARAMETER_CHECK:
+ case TypeUseKind.TYPE_VARIABLE_BOUND_CHECK:
+ if (_annotationsData.getParameterCheckPolicy(member).isEmitted) {
+ _registerIsCheck(type);
+ }
+ break;
+ case TypeUseKind.TYPE_LITERAL:
+ if (type is TypeVariableType) {
+ worldBuilder.registerTypeVariableTypeLiteral(type);
+ }
+ break;
+ case TypeUseKind.RTI_VALUE:
+ case TypeUseKind.TYPE_ARGUMENT:
+ case TypeUseKind.CONSTRUCTOR_REFERENCE:
+ failedAt(CURRENT_ELEMENT_SPANNABLE, "Unexpected type use: $typeUse.");
+ break;
+ case TypeUseKind.NAMED_TYPE_VARIABLE_NEW_RTI:
+ assert(type is TypeVariableType);
+ _registerNamedTypeVariableNewRti(type);
+ break;
+ }
+ }
+
+ void _registerIsCheck(DartType type) {
+ worldBuilder.registerIsCheck(type);
+ }
+
+ void _registerNamedTypeVariableNewRti(TypeVariableType type) {
+ worldBuilder.registerNamedTypeVariableNewRti(type);
+ }
+
+ void _registerClosurizedMember(MemberEntity element) {
+ assert(element.isInstanceMember);
+ applyImpact(listener.registerClosurizedMember(element));
+ worldBuilder.registerClosurizedMember(element);
+ }
+
+ void _forEach(void f(WorkItem work)) {
+ do {
+ while (_queue.isNotEmpty) {
+ // TODO(johnniwinther): Find an optimal process order.
+ WorkItem work = _queue.removeLast();
+ if (!worldBuilder.isMemberProcessed(work.element)) {
+ f(work);
+ worldBuilder.registerProcessedMember(work.element);
+ }
+ }
+ List<ClassEntity> recents = _recentClasses.toList(growable: false);
+ _recentClasses.clear();
+ _recentConstants = false;
+ if (!_onQueueEmpty(recents)) {
+ _recentClasses.addAll(recents);
+ }
+ } while (
+ _queue.isNotEmpty || _recentClasses.isNotEmpty || _recentConstants);
+ }
+
+ @override
+ void forEach(void f(WorkItem work)) {
+ _forEach(f);
+ if (onEmptyForTesting != null) {
+ onEmptyForTesting();
+ _forEach(f);
+ }
+ }
+
+ @override
+ void logSummary(void log(String message)) {
+ log('Resolved ${processedEntities.length} elements.');
+ listener.logSummary(log);
+ }
+
+ @override
+ String toString() => 'Enqueuer($name)';
+
+ @override
+ Iterable<MemberEntity> get processedEntities => worldBuilder.processedMembers;
+
+ @override
+ void close() {
+ super.close();
+ // Null out _workItemBuilder to release memory (it internally holds large
+ // data-structures unnecessary after resolution.)
+ _workItemBuilder = null;
+ }
+
+ /// Registers [entity] as processed by the resolution enqueuer. Used only for
+ /// testing.
+ void registerProcessedElementInternal(MemberEntity entity) {
+ worldBuilder.registerProcessedMember(entity);
+ }
+
+ /// Create a [WorkItem] for [entity] and add it to the work list if it has not
+ /// already been processed.
+ void _addToWorkList(MemberEntity entity) {
+ if (worldBuilder.isMemberProcessed(entity)) return;
+ WorkItem workItem = _workItemBuilder.createWorkItem(entity);
+ if (workItem == null) return;
+
+ if (queueIsClosed) {
+ failedAt(
+ entity, "Resolution work list is closed. Trying to add $entity.");
+ }
+
+ applyImpact(listener.registerUsedElement(entity));
+ worldBuilder.registerUsedElement(entity);
+ _queue.add(workItem);
+ }
+
+ /// [_onQueueEmpty] is called whenever the queue is drained. [recentClasses]
+ /// contains the set of all classes seen for the first time since
+ /// [_onQueueEmpty] was called last. A return value of [true] indicates that
+ /// the [recentClasses] have been processed and may be cleared. If [false] is
+ /// returned, [_onQueueEmpty] will be called once the queue is empty again (or
+ /// still empty) and [recentClasses] will be a superset of the current value.
+ bool _onQueueEmpty(Iterable<ClassEntity> recentClasses) {
+ return listener.onQueueEmpty(this, recentClasses);
+ }
+}
diff --git a/pkg/compiler/test/equivalence/id_equivalence_helper.dart b/pkg/compiler/test/equivalence/id_equivalence_helper.dart
index 037cf61..e8c5eae 100644
--- a/pkg/compiler/test/equivalence/id_equivalence_helper.dart
+++ b/pkg/compiler/test/equivalence/id_equivalence_helper.dart
@@ -149,7 +149,7 @@
diagnosticHandler: diagnosticCollector,
options: options,
beforeRun: (compiler) {
- compiler.stopAfterTypeInference =
+ compiler.stopAfterGlobalTypeInferenceForTesting =
options.contains(stopAfterTypeInference);
},
packageConfig: packageConfig,
diff --git a/pkg/compiler/test/helpers/type_test_helper.dart b/pkg/compiler/test/helpers/type_test_helper.dart
index 570e368..908efb4 100644
--- a/pkg/compiler/test/helpers/type_test_helper.dart
+++ b/pkg/compiler/test/helpers/type_test_helper.dart
@@ -47,7 +47,7 @@
options: [Flags.disableTypeInference]..addAll(options),
diagnosticHandler: collector,
beforeRun: (compiler) {
- compiler.stopAfterTypeInference = true;
+ compiler.stopAfterGlobalTypeInferenceForTesting = true;
});
Compiler compiler = result.compiler;
if (expectNoErrors || expectNoWarningsOrErrors) {
diff --git a/pkg/compiler/test/inference/type_combination_test.dart b/pkg/compiler/test/inference/type_combination_test.dart
index 0d371ed..df45a82 100644
--- a/pkg/compiler/test/inference/type_combination_test.dart
+++ b/pkg/compiler/test/inference/type_combination_test.dart
@@ -758,8 +758,9 @@
}
runTests() async {
- CompilationResult result = await runCompiler(memorySourceFiles: {
- 'main.dart': r'''
+ CompilationResult result = await runCompiler(
+ memorySourceFiles: {
+ 'main.dart': r'''
import 'dart:collection';
class AList<E> extends ListBase<E> {
noSuchMethod(_) {}
@@ -770,7 +771,9 @@
print('${const []}${const {}}${(){}}${new AList()}');
}
'''
- }, beforeRun: (compiler) => compiler.stopAfterTypeInference = true);
+ },
+ beforeRun: (compiler) =>
+ compiler.stopAfterGlobalTypeInferenceForTesting = true);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
JClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
diff --git a/pkg/compiler/test/serialization/serialization_test_helper.dart b/pkg/compiler/test/serialization/serialization_test_helper.dart
index 2df1808..0f1034d 100644
--- a/pkg/compiler/test/serialization/serialization_test_helper.dart
+++ b/pkg/compiler/test/serialization/serialization_test_helper.dart
@@ -8,6 +8,7 @@
import 'package:compiler/compiler.dart';
import 'package:compiler/src/commandline_options.dart';
+import 'package:compiler/src/common/codegen.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/js_model/js_world.dart';
import 'package:compiler/src/inferrer/types.dart';
@@ -26,6 +27,14 @@
'"toJsonDuration":'
];
+void generateJavaScriptCode(
+ Compiler compiler, GlobalTypeInferenceResults globalTypeInferenceResults) {
+ final codegenInputs = compiler.initializeCodegen(globalTypeInferenceResults);
+ final codegenResults = OnDemandCodegenResults(globalTypeInferenceResults,
+ codegenInputs, compiler.backendStrategy.functionCompiler);
+ compiler.runCodegenEnqueuer(codegenResults);
+}
+
void finishCompileAndCompare(
Map<OutputType, Map<String, String>> expectedOutput,
OutputCollector actualOutputCollector,
@@ -47,7 +56,7 @@
GlobalTypeInferenceResults newGlobalInferenceResults =
cloneInferenceResults(
indices, compiler, globalInferenceResults, strategy);
- compiler.generateJavaScriptCode(newGlobalInferenceResults);
+ generateJavaScriptCode(compiler, newGlobalInferenceResults);
}
var actualOutput = actualOutputCollector.clear();
Expect.setEquals(
@@ -120,7 +129,7 @@
outputProvider: collector2,
beforeRun: (Compiler compiler) {
compiler.forceSerializationForTesting = true;
- compiler.stopAfterClosedWorld = true;
+ compiler.stopAfterClosedWorldForTesting = true;
});
Expect.isTrue(result2.isSuccess);
@@ -165,7 +174,7 @@
outputProvider: collector3b,
beforeRun: (Compiler compiler) {
compiler.forceSerializationForTesting = true;
- compiler.stopAfterTypeInference = true;
+ compiler.stopAfterGlobalTypeInferenceForTesting = true;
});
Expect.isTrue(result3b.isSuccess);
diff --git a/pkg/front_end/lib/src/fasta/builder/fixed_type_builder.dart b/pkg/front_end/lib/src/fasta/builder/fixed_type_builder.dart
index 74797c3..44e408f 100644
--- a/pkg/front_end/lib/src/fasta/builder/fixed_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/fixed_type_builder.dart
@@ -48,21 +48,20 @@
}
@override
- DartType build(LibraryBuilder library, {TypedefType? origin}) {
+ DartType build(LibraryBuilder library) {
return type;
}
@override
- Supertype buildSupertype(
- LibraryBuilder library, int charOffset, Uri fileUri) {
- return unhandled('buildSupertype', 'FixedTypeBuilder', charOffset, fileUri);
+ Supertype buildSupertype(LibraryBuilder library) {
+ return unhandled(
+ 'buildSupertype', 'FixedTypeBuilder', charOffset ?? -1, fileUri);
}
@override
- Supertype buildMixedInType(
- LibraryBuilder library, int charOffset, Uri fileUri) {
+ Supertype buildMixedInType(LibraryBuilder library) {
return unhandled(
- 'buildMixedInType', 'FixedTypeBuilder', charOffset, fileUri);
+ 'buildMixedInType', 'FixedTypeBuilder', charOffset ?? -1, fileUri);
}
@override
diff --git a/pkg/front_end/lib/src/fasta/builder/function_type_builder.dart b/pkg/front_end/lib/src/fasta/builder/function_type_builder.dart
index d995931..ea413c2 100644
--- a/pkg/front_end/lib/src/fasta/builder/function_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/function_type_builder.dart
@@ -11,8 +11,7 @@
FunctionType,
NamedType,
Supertype,
- TypeParameter,
- TypedefType;
+ TypeParameter;
import '../fasta_codes.dart' show messageSupertypeIsFunction, noLength;
@@ -36,6 +35,8 @@
@override
final int charOffset;
+ FunctionType? _type;
+
FunctionTypeBuilder(this.returnType, this.typeVariables, this.formals,
this.nullabilityBuilder, this.fileUri, this.charOffset);
@@ -83,7 +84,11 @@
}
@override
- FunctionType build(LibraryBuilder library, {TypedefType? origin}) {
+ FunctionType build(LibraryBuilder library) {
+ return _type ??= _buildInternal(library);
+ }
+
+ FunctionType _buildInternal(LibraryBuilder library) {
DartType builtReturnType =
returnType?.build(library) ?? const DynamicType();
List<DartType> positionalParameters = <DartType>[];
@@ -111,29 +116,26 @@
for (TypeVariableBuilder t in typeVariables!) {
typeParameters.add(t.parameter);
// Build the bound to detect cycles in typedefs.
- t.bound?.build(library, origin: origin);
+ t.bound?.build(library);
}
}
return new FunctionType(positionalParameters, builtReturnType,
nullabilityBuilder.build(library),
namedParameters: namedParameters ?? const <NamedType>[],
typeParameters: typeParameters ?? const <TypeParameter>[],
- requiredParameterCount: requiredParameterCount,
- typedefType: origin);
+ requiredParameterCount: requiredParameterCount);
}
@override
- Supertype? buildSupertype(
- LibraryBuilder library, int charOffset, Uri fileUri) {
+ Supertype? buildSupertype(LibraryBuilder library) {
library.addProblem(
messageSupertypeIsFunction, charOffset, noLength, fileUri);
return null;
}
@override
- Supertype? buildMixedInType(
- LibraryBuilder library, int charOffset, Uri fileUri) {
- return buildSupertype(library, charOffset, fileUri);
+ Supertype? buildMixedInType(LibraryBuilder library) {
+ return buildSupertype(library);
}
@override
@@ -143,8 +145,9 @@
TypeParameterScopeBuilder contextDeclaration) {
List<TypeVariableBuilder>? clonedTypeVariables;
if (typeVariables != null) {
- clonedTypeVariables =
- contextLibrary.copyTypeVariables(typeVariables!, contextDeclaration);
+ clonedTypeVariables = contextLibrary.copyTypeVariables(
+ typeVariables!, contextDeclaration,
+ kind: TypeVariableKind.function);
}
List<FormalParameterBuilder>? clonedFormals;
if (formals != null) {
diff --git a/pkg/front_end/lib/src/fasta/builder/named_type_builder.dart b/pkg/front_end/lib/src/fasta/builder/named_type_builder.dart
index e66b50a..d885de8 100644
--- a/pkg/front_end/lib/src/fasta/builder/named_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/named_type_builder.dart
@@ -107,30 +107,77 @@
@override
final int? charOffset;
- @override
- TypeDeclarationBuilder? declaration;
+ TypeDeclarationBuilder? _declaration;
- final InstanceTypeVariableAccessState instanceTypeVariableAccess;
+ final InstanceTypeVariableAccessState _instanceTypeVariableAccess;
- NamedTypeBuilder(this.name, this.nullabilityBuilder, this.arguments,
- this.fileUri, this.charOffset,
- {required this.instanceTypeVariableAccess})
- : assert(name is String || name is QualifiedName);
+ final bool _forTypeLiteral;
- NamedTypeBuilder.fromTypeDeclarationBuilder(
- TypeDeclarationBuilder this.declaration, this.nullabilityBuilder,
+ DartType? _type;
+
+ NamedTypeBuilder(this.name, this.nullabilityBuilder,
{this.arguments,
this.fileUri,
this.charOffset,
- required this.instanceTypeVariableAccess})
- : this.name = declaration.name;
+ required InstanceTypeVariableAccessState instanceTypeVariableAccess,
+ bool forTypeLiteral: false})
+ : assert(name is String || name is QualifiedName),
+ this._instanceTypeVariableAccess = instanceTypeVariableAccess,
+ this._forTypeLiteral = forTypeLiteral;
+
+ NamedTypeBuilder.forDartType(DartType this._type,
+ TypeDeclarationBuilder this._declaration, this.nullabilityBuilder,
+ {this.arguments})
+ : this.name = _declaration.name,
+ this._instanceTypeVariableAccess =
+ InstanceTypeVariableAccessState.Unexpected,
+ this.fileUri = null,
+ this.charOffset = null,
+ this._forTypeLiteral = false;
+
+ NamedTypeBuilder.fromTypeDeclarationBuilder(
+ TypeDeclarationBuilder this._declaration, this.nullabilityBuilder,
+ {this.arguments,
+ this.fileUri,
+ this.charOffset,
+ required InstanceTypeVariableAccessState instanceTypeVariableAccess,
+ DartType? type})
+ : this.name = _declaration.name,
+ this._forTypeLiteral = false,
+ this._instanceTypeVariableAccess = instanceTypeVariableAccess,
+ this._type = type;
+
+ NamedTypeBuilder.forInvalidType(
+ String this.name, this.nullabilityBuilder, LocatedMessage message,
+ {List<LocatedMessage>? context})
+ : _declaration =
+ new InvalidTypeDeclarationBuilder(name, message, context: context),
+ this.fileUri = message.uri,
+ this.charOffset = message.charOffset,
+ this._instanceTypeVariableAccess =
+ InstanceTypeVariableAccessState.Unexpected,
+ this._forTypeLiteral = false,
+ this._type = const InvalidType();
+
+ @override
+ TypeDeclarationBuilder? get declaration => _declaration;
@override
bool get isVoidType => declaration is VoidTypeDeclarationBuilder;
- @override
- void bind(TypeDeclarationBuilder declaration) {
- this.declaration = declaration.origin;
+ void bind(LibraryBuilder libraryBuilder, TypeDeclarationBuilder declaration) {
+ _declaration = declaration.origin;
+ _check(libraryBuilder);
+ }
+
+ String get nameText {
+ if (name is Identifier) {
+ Identifier identifier = name as Identifier;
+ return identifier.name;
+ } else {
+ assert(name is String);
+ return name as String;
+ }
}
int get nameOffset {
@@ -138,25 +185,16 @@
Identifier identifier = name as Identifier;
return identifier.charOffset;
}
- return -1; // TODO(eernst): make it possible to get offset.
+ return charOffset!;
}
int get nameLength {
- if (name is Identifier) {
- Identifier identifier = name as Identifier;
- return identifier.name.length;
- } else if (name is String) {
- String nameString = name as String;
- return nameString.length;
- } else {
- return noLength;
- }
+ return nameText.length;
}
- @override
void resolveIn(
Scope scope, int charOffset, Uri fileUri, LibraryBuilder library) {
- if (declaration != null) return;
+ if (_declaration != null) return;
final Object name = this.name;
Builder? member;
if (name is QualifiedName) {
@@ -171,72 +209,106 @@
} else {
unhandled("${name.runtimeType}", "resolveIn", charOffset, fileUri);
}
- if (member is TypeVariableBuilder) {
- declaration = member.origin;
- if (arguments != null) {
- String typeName;
- int typeNameOffset;
- if (name is Identifier) {
- typeName = name.name;
- typeNameOffset = name.charOffset;
- } else {
- typeName = name as String;
- typeNameOffset = charOffset;
- }
+ if (member is TypeDeclarationBuilder) {
+ bind(library, member);
+ } else {
+ Template<Message Function(String name)> template =
+ member == null ? templateTypeNotFound : templateNotAType;
+ String flatName = flattenName(name, charOffset, fileUri);
+ int length = name is Identifier
+ ? name.endCharOffset - charOffset
+ : flatName.length;
+ Message message;
+ List<LocatedMessage>? context;
+ if (member == null) {
+ template = templateTypeNotFound;
+ message = template.withArguments(flatName);
+ } else {
+ template = templateNotAType;
+ context = <LocatedMessage>[
+ messageNotATypeContext.withLocation(
+ member.fileUri!,
+ member.charOffset,
+ name is Identifier ? name.name.length : "$name".length)
+ ];
+ message = template.withArguments(flatName);
+ }
+ library.addProblem(message, charOffset, length, fileUri,
+ context: context);
+ TypeDeclarationBuilder declaration = buildInvalidTypeDeclarationBuilder(
+ message.withLocation(fileUri, charOffset, length),
+ context: context);
+ bind(library, declaration);
+ }
+ }
+
+ void _check(LibraryBuilder library) {
+ if (_declaration is InvalidTypeDeclarationBuilder) {
+ return;
+ }
+ if (arguments != null) {
+ if (_declaration!.isTypeVariable) {
+ String typeName = nameText;
+ int typeNameOffset = nameOffset;
Message message =
templateTypeArgumentsOnTypeVariable.withArguments(typeName);
library.addProblem(message, typeNameOffset, typeName.length, fileUri);
- declaration = buildInvalidTypeDeclarationBuilder(
- message.withLocation(fileUri, typeNameOffset, typeName.length));
- }
- return;
- } else if (member is TypeDeclarationBuilder) {
- declaration = member.origin;
- if (!declaration!.isExtension ||
- library is SourceLibraryBuilder &&
- library.enableExtensionTypesInLibrary) {
- return;
+ // TODO(johnniwinther): Should we retain the declaration to support
+ // additional errors?
+ _declaration = buildInvalidTypeDeclarationBuilder(
+ message.withLocation(fileUri!, typeNameOffset, typeName.length));
+ } else if (arguments!.length != declaration!.typeVariablesCount) {
+ int typeNameLength = nameLength;
+ int typeNameOffset = nameOffset;
+ Message message = templateTypeArgumentMismatch
+ .withArguments(declaration!.typeVariablesCount);
+ library.addProblem(message, typeNameOffset, typeNameLength, fileUri);
+ _declaration = buildInvalidTypeDeclarationBuilder(
+ message.withLocation(fileUri!, typeNameOffset, typeNameLength));
}
}
- Template<Message Function(String name)> template =
- member == null ? templateTypeNotFound : templateNotAType;
- String flatName = flattenName(name, charOffset, fileUri);
- int length =
- name is Identifier ? name.endCharOffset - charOffset : flatName.length;
- Message message;
- List<LocatedMessage>? context;
- if (member == null) {
- template = templateTypeNotFound;
- message = template.withArguments(flatName);
- } else if (declaration != null &&
- declaration!.isExtension &&
+ if (_declaration!.isExtension &&
library is SourceLibraryBuilder &&
!library.enableExtensionTypesInLibrary) {
- message = templateExperimentNotEnabled.withArguments('extension-types',
+ Message message = templateExperimentNotEnabled.withArguments(
+ 'extension-types',
library.enableExtensionTypesVersionInLibrary.toText());
- } else {
- template = templateNotAType;
- context = <LocatedMessage>[
- messageNotATypeContext.withLocation(member.fileUri!, member.charOffset,
- name is Identifier ? name.name.length : "$name".length)
- ];
- message = template.withArguments(flatName);
- }
- library.addProblem(message, charOffset, length, fileUri, context: context);
- declaration = buildInvalidTypeDeclarationBuilder(
- message.withLocation(fileUri, charOffset, length),
- context: context);
- }
-
- @override
- void check(LibraryBuilder library, int charOffset, Uri fileUri) {
- if (arguments != null &&
- arguments!.length != declaration!.typeVariablesCount) {
- Message message = templateTypeArgumentMismatch
- .withArguments(declaration!.typeVariablesCount);
- library.addProblem(message, charOffset, noLength, fileUri);
- declaration = buildInvalidTypeDeclarationBuilder(
- message.withLocation(fileUri, charOffset, noLength));
+ int typeNameLength = nameLength;
+ int typeNameOffset = nameOffset;
+ library.addProblem(message, typeNameOffset, typeNameLength, fileUri);
+ _declaration = buildInvalidTypeDeclarationBuilder(
+ message.withLocation(fileUri!, typeNameOffset, typeNameLength));
+ } else if (_declaration!.isTypeVariable) {
+ TypeVariableBuilder typeParameterBuilder =
+ _declaration as TypeVariableBuilder;
+ if (typeParameterBuilder.kind == TypeVariableKind.classMixinOrEnum ||
+ typeParameterBuilder.kind == TypeVariableKind.extension ||
+ typeParameterBuilder.kind == TypeVariableKind.extensionSynthesized) {
+ switch (_instanceTypeVariableAccess) {
+ case InstanceTypeVariableAccessState.Disallowed:
+ int typeNameLength = nameLength;
+ int typeNameOffset = nameOffset;
+ Message message = messageTypeVariableInStaticContext;
+ library.addProblem(
+ message, typeNameOffset, typeNameLength, fileUri);
+ _declaration = buildInvalidTypeDeclarationBuilder(
+ message.withLocation(fileUri!, typeNameOffset, typeNameLength));
+ return;
+ case InstanceTypeVariableAccessState.Invalid:
+ int typeNameLength = nameLength;
+ int typeNameOffset = nameOffset;
+ Message message = messageTypeVariableInStaticContext;
+ _declaration = buildInvalidTypeDeclarationBuilder(
+ message.withLocation(fileUri!, typeNameOffset, typeNameLength));
+ return;
+ case InstanceTypeVariableAccessState.Unexpected:
+ assert(false,
+ "Unexpected instance type variable $typeParameterBuilder");
+ break;
+ case InstanceTypeVariableAccessState.Allowed:
+ break;
+ }
+ }
}
}
@@ -269,23 +341,18 @@
context: context);
}
- Supertype? handleInvalidSupertype(
- LibraryBuilder library, int charOffset, Uri fileUri) {
+ Supertype? _handleInvalidSupertype(LibraryBuilder library) {
Template<Message Function(String name)> template =
declaration!.isTypeVariable
? templateSupertypeIsTypeVariable
: templateSupertypeIsIllegal;
- library.addProblem(template.withArguments(fullNameForErrors), charOffset,
+ library.addProblem(template.withArguments(fullNameForErrors), charOffset!,
noLength, fileUri);
return null;
}
- Supertype? handleInvalidAliasedSupertype(
- LibraryBuilder library,
- int charOffset,
- Uri fileUri,
- TypeAliasBuilder aliasBuilder,
- DartType type) {
+ Supertype? _handleInvalidAliasedSupertype(
+ LibraryBuilder library, TypeAliasBuilder aliasBuilder, DartType type) {
// Don't report the error in case of InvalidType. An error has already been
// reported in this case.
if (type is InvalidType) return null;
@@ -303,7 +370,7 @@
message = templateSupertypeIsIllegalAliased.withArguments(
fullNameForErrors, type, library.isNonNullableByDefault);
}
- library.addProblem(message, charOffset, noLength, fileUri, context: [
+ library.addProblem(message, charOffset!, noLength, fileUri, context: [
messageTypedefCause.withLocation(
aliasBuilder.fileUri, aliasBuilder.charOffset, noLength),
]);
@@ -311,18 +378,12 @@
}
@override
- DartType build(LibraryBuilder library, {TypedefType? origin}) {
- return buildInternal(library, origin: origin, forTypeLiteral: false);
+ DartType build(LibraryBuilder library) {
+ return _type ??= _buildInternal(library);
}
- @override
- DartType buildTypeLiteralType(LibraryBuilder library, {TypedefType? origin}) {
- return buildInternal(library, origin: origin, forTypeLiteral: true);
- }
-
- DartType declarationBuildType(LibraryBuilder library,
- {required bool forTypeLiteral}) {
- if (forTypeLiteral) {
+ DartType _declarationBuildType(LibraryBuilder library) {
+ if (_forTypeLiteral) {
return declaration!
.buildTypeLiteralType(library, nullabilityBuilder, arguments);
} else {
@@ -330,39 +391,11 @@
}
}
- // TODO(johnniwinther): Store [origin] on the built type.
- DartType buildInternal(LibraryBuilder library,
- {TypedefType? origin, required bool forTypeLiteral}) {
+ DartType _buildInternal(LibraryBuilder library) {
assert(declaration != null, "Declaration has not been resolved on $this.");
- if (declaration!.isTypeVariable) {
- TypeVariableBuilder typeParameterBuilder =
- declaration as TypeVariableBuilder;
- TypeParameter typeParameter = typeParameterBuilder.parameter;
- if (typeParameter.parent is Class || typeParameter.parent is Extension) {
- switch (instanceTypeVariableAccess) {
- case InstanceTypeVariableAccessState.Disallowed:
- library.addProblem(
- messageTypeVariableInStaticContext,
- charOffset ?? TreeNode.noOffset,
- noLength,
- fileUri ?? library.fileUri);
- return const InvalidType();
- case InstanceTypeVariableAccessState.Invalid:
- return const InvalidType();
- case InstanceTypeVariableAccessState.Unexpected:
- assert(false,
- "Unexpected instance type variable $typeParameterBuilder");
- break;
- case InstanceTypeVariableAccessState.Allowed:
- break;
- }
- }
- }
-
if (library is SourceLibraryBuilder) {
int uncheckedTypedefTypeCount = library.uncheckedTypedefTypes.length;
- DartType builtType =
- declarationBuildType(library, forTypeLiteral: forTypeLiteral);
+ DartType builtType = _declarationBuildType(library);
// Set locations for new unchecked TypedefTypes for error reporting.
for (int i = uncheckedTypedefTypeCount;
i < library.uncheckedTypedefTypes.length;
@@ -375,19 +408,18 @@
}
return builtType;
} else {
- return declarationBuildType(library, forTypeLiteral: forTypeLiteral);
+ return _declarationBuildType(library);
}
}
@override
- Supertype? buildSupertype(
- LibraryBuilder library, int charOffset, Uri fileUri) {
+ Supertype? buildSupertype(LibraryBuilder library) {
TypeDeclarationBuilder declaration = this.declaration!;
if (declaration is ClassBuilder) {
if (declaration.isNullClass && !library.mayImplementRestrictedTypes) {
library.addProblem(
templateExtendingRestricted.withArguments(declaration.name),
- charOffset,
+ charOffset!,
noLength,
fileUri);
}
@@ -438,8 +470,7 @@
return new Supertype((unaliasedDeclaration as ClassBuilder).cls,
<DartType>[type.typeArgument]);
}
- return handleInvalidAliasedSupertype(
- library, charOffset, fileUri, aliasBuilder, type);
+ return _handleInvalidAliasedSupertype(library, aliasBuilder, type);
} else if (declaration is InvalidTypeDeclarationBuilder) {
library.addProblem(
declaration.message.messageObject,
@@ -449,12 +480,11 @@
severity: Severity.error);
return null;
}
- return handleInvalidSupertype(library, charOffset, fileUri);
+ return _handleInvalidSupertype(library);
}
@override
- Supertype? buildMixedInType(
- LibraryBuilder library, int charOffset, Uri fileUri) {
+ Supertype? buildMixedInType(LibraryBuilder library) {
TypeDeclarationBuilder declaration = this.declaration!;
if (declaration is ClassBuilder) {
return declaration.buildMixedInType(library, arguments);
@@ -464,8 +494,7 @@
if (type is InterfaceType && type.nullability != Nullability.nullable) {
return new Supertype(type.classNode, type.typeArguments);
}
- return handleInvalidAliasedSupertype(
- library, charOffset, fileUri, aliasBuilder, type);
+ return _handleInvalidAliasedSupertype(library, aliasBuilder, type);
} else if (declaration is InvalidTypeDeclarationBuilder) {
library.addProblem(
declaration.message.messageObject,
@@ -475,7 +504,7 @@
severity: Severity.error);
return null;
}
- return handleInvalidSupertype(library, charOffset, fileUri);
+ return _handleInvalidSupertype(library);
}
@override
@@ -496,15 +525,12 @@
i++;
}
if (arguments != null) {
- NamedTypeBuilder result = new NamedTypeBuilder(
- name, nullabilityBuilder, arguments, fileUri, charOffset,
- instanceTypeVariableAccess: instanceTypeVariableAccess);
- if (declaration != null) {
- result.bind(declaration!);
- } else {
- throw new UnsupportedError("Unbound type in substitution: $result.");
- }
- return result;
+ return new NamedTypeBuilder.fromTypeDeclarationBuilder(
+ declaration!, nullabilityBuilder,
+ arguments: arguments,
+ fileUri: fileUri,
+ charOffset: charOffset,
+ instanceTypeVariableAccess: _instanceTypeVariableAccess);
}
}
return this;
@@ -523,11 +549,13 @@
.clone(newTypes, contextLibrary, contextDeclaration);
}, growable: false);
}
- NamedTypeBuilder newType = new NamedTypeBuilder(
- name, nullabilityBuilder, clonedArguments, fileUri, charOffset,
- instanceTypeVariableAccess: instanceTypeVariableAccess);
+ NamedTypeBuilder newType = new NamedTypeBuilder(name, nullabilityBuilder,
+ arguments: clonedArguments,
+ fileUri: fileUri,
+ charOffset: charOffset,
+ instanceTypeVariableAccess: _instanceTypeVariableAccess);
if (declaration is BuiltinTypeDeclarationBuilder) {
- newType.declaration = declaration;
+ newType._declaration = declaration;
} else {
newTypes.add(newType);
}
@@ -537,9 +565,30 @@
@override
NamedTypeBuilder withNullabilityBuilder(
NullabilityBuilder nullabilityBuilder) {
- return new NamedTypeBuilder(
- name, nullabilityBuilder, arguments, fileUri, charOffset,
- instanceTypeVariableAccess: instanceTypeVariableAccess)
- ..bind(declaration!);
+ return new NamedTypeBuilder.fromTypeDeclarationBuilder(
+ declaration!, nullabilityBuilder,
+ arguments: arguments,
+ fileUri: fileUri,
+ charOffset: charOffset,
+ instanceTypeVariableAccess: _instanceTypeVariableAccess);
+ }
+
+ /// Returns a copy of this named type using the provided type [arguments]
+ /// instead of the original type arguments.
+ NamedTypeBuilder withArguments(List<TypeBuilder> arguments) {
+ if (_declaration != null) {
+ return new NamedTypeBuilder.fromTypeDeclarationBuilder(
+ _declaration!, nullabilityBuilder,
+ arguments: arguments,
+ fileUri: fileUri,
+ charOffset: charOffset,
+ instanceTypeVariableAccess: _instanceTypeVariableAccess);
+ } else {
+ return new NamedTypeBuilder(name, nullabilityBuilder,
+ arguments: arguments,
+ fileUri: fileUri,
+ charOffset: charOffset,
+ instanceTypeVariableAccess: _instanceTypeVariableAccess);
+ }
}
}
diff --git a/pkg/front_end/lib/src/fasta/builder/type_builder.dart b/pkg/front_end/lib/src/fasta/builder/type_builder.dart
index 73607dd..72d12fa 100644
--- a/pkg/front_end/lib/src/fasta/builder/type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/type_builder.dart
@@ -4,9 +4,8 @@
library fasta.type_builder;
-import 'package:kernel/ast.dart' show DartType, Supertype, TypedefType;
+import 'package:kernel/ast.dart' show DartType, Supertype;
-import '../scope.dart';
import '../source/source_library_builder.dart';
import 'library_builder.dart';
import 'named_type_builder.dart';
@@ -27,14 +26,6 @@
/// occurred, or `null` if the type was synthesized.
int? get charOffset;
- void resolveIn(
- Scope scope, int charOffset, Uri fileUri, LibraryBuilder library) {}
-
- /// See `UnresolvedType.checkType`.
- void check(LibraryBuilder library, int charOffset, Uri fileUri) {}
-
- void bind(TypeDeclarationBuilder builder) {}
-
/// May return null, for example, for mixin applications.
Object? get name;
@@ -69,17 +60,11 @@
String get fullNameForErrors => "${printOn(new StringBuffer())}";
- DartType build(LibraryBuilder library, {TypedefType? origin});
+ DartType build(LibraryBuilder library);
- DartType buildTypeLiteralType(LibraryBuilder library, {TypedefType? origin}) {
- return build(library, origin: origin);
- }
+ Supertype? buildSupertype(LibraryBuilder library);
- Supertype? buildSupertype(
- LibraryBuilder library, int charOffset, Uri fileUri);
-
- Supertype? buildMixedInType(
- LibraryBuilder library, int charOffset, Uri fileUri);
+ Supertype? buildMixedInType(LibraryBuilder library);
TypeBuilder withNullabilityBuilder(NullabilityBuilder nullabilityBuilder);
diff --git a/pkg/front_end/lib/src/fasta/builder/type_variable_builder.dart b/pkg/front_end/lib/src/fasta/builder/type_variable_builder.dart
index 077db8d..e999e89 100644
--- a/pkg/front_end/lib/src/fasta/builder/type_variable_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/type_variable_builder.dart
@@ -28,6 +28,25 @@
import 'type_builder.dart';
import 'type_declaration_builder.dart';
+enum TypeVariableKind {
+ /// A type variable declared on a function, method, local function or
+ /// function type.
+ function,
+
+ /// A type variable declared on a class, mixin or enum.
+ classMixinOrEnum,
+
+ /// A type variable declared on an extension.
+ extension,
+
+ /// A type variable on an extension instance member synthesized from an
+ /// extension type variable.
+ extensionSynthesized,
+
+ /// A type variable builder created from a kernel node.
+ fromKernel,
+}
+
class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
/// Sentinel value used to indicate that the variable has no name. This is
/// used for error recovery.
@@ -41,7 +60,7 @@
TypeVariableBuilder? actualOrigin;
- final bool isExtensionTypeParameter;
+ final TypeVariableKind kind;
@override
final Uri? fileUri;
@@ -49,7 +68,7 @@
TypeVariableBuilder(
String name, Builder? compilationUnit, int charOffset, this.fileUri,
{this.bound,
- this.isExtensionTypeParameter: false,
+ required this.kind,
int? variableVariance,
List<MetadataBuilder>? metadata})
: actualParameter =
@@ -63,7 +82,7 @@
: actualParameter = parameter,
// TODO(johnniwinther): Do we need to support synthesized type
// parameters from kernel?
- this.isExtensionTypeParameter = false,
+ kind = TypeVariableKind.fromKernel,
fileUri = compilationUnit.fileUri,
super(null, 0, parameter.name ?? '', compilationUnit,
parameter.fileOffset);
@@ -194,7 +213,8 @@
// is declared on.
return new TypeVariableBuilder(name, parent!, charOffset, fileUri,
bound: bound?.clone(newTypes, contextLibrary, contextDeclaration),
- variableVariance: variance);
+ variableVariance: variance,
+ kind: kind);
}
void buildOutlineExpressions(
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
index b53d488..4665e61 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
@@ -333,9 +333,11 @@
return library!.lookupLocalMember(cls.name, required: true) as ClassBuilder;
}
+ late TypeBuilderComputer _typeBuilderComputer = new TypeBuilderComputer(this);
+
@override
TypeBuilder computeTypeBuilder(DartType type) {
- return type.accept(new TypeBuilderComputer(this));
+ return type.accept(_typeBuilderComputer);
}
bool containsLibraryBuilder(Uri importUri) =>
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 5fc0557..5dc9c13 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -96,6 +96,8 @@
import 'builder/name_iterator.dart' show NameIterator;
+import 'builder/named_type_builder.dart' show NamedTypeBuilder;
+
import 'builder/type_builder.dart' show TypeBuilder;
import 'builder/type_declaration_builder.dart' show TypeDeclarationBuilder;
@@ -1377,21 +1379,26 @@
Map<LibraryBuilder, Map<String, Builder>> replacementMap,
Map<LibraryBuilder, Map<String, Builder>> replacementSettersMap,
TypeBuilder? typeBuilder) {
- TypeDeclarationBuilder? declaration = typeBuilder?.declaration;
- Builder? parent = declaration?.parent;
- if (parent == null) return;
- Map<String, Builder>? childReplacementMap;
- if (declaration!.isSetter) {
- childReplacementMap = replacementSettersMap[parent];
- } else {
- childReplacementMap = replacementMap[parent];
- }
+ if (typeBuilder is NamedTypeBuilder) {
+ TypeDeclarationBuilder? declaration = typeBuilder.declaration;
+ Builder? parent = declaration?.parent;
+ if (parent == null) return;
+ Map<String, Builder>? childReplacementMap;
+ if (declaration!.isSetter) {
+ childReplacementMap = replacementSettersMap[parent];
+ } else {
+ childReplacementMap = replacementMap[parent];
+ }
- if (childReplacementMap == null) return;
- Builder replacement = childReplacementMap[declaration.name]!;
- // ignore: unnecessary_null_comparison
- assert(replacement != null, "Didn't find the replacement for $typeBuilder");
- typeBuilder!.bind(replacement as TypeDeclarationBuilder);
+ if (childReplacementMap == null) return;
+ Builder replacement = childReplacementMap[declaration.name]!;
+ assert(
+ // ignore: unnecessary_null_comparison
+ replacement != null,
+ "Didn't find the replacement for $typeBuilder");
+ typeBuilder.bind(
+ parent as LibraryBuilder, replacement as TypeDeclarationBuilder);
+ }
}
/// Allows for updating the list of needed libraries.
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index ff5247a..80ca725 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -4092,16 +4092,11 @@
Message message = fasta.templateNotAType.withArguments(displayName);
libraryBuilder.addProblem(
message, offset, lengthOfSpan(beginToken, suffix), uri);
- push(new NamedTypeBuilder.fromTypeDeclarationBuilder(
- new InvalidTypeDeclarationBuilder(
- name,
- message.withLocation(
- uri, offset, lengthOfSpan(beginToken, suffix))),
+ push(new NamedTypeBuilder.forInvalidType(
+ name,
libraryBuilder.nullableBuilderIfTrue(isMarkedAsNullable),
- fileUri: uri,
- charOffset: offset,
- instanceTypeVariableAccess:
- InstanceTypeVariableAccessState.Unexpected));
+ message.withLocation(
+ uri, offset, lengthOfSpan(beginToken, suffix))));
return;
}
}
@@ -4119,7 +4114,8 @@
}
result = name.buildTypeWithResolvedArguments(
libraryBuilder.nullableBuilderIfTrue(isMarkedAsNullable), arguments,
- allowPotentiallyConstantType: allowPotentiallyConstantType);
+ allowPotentiallyConstantType: allowPotentiallyConstantType,
+ forTypeLiteral: false);
// ignore: unnecessary_null_comparison
if (result == null) {
unhandled("null", "result", beginToken.charOffset, uri);
@@ -4128,16 +4124,11 @@
// TODO(ahe): Arguments could be passed here.
libraryBuilder.addProblem(
name.message, name.charOffset, name.name.length, name.fileUri);
- result = new NamedTypeBuilder.fromTypeDeclarationBuilder(
- new InvalidTypeDeclarationBuilder(
- name.name,
- name.message.withLocation(
- name.fileUri, name.charOffset, name.name.length)),
+ result = new NamedTypeBuilder.forInvalidType(
+ name.name,
libraryBuilder.nullableBuilderIfTrue(isMarkedAsNullable),
- fileUri: name.fileUri,
- charOffset: name.charOffset,
- instanceTypeVariableAccess:
- InstanceTypeVariableAccessState.Unexpected);
+ name.message
+ .withLocation(name.fileUri, name.charOffset, name.name.length));
} else {
unhandled(
"${name.runtimeType}", "handleType", beginToken.charOffset, uri);
@@ -6802,7 +6793,8 @@
token.charOffset, uri);
}
TypeVariableBuilder variable = new TypeVariableBuilder(
- typeVariableName, libraryBuilder, typeVariableCharOffset, uri);
+ typeVariableName, libraryBuilder, typeVariableCharOffset, uri,
+ kind: TypeVariableKind.function);
if (annotations != null) {
inferAnnotations(variable.parameter, annotations);
for (Expression annotation in annotations) {
@@ -6862,11 +6854,6 @@
"Found a type not bound to a declaration in BodyBuilder.");
for (int i = 0; i < typeVariables.length; ++i) {
typeVariables[i].defaultType = calculatedBounds[i];
- typeVariables[i].defaultType!.resolveIn(
- scope,
- typeVariables[i].charOffset,
- typeVariables[i].fileUri!,
- libraryBuilder);
typeVariables[i].finish(
libraryBuilder,
libraryBuilder.loader.target.objectClassBuilder,
@@ -7251,43 +7238,17 @@
TypeParameter typeParameter = typeParameterBuilder.parameter;
if (typeParameter.parent is Class ||
typeParameter.parent is Extension) {
- switch (builder.instanceTypeVariableAccess) {
- case InstanceTypeVariableAccessState.Allowed:
- if (constantContext != ConstantContext.none &&
- (!inConstructorInitializer ||
- !allowPotentiallyConstantType)) {
- LocatedMessage message =
- fasta.messageTypeVariableInConstantContext.withLocation(
- builder.fileUri!,
- builder.charOffset!,
- typeParameter.name!.length);
- builder.bind(new InvalidTypeDeclarationBuilder(
+ if (constantContext != ConstantContext.none &&
+ (!inConstructorInitializer || !allowPotentiallyConstantType)) {
+ LocatedMessage message = fasta.messageTypeVariableInConstantContext
+ .withLocation(builder.fileUri!, builder.charOffset!,
+ typeParameter.name!.length);
+ builder.bind(
+ libraryBuilder,
+ new InvalidTypeDeclarationBuilder(
typeParameter.name!, message));
- addProblem(
- message.messageObject, message.charOffset, message.length);
- }
- break;
- case InstanceTypeVariableAccessState.Disallowed:
- // TODO(johnniwinther): Can we unify this check with the similar
- // check in NamedTypeBuilder.buildTypeInternal. If we skip it
- // here, the error below (type variable in constant context) will
- // be emitted _instead_ of this (type variable in static context),
- // which seems like an odd prioritization.
- // TODO: Handle this case.
- LocatedMessage message = fasta.messageTypeVariableInStaticContext
- .withLocation(builder.fileUri!, builder.charOffset!,
- typeParameter.name!.length);
- builder.bind(new InvalidTypeDeclarationBuilder(
- typeParameter.name!, message));
- addProblem(
- message.messageObject, message.charOffset, message.length);
- break;
- case InstanceTypeVariableAccessState.Invalid:
- break;
- case InstanceTypeVariableAccessState.Unexpected:
- assert(false,
- "Unexpected instance type variable $typeParameterBuilder");
- break;
+ addProblem(
+ message.messageObject, message.charOffset, message.length);
}
}
}
@@ -7482,14 +7443,6 @@
}
@override
- DartType buildTypeLiteralDartType(TypeBuilder typeBuilder,
- {required bool allowPotentiallyConstantType}) {
- return validateTypeVariableUse(typeBuilder,
- allowPotentiallyConstantType: allowPotentiallyConstantType)
- .buildTypeLiteralType(libraryBuilder);
- }
-
- @override
List<DartType> buildDartTypeArguments(List<TypeBuilder>? unresolvedTypes,
{required bool allowPotentiallyConstantType}) {
if (unresolvedTypes == null) return <DartType>[];
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
index d4540fb..4c64564 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -273,21 +273,13 @@
/// create a [TypeBuilder] for a valid type.
TypeBuilder buildTypeWithResolvedArguments(
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
- {required bool allowPotentiallyConstantType}) {
- // TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
- NamedTypeBuilder result = new NamedTypeBuilder(
- token.lexeme,
- nullabilityBuilder,
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
- instanceTypeVariableAccess: _helper.instanceTypeVariableAccessState);
+ {required bool allowPotentiallyConstantType,
+ required bool forTypeLiteral}) {
Message message = templateNotAType.withArguments(token.lexeme);
_helper.libraryBuilder
.addProblem(message, fileOffset, lengthForToken(token), _uri);
- result.bind(result.buildInvalidTypeDeclarationBuilder(
- message.withLocation(_uri, fileOffset, lengthForToken(token))));
- return result;
+ return new NamedTypeBuilder.forInvalidType(token.lexeme, nullabilityBuilder,
+ message.withLocation(_uri, fileOffset, lengthForToken(token)));
}
/* Expression | Generator */ Object qualifiedLookup(Token name) {
@@ -2910,12 +2902,14 @@
@override
TypeBuilder buildTypeWithResolvedArguments(
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
- {required bool allowPotentiallyConstantType}) {
+ {required bool allowPotentiallyConstantType,
+ required bool forTypeLiteral}) {
String name = "${prefixGenerator._plainNameForRead}."
"${suffixGenerator._plainNameForRead}";
TypeBuilder type = suffixGenerator.buildTypeWithResolvedArguments(
nullabilityBuilder, arguments,
- allowPotentiallyConstantType: allowPotentiallyConstantType);
+ allowPotentiallyConstantType: allowPotentiallyConstantType,
+ forTypeLiteral: forTypeLiteral);
LocatedMessage message;
if (type is NamedTypeBuilder &&
type.declaration is InvalidTypeDeclarationBuilder) {
@@ -2933,14 +2927,10 @@
.withLocation(
_uri, charOffset, lengthOfSpan(prefixGenerator.token, token));
}
- // TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
- NamedTypeBuilder result = new NamedTypeBuilder(name, nullabilityBuilder,
- /* arguments = */ null, /* fileUri = */ null, /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
_helper.libraryBuilder.addProblem(
message.messageObject, message.charOffset, message.length, message.uri);
- result.bind(result.buildInvalidTypeDeclarationBuilder(message));
- return result;
+ return new NamedTypeBuilder.forInvalidType(
+ name, nullabilityBuilder, message);
}
@override
@@ -3039,40 +3029,15 @@
@override
TypeBuilder buildTypeWithResolvedArguments(
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
- {required bool allowPotentiallyConstantType}) {
- if (declaration.isExtension && !_helper.enableExtensionTypesInLibrary) {
- // Extension declarations cannot be used as types.
- return super.buildTypeWithResolvedArguments(nullabilityBuilder, arguments,
- allowPotentiallyConstantType: allowPotentiallyConstantType);
- }
- if (arguments != null) {
- int expected = declaration.typeVariablesCount;
- if (arguments.length != expected) {
- // Build the type arguments to report any errors they may have.
- _helper.buildDartTypeArguments(arguments,
- allowPotentiallyConstantType: allowPotentiallyConstantType);
- _helper.warnTypeArgumentsMismatch(
- declaration.name, expected, fileOffset);
- // We ignore the provided arguments, which will in turn return the
- // raw type below.
- // TODO(sigmund): change to use an InvalidType and include the raw type
- // as a recovery node once the IR can represent it (Issue #29840).
- arguments = null;
- }
- }
-
- List<TypeBuilder>? argumentBuilders;
- if (arguments != null) {
- argumentBuilders =
- new List<TypeBuilder>.generate(arguments.length, (int i) {
- return _helper.validateTypeVariableUse(arguments![i],
- allowPotentiallyConstantType: allowPotentiallyConstantType);
- }, growable: false);
- }
- return new NamedTypeBuilder(
- targetName, nullabilityBuilder, argumentBuilders, _uri, fileOffset,
- instanceTypeVariableAccess: _helper.instanceTypeVariableAccessState)
- ..bind(declaration);
+ {required bool allowPotentiallyConstantType,
+ required bool forTypeLiteral}) {
+ return new NamedTypeBuilder(targetName, nullabilityBuilder,
+ arguments: arguments,
+ fileUri: _uri,
+ charOffset: fileOffset,
+ instanceTypeVariableAccess: _helper.instanceTypeVariableAccessState,
+ forTypeLiteral: forTypeLiteral)
+ ..bind(_helper.libraryBuilder, declaration);
}
@override
@@ -3115,10 +3080,10 @@
} else {
_expression = _forest.createTypeLiteral(
offsetForToken(token),
- _helper.buildTypeLiteralDartType(
+ _helper.buildDartType(
buildTypeWithResolvedArguments(
_helper.libraryBuilder.nonNullableBuilder, typeArguments,
- allowPotentiallyConstantType: true),
+ allowPotentiallyConstantType: true, forTypeLiteral: true),
allowPotentiallyConstantType:
_helper.enableConstructorTearOffsInLibrary));
}
@@ -3181,11 +3146,13 @@
aliasedTypeArguments = <TypeBuilder>[];
for (TypeVariableBuilder typeVariable
in aliasBuilder.typeVariables!) {
- aliasedTypeArguments.add(new NamedTypeBuilder(typeVariable.name,
- const NullabilityBuilder.omitted(), null, _uri, fileOffset,
+ aliasedTypeArguments.add(new NamedTypeBuilder(
+ typeVariable.name, const NullabilityBuilder.omitted(),
+ fileUri: _uri,
+ charOffset: fileOffset,
instanceTypeVariableAccess:
_helper.instanceTypeVariableAccessState)
- ..bind(typeVariable));
+ ..bind(_helper.libraryBuilder, typeVariable));
}
}
unaliasedTypeArguments =
@@ -4183,18 +4150,12 @@
@override
TypeBuilder buildTypeWithResolvedArguments(
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
- {required bool allowPotentiallyConstantType}) {
+ {required bool allowPotentiallyConstantType,
+ required bool forTypeLiteral}) {
Template<Message Function(String, String)> template = isUnresolved
? templateUnresolvedPrefixInTypeAnnotation
: templateNotAPrefixInTypeAnnotation;
// TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
- NamedTypeBuilder result = new NamedTypeBuilder(
- _plainNameForRead,
- nullabilityBuilder,
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
Message message =
template.withArguments(prefixGenerator.token.lexeme, token.lexeme);
_helper.libraryBuilder.addProblem(
@@ -4202,11 +4163,11 @@
offsetForToken(prefixGenerator.token),
lengthOfSpan(prefixGenerator.token, token),
_uri);
- result.bind(result.buildInvalidTypeDeclarationBuilder(message.withLocation(
- _uri,
- offsetForToken(prefixGenerator.token),
- lengthOfSpan(prefixGenerator.token, token))));
- return result;
+ return new NamedTypeBuilder.forInvalidType(
+ _plainNameForRead,
+ nullabilityBuilder,
+ message.withLocation(_uri, offsetForToken(prefixGenerator.token),
+ lengthOfSpan(prefixGenerator.token, token)));
}
@override
@@ -4309,19 +4270,11 @@
@override
TypeBuilder buildTypeWithResolvedArguments(
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
- {required bool allowPotentiallyConstantType}) {
- // TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
- NamedTypeBuilder result = new NamedTypeBuilder(
- token.lexeme,
- nullabilityBuilder,
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
+ {required bool allowPotentiallyConstantType,
+ required bool forTypeLiteral}) {
_helper.libraryBuilder.addProblem(message, fileOffset, noLength, _uri);
- result.bind(result.buildInvalidTypeDeclarationBuilder(
- message.withLocation(_uri, fileOffset, noLength)));
- return result;
+ return new NamedTypeBuilder.forInvalidType(token.lexeme, nullabilityBuilder,
+ message.withLocation(_uri, fileOffset, noLength));
}
@override
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
index 4805dac..a141e17 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
@@ -160,9 +160,6 @@
DartType buildDartType(TypeBuilder typeBuilder,
{required bool allowPotentiallyConstantType});
- DartType buildTypeLiteralDartType(TypeBuilder typeBuilder,
- {required bool allowPotentiallyConstantType});
-
List<DartType> buildDartTypeArguments(List<TypeBuilder>? typeArguments,
{required bool allowPotentiallyConstantType});
diff --git a/pkg/front_end/lib/src/fasta/kernel/hierarchy/hierarchy_node.dart b/pkg/front_end/lib/src/fasta/kernel/hierarchy/hierarchy_node.dart
index 9b5d76b..812152b 100644
--- a/pkg/front_end/lib/src/fasta/kernel/hierarchy/hierarchy_node.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/hierarchy/hierarchy_node.dart
@@ -68,10 +68,8 @@
superclasses = new List<Supertype>.filled(
supernode.superclasses.length + 1, dummySupertype);
- Supertype? supertype = classBuilder.supertypeBuilder!.buildSupertype(
- classBuilder.libraryBuilder,
- classBuilder.charOffset,
- classBuilder.fileUri);
+ Supertype? supertype = classBuilder.supertypeBuilder!
+ .buildSupertype(classBuilder.libraryBuilder);
if (supertype == null) {
// If the superclass is not an interface type we use Object instead.
// A similar normalization is performed on [supernode] above.
@@ -117,8 +115,7 @@
for (int i = 0; i < directInterfaceBuilders.length; i++) {
Supertype? directInterface = directInterfaceBuilders[i]
- .buildSupertype(classBuilder.libraryBuilder,
- classBuilder.charOffset, classBuilder.fileUri);
+ .buildSupertype(classBuilder.libraryBuilder);
if (directInterface != null) {
addInterface(interfaces, superclasses, directInterface);
ClassHierarchyNode interfaceNode =
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 67f05c4..d90e037 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -102,56 +102,32 @@
// 'dynamic' is always nullable.
// TODO(johnniwinther): Why isn't this using a FixedTypeBuilder?
- final TypeBuilder dynamicType = new NamedTypeBuilder(
- "dynamic",
- const NullabilityBuilder.inherent(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ final NamedTypeBuilder dynamicType = new NamedTypeBuilder(
+ "dynamic", const NullabilityBuilder.inherent(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
final NamedTypeBuilder objectType = new NamedTypeBuilder(
- "Object",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ "Object", const NullabilityBuilder.omitted(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
// Null is always nullable.
// TODO(johnniwinther): This could (maybe) use a FixedTypeBuilder when we
// have NullType?
- final TypeBuilder nullType = new NamedTypeBuilder(
- "Null",
- const NullabilityBuilder.inherent(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ final NamedTypeBuilder nullType = new NamedTypeBuilder(
+ "Null", const NullabilityBuilder.inherent(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
// TODO(johnniwinther): Why isn't this using a FixedTypeBuilder?
- final TypeBuilder bottomType = new NamedTypeBuilder(
- "Never",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ final NamedTypeBuilder bottomType = new NamedTypeBuilder(
+ "Never", const NullabilityBuilder.omitted(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
final NamedTypeBuilder enumType = new NamedTypeBuilder(
- "Enum",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ "Enum", const NullabilityBuilder.omitted(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
final NamedTypeBuilder underscoreEnumType = new NamedTypeBuilder(
- "_Enum",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ "_Enum", const NullabilityBuilder.omitted(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
final bool excludeSource = !CompilerContext.current.options.embedSourceText;
@@ -385,14 +361,9 @@
cls.implementedTypes.clear();
cls.supertype = null;
cls.mixedInType = null;
- builder.supertypeBuilder = new NamedTypeBuilder(
- "Object",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
- ..bind(objectClassBuilder);
+ builder.supertypeBuilder = new NamedTypeBuilder.fromTypeDeclarationBuilder(
+ objectClassBuilder, const NullabilityBuilder.omitted(),
+ instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
builder.interfaceBuilders = null;
builder.mixedInTypeBuilder = null;
}
@@ -1208,20 +1179,29 @@
}
void setupTopAndBottomTypes() {
- objectType.bind(loader.coreLibrary
- .lookupLocalMember("Object", required: true) as TypeDeclarationBuilder);
+ objectType.bind(
+ loader.coreLibrary,
+ loader.coreLibrary.lookupLocalMember("Object", required: true)
+ as TypeDeclarationBuilder);
dynamicType.bind(
+ loader.coreLibrary,
loader.coreLibrary.lookupLocalMember("dynamic", required: true)
as TypeDeclarationBuilder);
ClassBuilder nullClassBuilder = loader.coreLibrary
.lookupLocalMember("Null", required: true) as ClassBuilder;
- nullType.bind(nullClassBuilder..isNullClass = true);
- bottomType.bind(loader.coreLibrary
- .lookupLocalMember("Never", required: true) as TypeDeclarationBuilder);
- enumType.bind(loader.coreLibrary.lookupLocalMember("Enum", required: true)
- as TypeDeclarationBuilder);
- underscoreEnumType.bind(loader.coreLibrary
- .lookupLocalMember("_Enum", required: true) as TypeDeclarationBuilder);
+ nullType.bind(loader.coreLibrary, nullClassBuilder..isNullClass = true);
+ bottomType.bind(
+ loader.coreLibrary,
+ loader.coreLibrary.lookupLocalMember("Never", required: true)
+ as TypeDeclarationBuilder);
+ enumType.bind(
+ loader.coreLibrary,
+ loader.coreLibrary.lookupLocalMember("Enum", required: true)
+ as TypeDeclarationBuilder);
+ underscoreEnumType.bind(
+ loader.coreLibrary,
+ loader.coreLibrary.lookupLocalMember("_Enum", required: true)
+ as TypeDeclarationBuilder);
}
void computeCoreTypes() {
diff --git a/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart b/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart
index 55c1e0b..d50d234 100644
--- a/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart
@@ -268,12 +268,8 @@
assert(false, "Unexpected named type builder declaration: $declaration.");
}
if (arguments != null) {
- NamedTypeBuilder newTypeBuilder = new NamedTypeBuilder(type.name,
- type.nullabilityBuilder, arguments, type.fileUri, type.charOffset,
- instanceTypeVariableAccess: type.instanceTypeVariableAccess);
- if (declaration != null) {
- newTypeBuilder.bind(declaration);
- } else {
+ NamedTypeBuilder newTypeBuilder = type.withArguments(arguments);
+ if (declaration == null) {
unboundTypes.add(newTypeBuilder);
}
return newTypeBuilder;
@@ -305,7 +301,7 @@
TypeVariableBuilder newTypeVariableBuilder = variables[i] =
new TypeVariableBuilder(variable.name, variable.parent,
variable.charOffset, variable.fileUri,
- bound: bound);
+ bound: bound, kind: TypeVariableKind.function);
unboundTypeVariables.add(newTypeVariableBuilder);
if (functionTypeUpperSubstitution == null) {
functionTypeUpperSubstitution = {}..addAll(upperSubstitution);
diff --git a/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart b/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
index 52d0a58..591ae4d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
@@ -31,7 +31,27 @@
class TypeBuilderComputer implements DartTypeVisitor<TypeBuilder> {
final Loader loader;
- const TypeBuilderComputer(this.loader);
+ late final DynamicTypeDeclarationBuilder dynamicDeclaration =
+ new DynamicTypeDeclarationBuilder(
+ const DynamicType(), loader.coreLibrary, -1);
+
+ late final VoidTypeDeclarationBuilder voidDeclaration =
+ new VoidTypeDeclarationBuilder(const VoidType(), loader.coreLibrary, -1);
+
+ late final NeverTypeDeclarationBuilder neverDeclaration =
+ new NeverTypeDeclarationBuilder(
+ const NeverType.nonNullable(), loader.coreLibrary, -1);
+
+ late final NullTypeDeclarationBuilder nullDeclaration =
+ new NullTypeDeclarationBuilder(const NullType(), loader.coreLibrary, -1);
+
+ late final FutureOrTypeDeclarationBuilder futureOrDeclaration =
+ new FutureOrTypeDeclarationBuilder(
+ new FutureOrType(const DynamicType(), Nullability.nonNullable),
+ loader.coreLibrary,
+ -1);
+
+ TypeBuilderComputer(this.loader);
@override
TypeBuilder defaultDartType(DartType node) {
@@ -47,41 +67,27 @@
@override
TypeBuilder visitDynamicType(DynamicType node) {
// 'dynamic' is always nullable.
- return new NamedTypeBuilder("dynamic", const NullabilityBuilder.nullable(),
- /* arguments = */ null, /* fileUri = */ null, /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
- ..bind(new DynamicTypeDeclarationBuilder(
- const DynamicType(), loader.coreLibrary, -1));
+ return new NamedTypeBuilder.forDartType(
+ node, dynamicDeclaration, const NullabilityBuilder.inherent());
}
@override
TypeBuilder visitVoidType(VoidType node) {
// 'void' is always nullable.
- return new NamedTypeBuilder("void", const NullabilityBuilder.nullable(),
- /* arguments = */ null, /* fileUri = */ null, /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
- ..bind(new VoidTypeDeclarationBuilder(
- const VoidType(), loader.coreLibrary, -1));
+ return new NamedTypeBuilder.forDartType(
+ node, voidDeclaration, const NullabilityBuilder.inherent());
}
@override
TypeBuilder visitNeverType(NeverType node) {
- return new NamedTypeBuilder(
- "Never",
- new NullabilityBuilder.fromNullability(node.nullability),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
- ..bind(new NeverTypeDeclarationBuilder(node, loader.coreLibrary, -1));
+ return new NamedTypeBuilder.forDartType(node, neverDeclaration,
+ new NullabilityBuilder.fromNullability(node.nullability));
}
@override
TypeBuilder visitNullType(NullType node) {
- return new NamedTypeBuilder("Null", new NullabilityBuilder.nullable(),
- /* arguments = */ null, /* fileUri = */ null, /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
- ..bind(new NullTypeDeclarationBuilder(node, loader.coreLibrary, -1));
+ return new NamedTypeBuilder.forDartType(
+ node, nullDeclaration, const NullabilityBuilder.inherent());
}
@override
@@ -95,14 +101,9 @@
kernelArguments.length, (int i) => kernelArguments[i].accept(this),
growable: false);
}
- return new NamedTypeBuilder(
- cls.name,
- new NullabilityBuilder.fromNullability(node.nullability),
- arguments,
- /* fileUri = */ null,
- /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
- ..bind(cls);
+ return new NamedTypeBuilder.forDartType(
+ node, cls, new NullabilityBuilder.fromNullability(node.nullability),
+ arguments: arguments);
}
@override
@@ -113,14 +114,9 @@
@override
TypeBuilder visitFutureOrType(FutureOrType node) {
TypeBuilder argument = node.typeArgument.accept(this);
- return new NamedTypeBuilder(
- "FutureOr",
+ return new NamedTypeBuilder.forDartType(node, futureOrDeclaration,
new NullabilityBuilder.fromNullability(node.nullability),
- [argument],
- /* fileUri = */ null,
- /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
- ..bind(new FutureOrTypeDeclarationBuilder(node, loader.coreLibrary, -1));
+ arguments: [argument]);
}
@override
@@ -183,14 +179,11 @@
}
LibraryBuilder library =
loader.lookupLibraryBuilder(kernelLibrary!.importUri)!;
- return new NamedTypeBuilder(
- parameter.name!,
+ return new NamedTypeBuilder.fromTypeDeclarationBuilder(
+ new TypeVariableBuilder.fromKernel(parameter, library),
new NullabilityBuilder.fromNullability(node.nullability),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
- instanceTypeVariableAccess: InstanceTypeVariableAccessState.Allowed)
- ..bind(new TypeVariableBuilder.fromKernel(parameter, library));
+ instanceTypeVariableAccess: InstanceTypeVariableAccessState.Allowed,
+ type: node);
}
@override
diff --git a/pkg/front_end/lib/src/fasta/kernel/utils.dart b/pkg/front_end/lib/src/fasta/kernel/utils.dart
index 4cfbf57..fbed0bd 100644
--- a/pkg/front_end/lib/src/fasta/kernel/utils.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/utils.dart
@@ -232,8 +232,9 @@
new FixedTypeBuilder(dummyDartType, dummyUri, -1);
final FormalParameterBuilder dummyFormalParameterBuilder =
new FormalParameterBuilder(null, 0, null, '', null, -1, fileUri: dummyUri);
-final TypeVariableBuilder dummyTypeVariableBuilder =
- new TypeVariableBuilder(TypeVariableBuilder.noNameSentinel, null, -1, null);
+final TypeVariableBuilder dummyTypeVariableBuilder = new TypeVariableBuilder(
+ TypeVariableBuilder.noNameSentinel, null, -1, null,
+ kind: TypeVariableKind.function);
final Label dummyLabel = new Label('', -1);
final FieldInfo dummyFieldInfo = new FieldInfo('', -1, null, dummyToken, -1);
final Configuration dummyConfiguration = new Configuration(-1, '', '', '');
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index 4fdb9fc..7e1207b 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -369,6 +369,54 @@
return InstanceTypeVariableAccessState.Invalid;
}
}
+
+ /// Returns the kind of type variable created in the current context.
+ TypeVariableKind get typeVariableKind {
+ switch (this) {
+ case DeclarationContext.Class:
+ case DeclarationContext.ClassOrMixinOrNamedMixinApplication:
+ case DeclarationContext.Mixin:
+ case DeclarationContext.NamedMixinApplication:
+ return TypeVariableKind.classMixinOrEnum;
+ case DeclarationContext.Extension:
+ case DeclarationContext.ExtensionBody:
+ return TypeVariableKind.extension;
+ case DeclarationContext.ClassBody:
+ case DeclarationContext.ClassConstructor:
+ case DeclarationContext.ClassFactory:
+ case DeclarationContext.ClassInstanceField:
+ case DeclarationContext.ClassInstanceMethod:
+ case DeclarationContext.ClassStaticField:
+ case DeclarationContext.ClassStaticMethod:
+ case DeclarationContext.Enum:
+ case DeclarationContext.EnumBody:
+ case DeclarationContext.EnumConstructor:
+ case DeclarationContext.EnumFactory:
+ case DeclarationContext.EnumInstanceField:
+ case DeclarationContext.EnumInstanceMethod:
+ case DeclarationContext.EnumStaticField:
+ case DeclarationContext.EnumStaticMethod:
+ case DeclarationContext.ExtensionConstructor:
+ case DeclarationContext.ExtensionExternalInstanceField:
+ case DeclarationContext.ExtensionFactory:
+ case DeclarationContext.ExtensionInstanceField:
+ case DeclarationContext.ExtensionInstanceMethod:
+ case DeclarationContext.ExtensionStaticField:
+ case DeclarationContext.ExtensionStaticMethod:
+ case DeclarationContext.Library:
+ case DeclarationContext.MixinBody:
+ case DeclarationContext.MixinConstructor:
+ case DeclarationContext.MixinFactory:
+ case DeclarationContext.MixinInstanceField:
+ case DeclarationContext.MixinInstanceMethod:
+ case DeclarationContext.MixinStaticField:
+ case DeclarationContext.MixinStaticMethod:
+ case DeclarationContext.TopLevelField:
+ case DeclarationContext.TopLevelMethod:
+ case DeclarationContext.Typedef:
+ return TypeVariableKind.function;
+ }
+ }
}
class OutlineBuilder extends StackListenerImpl {
@@ -1842,7 +1890,7 @@
// names are used to create the scope.
List<TypeVariableBuilder> synthesizedTypeVariables = libraryBuilder
.copyTypeVariables(extension.typeVariables!, declarationBuilder,
- isExtensionTypeParameter: true);
+ kind: TypeVariableKind.extensionSynthesized);
substitution = {};
for (int i = 0; i < synthesizedTypeVariables.length; i++) {
substitution[extension.typeVariables![i]] =
@@ -2904,7 +2952,8 @@
push(name);
} else {
push(libraryBuilder.addTypeVariable(
- metadata, name as String, null, charOffset, uri));
+ metadata, name as String, null, charOffset, uri,
+ kind: declarationContext.typeVariableKind));
}
}
@@ -2994,18 +3043,18 @@
builder.name, via.join("', '"));
addProblem(message, builder.charOffset, builder.name.length);
builder.bound = new NamedTypeBuilder(
- builder.name,
- const NullabilityBuilder.omitted(),
- null,
- uri,
- builder.charOffset,
+ builder.name, const NullabilityBuilder.omitted(),
+ fileUri: uri,
+ charOffset: builder.charOffset,
instanceTypeVariableAccess:
//InstanceTypeVariableAccessState.Unexpected
declarationContext.instanceTypeVariableAccessState)
- ..bind(new InvalidTypeDeclarationBuilder(
- builder.name,
- message.withLocation(
- uri, builder.charOffset, builder.name.length)));
+ ..bind(
+ libraryBuilder,
+ new InvalidTypeDeclarationBuilder(
+ builder.name,
+ message.withLocation(
+ uri, builder.charOffset, builder.name.length)));
}
}
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index 9c477e0..3cfb2bf 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -213,8 +213,7 @@
if (supertypeBuilder != null) {
supertypeBuilder = _checkSupertype(supertypeBuilder!);
}
- Supertype? supertype =
- supertypeBuilder?.buildSupertype(libraryBuilder, charOffset, fileUri);
+ Supertype? supertype = supertypeBuilder?.buildSupertype(libraryBuilder);
if (supertype != null) {
Class superclass = supertype.classNode;
if (superclass.name == 'Function' &&
@@ -247,8 +246,8 @@
if (mixedInTypeBuilder != null) {
mixedInTypeBuilder = _checkSupertype(mixedInTypeBuilder!);
}
- Supertype? mixedInType = mixedInTypeBuilder?.buildMixedInType(
- libraryBuilder, charOffset, fileUri);
+ Supertype? mixedInType =
+ mixedInTypeBuilder?.buildMixedInType(libraryBuilder);
if (_isFunction(mixedInType, coreLibrary)) {
libraryBuilder.addProblem(
messageMixinFunction, charOffset, noLength, fileUri);
@@ -270,8 +269,8 @@
if (interfaceBuilders != null) {
for (int i = 0; i < interfaceBuilders!.length; ++i) {
interfaceBuilders![i] = _checkSupertype(interfaceBuilders![i]);
- Supertype? supertype = interfaceBuilders![i]
- .buildSupertype(libraryBuilder, charOffset, fileUri);
+ Supertype? supertype =
+ interfaceBuilders![i].buildSupertype(libraryBuilder);
if (supertype != null) {
if (_isFunction(supertype, coreLibrary)) {
libraryBuilder.addProblem(
@@ -823,11 +822,6 @@
TypeAliasBuilder? aliasBuilder) {
int nameOffset = target.nameOffset;
int nameLength = target.nameLength;
- // TODO(eernst): nameOffset not fully implemented; use backup.
- if (nameOffset == -1) {
- nameOffset = this.charOffset;
- nameLength = noLength;
- }
if (aliasBuilder != null) {
addProblem(message, nameOffset, nameLength, context: [
messageTypedefCause.withLocation(
@@ -1216,15 +1210,15 @@
}
if (message != null) {
return new NamedTypeBuilder(
- supertype.name as String,
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- fileUri,
- charOffset,
+ supertype.name as String, const NullabilityBuilder.omitted(),
+ fileUri: fileUri,
+ charOffset: charOffset,
instanceTypeVariableAccess:
InstanceTypeVariableAccessState.Unexpected)
- ..bind(new InvalidTypeDeclarationBuilder(supertype.name as String,
- message.withLocation(fileUri, charOffset, noLength)));
+ ..bind(
+ libraryBuilder,
+ new InvalidTypeDeclarationBuilder(supertype.name as String,
+ message.withLocation(fileUri, charOffset, noLength)));
}
return supertype;
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_enum_builder.dart b/pkg/front_end/lib/src/fasta/source/source_enum_builder.dart
index d634e7f..de8d674 100644
--- a/pkg/front_end/lib/src/fasta/source/source_enum_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_enum_builder.dart
@@ -130,7 +130,7 @@
TypeBuilder? supertypeBuilder,
List<TypeBuilder>? interfaceBuilders,
List<EnumConstantInfo?>? enumConstantInfos,
- SourceLibraryBuilder parent,
+ SourceLibraryBuilder libraryBuilder,
List<ConstructorReferenceBuilder> constructorReferences,
int startCharOffset,
int charOffset,
@@ -140,16 +140,12 @@
ConstructorScope constructorScope) {
assert(enumConstantInfos == null || enumConstantInfos.isNotEmpty);
- Uri fileUri = parent.fileUri;
+ Uri fileUri = libraryBuilder.fileUri;
// TODO(ahe): These types shouldn't be looked up in scope, they come
// directly from dart:core.
NamedTypeBuilder intType = new NamedTypeBuilder(
- "int",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ "int", const NullabilityBuilder.omitted(),
instanceTypeVariableAccess:
// If "int" resolves to an instance type variable then that we would
// allowed (the types that we are adding are in instance context
@@ -162,25 +158,13 @@
// variables.
InstanceTypeVariableAccessState.Unexpected);
NamedTypeBuilder stringType = new NamedTypeBuilder(
- "String",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ "String", const NullabilityBuilder.omitted(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
NamedTypeBuilder objectType = new NamedTypeBuilder(
- "Object",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ "Object", const NullabilityBuilder.omitted(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
supertypeBuilder ??= new NamedTypeBuilder(
- "_Enum",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ "_Enum", const NullabilityBuilder.omitted(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
Class cls = new Class(
name: name,
@@ -193,18 +177,11 @@
Map<String, MemberBuilder> constructors = <String, MemberBuilder>{};
List<SourceFieldBuilder> elementBuilders = <SourceFieldBuilder>[];
NamedTypeBuilder selfType = new NamedTypeBuilder(
- name,
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
+ name, const NullabilityBuilder.omitted(),
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
NamedTypeBuilder listType = new NamedTypeBuilder(
- "List",
- const NullabilityBuilder.omitted(),
- <TypeBuilder>[selfType],
- /* fileUri = */ null,
- /* charOffset = */ null,
+ "List", const NullabilityBuilder.omitted(),
+ arguments: <TypeBuilder>[selfType],
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
// metadata class E extends _Enum {
@@ -225,7 +202,7 @@
extensionName: null,
libraryReference: referencesFromIndexed != null
? referencesFromIndexed.library.reference
- : parent.library.reference);
+ : libraryBuilder.library.reference);
NameScheme procedureNameScheme = new NameScheme(
isInstanceMember: true,
@@ -234,7 +211,7 @@
extensionName: null,
libraryReference: referencesFromIndexed != null
? referencesFromIndexed.library.reference
- : parent.library.reference);
+ : libraryBuilder.library.reference);
Reference? constructorReference;
Reference? tearOffReference;
@@ -265,7 +242,7 @@
while (customValuesDeclaration?.next != null) {
customValuesDeclaration = customValuesDeclaration?.next;
}
- parent.addProblem(
+ libraryBuilder.addProblem(
messageEnumContainsValuesDeclaration,
customValuesDeclaration!.charOffset,
customValuesDeclaration.fullNameForErrors.length,
@@ -285,7 +262,7 @@
while (customIndexDeclaration?.next != null) {
customIndexDeclaration = customIndexDeclaration?.next;
}
- parent.addProblem(
+ libraryBuilder.addProblem(
templateEnumContainsRestrictedInstanceDeclaration
.withArguments(restrictedInstanceMemberName),
customIndexDeclaration!.charOffset,
@@ -300,7 +277,7 @@
"values",
constMask | staticMask | hasInitializerMask,
/* isTopLevel = */ false,
- parent,
+ libraryBuilder,
charOffset,
charOffset,
staticFieldNameScheme,
@@ -333,11 +310,11 @@
/* typeParameters = */ null,
<FormalParameterBuilder>[
new FormalParameterBuilder(
- null, 0, intType, "index", parent, charOffset),
+ null, 0, intType, "index", libraryBuilder, charOffset),
new FormalParameterBuilder(
- null, 0, stringType, "name", parent, charOffset)
+ null, 0, stringType, "name", libraryBuilder, charOffset)
],
- parent,
+ libraryBuilder,
charOffset,
charOffset,
charOffset,
@@ -355,11 +332,11 @@
member.formals!.insert(
0,
new FormalParameterBuilder(
- null, 0, stringType, "name", parent, charOffset));
+ null, 0, stringType, "name", libraryBuilder, charOffset));
member.formals!.insert(
0,
new FormalParameterBuilder(
- null, 0, intType, "index", parent, charOffset));
+ null, 0, intType, "index", libraryBuilder, charOffset));
}
});
}
@@ -373,7 +350,7 @@
/* typeVariables = */ null,
/* formals = */ null,
ProcedureKind.Method,
- parent,
+ libraryBuilder,
charOffset,
charOffset,
charOffset,
@@ -425,23 +402,27 @@
templateDuplicatedDeclarationSyntheticCause
.withArguments(name)
.withLocation(
- parent.fileUri, charOffset, className.length)
+ libraryBuilder.fileUri, charOffset, className.length)
]
: <LocatedMessage>[
templateDuplicatedDeclarationCause
.withArguments(name)
- .withLocation(parent.fileUri, existingOffset, name.length)
+ .withLocation(
+ libraryBuilder.fileUri, existingOffset, name.length)
];
- parent.addProblem(templateDuplicatedDeclaration.withArguments(name),
- duplicateOffset, name.length, parent.fileUri,
+ libraryBuilder.addProblem(
+ templateDuplicatedDeclaration.withArguments(name),
+ duplicateOffset,
+ name.length,
+ libraryBuilder.fileUri,
context: context);
enumConstantInfos[i] = null;
} else if (name == className) {
- parent.addProblem(
+ libraryBuilder.addProblem(
templateEnumConstantSameNameAsEnclosing.withArguments(name),
enumConstantInfo.charOffset,
name.length,
- parent.fileUri);
+ libraryBuilder.fileUri);
}
Reference? fieldReference;
Reference? getterReference;
@@ -460,7 +441,7 @@
name,
constMask | staticMask | hasInitializerMask,
/* isTopLevel = */ false,
- parent,
+ libraryBuilder,
enumConstantInfo.charOffset,
enumConstantInfo.charOffset,
staticFieldNameScheme,
@@ -469,7 +450,7 @@
fieldSetterReference: setterReference);
fieldBuilder.fieldType = new ImplicitFieldType(
fieldBuilder, enumConstantInfo.argumentsBeginToken);
- parent.registerImplicitlyTypedField(fieldBuilder);
+ libraryBuilder.registerImplicitlyTypedField(fieldBuilder);
members[name] = fieldBuilder..next = existing;
elementBuilders.add(fieldBuilder);
}
@@ -496,7 +477,7 @@
objectType,
stringType,
selfType,
- parent,
+ libraryBuilder,
constructorReferences,
startCharOffsetComputed,
charOffset,
@@ -514,12 +495,12 @@
members.forEach(setParent);
constructorScope.local.forEach(setParent);
- selfType.bind(enumBuilder);
+ selfType.bind(libraryBuilder, enumBuilder);
if (constructorScope.local.isNotEmpty) {
for (MemberBuilder constructorBuilder in constructorScope.local.values) {
if (!constructorBuilder.isFactory && !constructorBuilder.isConst) {
- parent.addProblem(messageEnumNonConstConstructor,
+ libraryBuilder.addProblem(messageEnumNonConstConstructor,
constructorBuilder.charOffset, noLength, fileUri);
}
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_extension_builder.dart b/pkg/front_end/lib/src/fasta/source/source_extension_builder.dart
index 409a95f..882b9f9 100644
--- a/pkg/front_end/lib/src/fasta/source/source_extension_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_extension_builder.dart
@@ -321,14 +321,10 @@
required this.hiddenOperators});
void buildAndStoreTypes(Extension extension, LibraryBuilder libraryBuilder) {
- List<Supertype> builtShownSupertypes = shownSupertypes
- .map(
- (t) => t.buildSupertype(libraryBuilder, t.charOffset!, t.fileUri!)!)
- .toList();
- List<Supertype> builtHiddenSupertypes = hiddenSupertypes
- .map(
- (t) => t.buildSupertype(libraryBuilder, t.charOffset!, t.fileUri!)!)
- .toList();
+ List<Supertype> builtShownSupertypes =
+ shownSupertypes.map((t) => t.buildSupertype(libraryBuilder)!).toList();
+ List<Supertype> builtHiddenSupertypes =
+ hiddenSupertypes.map((t) => t.buildSupertype(libraryBuilder)!).toList();
ExtensionTypeShowHideClause showHideClause =
extension.showHideClause ?? new ExtensionTypeShowHideClause();
showHideClause.shownSupertypes.addAll(builtShownSupertypes);
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index b11228e..9b796de 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -1517,7 +1517,6 @@
for (NamedTypeBuilder namedType in unresolvedNamedTypes) {
namedType.resolveIn(
scope, namedType.charOffset!, namedType.fileUri!, this);
- namedType.check(this, namedType.charOffset!, namedType.fileUri!);
}
unresolvedNamedTypes.clear();
return typeCount;
@@ -1539,19 +1538,15 @@
Class cls = declaration.cls;
if (cls != objectClass) {
cls.supertype ??= objectClass.asRawSupertype;
- declaration.supertypeBuilder ??= new NamedTypeBuilder(
- "Object",
- const NullabilityBuilder.omitted(),
- /* arguments = */ null,
- /* fileUri = */ null,
- /* charOffset = */ null,
- instanceTypeVariableAccess:
- InstanceTypeVariableAccessState.Unexpected)
- ..bind(objectClassBuilder);
+ declaration.supertypeBuilder ??=
+ new NamedTypeBuilder.fromTypeDeclarationBuilder(
+ objectClassBuilder, const NullabilityBuilder.omitted(),
+ instanceTypeVariableAccess:
+ InstanceTypeVariableAccessState.Unexpected);
}
if (declaration.isMixinApplication) {
- cls.mixedInType = declaration.mixedInTypeBuilder!.buildMixedInType(
- this, declaration.charOffset, declaration.fileUri);
+ cls.mixedInType =
+ declaration.mixedInTypeBuilder!.buildMixedInType(this);
}
}
}
@@ -1661,11 +1656,17 @@
//addBuilder("Null", new NullTypeBuilder(const NullType(), this, -1), -1);
}
- TypeBuilder addNamedType(Object name, NullabilityBuilder nullabilityBuilder,
- List<TypeBuilder>? arguments, int charOffset,
+ NamedTypeBuilder addNamedType(
+ Object name,
+ NullabilityBuilder nullabilityBuilder,
+ List<TypeBuilder>? arguments,
+ int charOffset,
{required InstanceTypeVariableAccessState instanceTypeVariableAccess}) {
return registerUnresolvedNamedType(new NamedTypeBuilder(
- name, nullabilityBuilder, arguments, fileUri, charOffset,
+ name, nullabilityBuilder,
+ arguments: arguments,
+ fileUri: fileUri,
+ charOffset: charOffset,
instanceTypeVariableAccess: instanceTypeVariableAccess));
}
@@ -1679,7 +1680,7 @@
return addNamedType(
"void", const NullabilityBuilder.inherent(), null, charOffset,
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
- ..bind(
+ ..bind(this,
new VoidTypeDeclarationBuilder(const VoidType(), this, charOffset));
}
@@ -1957,7 +1958,7 @@
for (TypeVariableBuilder tv in typeVariables) {
TypeVariableBuilder? existing = typeVariablesByName[tv.name];
if (existing != null) {
- if (existing.isExtensionTypeParameter) {
+ if (existing.kind == TypeVariableKind.extensionSynthesized) {
// The type parameter from the extension is shadowed by the type
// parameter from the member. Rename the shadowed type parameter.
existing.parameter.name = '#${existing.name}';
@@ -2316,7 +2317,8 @@
"mixin application");
applicationTypeVariables = copyTypeVariables(
- typeVariables!, currentTypeParameterScopeBuilder);
+ typeVariables!, currentTypeParameterScopeBuilder,
+ kind: TypeVariableKind.extensionSynthesized);
List<NamedTypeBuilder> newTypes = <NamedTypeBuilder>[];
if (supertype is NamedTypeBuilder && supertype.arguments != null) {
@@ -2344,16 +2346,18 @@
applicationTypeArguments = <TypeBuilder>[];
for (TypeVariableBuilder typeVariable in typeVariables) {
- applicationTypeArguments.add(addNamedType(typeVariable.name,
- const NullabilityBuilder.omitted(), null, charOffset,
- instanceTypeVariableAccess:
- InstanceTypeVariableAccessState.Allowed)
- ..bind(
- // The type variable types passed as arguments to the
- // generic class representing the anonymous mixin
- // application should refer back to the type variables of
- // the class that extend the anonymous mixin application.
- typeVariable));
+ applicationTypeArguments.add(
+ new NamedTypeBuilder.fromTypeDeclarationBuilder(
+ // The type variable types passed as arguments to the
+ // generic class representing the anonymous mixin
+ // application should refer back to the type variables of
+ // the class that extend the anonymous mixin application.
+ typeVariable,
+ const NullabilityBuilder.omitted(),
+ fileUri: fileUri,
+ charOffset: charOffset,
+ instanceTypeVariableAccess:
+ InstanceTypeVariableAccessState.Allowed));
}
}
}
@@ -2750,7 +2754,7 @@
int charEndOffset,
String? nativeMethodName,
AsyncMarker asyncModifier) {
- TypeBuilder returnType = addNamedType(
+ NamedTypeBuilder returnType = addNamedType(
currentTypeParameterScopeBuilder.parent!.name,
const NullabilityBuilder.omitted(),
<TypeBuilder>[],
@@ -2760,10 +2764,12 @@
TypeParameterScopeKind.extensionDeclaration) {
// Make the synthesized return type invalid for extensions.
String name = currentTypeParameterScopeBuilder.parent!.name;
- returnType.bind(new InvalidTypeDeclarationBuilder(
- name,
- messageExtensionDeclaresConstructor.withLocation(
- fileUri, charOffset, name.length)));
+ returnType.bind(
+ this,
+ new InvalidTypeDeclarationBuilder(
+ name,
+ messageExtensionDeclaresConstructor.withLocation(
+ fileUri, charOffset, name.length)));
}
// Nested declaration began in `OutlineBuilder.beginFactoryMethod`.
TypeParameterScopeBuilder factoryDeclaration = endNestedDeclaration(
@@ -2811,7 +2817,8 @@
copyTypeVariables(
currentTypeParameterScopeBuilder.typeVariables ??
const <TypeVariableBuilder>[],
- factoryDeclaration),
+ factoryDeclaration,
+ kind: TypeVariableKind.function),
formals,
this,
startCharOffset,
@@ -2832,7 +2839,8 @@
copyTypeVariables(
currentTypeParameterScopeBuilder.typeVariables ??
const <TypeVariableBuilder>[],
- factoryDeclaration),
+ factoryDeclaration,
+ kind: TypeVariableKind.function),
formals,
this,
startCharOffset,
@@ -3030,10 +3038,11 @@
}
TypeVariableBuilder addTypeVariable(List<MetadataBuilder>? metadata,
- String name, TypeBuilder? bound, int charOffset, Uri fileUri) {
+ String name, TypeBuilder? bound, int charOffset, Uri fileUri,
+ {required TypeVariableKind kind}) {
TypeVariableBuilder builder = new TypeVariableBuilder(
name, this, charOffset, fileUri,
- bound: bound, metadata: metadata);
+ bound: bound, metadata: metadata, kind: kind);
unboundTypeVariables.add(builder);
return builder;
@@ -3402,14 +3411,14 @@
/// [TypeParameter] are prefix with '#' to indicate that their synthesized.
List<TypeVariableBuilder> copyTypeVariables(
List<TypeVariableBuilder> original, TypeParameterScopeBuilder declaration,
- {bool isExtensionTypeParameter: false}) {
+ {required TypeVariableKind kind}) {
List<NamedTypeBuilder> newTypes = <NamedTypeBuilder>[];
List<TypeVariableBuilder> copy = <TypeVariableBuilder>[];
for (TypeVariableBuilder variable in original) {
TypeVariableBuilder newVariable = new TypeVariableBuilder(
variable.name, this, variable.charOffset, variable.fileUri,
bound: variable.bound?.clone(newTypes, this, declaration),
- isExtensionTypeParameter: isExtensionTypeParameter,
+ kind: kind,
variableVariance:
variable.parameter.isLegacyCovariant ? null : variable.variance);
copy.add(newVariable);
@@ -5234,11 +5243,14 @@
namedTypeBuilder.charOffset!,
nameOrQualified.endCharOffset - namedTypeBuilder.charOffset!,
namedTypeBuilder.fileUri!);
- namedTypeBuilder.bind(namedTypeBuilder
- .buildInvalidTypeDeclarationBuilder(message.withLocation(
- namedTypeBuilder.fileUri!,
- namedTypeBuilder.charOffset!,
- nameOrQualified.endCharOffset - namedTypeBuilder.charOffset!)));
+ namedTypeBuilder.bind(
+ library,
+ namedTypeBuilder.buildInvalidTypeDeclarationBuilder(
+ message.withLocation(
+ namedTypeBuilder.fileUri!,
+ namedTypeBuilder.charOffset!,
+ nameOrQualified.endCharOffset -
+ namedTypeBuilder.charOffset!)));
} else {
scope ??= toScope(null).withTypeVariables(typeVariables);
namedTypeBuilder.resolveIn(scope, namedTypeBuilder.charOffset!,
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index e0e89e3..084733a 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -2521,9 +2521,11 @@
return library.lookupLocalMember(cls.name, required: true) as ClassBuilder;
}
+ late TypeBuilderComputer _typeBuilderComputer = new TypeBuilderComputer(this);
+
@override
TypeBuilder computeTypeBuilder(DartType type) {
- return type.accept(new TypeBuilderComputer(this));
+ return type.accept(_typeBuilderComputer);
}
BodyBuilder createBodyBuilderForField(
diff --git a/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart b/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
index 39cce6d..638253e 100644
--- a/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
@@ -157,8 +157,17 @@
TypeBuilder? type = this.type;
// ignore: unnecessary_null_comparison
if (type != null) {
- DartType builtType = type.build(libraryBuilder,
- origin: thisTypedefType(typedef, libraryBuilder));
+ DartType builtType = type.build(libraryBuilder);
+ if (builtType is FunctionType) {
+ // Set the `typedefType` if it hasn't already been set. It can already
+ // be set if this type alias is an alias of another typedef, in which
+ // we use the existing value. For instance
+ //
+ // typedef void F(); // typedefType will be set to `F`.
+ // typedef G = F; // The typedefType has already been set to `F`.
+ //
+ builtType.typedefType ??= thisTypedefType(typedef, libraryBuilder);
+ }
// ignore: unnecessary_null_comparison
if (builtType != null) {
if (typeVariables != null) {
diff --git a/pkg/front_end/test/extensions/data/use_as_type.dart b/pkg/front_end/test/extensions/data/use_as_type.dart
index fd5e3dd..791e6cc 100644
--- a/pkg/front_end/test/extensions/data/use_as_type.dart
+++ b/pkg/front_end/test/extensions/data/use_as_type.dart
@@ -34,11 +34,11 @@
extension B2<T> on B1<T> {}
main() {
- /*error: errors=['A2' isn't a type.]*/
+ /*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/
A2 var1;
- /*error: errors=['B2' isn't a type.]*/
+ /*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/
B2<A1> var2;
- B1</*error: errors=['A2' isn't a type.]*/A2> var3;
+ B1</*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/A2> var3;
}
/*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/
@@ -46,7 +46,7 @@
// TODO(johnniwinther): We should report an error on the number of type
// arguments here.
-/*error: errors=[Expected 0 type arguments.,This requires the 'extension-types' language feature to be enabled.]*/
+/*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/
B2<A1> method2() => null;
B1</*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/A2> method3() => null;
diff --git a/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.strong.expect b/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.strong.expect
index 7f95ca4..ce61661 100644
--- a/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.strong.expect
+++ b/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.strong.expect
@@ -2,22 +2,22 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
-// static A<T>? method1(A<T> arg) {
-// ^
-//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:12: Error: Type variables can't be used in static members.
// static A<T>? method1(A<T> arg) {
// ^
//
-// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
-// static A<A<T>>? method2(A<A<T>> arg) {
-// ^
+// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
+// static A<T>? method1(A<T> arg) {
+// ^
//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:14: Error: Type variables can't be used in static members.
// static A<A<T>>? method2(A<A<T>> arg) {
// ^
//
+// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
+// static A<A<T>>? method2(A<A<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:9:7: Error: Type variables can't be used in static members.
// A<T>? local;
// ^
diff --git a/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.expect b/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.expect
index 7f95ca4..ce61661 100644
--- a/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.expect
+++ b/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.expect
@@ -2,22 +2,22 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
-// static A<T>? method1(A<T> arg) {
-// ^
-//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:12: Error: Type variables can't be used in static members.
// static A<T>? method1(A<T> arg) {
// ^
//
-// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
-// static A<A<T>>? method2(A<A<T>> arg) {
-// ^
+// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
+// static A<T>? method1(A<T> arg) {
+// ^
//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:14: Error: Type variables can't be used in static members.
// static A<A<T>>? method2(A<A<T>> arg) {
// ^
//
+// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
+// static A<A<T>>? method2(A<A<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:9:7: Error: Type variables can't be used in static members.
// A<T>? local;
// ^
diff --git a/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.modular.expect b/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.modular.expect
index 7f95ca4..ce61661 100644
--- a/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.modular.expect
@@ -2,22 +2,22 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
-// static A<T>? method1(A<T> arg) {
-// ^
-//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:12: Error: Type variables can't be used in static members.
// static A<T>? method1(A<T> arg) {
// ^
//
-// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
-// static A<A<T>>? method2(A<A<T>> arg) {
-// ^
+// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
+// static A<T>? method1(A<T> arg) {
+// ^
//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:14: Error: Type variables can't be used in static members.
// static A<A<T>>? method2(A<A<T>> arg) {
// ^
//
+// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
+// static A<A<T>>? method2(A<A<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:9:7: Error: Type variables can't be used in static members.
// A<T>? local;
// ^
diff --git a/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.outline.expect
index 9dda330..86a9155 100644
--- a/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart.weak.outline.expect
@@ -2,22 +2,22 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
-// static A<T>? method1(A<T> arg) {
-// ^
-//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:12: Error: Type variables can't be used in static members.
// static A<T>? method1(A<T> arg) {
// ^
//
-// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
-// static A<A<T>>? method2(A<A<T>> arg) {
-// ^
+// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
+// static A<T>? method1(A<T> arg) {
+// ^
//
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:14: Error: Type variables can't be used in static members.
// static A<A<T>>? method2(A<A<T>> arg) {
// ^
//
+// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
+// static A<A<T>>? method2(A<A<T>> arg) {
+// ^
+//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/extensions/duplicate_type_variables.dart b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart
new file mode 100644
index 0000000..e12014a
--- /dev/null
+++ b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+extension E1<T, T> on int {}
+
+main() {}
diff --git a/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.textual_outline.expect b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.textual_outline.expect
new file mode 100644
index 0000000..5413d5e
--- /dev/null
+++ b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.textual_outline.expect
@@ -0,0 +1,3 @@
+extension E1<T, T> on int {}
+
+main() {}
diff --git a/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..5413d5e
--- /dev/null
+++ b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.textual_outline_modelled.expect
@@ -0,0 +1,3 @@
+extension E1<T, T> on int {}
+
+main() {}
diff --git a/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.expect b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.expect
new file mode 100644
index 0000000..35621d1
--- /dev/null
+++ b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.expect
@@ -0,0 +1,17 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:17: Error: A type variable can't have the same name as another.
+// extension E1<T, T> on int {}
+// ^
+// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:14: Context: The other type variable named 'T'.
+// extension E1<T, T> on int {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+extension E1<T extends core::Object? = dynamic, T extends core::Object? = dynamic> on core::int {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.modular.expect b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.modular.expect
new file mode 100644
index 0000000..35621d1
--- /dev/null
+++ b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.modular.expect
@@ -0,0 +1,17 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:17: Error: A type variable can't have the same name as another.
+// extension E1<T, T> on int {}
+// ^
+// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:14: Context: The other type variable named 'T'.
+// extension E1<T, T> on int {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+extension E1<T extends core::Object? = dynamic, T extends core::Object? = dynamic> on core::int {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.outline.expect b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.outline.expect
new file mode 100644
index 0000000..6d9498c988
--- /dev/null
+++ b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.outline.expect
@@ -0,0 +1,18 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:17: Error: A type variable can't have the same name as another.
+// extension E1<T, T> on int {}
+// ^
+// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:14: Context: The other type variable named 'T'.
+// extension E1<T, T> on int {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+extension E1<T extends core::Object? = dynamic, T extends core::Object? = dynamic> on core::int {
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.transformed.expect b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.transformed.expect
new file mode 100644
index 0000000..35621d1
--- /dev/null
+++ b/pkg/front_end/testcases/extensions/duplicate_type_variables.dart.weak.transformed.expect
@@ -0,0 +1,17 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:17: Error: A type variable can't have the same name as another.
+// extension E1<T, T> on int {}
+// ^
+// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:14: Context: The other type variable named 'T'.
+// extension E1<T, T> on int {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+extension E1<T extends core::Object? = dynamic, T extends core::Object? = dynamic> on core::int {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.expect b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.expect
index 35d93a3..fd29488 100644
--- a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.expect
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.expect
@@ -53,15 +53,15 @@
// field11 = o as Class<T>,
// ^
//
-// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
-// field15 = <Class<T>>[];
-// ^
-//
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
// Try inserting 'const'.
// field15 = <Class<T>>[];
// ^
//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:40:20: Error: Type variables can't be used as constants.
// const local1 = T;
// ^
@@ -236,15 +236,15 @@
// field7 = <T, T>{},
// ^
//
-// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
-// field15 = <Class<T>>[];
-// ^
-//
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
// Try inserting 'const'.
// field15 = <Class<T>>[];
// ^
//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:37:20: Error: Type variables can't be used as constants.
// const local1 = T;
// ^
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.modular.expect b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.modular.expect
index 35d93a3..fd29488 100644
--- a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.modular.expect
@@ -53,15 +53,15 @@
// field11 = o as Class<T>,
// ^
//
-// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
-// field15 = <Class<T>>[];
-// ^
-//
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
// Try inserting 'const'.
// field15 = <Class<T>>[];
// ^
//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:40:20: Error: Type variables can't be used as constants.
// const local1 = T;
// ^
@@ -236,15 +236,15 @@
// field7 = <T, T>{},
// ^
//
-// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
-// field15 = <Class<T>>[];
-// ^
-//
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
// Try inserting 'const'.
// field15 = <Class<T>>[];
// ^
//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:37:20: Error: Type variables can't be used as constants.
// const local1 = T;
// ^
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.outline.expect b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.outline.expect
index 559f6ba..741a4d8 100644
--- a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.outline.expect
@@ -53,15 +53,15 @@
// field11 = o as Class<T>,
// ^
//
-// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
-// field15 = <Class<T>>[];
-// ^
-//
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
// Try inserting 'const'.
// field15 = <Class<T>>[];
// ^
//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
@@ -141,15 +141,15 @@
// field7 = <T, T>{},
// ^
//
-// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
-// field15 = <Class<T>>[];
-// ^
-//
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
// Try inserting 'const'.
// field15 = <Class<T>>[];
// ^
//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
import self as self2;
import "dart:core" as core;
import "dart:collection" as col;
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.transformed.expect b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.transformed.expect
index 35d93a3..fd29488 100644
--- a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.transformed.expect
@@ -53,15 +53,15 @@
// field11 = o as Class<T>,
// ^
//
-// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
-// field15 = <Class<T>>[];
-// ^
-//
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
// Try inserting 'const'.
// field15 = <Class<T>>[];
// ^
//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:40:20: Error: Type variables can't be used as constants.
// const local1 = T;
// ^
@@ -236,15 +236,15 @@
// field7 = <T, T>{},
// ^
//
-// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
-// field15 = <Class<T>>[];
-// ^
-//
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
// Try inserting 'const'.
// field15 = <Class<T>>[];
// ^
//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:37:20: Error: Type variables can't be used as constants.
// const local1 = T;
// ^
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.expect
index 8044a08..4f9249f 100644
--- a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.expect
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
// const Map<bool> MapWithUnevaluated = {
-// ^
+// ^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.modular.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.modular.expect
index 8044a08..4f9249f 100644
--- a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.modular.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
// const Map<bool> MapWithUnevaluated = {
-// ^
+// ^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.outline.expect
index d08ca5a..620b538 100644
--- a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.outline.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
// const Map<bool> MapWithUnevaluated = {
-// ^
+// ^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.transformed.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.transformed.expect
index c7e9a22..68271db 100644
--- a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.weak.transformed.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
// const Map<bool> MapWithUnevaluated = {
-// ^
+// ^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.expect b/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.expect
index 679fe85..0e4161b 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.expect
@@ -36,8 +36,4 @@
// n<S e(
// ^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart:1:1: Error: Expected 0 type arguments.
-// n<S e(
-// ^
-//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.modular.expect b/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.modular.expect
index 679fe85..0e4161b 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.modular.expect
@@ -36,8 +36,4 @@
// n<S e(
// ^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart:1:1: Error: Expected 0 type arguments.
-// n<S e(
-// ^
-//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.outline.expect b/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.outline.expect
index 679fe85..0e4161b 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.outline.expect
@@ -36,8 +36,4 @@
// n<S e(
// ^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart:1:1: Error: Expected 0 type arguments.
-// n<S e(
-// ^
-//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.transformed.expect b/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.transformed.expect
index 679fe85..0e4161b 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart.weak.transformed.expect
@@ -36,8 +36,4 @@
// n<S e(
// ^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart:1:1: Error: Expected 0 type arguments.
-// n<S e(
-// ^
-//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.expect b/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.expect
index e1e7c23..1a6da32 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.expect
@@ -36,10 +36,6 @@
// () async => a b < c $? >
// ^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:15: Error: Expected 0 type arguments.
-// () async => a b < c $? >
-// ^
-//
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:13: Error: Expected ';' after this.
// () async => a b < c $? >
// ^
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.modular.expect b/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.modular.expect
index e1e7c23..1a6da32 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.modular.expect
@@ -36,10 +36,6 @@
// () async => a b < c $? >
// ^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:15: Error: Expected 0 type arguments.
-// () async => a b < c $? >
-// ^
-//
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:13: Error: Expected ';' after this.
// () async => a b < c $? >
// ^
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.outline.expect b/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.outline.expect
index 468caf0..a235882 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.outline.expect
@@ -36,10 +36,6 @@
// () async => a b < c $? >
// ^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:15: Error: Expected 0 type arguments.
-// () async => a b < c $? >
-// ^
-//
import self as self;
static method async() → dynamic
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.transformed.expect b/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.transformed.expect
index e1e7c23..1a6da32 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart.weak.transformed.expect
@@ -36,10 +36,6 @@
// () async => a b < c $? >
// ^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:15: Error: Expected 0 type arguments.
-// () async => a b < c $? >
-// ^
-//
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:13: Error: Expected ';' after this.
// () async => a b < c $? >
// ^
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.expect
index 25b9642..e96c8c7 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart:1:1: Error: Expected 0 type arguments.
// dynamic<int> f() {}
-// ^
+// ^^^^^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.modular.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.modular.expect
index 25b9642..e96c8c7 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.modular.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart:1:1: Error: Expected 0 type arguments.
// dynamic<int> f() {}
-// ^
+// ^^^^^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.outline.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.outline.expect
index a025710..efc1b8e 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.outline.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart:1:1: Error: Expected 0 type arguments.
// dynamic<int> f() {}
-// ^
+// ^^^^^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.transformed.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.transformed.expect
index 25b9642..e96c8c7 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart.weak.transformed.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart:1:1: Error: Expected 0 type arguments.
// dynamic<int> f() {}
-// ^
+// ^^^^^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.expect
index 4340016..e7b316b 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart:1:1: Error: Expected 0 type arguments.
// int<int> f() {}
-// ^
+// ^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.modular.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.modular.expect
index 4340016..e7b316b 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.modular.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart:1:1: Error: Expected 0 type arguments.
// int<int> f() {}
-// ^
+// ^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.outline.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.outline.expect
index 8548c0d..bc93b44 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.outline.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart:1:1: Error: Expected 0 type arguments.
// int<int> f() {}
-// ^
+// ^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.transformed.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.transformed.expect
index 4340016..e7b316b 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart.weak.transformed.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart:1:1: Error: Expected 0 type arguments.
// int<int> f() {}
-// ^
+// ^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.expect
index 1d42619..94d89e8 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.expect
@@ -6,10 +6,6 @@
// Foo<int> f() {}
// ^^^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart:1:1: Error: Expected 0 type arguments.
-// Foo<int> f() {}
-// ^
-//
import self as self;
static method f() → invalid-type {}
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.modular.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.modular.expect
index 1d42619..94d89e8 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.modular.expect
@@ -6,10 +6,6 @@
// Foo<int> f() {}
// ^^^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart:1:1: Error: Expected 0 type arguments.
-// Foo<int> f() {}
-// ^
-//
import self as self;
static method f() → invalid-type {}
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.outline.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.outline.expect
index cca6d79..2a583d8 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.outline.expect
@@ -6,10 +6,6 @@
// Foo<int> f() {}
// ^^^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart:1:1: Error: Expected 0 type arguments.
-// Foo<int> f() {}
-// ^
-//
import self as self;
static method f() → invalid-type
diff --git a/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.transformed.expect b/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.transformed.expect
index 1d42619..94d89e8 100644
--- a/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart.weak.transformed.expect
@@ -6,10 +6,6 @@
// Foo<int> f() {}
// ^^^
//
-// pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart:1:1: Error: Expected 0 type arguments.
-// Foo<int> f() {}
-// ^
-//
import self as self;
static method f() → invalid-type {}
diff --git a/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.expect b/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.expect
index 932b16b..a167e00 100644
--- a/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.expect
+++ b/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.expect
@@ -6,13 +6,13 @@
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
// ^
//
-// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:7: Error: The type variable 'S' can't be used as supertype.
+// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:47: Error: The type variable 'S' can't be used as supertype.
// class Class1<T, S extends SuperClass> extends S with Mixin<T> {}
-// ^
+// ^
//
-// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:7: Error: The type variable 'M' can't be used as supertype.
+// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:61: Error: The type variable 'M' can't be used as supertype.
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.modular.expect b/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.modular.expect
index 932b16b..a167e00 100644
--- a/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.modular.expect
@@ -6,13 +6,13 @@
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
// ^
//
-// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:7: Error: The type variable 'S' can't be used as supertype.
+// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:47: Error: The type variable 'S' can't be used as supertype.
// class Class1<T, S extends SuperClass> extends S with Mixin<T> {}
-// ^
+// ^
//
-// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:7: Error: The type variable 'M' can't be used as supertype.
+// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:61: Error: The type variable 'M' can't be used as supertype.
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.outline.expect b/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.outline.expect
index c883ec7..e70af7c 100644
--- a/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.outline.expect
@@ -6,13 +6,13 @@
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
// ^
//
-// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:7: Error: The type variable 'S' can't be used as supertype.
+// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:47: Error: The type variable 'S' can't be used as supertype.
// class Class1<T, S extends SuperClass> extends S with Mixin<T> {}
-// ^
+// ^
//
-// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:7: Error: The type variable 'M' can't be used as supertype.
+// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:61: Error: The type variable 'M' can't be used as supertype.
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.transformed.expect b/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.transformed.expect
index b205d46..7710aee 100644
--- a/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/extend_with_type_variable.dart.weak.transformed.expect
@@ -6,13 +6,13 @@
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
// ^
//
-// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:7: Error: The type variable 'S' can't be used as supertype.
+// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:47: Error: The type variable 'S' can't be used as supertype.
// class Class1<T, S extends SuperClass> extends S with Mixin<T> {}
-// ^
+// ^
//
-// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:7: Error: The type variable 'M' can't be used as supertype.
+// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:61: Error: The type variable 'M' can't be used as supertype.
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.expect b/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.expect
index d038898..2777d14 100644
--- a/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.expect
+++ b/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.expect
@@ -7,10 +7,6 @@
// test(E e) {} // Error.
// ^
//
-// pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart:11:6: Error: 'E' isn't a type.
-// test(E e) {} // Error.
-// ^
-//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.modular.expect b/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.modular.expect
index d038898..2777d14 100644
--- a/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.modular.expect
@@ -7,10 +7,6 @@
// test(E e) {} // Error.
// ^
//
-// pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart:11:6: Error: 'E' isn't a type.
-// test(E e) {} // Error.
-// ^
-//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.transformed.expect b/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.transformed.expect
index d038898..2777d14 100644
--- a/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart.weak.transformed.expect
@@ -7,10 +7,6 @@
// test(E e) {} // Error.
// ^
//
-// pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart:11:6: Error: 'E' isn't a type.
-// test(E e) {} // Error.
-// ^
-//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/issue45700.crash_dart.weak.expect b/pkg/front_end/testcases/general/issue45700.crash_dart.weak.expect
index a03c56f..3048e79 100644
--- a/pkg/front_end/testcases/general/issue45700.crash_dart.weak.expect
+++ b/pkg/front_end/testcases/general/issue45700.crash_dart.weak.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue45700.crash_dart:5:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/general/issue45700.crash_dart:5:12: Error: Can't use a function type as supertype.
// mixin M on Function() {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/issue45700.crash_dart.weak.modular.expect b/pkg/front_end/testcases/general/issue45700.crash_dart.weak.modular.expect
index a03c56f..3048e79 100644
--- a/pkg/front_end/testcases/general/issue45700.crash_dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/issue45700.crash_dart.weak.modular.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue45700.crash_dart:5:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/general/issue45700.crash_dart:5:12: Error: Can't use a function type as supertype.
// mixin M on Function() {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/issue45700.crash_dart.weak.outline.expect b/pkg/front_end/testcases/general/issue45700.crash_dart.weak.outline.expect
index 2c993ea..e7d0e03 100644
--- a/pkg/front_end/testcases/general/issue45700.crash_dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/issue45700.crash_dart.weak.outline.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue45700.crash_dart:5:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/general/issue45700.crash_dart:5:12: Error: Can't use a function type as supertype.
// mixin M on Function() {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/issue45700.crash_dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue45700.crash_dart.weak.transformed.expect
index a03c56f..3048e79 100644
--- a/pkg/front_end/testcases/general/issue45700.crash_dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/issue45700.crash_dart.weak.transformed.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue45700.crash_dart:5:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/general/issue45700.crash_dart:5:12: Error: Can't use a function type as supertype.
// mixin M on Function() {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/issue47728_4.dart.weak.expect b/pkg/front_end/testcases/general/issue47728_4.dart.weak.expect
index b242e08..2a79c0b 100644
--- a/pkg/front_end/testcases/general/issue47728_4.dart.weak.expect
+++ b/pkg/front_end/testcases/general/issue47728_4.dart.weak.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue47728_4.dart:9:7: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/general/issue47728_4.dart:9:11: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
// class C = A with B;
-// ^
+// ^
// pkg/front_end/testcases/general/issue47728_4.dart:5:9: Context: The issue arises via this type alias.
// typedef A = Function()?;
// ^
diff --git a/pkg/front_end/testcases/general/issue47728_4.dart.weak.modular.expect b/pkg/front_end/testcases/general/issue47728_4.dart.weak.modular.expect
index b242e08..2a79c0b 100644
--- a/pkg/front_end/testcases/general/issue47728_4.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/issue47728_4.dart.weak.modular.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue47728_4.dart:9:7: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/general/issue47728_4.dart:9:11: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
// class C = A with B;
-// ^
+// ^
// pkg/front_end/testcases/general/issue47728_4.dart:5:9: Context: The issue arises via this type alias.
// typedef A = Function()?;
// ^
diff --git a/pkg/front_end/testcases/general/issue47728_4.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue47728_4.dart.weak.outline.expect
index bcc7a6f..9e97c40 100644
--- a/pkg/front_end/testcases/general/issue47728_4.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/issue47728_4.dart.weak.outline.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue47728_4.dart:9:7: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/general/issue47728_4.dart:9:11: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
// class C = A with B;
-// ^
+// ^
// pkg/front_end/testcases/general/issue47728_4.dart:5:9: Context: The issue arises via this type alias.
// typedef A = Function()?;
// ^
diff --git a/pkg/front_end/testcases/general/issue47728_4.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue47728_4.dart.weak.transformed.expect
index a92eb47..3d2bbb7 100644
--- a/pkg/front_end/testcases/general/issue47728_4.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/issue47728_4.dart.weak.transformed.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/issue47728_4.dart:9:7: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/general/issue47728_4.dart:9:11: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
// class C = A with B;
-// ^
+// ^
// pkg/front_end/testcases/general/issue47728_4.dart:5:9: Context: The issue arises via this type alias.
// typedef A = Function()?;
// ^
diff --git a/pkg/front_end/testcases/general/qualified.dart.weak.expect b/pkg/front_end/testcases/general/qualified.dart.weak.expect
index 31a30f6..be3713b 100644
--- a/pkg/front_end/testcases/general/qualified.dart.weak.expect
+++ b/pkg/front_end/testcases/general/qualified.dart.weak.expect
@@ -17,9 +17,9 @@
// lib.Missing method() {}
// ^^^^^^^^^^^
//
-// pkg/front_end/testcases/general/qualified.dart:18:7: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
+// pkg/front_end/testcases/general/qualified.dart:18:32: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
// class IllegalSupertype extends lib.VoidFunction {}
-// ^
+// ^
// pkg/front_end/testcases/general/qualified_lib.dart:27:9: Context: The issue arises via this type alias.
// typedef VoidFunction = void Function();
// ^
diff --git a/pkg/front_end/testcases/general/qualified.dart.weak.modular.expect b/pkg/front_end/testcases/general/qualified.dart.weak.modular.expect
index 31a30f6..be3713b 100644
--- a/pkg/front_end/testcases/general/qualified.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/qualified.dart.weak.modular.expect
@@ -17,9 +17,9 @@
// lib.Missing method() {}
// ^^^^^^^^^^^
//
-// pkg/front_end/testcases/general/qualified.dart:18:7: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
+// pkg/front_end/testcases/general/qualified.dart:18:32: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
// class IllegalSupertype extends lib.VoidFunction {}
-// ^
+// ^
// pkg/front_end/testcases/general/qualified_lib.dart:27:9: Context: The issue arises via this type alias.
// typedef VoidFunction = void Function();
// ^
diff --git a/pkg/front_end/testcases/general/qualified.dart.weak.outline.expect b/pkg/front_end/testcases/general/qualified.dart.weak.outline.expect
index a9d4036..822ff06 100644
--- a/pkg/front_end/testcases/general/qualified.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/qualified.dart.weak.outline.expect
@@ -17,9 +17,9 @@
// lib.Missing method() {}
// ^^^^^^^^^^^
//
-// pkg/front_end/testcases/general/qualified.dart:18:7: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
+// pkg/front_end/testcases/general/qualified.dart:18:32: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
// class IllegalSupertype extends lib.VoidFunction {}
-// ^
+// ^
// pkg/front_end/testcases/general/qualified_lib.dart:27:9: Context: The issue arises via this type alias.
// typedef VoidFunction = void Function();
// ^
diff --git a/pkg/front_end/testcases/general/qualified.dart.weak.transformed.expect b/pkg/front_end/testcases/general/qualified.dart.weak.transformed.expect
index 04ffa8c..74e7869 100644
--- a/pkg/front_end/testcases/general/qualified.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/qualified.dart.weak.transformed.expect
@@ -17,9 +17,9 @@
// lib.Missing method() {}
// ^^^^^^^^^^^
//
-// pkg/front_end/testcases/general/qualified.dart:18:7: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
+// pkg/front_end/testcases/general/qualified.dart:18:32: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
// class IllegalSupertype extends lib.VoidFunction {}
-// ^
+// ^
// pkg/front_end/testcases/general/qualified_lib.dart:27:9: Context: The issue arises via this type alias.
// typedef VoidFunction = void Function();
// ^
diff --git a/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.expect b/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.expect
index 45cdf4b..97abf4a 100644
--- a/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.expect
+++ b/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/type_parameters_on_dynamic.dart:1:1: Error: Expected 0 type arguments.
// dynamic<int> f() {}
-// ^
+// ^^^^^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.modular.expect b/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.modular.expect
index 45cdf4b..97abf4a 100644
--- a/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.modular.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/type_parameters_on_dynamic.dart:1:1: Error: Expected 0 type arguments.
// dynamic<int> f() {}
-// ^
+// ^^^^^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.outline.expect b/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.outline.expect
index 092d23a..0631065 100644
--- a/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.outline.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/type_parameters_on_dynamic.dart:1:1: Error: Expected 0 type arguments.
// dynamic<int> f() {}
-// ^
+// ^^^^^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.transformed.expect b/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.transformed.expect
index 45cdf4b..97abf4a 100644
--- a/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/type_parameters_on_dynamic.dart.weak.transformed.expect
@@ -4,7 +4,7 @@
//
// pkg/front_end/testcases/general/type_parameters_on_dynamic.dart:1:1: Error: Expected 0 type arguments.
// dynamic<int> f() {}
-// ^
+// ^^^^^^^
//
import self as self;
diff --git a/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.expect b/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.expect
index 598ef86..f745338 100644
--- a/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.expect
+++ b/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:5:16: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:5:29: Error: The type variable 'T' can't be used as supertype.
// abstract class A<T> extends T {}
-// ^
+// ^
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:7:16: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:7:29: Error: The type variable 'T' can't be used as supertype.
// abstract class B<T> extends T {
-// ^
+// ^
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:11:7: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:11:20: Error: The type variable 'T' can't be used as supertype.
// class C<T> extends T {}
-// ^
+// ^
//
// pkg/front_end/testcases/general/type_variable_as_super.dart:14:7: Error: The class 'A' is abstract and can't be instantiated.
// new A();
diff --git a/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.modular.expect b/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.modular.expect
index 598ef86..f745338 100644
--- a/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.modular.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:5:16: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:5:29: Error: The type variable 'T' can't be used as supertype.
// abstract class A<T> extends T {}
-// ^
+// ^
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:7:16: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:7:29: Error: The type variable 'T' can't be used as supertype.
// abstract class B<T> extends T {
-// ^
+// ^
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:11:7: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:11:20: Error: The type variable 'T' can't be used as supertype.
// class C<T> extends T {}
-// ^
+// ^
//
// pkg/front_end/testcases/general/type_variable_as_super.dart:14:7: Error: The class 'A' is abstract and can't be instantiated.
// new A();
diff --git a/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.outline.expect b/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.outline.expect
index 66c885f..6077ec0 100644
--- a/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.outline.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:5:16: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:5:29: Error: The type variable 'T' can't be used as supertype.
// abstract class A<T> extends T {}
-// ^
+// ^
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:7:16: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:7:29: Error: The type variable 'T' can't be used as supertype.
// abstract class B<T> extends T {
-// ^
+// ^
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:11:7: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:11:20: Error: The type variable 'T' can't be used as supertype.
// class C<T> extends T {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.transformed.expect b/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.transformed.expect
index 598ef86..f745338 100644
--- a/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/type_variable_as_super.dart.weak.transformed.expect
@@ -2,17 +2,17 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:5:16: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:5:29: Error: The type variable 'T' can't be used as supertype.
// abstract class A<T> extends T {}
-// ^
+// ^
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:7:16: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:7:29: Error: The type variable 'T' can't be used as supertype.
// abstract class B<T> extends T {
-// ^
+// ^
//
-// pkg/front_end/testcases/general/type_variable_as_super.dart:11:7: Error: The type variable 'T' can't be used as supertype.
+// pkg/front_end/testcases/general/type_variable_as_super.dart:11:20: Error: The type variable 'T' can't be used as supertype.
// class C<T> extends T {}
-// ^
+// ^
//
// pkg/front_end/testcases/general/type_variable_as_super.dart:14:7: Error: The class 'A' is abstract and can't be instantiated.
// new A();
diff --git a/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.expect b/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.expect
index 31bd8fe..9952b84 100644
--- a/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.expect
+++ b/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.expect
@@ -2,61 +2,114 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
-// Try removing the constructor declaration.
-// Extension(T t);
-// ^^^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
-// Try removing the constructor declaration.
-// factory Extension.fact(T t) => null;
-// ^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
-// Try removing the field declaration or making it a static field
-// T field1;
-// ^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
-// Mixin(T t);
-// ^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
-// factory Mixin.fact(T t) => null;
-// ^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:11: Error: Expected 0 type arguments.
-// factory Extension.fact(T t) => null;
-// ^
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
+// static T? method0<S extends T>(T arg) {
+// ^
//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:31: Error: Type variables can't be used in static members.
// static T? method0<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
+// static T? method0<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
+// @Class<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
+// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:44: Error: Type variables can't be used in static members.
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
+// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
+// @Class<Class<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
+// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:57: Error: Type variables can't be used in static members.
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
+// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
+// @A<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
+// static A<T>? method3<S extends A<T>>(A<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:36: Error: Type variables can't be used in static members.
// static A<T>? method3<S extends A<T>>(A<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
+// static A<T>? method3<S extends A<T>>(A<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
+// @A<A<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
+// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:41: Error: Type variables can't be used in static members.
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
+// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
+// @B<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
+// static B<T>? method5<S extends B<T>>(B<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:36: Error: Type variables can't be used in static members.
// static B<T>? method5<S extends B<T>>(B<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
+// static B<T>? method5<S extends B<T>>(B<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
+// @A<B<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
+// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:41: Error: Type variables can't be used in static members.
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
+// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:73:34: Error: Type variables can't be used in static members.
// @Class<void Function<S extends T>()>()
// ^
@@ -73,102 +126,85 @@
// static void Function<S extends T>()? method7<U extends void Function<S extends T>()>(void Function<S extends T>() arg) {
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
-// static T? method0<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
-// static T? method0<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
-// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
-// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
-// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
-// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
-// static A<T>? method3<S extends A<T>>(A<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
-// static A<T>? method3<S extends A<T>>(A<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
-// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
-// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
-// static B<T>? method5<S extends B<T>>(B<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
-// static B<T>? method5<S extends B<T>>(B<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
-// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
-// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:80:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
+// @Class<T>()
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:83:16: Error: Type variables can't be used in static members.
// static Class<T>? field1;
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
+// @Class<Class<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
+// @A<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
+// @B<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
+// Try removing the constructor declaration.
+// Extension(T t);
+// ^^^^^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
+// Try removing the constructor declaration.
+// factory Extension.fact(T t) => null;
+// ^^^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
+// Try removing the field declaration or making it a static field
+// T field1;
+// ^^^^^^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:110:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:10: Error: Type variables can't be used in static members.
// static T? staticMethod<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
+// Mixin(T t);
+// ^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
+// factory Mixin.fact(T t) => null;
+// ^^^^^^^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:135:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:10: Error: Type variables can't be used in static members.
// static T? staticMethod<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:92:24: Error: Type variables can't be used in static members.
// static var field4 = (T t) => T;
// ^
@@ -181,50 +217,10 @@
// @T()
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
-// @Class<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
-// @Class<Class<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
-// @A<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
-// @A<A<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
-// @B<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
-// @A<B<T>>()
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:79:4: Error: Couldn't find constructor 'T'.
// @T()
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
-// @Class<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
-// @Class<Class<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
-// @A<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
-// @B<T>()
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:94:4: Error: Couldn't find constructor 'T'.
// @T()
// ^
diff --git a/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.modular.expect b/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.modular.expect
index 31bd8fe..9952b84 100644
--- a/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.modular.expect
@@ -2,61 +2,114 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
-// Try removing the constructor declaration.
-// Extension(T t);
-// ^^^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
-// Try removing the constructor declaration.
-// factory Extension.fact(T t) => null;
-// ^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
-// Try removing the field declaration or making it a static field
-// T field1;
-// ^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
-// Mixin(T t);
-// ^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
-// factory Mixin.fact(T t) => null;
-// ^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:11: Error: Expected 0 type arguments.
-// factory Extension.fact(T t) => null;
-// ^
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
+// static T? method0<S extends T>(T arg) {
+// ^
//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:31: Error: Type variables can't be used in static members.
// static T? method0<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
+// static T? method0<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
+// @Class<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
+// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:44: Error: Type variables can't be used in static members.
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
+// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
+// @Class<Class<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
+// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:57: Error: Type variables can't be used in static members.
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
+// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
+// @A<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
+// static A<T>? method3<S extends A<T>>(A<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:36: Error: Type variables can't be used in static members.
// static A<T>? method3<S extends A<T>>(A<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
+// static A<T>? method3<S extends A<T>>(A<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
+// @A<A<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
+// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:41: Error: Type variables can't be used in static members.
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
+// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
+// @B<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
+// static B<T>? method5<S extends B<T>>(B<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:36: Error: Type variables can't be used in static members.
// static B<T>? method5<S extends B<T>>(B<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
+// static B<T>? method5<S extends B<T>>(B<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
+// @A<B<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
+// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:41: Error: Type variables can't be used in static members.
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
+// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:73:34: Error: Type variables can't be used in static members.
// @Class<void Function<S extends T>()>()
// ^
@@ -73,102 +126,85 @@
// static void Function<S extends T>()? method7<U extends void Function<S extends T>()>(void Function<S extends T>() arg) {
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
-// static T? method0<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
-// static T? method0<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
-// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
-// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
-// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
-// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
-// static A<T>? method3<S extends A<T>>(A<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
-// static A<T>? method3<S extends A<T>>(A<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
-// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
-// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
-// static B<T>? method5<S extends B<T>>(B<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
-// static B<T>? method5<S extends B<T>>(B<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
-// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
-// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:80:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
+// @Class<T>()
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:83:16: Error: Type variables can't be used in static members.
// static Class<T>? field1;
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
+// @Class<Class<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
+// @A<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
+// @B<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
+// Try removing the constructor declaration.
+// Extension(T t);
+// ^^^^^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
+// Try removing the constructor declaration.
+// factory Extension.fact(T t) => null;
+// ^^^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
+// Try removing the field declaration or making it a static field
+// T field1;
+// ^^^^^^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:110:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:10: Error: Type variables can't be used in static members.
// static T? staticMethod<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
+// Mixin(T t);
+// ^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
+// factory Mixin.fact(T t) => null;
+// ^^^^^^^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:135:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:10: Error: Type variables can't be used in static members.
// static T? staticMethod<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:92:24: Error: Type variables can't be used in static members.
// static var field4 = (T t) => T;
// ^
@@ -181,50 +217,10 @@
// @T()
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
-// @Class<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
-// @Class<Class<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
-// @A<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
-// @A<A<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
-// @B<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
-// @A<B<T>>()
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:79:4: Error: Couldn't find constructor 'T'.
// @T()
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
-// @Class<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
-// @Class<Class<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
-// @A<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
-// @B<T>()
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:94:4: Error: Couldn't find constructor 'T'.
// @T()
// ^
diff --git a/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.outline.expect b/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.outline.expect
index fcae7bb..9be0113 100644
--- a/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.outline.expect
@@ -2,61 +2,114 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
-// Try removing the constructor declaration.
-// Extension(T t);
-// ^^^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
-// Try removing the constructor declaration.
-// factory Extension.fact(T t) => null;
-// ^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
-// Try removing the field declaration or making it a static field
-// T field1;
-// ^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
-// Mixin(T t);
-// ^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
-// factory Mixin.fact(T t) => null;
-// ^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:11: Error: Expected 0 type arguments.
-// factory Extension.fact(T t) => null;
-// ^
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
+// static T? method0<S extends T>(T arg) {
+// ^
//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:31: Error: Type variables can't be used in static members.
// static T? method0<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
+// static T? method0<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
+// @Class<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
+// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:44: Error: Type variables can't be used in static members.
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
+// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
+// @Class<Class<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
+// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:57: Error: Type variables can't be used in static members.
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
+// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
+// @A<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
+// static A<T>? method3<S extends A<T>>(A<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:36: Error: Type variables can't be used in static members.
// static A<T>? method3<S extends A<T>>(A<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
+// static A<T>? method3<S extends A<T>>(A<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
+// @A<A<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
+// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:41: Error: Type variables can't be used in static members.
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
+// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
+// @B<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
+// static B<T>? method5<S extends B<T>>(B<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:36: Error: Type variables can't be used in static members.
// static B<T>? method5<S extends B<T>>(B<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
+// static B<T>? method5<S extends B<T>>(B<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
+// @A<B<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
+// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:41: Error: Type variables can't be used in static members.
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
+// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:73:34: Error: Type variables can't be used in static members.
// @Class<void Function<S extends T>()>()
// ^
@@ -73,102 +126,85 @@
// static void Function<S extends T>()? method7<U extends void Function<S extends T>()>(void Function<S extends T>() arg) {
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
-// static T? method0<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
-// static T? method0<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
-// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
-// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
-// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
-// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
-// static A<T>? method3<S extends A<T>>(A<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
-// static A<T>? method3<S extends A<T>>(A<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
-// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
-// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
-// static B<T>? method5<S extends B<T>>(B<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
-// static B<T>? method5<S extends B<T>>(B<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
-// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
-// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:80:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
+// @Class<T>()
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:83:16: Error: Type variables can't be used in static members.
// static Class<T>? field1;
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
+// @Class<Class<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
+// @A<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
+// @B<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
+// Try removing the constructor declaration.
+// Extension(T t);
+// ^^^^^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
+// Try removing the constructor declaration.
+// factory Extension.fact(T t) => null;
+// ^^^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
+// Try removing the field declaration or making it a static field
+// T field1;
+// ^^^^^^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:110:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:10: Error: Type variables can't be used in static members.
// static T? staticMethod<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
+// Mixin(T t);
+// ^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
+// factory Mixin.fact(T t) => null;
+// ^^^^^^^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:135:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:10: Error: Type variables can't be used in static members.
// static T? staticMethod<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:92:24: Error: Type variables can't be used in static members.
// static var field4 = (T t) => T;
// ^
@@ -181,50 +217,10 @@
// @T()
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
-// @Class<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
-// @Class<Class<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
-// @A<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
-// @A<A<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
-// @B<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
-// @A<B<T>>()
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:79:4: Error: Couldn't find constructor 'T'.
// @T()
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
-// @Class<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
-// @Class<Class<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
-// @A<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
-// @B<T>()
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:94:4: Error: Couldn't find constructor 'T'.
// @T()
// ^
diff --git a/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.transformed.expect b/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.transformed.expect
index 1da87de..643a91f 100644
--- a/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/type_variable_in_static_context.dart.weak.transformed.expect
@@ -2,61 +2,114 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
-// Try removing the constructor declaration.
-// Extension(T t);
-// ^^^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
-// Try removing the constructor declaration.
-// factory Extension.fact(T t) => null;
-// ^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
-// Try removing the field declaration or making it a static field
-// T field1;
-// ^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
-// Mixin(T t);
-// ^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
-// factory Mixin.fact(T t) => null;
-// ^^^^^^^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:11: Error: Expected 0 type arguments.
-// factory Extension.fact(T t) => null;
-// ^
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
+// static T? method0<S extends T>(T arg) {
+// ^
//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:31: Error: Type variables can't be used in static members.
// static T? method0<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
+// static T? method0<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
+// @Class<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
+// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:44: Error: Type variables can't be used in static members.
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
+// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
+// @Class<Class<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
+// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:57: Error: Type variables can't be used in static members.
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
+// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
+// @A<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
+// static A<T>? method3<S extends A<T>>(A<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:36: Error: Type variables can't be used in static members.
// static A<T>? method3<S extends A<T>>(A<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
+// static A<T>? method3<S extends A<T>>(A<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
+// @A<A<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
+// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:41: Error: Type variables can't be used in static members.
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
+// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
+// @B<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
+// static B<T>? method5<S extends B<T>>(B<T> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:36: Error: Type variables can't be used in static members.
// static B<T>? method5<S extends B<T>>(B<T> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
+// static B<T>? method5<S extends B<T>>(B<T> arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
+// @A<B<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
+// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:41: Error: Type variables can't be used in static members.
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
+// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:73:34: Error: Type variables can't be used in static members.
// @Class<void Function<S extends T>()>()
// ^
@@ -73,102 +126,85 @@
// static void Function<S extends T>()? method7<U extends void Function<S extends T>()>(void Function<S extends T>() arg) {
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
-// static T? method0<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
-// static T? method0<S extends T>(T arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
-// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
-// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
-// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
-// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
-// static A<T>? method3<S extends A<T>>(A<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
-// static A<T>? method3<S extends A<T>>(A<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
-// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
-// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
-// static B<T>? method5<S extends B<T>>(B<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
-// static B<T>? method5<S extends B<T>>(B<T> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
-// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
-// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:80:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
+// @Class<T>()
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:83:16: Error: Type variables can't be used in static members.
// static Class<T>? field1;
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
+// @Class<Class<T>>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
+// @A<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
+// @B<T>()
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
+// Try removing the constructor declaration.
+// Extension(T t);
+// ^^^^^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
+// Try removing the constructor declaration.
+// factory Extension.fact(T t) => null;
+// ^^^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
+// Try removing the field declaration or making it a static field
+// T field1;
+// ^^^^^^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:110:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:10: Error: Type variables can't be used in static members.
// static T? staticMethod<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
+// Mixin(T t);
+// ^^^^^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
+// factory Mixin.fact(T t) => null;
+// ^^^^^^^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:135:10: Error: Type variables can't be used in static members.
// static T field0;
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
-// static T? staticMethod<S extends T>(T arg) {
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:10: Error: Type variables can't be used in static members.
// static T? staticMethod<S extends T>(T arg) {
// ^
//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
+// static T? staticMethod<S extends T>(T arg) {
+// ^
+//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:92:24: Error: Type variables can't be used in static members.
// static var field4 = (T t) => T;
// ^
@@ -181,50 +217,10 @@
// @T()
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
-// @Class<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
-// @Class<Class<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
-// @A<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
-// @A<A<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
-// @B<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
-// @A<B<T>>()
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:79:4: Error: Couldn't find constructor 'T'.
// @T()
// ^
//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
-// @Class<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
-// @Class<Class<T>>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
-// @A<T>()
-// ^
-//
-// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
-// @B<T>()
-// ^
-//
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:94:4: Error: Couldn't find constructor 'T'.
// @T()
// ^
diff --git a/pkg/front_end/testcases/general/type_variable_type_arguments.dart b/pkg/front_end/testcases/general/type_variable_type_arguments.dart
new file mode 100644
index 0000000..6243642
--- /dev/null
+++ b/pkg/front_end/testcases/general/type_variable_type_arguments.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+void method<S>(S<int> a) {}
+
+class Class<T> {
+ void method<S>(T<int> a, S<int> b) {
+ local<U>(U<int> a) {}
+ }
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/type_variable_type_arguments.dart.textual_outline.expect b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.textual_outline.expect
new file mode 100644
index 0000000..07ae777
--- /dev/null
+++ b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.textual_outline.expect
@@ -0,0 +1,7 @@
+void method<S>(S<int> a) {}
+
+class Class<T> {
+ void method<S>(T<int> a, S<int> b) {}
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/type_variable_type_arguments.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..68c99cb
--- /dev/null
+++ b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.textual_outline_modelled.expect
@@ -0,0 +1,6 @@
+class Class<T> {
+ void method<S>(T<int> a, S<int> b) {}
+}
+
+main() {}
+void method<S>(S<int> a) {}
diff --git a/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.expect b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.expect
new file mode 100644
index 0000000..b5dd513
--- /dev/null
+++ b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.expect
@@ -0,0 +1,37 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:5:16: Error: Can't use type arguments with type variable 'S'.
+// Try removing the type arguments.
+// void method<S>(S<int> a) {}
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:28: Error: Can't use type arguments with type variable 'S'.
+// Try removing the type arguments.
+// void method<S>(T<int> a, S<int> b) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:18: Error: Can't use type arguments with type variable 'T'.
+// Try removing the type arguments.
+// void method<S>(T<int> a, S<int> b) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:9:14: Error: Can't use type arguments with type variable 'U'.
+// Try removing the type arguments.
+// local<U>(U<int> a) {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Class<T extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::Class<self::Class::T%>
+ : super core::Object::•()
+ ;
+ method method<S extends core::Object? = dynamic>(invalid-type a, invalid-type b) → void {
+ function local<U extends core::Object? = dynamic>(invalid-type a) → Null {}
+ }
+}
+static method method<S extends core::Object? = dynamic>(invalid-type a) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.modular.expect b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.modular.expect
new file mode 100644
index 0000000..b5dd513
--- /dev/null
+++ b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.modular.expect
@@ -0,0 +1,37 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:5:16: Error: Can't use type arguments with type variable 'S'.
+// Try removing the type arguments.
+// void method<S>(S<int> a) {}
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:28: Error: Can't use type arguments with type variable 'S'.
+// Try removing the type arguments.
+// void method<S>(T<int> a, S<int> b) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:18: Error: Can't use type arguments with type variable 'T'.
+// Try removing the type arguments.
+// void method<S>(T<int> a, S<int> b) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:9:14: Error: Can't use type arguments with type variable 'U'.
+// Try removing the type arguments.
+// local<U>(U<int> a) {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Class<T extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::Class<self::Class::T%>
+ : super core::Object::•()
+ ;
+ method method<S extends core::Object? = dynamic>(invalid-type a, invalid-type b) → void {
+ function local<U extends core::Object? = dynamic>(invalid-type a) → Null {}
+ }
+}
+static method method<S extends core::Object? = dynamic>(invalid-type a) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.outline.expect b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.outline.expect
new file mode 100644
index 0000000..20db1ac
--- /dev/null
+++ b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.outline.expect
@@ -0,0 +1,32 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:5:16: Error: Can't use type arguments with type variable 'S'.
+// Try removing the type arguments.
+// void method<S>(S<int> a) {}
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:28: Error: Can't use type arguments with type variable 'S'.
+// Try removing the type arguments.
+// void method<S>(T<int> a, S<int> b) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:18: Error: Can't use type arguments with type variable 'T'.
+// Try removing the type arguments.
+// void method<S>(T<int> a, S<int> b) {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Class<T extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::Class<self::Class::T%>
+ ;
+ method method<S extends core::Object? = dynamic>(invalid-type a, invalid-type b) → void
+ ;
+}
+static method method<S extends core::Object? = dynamic>(invalid-type a) → void
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.transformed.expect b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.transformed.expect
new file mode 100644
index 0000000..b5dd513
--- /dev/null
+++ b/pkg/front_end/testcases/general/type_variable_type_arguments.dart.weak.transformed.expect
@@ -0,0 +1,37 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:5:16: Error: Can't use type arguments with type variable 'S'.
+// Try removing the type arguments.
+// void method<S>(S<int> a) {}
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:28: Error: Can't use type arguments with type variable 'S'.
+// Try removing the type arguments.
+// void method<S>(T<int> a, S<int> b) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:18: Error: Can't use type arguments with type variable 'T'.
+// Try removing the type arguments.
+// void method<S>(T<int> a, S<int> b) {
+// ^
+//
+// pkg/front_end/testcases/general/type_variable_type_arguments.dart:9:14: Error: Can't use type arguments with type variable 'U'.
+// Try removing the type arguments.
+// local<U>(U<int> a) {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Class<T extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::Class<self::Class::T%>
+ : super core::Object::•()
+ ;
+ method method<S extends core::Object? = dynamic>(invalid-type a, invalid-type b) → void {
+ function local<U extends core::Object? = dynamic>(invalid-type a) → Null {}
+ }
+}
+static method method<S extends core::Object? = dynamic>(invalid-type a) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/incremental/reissue_errors_6.yaml.world.1.expect b/pkg/front_end/testcases/incremental/reissue_errors_6.yaml.world.1.expect
index 4fb5295..3ca4123 100644
--- a/pkg/front_end/testcases/incremental/reissue_errors_6.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental/reissue_errors_6.yaml.world.1.expect
@@ -3,10 +3,6 @@
//
// Problems in library:
//
-// org-dartlang-test:///lib.dart:4:21: Error: Expected 0 type arguments.
-// class Bar<X extends Foo<Null>> {}
-// ^
-//
// org-dartlang-test:///lib.dart:4:21: Error: Type 'Foo' not found.
// class Bar<X extends Foo<Null>> {}
// ^^^
diff --git a/pkg/front_end/testcases/incremental/reissue_errors_6.yaml.world.2.expect b/pkg/front_end/testcases/incremental/reissue_errors_6.yaml.world.2.expect
index 5a65282..6e6264d 100644
--- a/pkg/front_end/testcases/incremental/reissue_errors_6.yaml.world.2.expect
+++ b/pkg/front_end/testcases/incremental/reissue_errors_6.yaml.world.2.expect
@@ -3,10 +3,6 @@
//
// Problems in library:
//
-// org-dartlang-test:///lib.dart:4:21: Error: Expected 0 type arguments.
-// class Bar<X extends Foo<Null>> {}
-// ^
-//
// org-dartlang-test:///lib.dart:4:21: Error: Type 'Foo' not found.
// class Bar<X extends Foo<Null>> {}
// ^^^
diff --git a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.strong.expect b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.strong.expect
index 5fac846..45ecb5c 100644
--- a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.strong.expect
@@ -75,81 +75,81 @@
// class Ooo = Aoo with Never;
// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:28: Error: The type 'Never' can't be used as supertype.
// class Joo extends Boo with Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used as supertype.
// class Koo extends Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used as supertype.
// class Loo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used as supertype.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used as supertype.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used as supertype.
// mixin Moo6 on Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used as supertype.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used as supertype.
// mixin Moo8 implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used as supertype.
// class Noo = Never with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:7: Error: The type 'dynamic' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:20: Error: The type 'dynamic' can't be used as supertype.
// class NooDynamic = dynamic with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:22: Error: The type 'Never' can't be used as supertype.
// class Ooo = Aoo with Never;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used in an 'extends' clause.
// class Koo extends Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used in an 'implements' clause.
// class Loo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used in an 'extends' clause.
// mixin Moo6 on Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo8 implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used in an 'extends' clause.
// class Noo = Never with Aoo;
-// ^
+// ^^^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.strong.transformed.expect
index a6f6d2a..36281bf 100644
--- a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.strong.transformed.expect
@@ -75,81 +75,81 @@
// class Ooo = Aoo with Never;
// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:28: Error: The type 'Never' can't be used as supertype.
// class Joo extends Boo with Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used as supertype.
// class Koo extends Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used as supertype.
// class Loo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used as supertype.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used as supertype.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used as supertype.
// mixin Moo6 on Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used as supertype.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used as supertype.
// mixin Moo8 implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used as supertype.
// class Noo = Never with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:7: Error: The type 'dynamic' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:20: Error: The type 'dynamic' can't be used as supertype.
// class NooDynamic = dynamic with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:22: Error: The type 'Never' can't be used as supertype.
// class Ooo = Aoo with Never;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used in an 'extends' clause.
// class Koo extends Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used in an 'implements' clause.
// class Loo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used in an 'extends' clause.
// mixin Moo6 on Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo8 implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used in an 'extends' clause.
// class Noo = Never with Aoo;
-// ^
+// ^^^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.expect b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.expect
index 5fac846..45ecb5c 100644
--- a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.expect
@@ -75,81 +75,81 @@
// class Ooo = Aoo with Never;
// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:28: Error: The type 'Never' can't be used as supertype.
// class Joo extends Boo with Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used as supertype.
// class Koo extends Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used as supertype.
// class Loo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used as supertype.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used as supertype.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used as supertype.
// mixin Moo6 on Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used as supertype.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used as supertype.
// mixin Moo8 implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used as supertype.
// class Noo = Never with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:7: Error: The type 'dynamic' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:20: Error: The type 'dynamic' can't be used as supertype.
// class NooDynamic = dynamic with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:22: Error: The type 'Never' can't be used as supertype.
// class Ooo = Aoo with Never;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used in an 'extends' clause.
// class Koo extends Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used in an 'implements' clause.
// class Loo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used in an 'extends' clause.
// mixin Moo6 on Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo8 implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used in an 'extends' clause.
// class Noo = Never with Aoo;
-// ^
+// ^^^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.modular.expect b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.modular.expect
index 5fac846..45ecb5c 100644
--- a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.modular.expect
@@ -75,81 +75,81 @@
// class Ooo = Aoo with Never;
// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:28: Error: The type 'Never' can't be used as supertype.
// class Joo extends Boo with Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used as supertype.
// class Koo extends Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used as supertype.
// class Loo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used as supertype.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used as supertype.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used as supertype.
// mixin Moo6 on Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used as supertype.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used as supertype.
// mixin Moo8 implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used as supertype.
// class Noo = Never with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:7: Error: The type 'dynamic' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:20: Error: The type 'dynamic' can't be used as supertype.
// class NooDynamic = dynamic with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:22: Error: The type 'Never' can't be used as supertype.
// class Ooo = Aoo with Never;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used in an 'extends' clause.
// class Koo extends Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used in an 'implements' clause.
// class Loo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used in an 'extends' clause.
// mixin Moo6 on Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo8 implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used in an 'extends' clause.
// class Noo = Never with Aoo;
-// ^
+// ^^^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.outline.expect b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.outline.expect
index 33133b3..94601e3 100644
--- a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.outline.expect
@@ -75,81 +75,81 @@
// class Ooo = Aoo with Never;
// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:28: Error: The type 'Never' can't be used as supertype.
// class Joo extends Boo with Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used as supertype.
// class Koo extends Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used as supertype.
// class Loo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used as supertype.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used as supertype.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used as supertype.
// mixin Moo6 on Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used as supertype.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used as supertype.
// mixin Moo8 implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used as supertype.
// class Noo = Never with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:7: Error: The type 'dynamic' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:20: Error: The type 'dynamic' can't be used as supertype.
// class NooDynamic = dynamic with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:22: Error: The type 'Never' can't be used as supertype.
// class Ooo = Aoo with Never;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used in an 'extends' clause.
// class Koo extends Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used in an 'implements' clause.
// class Loo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used in an 'extends' clause.
// mixin Moo6 on Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo8 implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used in an 'extends' clause.
// class Noo = Never with Aoo;
-// ^
+// ^^^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.transformed.expect
index a6f6d2a..36281bf 100644
--- a/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/forbidden_supers.dart.weak.transformed.expect
@@ -75,81 +75,81 @@
// class Ooo = Aoo with Never;
// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:26:28: Error: The type 'Never' can't be used as supertype.
// class Joo extends Boo with Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used as supertype.
// class Koo extends Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used as supertype.
// class Loo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used as supertype.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used as supertype.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used as supertype.
// mixin Moo6 on Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used as supertype.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used as supertype.
// mixin Moo8 implements Never {}
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used as supertype.
// class Noo = Never with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:7: Error: The type 'dynamic' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:49:20: Error: The type 'dynamic' can't be used as supertype.
// class NooDynamic = dynamic with Aoo;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:7: Error: The type 'Never' can't be used as supertype.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:52:22: Error: The type 'Never' can't be used as supertype.
// class Ooo = Aoo with Never;
-// ^
+// ^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:28:19: Error: The type 'Never' can't be used in an 'extends' clause.
// class Koo extends Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:30:22: Error: The type 'Never' can't be used in an 'implements' clause.
// class Loo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:38:30: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo4 on Aoo implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:40:20: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo5 on Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:42:15: Error: The type 'Never' can't be used in an 'extends' clause.
// mixin Moo6 on Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:44:28: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo7 implements Aoo, Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:7: Error: The type 'Never' can't be used in an 'implements' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:46:23: Error: The type 'Never' can't be used in an 'implements' clause.
// mixin Moo8 implements Never {}
-// ^
+// ^^^^^
//
-// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:7: Error: The type 'Never' can't be used in an 'extends' clause.
+// pkg/front_end/testcases/nnbd/forbidden_supers.dart:48:13: Error: The type 'Never' can't be used in an 'extends' clause.
// class Noo = Never with Aoo;
-// ^
+// ^^^^^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.strong.expect b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.strong.expect
index 6095355..067e4b2 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.strong.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.strong.expect
@@ -100,162 +100,162 @@
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:18: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C1 extends AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:21: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C2 implements AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:19: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C3 = A with BAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:7: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:32: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C4 = A with B implements CAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:13:9: Context: The issue arises via this type alias.
// typedef CAlias = C?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:25: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C5 extends A with BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:13: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M1 on AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:16: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M2 on A, BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:26: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M3 on A implements BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:18: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1 extends TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:19: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1a extends prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:19: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1b extends TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:21: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D2 implements TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:19: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D3 = A with TAlias<B>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:7: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:32: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D4 = A with B implements TAlias<C>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:25: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D5 extends A with TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:13: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1 on TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:14: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1a on prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:14: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1b on TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:16: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N2 on A, TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:26: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N3 on A implements TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.strong.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.strong.transformed.expect
index 62c7762..eeb78f7 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.strong.transformed.expect
@@ -100,162 +100,162 @@
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:18: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C1 extends AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:21: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C2 implements AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:19: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C3 = A with BAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:7: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:32: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C4 = A with B implements CAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:13:9: Context: The issue arises via this type alias.
// typedef CAlias = C?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:25: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C5 extends A with BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:13: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M1 on AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:16: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M2 on A, BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:26: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M3 on A implements BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:18: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1 extends TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:19: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1a extends prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:19: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1b extends TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:21: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D2 implements TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:19: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D3 = A with TAlias<B>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:7: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:32: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D4 = A with B implements TAlias<C>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:25: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D5 extends A with TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:13: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1 on TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:14: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1a on prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:14: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1b on TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:16: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N2 on A, TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:26: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N3 on A implements TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.expect b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.expect
index 6095355..067e4b2 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.expect
@@ -100,162 +100,162 @@
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:18: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C1 extends AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:21: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C2 implements AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:19: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C3 = A with BAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:7: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:32: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C4 = A with B implements CAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:13:9: Context: The issue arises via this type alias.
// typedef CAlias = C?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:25: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C5 extends A with BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:13: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M1 on AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:16: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M2 on A, BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:26: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M3 on A implements BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:18: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1 extends TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:19: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1a extends prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:19: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1b extends TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:21: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D2 implements TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:19: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D3 = A with TAlias<B>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:7: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:32: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D4 = A with B implements TAlias<C>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:25: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D5 extends A with TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:13: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1 on TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:14: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1a on prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:14: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1b on TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:16: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N2 on A, TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:26: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N3 on A implements TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.modular.expect b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.modular.expect
index 6095355..067e4b2 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.modular.expect
@@ -100,162 +100,162 @@
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:18: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C1 extends AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:21: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C2 implements AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:19: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C3 = A with BAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:7: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:32: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C4 = A with B implements CAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:13:9: Context: The issue arises via this type alias.
// typedef CAlias = C?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:25: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C5 extends A with BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:13: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M1 on AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:16: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M2 on A, BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:26: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M3 on A implements BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:18: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1 extends TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:19: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1a extends prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:19: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1b extends TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:21: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D2 implements TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:19: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D3 = A with TAlias<B>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:7: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:32: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D4 = A with B implements TAlias<C>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:25: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D5 extends A with TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:13: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1 on TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:14: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1a on prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:14: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1b on TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:16: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N2 on A, TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:26: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N3 on A implements TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.outline.expect
index 22df973..d128009 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.outline.expect
@@ -100,162 +100,162 @@
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:18: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C1 extends AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:21: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C2 implements AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:19: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C3 = A with BAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:7: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:32: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C4 = A with B implements CAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:13:9: Context: The issue arises via this type alias.
// typedef CAlias = C?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:25: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C5 extends A with BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:13: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M1 on AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:16: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M2 on A, BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:26: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M3 on A implements BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:18: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1 extends TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:19: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1a extends prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:19: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1b extends TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:21: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D2 implements TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:19: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D3 = A with TAlias<B>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:7: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:32: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D4 = A with B implements TAlias<C>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:25: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D5 extends A with TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:13: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1 on TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:14: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1a on prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:14: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1b on TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:16: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N2 on A, TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:26: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N3 on A implements TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.transformed.expect
index 62c7762..eeb78f7 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.weak.transformed.expect
@@ -100,162 +100,162 @@
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:16:18: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C1 extends AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:18:21: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C2 implements AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:20:19: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C3 = A with BAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:7: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:22:32: Error: The type 'CAlias' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C4 = A with B implements CAlias;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:13:9: Context: The issue arises via this type alias.
// typedef CAlias = C?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:24:25: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class C5 extends A with BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:7: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:26:13: Error: The type 'AAlias' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M1 on AAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:11:9: Context: The issue arises via this type alias.
// typedef AAlias = A?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:28:16: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M2 on A, BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:7: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:30:26: Error: The type 'BAlias' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin M3 on A implements BAlias {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:12:9: Context: The issue arises via this type alias.
// typedef BAlias = B?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:32:18: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1 extends TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:34:19: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1a extends prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:36:19: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D1b extends TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:38:21: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D2 implements TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:40:19: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D3 = A with TAlias<B>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:7: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:42:32: Error: The type 'TAlias<C>' which is an alias of 'C?' can't be used as supertype because it is nullable.
// - 'C' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D4 = A with B implements TAlias<C>;
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:44:25: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// class D5 extends A with TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:7: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:46:13: Error: The type 'TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1 on TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:7: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:48:14: Error: The type 'prefix.TAlias<A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1a on prefix.TAlias<A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:7: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:50:14: Error: The type 'TAlias<prefix.A>' which is an alias of 'A?' can't be used as supertype because it is nullable.
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N1b on TAlias<prefix.A> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:52:16: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N2 on A, TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
//
-// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:7: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
+// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:54:26: Error: The type 'TAlias<B>' which is an alias of 'B?' can't be used as supertype because it is nullable.
// - 'B' is from 'pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart'.
// mixin N3 on A implements TAlias<B> {}
-// ^
+// ^
// pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart:14:9: Context: The issue arises via this type alias.
// typedef TAlias<T> = T?;
// ^
diff --git a/pkg/front_end/testcases/regress/issue_31190.dart.weak.expect b/pkg/front_end/testcases/regress/issue_31190.dart.weak.expect
index ba00133..728db79 100644
--- a/pkg/front_end/testcases/regress/issue_31190.dart.weak.expect
+++ b/pkg/front_end/testcases/regress/issue_31190.dart.weak.expect
@@ -15,10 +15,6 @@
// T<U> v;
// ^
//
-// pkg/front_end/testcases/regress/issue_31190.dart:6:3: Error: Expected 0 type arguments.
-// T<U> v;
-// ^
-//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_31190.dart.weak.modular.expect b/pkg/front_end/testcases/regress/issue_31190.dart.weak.modular.expect
index ba00133..728db79 100644
--- a/pkg/front_end/testcases/regress/issue_31190.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/regress/issue_31190.dart.weak.modular.expect
@@ -15,10 +15,6 @@
// T<U> v;
// ^
//
-// pkg/front_end/testcases/regress/issue_31190.dart:6:3: Error: Expected 0 type arguments.
-// T<U> v;
-// ^
-//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_31190.dart.weak.transformed.expect b/pkg/front_end/testcases/regress/issue_31190.dart.weak.transformed.expect
index ba00133..728db79 100644
--- a/pkg/front_end/testcases/regress/issue_31190.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31190.dart.weak.transformed.expect
@@ -15,10 +15,6 @@
// T<U> v;
// ^
//
-// pkg/front_end/testcases/regress/issue_31190.dart:6:3: Error: Expected 0 type arguments.
-// T<U> v;
-// ^
-//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_34291.dart.weak.expect b/pkg/front_end/testcases/regress/issue_34291.dart.weak.expect
index efb5579..13bbe76 100644
--- a/pkg/front_end/testcases/regress/issue_34291.dart.weak.expect
+++ b/pkg/front_end/testcases/regress/issue_34291.dart.weak.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/regress/issue_34291.dart:9:1: Error: Expected 0 type arguments.
+// pkg/front_end/testcases/regress/issue_34291.dart:9:5: Error: Expected 0 type arguments.
// lib.A<B> foo() {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_34291.dart.weak.modular.expect b/pkg/front_end/testcases/regress/issue_34291.dart.weak.modular.expect
index efb5579..13bbe76 100644
--- a/pkg/front_end/testcases/regress/issue_34291.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/regress/issue_34291.dart.weak.modular.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/regress/issue_34291.dart:9:1: Error: Expected 0 type arguments.
+// pkg/front_end/testcases/regress/issue_34291.dart:9:5: Error: Expected 0 type arguments.
// lib.A<B> foo() {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_34291.dart.weak.outline.expect b/pkg/front_end/testcases/regress/issue_34291.dart.weak.outline.expect
index 5df2ea6..79da717 100644
--- a/pkg/front_end/testcases/regress/issue_34291.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/regress/issue_34291.dart.weak.outline.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/regress/issue_34291.dart:9:1: Error: Expected 0 type arguments.
+// pkg/front_end/testcases/regress/issue_34291.dart:9:5: Error: Expected 0 type arguments.
// lib.A<B> foo() {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_34291.dart.weak.transformed.expect b/pkg/front_end/testcases/regress/issue_34291.dart.weak.transformed.expect
index efb5579..13bbe76 100644
--- a/pkg/front_end/testcases/regress/issue_34291.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_34291.dart.weak.transformed.expect
@@ -2,9 +2,9 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/regress/issue_34291.dart:9:1: Error: Expected 0 type arguments.
+// pkg/front_end/testcases/regress/issue_34291.dart:9:5: Error: Expected 0 type arguments.
// lib.A<B> foo() {}
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_34850.dart.weak.expect b/pkg/front_end/testcases/regress/issue_34850.dart.weak.expect
index 9e29266..460422e 100644
--- a/pkg/front_end/testcases/regress/issue_34850.dart.weak.expect
+++ b/pkg/front_end/testcases/regress/issue_34850.dart.weak.expect
@@ -31,10 +31,6 @@
// <foo<
// ^^^
//
-// pkg/front_end/testcases/regress/issue_34850.dart:5:2: Error: Expected 0 type arguments.
-// <foo<
-// ^
-//
// pkg/front_end/testcases/regress/issue_34850.dart:11:1: Error: Type 'foo' not found.
// foo
// ^^^
@@ -46,10 +42,6 @@
// Future<List<int>> f2() async => null;
// ^^^^^^
//
-// pkg/front_end/testcases/regress/issue_34850.dart:14:1: Error: Expected 0 type arguments.
-// Future<List<>> f3() async {
-// ^
-//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_34850.dart.weak.modular.expect b/pkg/front_end/testcases/regress/issue_34850.dart.weak.modular.expect
index 9e29266..460422e 100644
--- a/pkg/front_end/testcases/regress/issue_34850.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/regress/issue_34850.dart.weak.modular.expect
@@ -31,10 +31,6 @@
// <foo<
// ^^^
//
-// pkg/front_end/testcases/regress/issue_34850.dart:5:2: Error: Expected 0 type arguments.
-// <foo<
-// ^
-//
// pkg/front_end/testcases/regress/issue_34850.dart:11:1: Error: Type 'foo' not found.
// foo
// ^^^
@@ -46,10 +42,6 @@
// Future<List<int>> f2() async => null;
// ^^^^^^
//
-// pkg/front_end/testcases/regress/issue_34850.dart:14:1: Error: Expected 0 type arguments.
-// Future<List<>> f3() async {
-// ^
-//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_34850.dart.weak.outline.expect b/pkg/front_end/testcases/regress/issue_34850.dart.weak.outline.expect
index 393c9ed..34f987e 100644
--- a/pkg/front_end/testcases/regress/issue_34850.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/regress/issue_34850.dart.weak.outline.expect
@@ -31,10 +31,6 @@
// <foo<
// ^^^
//
-// pkg/front_end/testcases/regress/issue_34850.dart:5:2: Error: Expected 0 type arguments.
-// <foo<
-// ^
-//
// pkg/front_end/testcases/regress/issue_34850.dart:11:1: Error: Type 'foo' not found.
// foo
// ^^^
@@ -46,10 +42,6 @@
// Future<List<int>> f2() async => null;
// ^^^^^^
//
-// pkg/front_end/testcases/regress/issue_34850.dart:14:1: Error: Expected 0 type arguments.
-// Future<List<>> f3() async {
-// ^
-//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_34850.dart.weak.transformed.expect b/pkg/front_end/testcases/regress/issue_34850.dart.weak.transformed.expect
index 6ded2e6..e1979d3 100644
--- a/pkg/front_end/testcases/regress/issue_34850.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_34850.dart.weak.transformed.expect
@@ -31,10 +31,6 @@
// <foo<
// ^^^
//
-// pkg/front_end/testcases/regress/issue_34850.dart:5:2: Error: Expected 0 type arguments.
-// <foo<
-// ^
-//
// pkg/front_end/testcases/regress/issue_34850.dart:11:1: Error: Type 'foo' not found.
// foo
// ^^^
@@ -46,10 +42,6 @@
// Future<List<int>> f2() async => null;
// ^^^^^^
//
-// pkg/front_end/testcases/regress/issue_34850.dart:14:1: Error: Expected 0 type arguments.
-// Future<List<>> f3() async {
-// ^
-//
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
diff --git a/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.expect b/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.expect
index 03c63ac..9b9fe6e 100644
--- a/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.expect
+++ b/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.expect
@@ -14,21 +14,21 @@
// class DND2 extends Object with M<dynamic> Function() {
// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:9:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:9:43: Error: Can't use a function type as supertype.
// class DND1 extends Object with M<dynamic> Function()> {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:12:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:12:43: Error: Can't use a function type as supertype.
// class DND2 extends Object with M<dynamic> Function() {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:15:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:15:31: Error: Can't use a function type as supertype.
// class DND3 extends M<dynamic> Function() {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:18:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:18:34: Error: Can't use a function type as supertype.
// class DND4 implements M<dynamic> Function() {
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.modular.expect b/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.modular.expect
index 03c63ac..9b9fe6e 100644
--- a/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.modular.expect
+++ b/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.modular.expect
@@ -14,21 +14,21 @@
// class DND2 extends Object with M<dynamic> Function() {
// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:9:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:9:43: Error: Can't use a function type as supertype.
// class DND1 extends Object with M<dynamic> Function()> {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:12:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:12:43: Error: Can't use a function type as supertype.
// class DND2 extends Object with M<dynamic> Function() {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:15:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:15:31: Error: Can't use a function type as supertype.
// class DND3 extends M<dynamic> Function() {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:18:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:18:34: Error: Can't use a function type as supertype.
// class DND4 implements M<dynamic> Function() {
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.outline.expect b/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.outline.expect
index b75b781..4e0b87c 100644
--- a/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.outline.expect
+++ b/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.outline.expect
@@ -14,21 +14,21 @@
// class DND2 extends Object with M<dynamic> Function() {
// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:9:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:9:43: Error: Can't use a function type as supertype.
// class DND1 extends Object with M<dynamic> Function()> {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:12:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:12:43: Error: Can't use a function type as supertype.
// class DND2 extends Object with M<dynamic> Function() {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:15:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:15:31: Error: Can't use a function type as supertype.
// class DND3 extends M<dynamic> Function() {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:18:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:18:34: Error: Can't use a function type as supertype.
// class DND4 implements M<dynamic> Function() {
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.transformed.expect b/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.transformed.expect
index 03c63ac..9b9fe6e 100644
--- a/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_41265.crash_dart.weak.transformed.expect
@@ -14,21 +14,21 @@
// class DND2 extends Object with M<dynamic> Function() {
// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:9:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:9:43: Error: Can't use a function type as supertype.
// class DND1 extends Object with M<dynamic> Function()> {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:12:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:12:43: Error: Can't use a function type as supertype.
// class DND2 extends Object with M<dynamic> Function() {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:15:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:15:31: Error: Can't use a function type as supertype.
// class DND3 extends M<dynamic> Function() {
-// ^
+// ^
//
-// pkg/front_end/testcases/regress/issue_41265.crash_dart:18:7: Error: Can't use a function type as supertype.
+// pkg/front_end/testcases/regress/issue_41265.crash_dart:18:34: Error: Can't use a function type as supertype.
// class DND4 implements M<dynamic> Function() {
-// ^
+// ^
//
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/tool/ast_model.dart b/pkg/front_end/tool/ast_model.dart
index 834aa12..e06996a 100644
--- a/pkg/front_end/tool/ast_model.dart
+++ b/pkg/front_end/tool/ast_model.dart
@@ -177,6 +177,7 @@
},
'FunctionType': {
'typeParameters': FieldRule(isDeclaration: true),
+ '_typedefType': FieldRule(name: 'typedefType'),
},
'TypeParameterType': {
'parameter': FieldRule(isDeclaration: false),
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 28d8c84..17ac253 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -11203,8 +11203,7 @@
@override
final Nullability declaredNullability;
- /// The [Typedef] this function type is created for.
- final TypedefType? typedefType;
+ TypedefType? _typedefType;
final DartType returnType;
@@ -11216,15 +11215,27 @@
{this.namedParameters: const <NamedType>[],
this.typeParameters: const <TypeParameter>[],
int? requiredParameterCount,
- this.typedefType})
+ TypedefType? typedefType})
: this.positionalParameters = positionalParameters,
this.requiredParameterCount =
- requiredParameterCount ?? positionalParameters.length;
+ requiredParameterCount ?? positionalParameters.length,
+ _typedefType = typedefType;
- Reference? get typedefReference => typedefType?.typedefReference;
+ Reference? get typedefReference => _typedefType?.typedefReference;
Typedef? get typedef => typedefReference?.asTypedef;
+ /// The [Typedef] this function type is created for, if any.
+ TypedefType? get typedefType => _typedefType;
+
+ void set typedefType(TypedefType? value) {
+ assert(
+ _typedefType == null,
+ "Cannot change an already set FunctionType.typedefType from "
+ "$_typedefType to $value.");
+ _typedefType = value;
+ }
+
@override
Nullability get nullability => declaredNullability;
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.cc b/runtime/vm/compiler/assembler/assembler_arm64.cc
index 580bd40..359c6db 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64.cc
@@ -2382,7 +2382,7 @@
void Assembler::PopNativeCalleeSavedRegisters() {
// Restore the bottom 64-bits of callee-saved V registers.
- bool pop_single = (kAbiPreservedCpuRegCount & 1) == 1;
+ bool pop_single = (kAbiPreservedFpuRegCount & 1) == 1;
VRegister vprev = kNoVRegister;
for (int i = kAbiLastPreservedFpuReg; i >= kAbiFirstPreservedFpuReg; i--) {
const VRegister r = static_cast<VRegister>(i);
diff --git a/tests/co19/update.sh b/tests/co19/update.sh
index abce487..610182f 100755
--- a/tests/co19/update.sh
+++ b/tests/co19/update.sh
@@ -21,14 +21,6 @@
git branch cl-co19-roll-co19-to-$NEW origin/main
git checkout cl-co19-roll-co19-to-$NEW
-# Build a cipd package of the commit.
-BUILD_ID=$(bb add \
- -commit https://dart.googlesource.com/co19/+/$NEW \
- -json \
- dart/ci/co19-roller \
- | jq -r '.id')
-bb collect -interval 10s $BUILD_ID
-
# Update DEPS:
gclient setdep --var=co19_rev=$NEW
diff --git a/tests/co19_2/update.sh b/tests/co19_2/update.sh
index b70d919..ca6b486 100755
--- a/tests/co19_2/update.sh
+++ b/tests/co19_2/update.sh
@@ -21,15 +21,6 @@
git branch cl-co19-roll-co19-to-$NEW origin/main
git checkout cl-co19-roll-co19-to-$NEW
-# Build a cipd package of the commit.
-BUILD_ID=$(bb add \
- -commit https://dart.googlesource.com/co19/+/$NEW \
- -json \
- -p variant=legacy \
- dart/ci/co19-roller \
- | jq -r '.id')
-bb collect -interval 10s $BUILD_ID
-
# Update DEPS:
gclient setdep --var=co19_2_rev=$NEW
diff --git a/tests/language/dynamic/dynamic2_test.dart b/tests/language/dynamic/dynamic2_test.dart
index 6871f9f..e62c7aa 100644
--- a/tests/language/dynamic/dynamic2_test.dart
+++ b/tests/language/dynamic/dynamic2_test.dart
@@ -5,14 +5,14 @@
// Test the prohibited use of 'dynamic' in extending and implementing classes.
class A
-// ^
-// [cfe] The type 'dynamic' can't be used as supertype.
extends dynamic
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
+ // [cfe] The type 'dynamic' can't be used as supertype.
implements dynamic
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
+ // [cfe] The type 'dynamic' can't be used as supertype.
{}
main() {
diff --git a/tests/language/identifier/known_prefix_error_test.dart b/tests/language/identifier/known_prefix_error_test.dart
index 458f6e0..e0d5ac6 100644
--- a/tests/language/identifier/known_prefix_error_test.dart
+++ b/tests/language/identifier/known_prefix_error_test.dart
@@ -29,42 +29,34 @@
// [error line 28, column 1, length 5]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'async' isn't a type.
-// [cfe] Expected 0 type arguments.
await<dynamic> _await = new await.A();
-// [error line 33, column 1, length 5]
+// [error line 32, column 1, length 5]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'await' isn't a type.
-// [cfe] Expected 0 type arguments.
hide<dynamic> _hide = new hide.A();
-// [error line 38, column 1, length 4]
+// [error line 36, column 1, length 4]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'hide' isn't a type.
-// [cfe] Expected 0 type arguments.
of<dynamic> _of = new of.A();
-// [error line 43, column 1, length 2]
+// [error line 40, column 1, length 2]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'of' isn't a type.
-// [cfe] Expected 0 type arguments.
on<dynamic> _on = new on.A();
-// [error line 48, column 1, length 2]
+// [error line 44, column 1, length 2]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'on' isn't a type.
-// [cfe] Expected 0 type arguments.
show<dynamic> _show = new show.A();
-// [error line 53, column 1, length 4]
+// [error line 48, column 1, length 4]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'show' isn't a type.
-// [cfe] Expected 0 type arguments.
sync<dynamic> _sync = new sync.A();
-// [error line 58, column 1, length 4]
+// [error line 52, column 1, length 4]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'sync' isn't a type.
-// [cfe] Expected 0 type arguments.
yield<dynamic> _yield = new yield.A();
-// [error line 63, column 1, length 5]
+// [error line 56, column 1, length 5]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'yield' isn't a type.
-// [cfe] Expected 0 type arguments.
async.B<async> _B_async = new async.B();
// ^^^^^
@@ -103,42 +95,34 @@
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'async' isn't a type.
-// [cfe] Expected 0 type arguments.
await.B<await<dynamic>> _B2_await = new await.B();
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'await' isn't a type.
-// [cfe] Expected 0 type arguments.
hide.B<hide<dynamic>> _B2_hide = new hide.B();
// ^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'hide' isn't a type.
-// [cfe] Expected 0 type arguments.
of.B<of<dynamic>> _B2_of = new of.B();
// ^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'of' isn't a type.
-// [cfe] Expected 0 type arguments.
on.B<on<dynamic>> _B2_on = new on.B();
// ^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'on' isn't a type.
-// [cfe] Expected 0 type arguments.
show.B<show<dynamic>> _B2_show = new show.B();
// ^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'show' isn't a type.
-// [cfe] Expected 0 type arguments.
sync.B<sync<dynamic>> _B2_sync = new sync.B();
// ^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'sync' isn't a type.
-// [cfe] Expected 0 type arguments.
yield.B<yield<dynamic>> _B2_yield = new yield.B();
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'yield' isn't a type.
-// [cfe] Expected 0 type arguments.
main() {
Expect.isTrue(_async is async.A);
diff --git a/tests/language/malformed/inheritance_test.dart b/tests/language/malformed/inheritance_test.dart
index 8eed858..4161dfa 100644
--- a/tests/language/malformed/inheritance_test.dart
+++ b/tests/language/malformed/inheritance_test.dart
@@ -61,9 +61,9 @@
extends A<int>
// ^
// [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
{
}
@@ -71,9 +71,9 @@
extends A<Unresolved>
// ^
// [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
@@ -86,9 +86,9 @@
extends Object with A<int>
// ^
// [analyzer] COMPILE_TIME_ERROR.MIXIN_OF_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
{
}
@@ -98,9 +98,9 @@
extends Object with A<Unresolved>
// ^
// [analyzer] COMPILE_TIME_ERROR.MIXIN_OF_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
@@ -111,9 +111,9 @@
implements A<int>
// ^
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
{
}
@@ -121,9 +121,9 @@
implements A<Unresolved>
// ^
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
diff --git a/tests/language_2/dynamic/dynamic2_test.dart b/tests/language_2/dynamic/dynamic2_test.dart
index 25e43d1..e83c75c 100644
--- a/tests/language_2/dynamic/dynamic2_test.dart
+++ b/tests/language_2/dynamic/dynamic2_test.dart
@@ -7,14 +7,14 @@
// @dart = 2.9
class A
-// ^
-// [cfe] The type 'dynamic' can't be used as supertype.
extends dynamic
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
+ // [cfe] The type 'dynamic' can't be used as supertype.
implements dynamic
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
+ // [cfe] The type 'dynamic' can't be used as supertype.
{}
main() {
diff --git a/tests/language_2/identifier/known_prefix_error_test.dart b/tests/language_2/identifier/known_prefix_error_test.dart
index 2cc7982..e4bd56f 100644
--- a/tests/language_2/identifier/known_prefix_error_test.dart
+++ b/tests/language_2/identifier/known_prefix_error_test.dart
@@ -31,42 +31,34 @@
// [error line 30, column 1, length 5]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'async' isn't a type.
-// [cfe] Expected 0 type arguments.
await<dynamic> _await = new await.A();
-// [error line 35, column 1, length 5]
+// [error line 34, column 1, length 5]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'await' isn't a type.
-// [cfe] Expected 0 type arguments.
hide<dynamic> _hide = new hide.A();
-// [error line 40, column 1, length 4]
+// [error line 38, column 1, length 4]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'hide' isn't a type.
-// [cfe] Expected 0 type arguments.
of<dynamic> _of = new of.A();
-// [error line 45, column 1, length 2]
+// [error line 42, column 1, length 2]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'of' isn't a type.
-// [cfe] Expected 0 type arguments.
on<dynamic> _on = new on.A();
-// [error line 50, column 1, length 2]
+// [error line 46, column 1, length 2]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'on' isn't a type.
-// [cfe] Expected 0 type arguments.
show<dynamic> _show = new show.A();
-// [error line 55, column 1, length 4]
+// [error line 50, column 1, length 4]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'show' isn't a type.
-// [cfe] Expected 0 type arguments.
sync<dynamic> _sync = new sync.A();
-// [error line 60, column 1, length 4]
+// [error line 54, column 1, length 4]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'sync' isn't a type.
-// [cfe] Expected 0 type arguments.
yield<dynamic> _yield = new yield.A();
-// [error line 65, column 1, length 5]
+// [error line 58, column 1, length 5]
// [analyzer] COMPILE_TIME_ERROR.NOT_A_TYPE
// [cfe] 'yield' isn't a type.
-// [cfe] Expected 0 type arguments.
async.B<async> _B_async = new async.B();
// ^^^^^
@@ -105,42 +97,34 @@
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'async' isn't a type.
-// [cfe] Expected 0 type arguments.
await.B<await<dynamic>> _B2_await = new await.B();
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'await' isn't a type.
-// [cfe] Expected 0 type arguments.
hide.B<hide<dynamic>> _B2_hide = new hide.B();
// ^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'hide' isn't a type.
-// [cfe] Expected 0 type arguments.
of.B<of<dynamic>> _B2_of = new of.B();
// ^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'of' isn't a type.
-// [cfe] Expected 0 type arguments.
on.B<on<dynamic>> _B2_on = new on.B();
// ^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'on' isn't a type.
-// [cfe] Expected 0 type arguments.
show.B<show<dynamic>> _B2_show = new show.B();
// ^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'show' isn't a type.
-// [cfe] Expected 0 type arguments.
sync.B<sync<dynamic>> _B2_sync = new sync.B();
// ^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'sync' isn't a type.
-// [cfe] Expected 0 type arguments.
yield.B<yield<dynamic>> _B2_yield = new yield.B();
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] 'yield' isn't a type.
-// [cfe] Expected 0 type arguments.
main() {
Expect.isTrue(_async is async.A);
diff --git a/tests/language_2/malformed/inheritance_test.dart b/tests/language_2/malformed/inheritance_test.dart
index 20b78dd..6a0c070 100644
--- a/tests/language_2/malformed/inheritance_test.dart
+++ b/tests/language_2/malformed/inheritance_test.dart
@@ -63,9 +63,9 @@
extends A<int>
// ^
// [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
{
}
@@ -73,9 +73,9 @@
extends A<Unresolved>
// ^
// [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
@@ -88,9 +88,9 @@
extends Object with A<int>
// ^
// [analyzer] COMPILE_TIME_ERROR.MIXIN_OF_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
{
}
@@ -100,9 +100,9 @@
extends Object with A<Unresolved>
// ^
// [analyzer] COMPILE_TIME_ERROR.MIXIN_OF_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
@@ -113,9 +113,9 @@
implements A<int>
// ^
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
{
}
@@ -123,9 +123,9 @@
implements A<Unresolved>
// ^
// [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
- // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Can't use type arguments with type variable 'A'.
// ^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.NON_TYPE_AS_TYPE_ARGUMENT
// [cfe] Type 'Unresolved' not found.
diff --git a/tools/VERSION b/tools/VERSION
index ebc26f2..c15e757 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 248
+PRERELEASE 249
PRERELEASE_PATCH 0
\ No newline at end of file