Version 2.16.0-87.0.dev
Merge commit 'd5b3632868a7ea2e175c9b23a0226337fe945545' into 'dev'
diff --git a/pkg/analysis_server/analysis_options.yaml b/pkg/analysis_server/analysis_options.yaml
index e737f27..fdda3f2 100644
--- a/pkg/analysis_server/analysis_options.yaml
+++ b/pkg/analysis_server/analysis_options.yaml
@@ -1,10 +1,8 @@
include: package:pedantic/analysis_options.1.9.0.yaml
analyzer:
- # This currently finds ~1,200 implicit-casts issues when enabled.
- # TODO(srawlins): Switch to strict-casts
- # strong-mode:
- # implicit-casts: false
+ language:
+ strict-casts: true
exclude:
- test/mock_packages/**
errors:
diff --git a/pkg/analysis_server/benchmark/perf/flutter_completion_benchmark.dart b/pkg/analysis_server/benchmark/perf/flutter_completion_benchmark.dart
index 78497cb..7863130 100644
--- a/pkg/analysis_server/benchmark/perf/flutter_completion_benchmark.dart
+++ b/pkg/analysis_server/benchmark/perf/flutter_completion_benchmark.dart
@@ -33,7 +33,7 @@
);
@override
- int get maxIterations => 2;
+ int get maxIterations => 1;
@override
Future<BenchMarkResult> run({
@@ -243,12 +243,12 @@
// Perform warm-up.
// The cold start does not matter.
// The sustained performance is much more important.
- const kWarmUpCount = 20;
+ const kWarmUpCount = 5;
for (var i = 0; i < kWarmUpCount; i++) {
await perform();
}
- const kRepeatCount = 10;
+ const kRepeatCount = 5;
final timer = Stopwatch()..start();
for (var i = 0; i < kRepeatCount; i++) {
await perform();
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
index 03ef62f..5c222c3 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart
@@ -846,7 +846,7 @@
try {
final attributes = obj['attributes'];
if (attributes != null &&
- !((attributes is List &&
+ !((attributes is List<Object?> &&
(attributes.every((item) =>
FlutterOutlineAttribute.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FlutterOutlineAttribute>');
@@ -905,7 +905,7 @@
try {
final children = obj['children'];
if (children != null &&
- !((children is List &&
+ !((children is List<Object?> &&
(children.every(
(item) => FlutterOutline.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FlutterOutline>');
@@ -1168,7 +1168,7 @@
try {
final children = obj['children'];
if (children != null &&
- !((children is List &&
+ !((children is List<Object?> &&
(children
.every((item) => Outline.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Outline>');
@@ -1376,7 +1376,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((labels is List &&
+ if (!((labels is List<Object?> &&
(labels.every((item) => ClosingLabel.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<ClosingLabel>');
return false;
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
index e792375..e8de391 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
@@ -452,7 +452,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((fromRanges is List &&
+ if (!((fromRanges is List<Object?> &&
(fromRanges.every((item) => Range.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Range>');
return false;
@@ -741,7 +741,7 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List &&
+ !((tags is List<Object?> &&
(tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
@@ -963,7 +963,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((fromRanges is List &&
+ if (!((fromRanges is List<Object?> &&
(fromRanges.every((item) => Range.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Range>');
return false;
@@ -1298,7 +1298,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -2585,7 +2585,7 @@
try {
final diagnostics = obj['diagnostics'];
if (diagnostics != null &&
- !((diagnostics is List &&
+ !((diagnostics is List<Object?> &&
(diagnostics
.every((item) => Diagnostic.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Diagnostic>');
@@ -2926,7 +2926,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List &&
+ if (!((valueSet is List<Object?> &&
(valueSet
.every((item) => CodeActionKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CodeActionKind>');
@@ -3071,7 +3071,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((properties is List &&
+ if (!((properties is List<Object?> &&
(properties.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -3160,7 +3160,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((diagnostics is List &&
+ if (!((diagnostics is List<Object?> &&
(diagnostics
.every((item) => Diagnostic.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Diagnostic>');
@@ -3173,7 +3173,7 @@
try {
final only = obj['only'];
if (only != null &&
- !((only is List &&
+ !((only is List<Object?> &&
(only.every(
(item) => CodeActionKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CodeActionKind>');
@@ -3280,7 +3280,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is String;
}
@@ -3402,7 +3402,7 @@
try {
final codeActionKinds = obj['codeActionKinds'];
if (codeActionKinds != null &&
- !((codeActionKinds is List &&
+ !((codeActionKinds is List<Object?> &&
(codeActionKinds.every(
(item) => CodeActionKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CodeActionKind>');
@@ -3712,7 +3712,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -3725,7 +3725,7 @@
try {
final codeActionKinds = obj['codeActionKinds'];
if (codeActionKinds != null &&
- !((codeActionKinds is List &&
+ !((codeActionKinds is List<Object?> &&
(codeActionKinds.every(
(item) => CodeActionKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CodeActionKind>');
@@ -4262,7 +4262,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -4698,7 +4698,7 @@
try {
final additionalTextEdits = obj['additionalTextEdits'];
if (additionalTextEdits != null &&
- !((additionalTextEdits is List &&
+ !((additionalTextEdits is List<Object?> &&
(additionalTextEdits
.every((item) => TextEdit.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<TextEdit>');
@@ -4990,7 +4990,8 @@
try {
final arguments = obj['arguments'];
if (arguments != null &&
- !((arguments is List && (arguments.every((item) => true))))) {
+ !((arguments is List<Object?> &&
+ (arguments.every((item) => true))))) {
reporter.reportError('must be of type List<Object?>');
return false;
}
@@ -5323,7 +5324,7 @@
try {
final documentationFormat = obj['documentationFormat'];
if (documentationFormat != null &&
- !((documentationFormat is List &&
+ !((documentationFormat is List<Object?> &&
(documentationFormat
.every((item) => MarkupKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<MarkupKind>');
@@ -5482,7 +5483,7 @@
try {
final valueSet = obj['valueSet'];
if (valueSet != null &&
- !((valueSet is List &&
+ !((valueSet is List<Object?> &&
(valueSet.every(
(item) => CompletionItemKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CompletionItemKind>');
@@ -5554,7 +5555,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List &&
+ if (!((valueSet is List<Object?> &&
(valueSet
.every((item) => InsertTextMode.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<InsertTextMode>');
@@ -5627,7 +5628,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((properties is List &&
+ if (!((properties is List<Object?> &&
(properties.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -5698,7 +5699,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List &&
+ if (!((valueSet is List<Object?> &&
(valueSet.every(
(item) => CompletionItemTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CompletionItemTag>');
@@ -6124,7 +6125,7 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List &&
+ !((tags is List<Object?> &&
(tags.every(
(item) => CompletionItemTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CompletionItemTag>');
@@ -6245,7 +6246,7 @@
try {
final additionalTextEdits = obj['additionalTextEdits'];
if (additionalTextEdits != null &&
- !((additionalTextEdits is List &&
+ !((additionalTextEdits is List<Object?> &&
(additionalTextEdits
.every((item) => TextEdit.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<TextEdit>');
@@ -6258,7 +6259,7 @@
try {
final commitCharacters = obj['commitCharacters'];
if (commitCharacters != null &&
- !((commitCharacters is List &&
+ !((commitCharacters is List<Object?> &&
(commitCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -6353,7 +6354,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -6403,7 +6404,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -6483,7 +6484,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((items is List &&
+ if (!((items is List<Object?> &&
(items
.every((item) => CompletionItem.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<CompletionItem>');
@@ -6600,7 +6601,7 @@
try {
final triggerCharacters = obj['triggerCharacters'];
if (triggerCharacters != null &&
- !((triggerCharacters is List &&
+ !((triggerCharacters is List<Object?> &&
(triggerCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -6612,7 +6613,7 @@
try {
final allCommitCharacters = obj['allCommitCharacters'];
if (allCommitCharacters != null &&
- !((allCommitCharacters is List &&
+ !((allCommitCharacters is List<Object?> &&
(allCommitCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -6946,7 +6947,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -6959,7 +6960,7 @@
try {
final triggerCharacters = obj['triggerCharacters'];
if (triggerCharacters != null &&
- !((triggerCharacters is List &&
+ !((triggerCharacters is List<Object?> &&
(triggerCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -6971,7 +6972,7 @@
try {
final allCommitCharacters = obj['allCommitCharacters'];
if (allCommitCharacters != null &&
- !((allCommitCharacters is List &&
+ !((allCommitCharacters is List<Object?> &&
(allCommitCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -7042,7 +7043,7 @@
final num _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
switch (obj) {
case 1:
case 2:
@@ -7183,7 +7184,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((items is List &&
+ if (!((items is List<Object?> &&
(items.every(
(item) => ConfigurationItem.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<ConfigurationItem>');
@@ -7473,7 +7474,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((files is List &&
+ if (!((files is List<Object?> &&
(files.every((item) => FileCreate.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileCreate>');
return false;
@@ -7869,7 +7870,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -8252,7 +8253,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -8554,7 +8555,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((files is List &&
+ if (!((files is List<Object?> &&
(files.every((item) => FileDelete.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileDelete>');
return false;
@@ -8788,7 +8789,7 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List &&
+ !((tags is List<Object?> &&
(tags.every(
(item) => DiagnosticTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DiagnosticTag>');
@@ -8801,7 +8802,7 @@
try {
final relatedInformation = obj['relatedInformation'];
if (relatedInformation != null &&
- !((relatedInformation is List &&
+ !((relatedInformation is List<Object?> &&
(relatedInformation.every((item) =>
DiagnosticRelatedInformation.canParse(item, reporter)))))) {
reporter.reportError(
@@ -8954,7 +8955,7 @@
final num _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is num;
}
@@ -8989,7 +8990,7 @@
final num _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is num;
}
@@ -9211,7 +9212,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((contentChanges is List &&
+ if (!((contentChanges is List<Object?> &&
(contentChanges.every((item) =>
(TextDocumentContentChangeEvent1.canParse(item, reporter) ||
TextDocumentContentChangeEvent2.canParse(
@@ -9356,7 +9357,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((changes is List &&
+ if (!((changes is List<Object?> &&
(changes.every((item) => FileEvent.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileEvent>');
return false;
@@ -9427,7 +9428,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((watchers is List &&
+ if (!((watchers is List<Object?> &&
(watchers.every(
(item) => FileSystemWatcher.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileSystemWatcher>');
@@ -10040,7 +10041,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -10493,7 +10494,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -10693,7 +10694,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -10982,7 +10983,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -11492,7 +11493,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -11672,7 +11673,7 @@
try {
final moreTriggerCharacter = obj['moreTriggerCharacter'];
if (moreTriggerCharacter != null &&
- !((moreTriggerCharacter is List &&
+ !((moreTriggerCharacter is List<Object?> &&
(moreTriggerCharacter.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -11919,7 +11920,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -11950,7 +11951,7 @@
try {
final moreTriggerCharacter = obj['moreTriggerCharacter'];
if (moreTriggerCharacter != null &&
- !((moreTriggerCharacter is List &&
+ !((moreTriggerCharacter is List<Object?> &&
(moreTriggerCharacter.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -12310,7 +12311,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -12512,7 +12513,7 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List &&
+ !((tags is List<Object?> &&
(tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
@@ -12570,7 +12571,7 @@
try {
final children = obj['children'];
if (children != null &&
- !((children is List &&
+ !((children is List<Object?> &&
(children.every(
(item) => DocumentSymbol.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentSymbol>');
@@ -12818,7 +12819,7 @@
try {
final valueSet = obj['valueSet'];
if (valueSet != null &&
- !((valueSet is List &&
+ !((valueSet is List<Object?> &&
(valueSet
.every((item) => SymbolKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolKind>');
@@ -12890,7 +12891,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List &&
+ if (!((valueSet is List<Object?> &&
(valueSet.every((item) => SymbolTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
@@ -13189,7 +13190,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -13252,7 +13253,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -13402,7 +13403,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((commands is List &&
+ if (!((commands is List<Object?> &&
(commands.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -13515,7 +13516,8 @@
try {
final arguments = obj['arguments'];
if (arguments != null &&
- !((arguments is List && (arguments.every((item) => true))))) {
+ !((arguments is List<Object?> &&
+ (arguments.every((item) => true))))) {
reporter.reportError('must be of type List<Object?>');
return false;
}
@@ -13606,7 +13608,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((commands is List &&
+ if (!((commands is List<Object?> &&
(commands.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -13656,7 +13658,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
switch (obj) {
case 'abort':
case 'transactional':
@@ -13704,7 +13706,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -14160,7 +14162,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is String;
}
@@ -14281,7 +14283,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((filters is List &&
+ if (!((filters is List<Object?> &&
(filters.every(
(item) => FileOperationFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileOperationFilter>');
@@ -14781,7 +14783,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is String;
}
@@ -15048,7 +15050,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -15408,7 +15410,7 @@
try {
final contentFormat = obj['contentFormat'];
if (contentFormat != null &&
- !((contentFormat is List &&
+ !((contentFormat is List<Object?> &&
(contentFormat
.every((item) => MarkupKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<MarkupKind>');
@@ -15663,7 +15665,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -16066,7 +16068,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -16356,7 +16358,7 @@
try {
final workspaceFolders = obj['workspaceFolders'];
if (workspaceFolders != null &&
- !((workspaceFolders is List &&
+ !((workspaceFolders is List<Object?> &&
(workspaceFolders.every(
(item) => WorkspaceFolder.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<WorkspaceFolder>');
@@ -16831,7 +16833,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
switch (obj) {
case 1:
case 2:
@@ -16870,7 +16872,7 @@
final num _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is num;
}
@@ -17203,7 +17205,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -17308,7 +17310,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((ranges is List &&
+ if (!((ranges is List<Object?> &&
(ranges.every((item) => Range.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Range>');
return false;
@@ -17955,7 +17957,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
switch (obj) {
case 'plaintext':
case 'markdown':
@@ -18118,7 +18120,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -18152,7 +18154,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is String;
}
@@ -18624,7 +18626,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is String;
}
@@ -18904,7 +18906,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -19567,7 +19569,7 @@
final num _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is num;
}
@@ -19859,7 +19861,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List &&
+ if (!((valueSet is List<Object?> &&
(valueSet
.every((item) => DiagnosticTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DiagnosticTag>');
@@ -19975,7 +19977,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((diagnostics is List &&
+ if (!((diagnostics is List<Object?> &&
(diagnostics
.every((item) => Diagnostic.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Diagnostic>');
@@ -20584,7 +20586,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -20765,7 +20767,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((registrations is List &&
+ if (!((registrations is List<Object?> &&
(registrations
.every((item) => Registration.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Registration>');
@@ -21317,7 +21319,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((files is List &&
+ if (!((files is List<Object?> &&
(files.every((item) => FileRename.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<FileRename>');
return false;
@@ -21630,7 +21632,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -21822,7 +21824,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
switch (obj) {
case 'create':
case 'rename':
@@ -22440,7 +22442,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((positions is List &&
+ if (!((positions is List<Object?> &&
(positions.every((item) => Position.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Position>');
return false;
@@ -22567,7 +22569,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -22620,7 +22622,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is String;
}
@@ -22653,7 +22655,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is String;
}
@@ -22749,7 +22751,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((data is List && (data.every((item) => item is int))))) {
+ if (!((data is List<Object?> && (data.every((item) => item is int))))) {
reporter.reportError('must be of type List<int>');
return false;
}
@@ -22917,7 +22919,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((tokenTypes is List &&
+ if (!((tokenTypes is List<Object?> &&
(tokenTypes.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -22936,7 +22938,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((tokenModifiers is List &&
+ if (!((tokenModifiers is List<Object?> &&
(tokenModifiers.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -22955,7 +22957,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((formats is List &&
+ if (!((formats is List<Object?> &&
(formats.every((item) => TokenFormat.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<TokenFormat>');
return false;
@@ -23284,7 +23286,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((edits is List &&
+ if (!((edits is List<Object?> &&
(edits.every(
(item) => SemanticTokensEdit.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SemanticTokensEdit>');
@@ -23509,7 +23511,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((edits is List &&
+ if (!((edits is List<Object?> &&
(edits.every(
(item) => SemanticTokensEdit.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SemanticTokensEdit>');
@@ -23622,7 +23624,7 @@
try {
final data = obj['data'];
if (data != null &&
- !((data is List && (data.every((item) => item is int))))) {
+ !((data is List<Object?> && (data.every((item) => item is int))))) {
reporter.reportError('must be of type List<int>');
return false;
}
@@ -23700,7 +23702,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((tokenTypes is List &&
+ if (!((tokenTypes is List<Object?> &&
(tokenTypes.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -23719,7 +23721,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((tokenModifiers is List &&
+ if (!((tokenModifiers is List<Object?> &&
(tokenModifiers.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -24162,7 +24164,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((data is List && (data.every((item) => item is int))))) {
+ if (!((data is List<Object?> && (data.every((item) => item is int))))) {
reporter.reportError('must be of type List<int>');
return false;
}
@@ -24452,7 +24454,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -26627,7 +26629,7 @@
try {
final actions = obj['actions'];
if (actions != null &&
- !((actions is List &&
+ !((actions is List<Object?> &&
(actions.every(
(item) => MessageActionItem.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<MessageActionItem>');
@@ -26735,7 +26737,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((signatures is List &&
+ if (!((signatures is List<Object?> &&
(signatures.every(
(item) => SignatureInformation.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SignatureInformation>');
@@ -27036,7 +27038,7 @@
try {
final documentationFormat = obj['documentationFormat'];
if (documentationFormat != null &&
- !((documentationFormat is List &&
+ !((documentationFormat is List<Object?> &&
(documentationFormat
.every((item) => MarkupKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<MarkupKind>');
@@ -27312,7 +27314,7 @@
try {
final triggerCharacters = obj['triggerCharacters'];
if (triggerCharacters != null &&
- !((triggerCharacters is List &&
+ !((triggerCharacters is List<Object?> &&
(triggerCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -27324,7 +27326,7 @@
try {
final retriggerCharacters = obj['retriggerCharacters'];
if (retriggerCharacters != null &&
- !((retriggerCharacters is List &&
+ !((retriggerCharacters is List<Object?> &&
(retriggerCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -27598,7 +27600,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -27611,7 +27613,7 @@
try {
final triggerCharacters = obj['triggerCharacters'];
if (triggerCharacters != null &&
- !((triggerCharacters is List &&
+ !((triggerCharacters is List<Object?> &&
(triggerCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -27623,7 +27625,7 @@
try {
final retriggerCharacters = obj['retriggerCharacters'];
if (retriggerCharacters != null &&
- !((retriggerCharacters is List &&
+ !((retriggerCharacters is List<Object?> &&
(retriggerCharacters.every((item) => item is String))))) {
reporter.reportError('must be of type List<String>');
return false;
@@ -27683,7 +27685,7 @@
final num _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is num;
}
@@ -27815,7 +27817,7 @@
try {
final parameters = obj['parameters'];
if (parameters != null &&
- !((parameters is List &&
+ !((parameters is List<Object?> &&
(parameters.every((item) =>
ParameterInformation.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<ParameterInformation>');
@@ -28077,7 +28079,7 @@
try {
final tags = obj['tags'];
if (tags != null &&
- !((tags is List &&
+ !((tags is List<Object?> &&
(tags.every((item) => SymbolTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
@@ -28159,7 +28161,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -28209,7 +28211,7 @@
final num _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is num;
}
@@ -28292,7 +28294,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -29338,7 +29340,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((edits is List &&
+ if (!((edits is List<Object?> &&
(edits.every((item) => (SnippetTextEdit.canParse(item, reporter) ||
AnnotatedTextEdit.canParse(item, reporter) ||
TextEdit.canParse(item, reporter))))))) {
@@ -29850,7 +29852,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -29891,7 +29893,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -29973,7 +29975,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -30146,7 +30148,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -30433,7 +30435,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is String;
}
@@ -30807,7 +30809,7 @@
}
final documentSelector = obj['documentSelector'];
if (documentSelector != null &&
- !((documentSelector is List &&
+ !((documentSelector is List<Object?> &&
(documentSelector.every(
(item) => DocumentFilter.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<DocumentFilter>');
@@ -30871,7 +30873,7 @@
final String _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is String;
}
@@ -31027,7 +31029,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((unregisterations is List &&
+ if (!((unregisterations is List<Object?> &&
(unregisterations
.every((item) => Unregistration.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<Unregistration>');
@@ -31159,7 +31161,7 @@
final int _value;
- static bool canParse(Object obj, LspJsonReporter reporter) {
+ static bool canParse(Object? obj, LspJsonReporter reporter) {
return obj is int;
}
@@ -32116,15 +32118,14 @@
final documentChangesJson = json['documentChanges'];
final documentChanges = documentChangesJson == null
? null
- : ((documentChangesJson is List &&
+ : ((documentChangesJson is List<Object?> &&
(documentChangesJson.every((item) =>
TextDocumentEdit.canParse(item, nullLspJsonReporter))))
- ? Either2<List<TextDocumentEdit>, List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>>.t1(
- (documentChangesJson)
- .map((item) =>
- TextDocumentEdit.fromJson(item as Map<String, Object?>))
- .toList())
- : ((documentChangesJson is List &&
+ ? Either2<List<TextDocumentEdit>, List<Either4<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>>.t1((documentChangesJson)
+ .map((item) =>
+ TextDocumentEdit.fromJson(item as Map<String, Object?>))
+ .toList())
+ : ((documentChangesJson is List<Object?> &&
(documentChangesJson.every((item) =>
(TextDocumentEdit.canParse(item, nullLspJsonReporter) ||
CreateFile.canParse(item, nullLspJsonReporter) ||
@@ -32194,7 +32195,7 @@
!((changes is Map &&
(changes.keys.every((item) =>
item is String &&
- changes.values.every((item) => (item is List &&
+ changes.values.every((item) => (item is List<Object?> &&
(item.every((item) =>
TextEdit.canParse(item, reporter)))))))))) {
reporter.reportError('must be of type Map<String, List<TextEdit>>');
@@ -32207,10 +32208,10 @@
try {
final documentChanges = obj['documentChanges'];
if (documentChanges != null &&
- !(((documentChanges is List &&
+ !(((documentChanges is List<Object?> &&
(documentChanges.every((item) =>
TextDocumentEdit.canParse(item, reporter)))) ||
- (documentChanges is List &&
+ (documentChanges is List<Object?> &&
(documentChanges.every((item) =>
(TextDocumentEdit.canParse(item, reporter) ||
CreateFile.canParse(item, reporter) ||
@@ -32368,7 +32369,7 @@
try {
final resourceOperations = obj['resourceOperations'];
if (resourceOperations != null &&
- !((resourceOperations is List &&
+ !((resourceOperations is List<Object?> &&
(resourceOperations.every((item) =>
ResourceOperationKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<ResourceOperationKind>');
@@ -32642,7 +32643,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((added is List &&
+ if (!((added is List<Object?> &&
(added
.every((item) => WorkspaceFolder.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<WorkspaceFolder>');
@@ -32662,7 +32663,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((removed is List &&
+ if (!((removed is List<Object?> &&
(removed
.every((item) => WorkspaceFolder.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<WorkspaceFolder>');
@@ -32945,7 +32946,7 @@
try {
final valueSet = obj['valueSet'];
if (valueSet != null &&
- !((valueSet is List &&
+ !((valueSet is List<Object?> &&
(valueSet
.every((item) => SymbolKind.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolKind>');
@@ -33017,7 +33018,7 @@
reporter.reportError('must not be null');
return false;
}
- if (!((valueSet is List &&
+ if (!((valueSet is List<Object?> &&
(valueSet.every((item) => SymbolTag.canParse(item, reporter)))))) {
reporter.reportError('must be of type List<SymbolTag>');
return false;
diff --git a/pkg/analysis_server/lib/src/plugin/result_merger.dart b/pkg/analysis_server/lib/src/plugin/result_merger.dart
index 6e1257a..e8e51f3 100644
--- a/pkg/analysis_server/lib/src/plugin/result_merger.dart
+++ b/pkg/analysis_server/lib/src/plugin/result_merger.dart
@@ -239,9 +239,9 @@
/// Return the index of the region in the collection of [mergedRegions] that
/// covers exactly the same region as the [newRegion], or `-1` if there is
/// no such region.
- int matchingRegion(newRegion) {
- int newOffset = newRegion.offset;
- int newLength = newRegion.length;
+ int matchingRegion(NavigationRegion newRegion) {
+ var newOffset = newRegion.offset;
+ var newLength = newRegion.length;
for (var i = 0; i < mergedRegions.length; i++) {
var mergedRegion = mergedRegions[i];
if (newOffset == mergedRegion.offset &&
diff --git a/pkg/analysis_server/lib/src/server/sdk_configuration.dart b/pkg/analysis_server/lib/src/server/sdk_configuration.dart
index 39eb0d1..23d6a76 100644
--- a/pkg/analysis_server/lib/src/server/sdk_configuration.dart
+++ b/pkg/analysis_server/lib/src/server/sdk_configuration.dart
@@ -40,19 +40,21 @@
}
/// Whether analytics is forced on.
- bool? get analyticsForceEnabled => _values['server.analytics.forceEnabled'];
+ bool? get analyticsForceEnabled =>
+ _values['server.analytics.forceEnabled'] as bool?;
/// Return an override value for the analysis server's google analytics ID, or
/// `null` if the default value should be used.
- String? get analyticsId => _values['server.analytics.id'];
+ String? get analyticsId => _values['server.analytics.id'] as String?;
/// Whether crash reporting is forced on.
bool? get crashReportingForceEnabled =>
- _values['server.crash.reporting.forceEnabled'];
+ _values['server.crash.reporting.forceEnabled'] as bool?;
/// Return an override value for the analysis server's crash reporting product
/// ID, or `null` if the default value should be used.
- String? get crashReportingId => _values['server.crash.reporting.id'];
+ String? get crashReportingId =>
+ _values['server.crash.reporting.id'] as String?;
/// Return a string describing the contents of this SDK configuration.
String get displayString {
@@ -67,9 +69,10 @@
void _readFromFile(File file) {
try {
- Map m = jsonDecode(file.readAsStringSync());
- for (var key in m.keys) {
- _values[key] = m[key];
+ var content =
+ jsonDecode(file.readAsStringSync()) as Map<Object?, Object?>;
+ for (var key in content.keys) {
+ _values[key as String] = content[key];
}
} catch (_) {
// ignore issues reading the file
diff --git a/pkg/analysis_server/lib/src/services/pub/pub_api.dart b/pkg/analysis_server/lib/src/services/pub/pub_api.dart
index d89d165..b2f9fe1 100644
--- a/pkg/analysis_server/lib/src/services/pub/pub_api.dart
+++ b/pkg/analysis_server/lib/src/services/pub/pub_api.dart
@@ -59,7 +59,7 @@
final packageNames = json['packages'];
return packageNames is List
- ? packageNames.map((name) => PubApiPackage(name)).toList()
+ ? packageNames.map((name) => PubApiPackage(name as String)).toList()
: null;
}
@@ -103,7 +103,7 @@
await httpClient.get(Uri.parse(url), headers: _headers);
if (response.statusCode == 200) {
instrumentationService.logInfo('Pub API request successful for $url');
- return jsonDecode(response.body);
+ return jsonDecode(response.body) as Map<String, Object?>?;
} else if (response.statusCode >= 400 && response.statusCode < 500) {
// Do not retry 4xx responses.
instrumentationService.logError(
diff --git a/pkg/analysis_server/lib/src/services/pub/pub_command.dart b/pkg/analysis_server/lib/src/services/pub/pub_command.dart
index f6188e0..2351441 100644
--- a/pkg/analysis_server/lib/src/services/pub/pub_command.dart
+++ b/pkg/analysis_server/lib/src/services/pub/pub_command.dart
@@ -136,7 +136,7 @@
try {
final results = jsonDecode(stdout);
_instrumentationService.logInfo('pub command completed successfully');
- return results;
+ return results as Map<String, Object?>?;
} catch (e) {
_instrumentationService
.logError('pub command returned invalid JSON: $e.');
diff --git a/pkg/analysis_server/lib/src/status/pages.dart b/pkg/analysis_server/lib/src/status/pages.dart
index e626e02..e0a24ca 100644
--- a/pkg/analysis_server/lib/src/status/pages.dart
+++ b/pkg/analysis_server/lib/src/status/pages.dart
@@ -15,7 +15,7 @@
String printMilliseconds(num value) => '${numberFormat.format(value)} ms';
-String printPercentage(num value, [fractionDigits = 1]) =>
+String printPercentage(num value, [int fractionDigits = 1]) =>
'${(value * 100).toStringAsFixed(fractionDigits)}%';
/// An entity that knows how to serve itself over http.
diff --git a/pkg/analysis_server/lib/src/utilities/extensions/yaml.dart b/pkg/analysis_server/lib/src/utilities/extensions/yaml.dart
index 474b711..b3c0c2e 100644
--- a/pkg/analysis_server/lib/src/utilities/extensions/yaml.dart
+++ b/pkg/analysis_server/lib/src/utilities/extensions/yaml.dart
@@ -29,8 +29,9 @@
var nextEntryOffset = i + 1 < entries.length
? (entries[i + 1].key as YamlNode).span.start.offset
: null;
- if ((entry.key as YamlNode).containsOffset(offset)) {
- return entry.key;
+ var key = entry.key as YamlNode;
+ if (key.containsOffset(offset)) {
+ return key;
}
var value = entry.value;
if (value.containsOffset(offset) ||
diff --git a/pkg/analysis_server/lib/src/utilities/profiling.dart b/pkg/analysis_server/lib/src/utilities/profiling.dart
index b5e41fb..f1fcddb 100644
--- a/pkg/analysis_server/lib/src/utilities/profiling.dart
+++ b/pkg/analysis_server/lib/src/utilities/profiling.dart
@@ -56,7 +56,7 @@
return Future.value(null);
}
- return Future.value(_parse(result.stdout));
+ return Future.value(_parse(result.stdout as String));
});
} catch (e) {
return Future.error(e);
diff --git a/pkg/analysis_server/lib/src/utilities/yaml_node_locator.dart b/pkg/analysis_server/lib/src/utilities/yaml_node_locator.dart
index c8c49ef..c04e29e 100644
--- a/pkg/analysis_server/lib/src/utilities/yaml_node_locator.dart
+++ b/pkg/analysis_server/lib/src/utilities/yaml_node_locator.dart
@@ -49,7 +49,7 @@
} else if (node is YamlMap) {
var nodeMap = node.nodes;
for (var entry in nodeMap.entries) {
- _searchWithin(path, entry.key);
+ _searchWithin(path, entry.key as YamlNode);
if (path.isNotEmpty) {
path.add(node);
return;
diff --git a/pkg/analysis_server/test/benchmarks_test.dart b/pkg/analysis_server/test/benchmarks_test.dart
index 87a822e..30e5da63 100644
--- a/pkg/analysis_server/test/benchmarks_test.dart
+++ b/pkg/analysis_server/test/benchmarks_test.dart
@@ -61,7 +61,7 @@
[path.join('benchmark', 'benchmarks.dart'), 'list', '--machine'],
workingDirectory: _serverSourcePath,
);
- Map m = json.decode(result.stdout);
- List benchmarks = m['benchmarks'];
+ var output = json.decode(result.stdout as String) as Map<Object?, Object?>;
+ var benchmarks = (output['benchmarks'] as List).cast<Map<Object?, Object?>>();
return benchmarks.map((b) => b['id']).cast<String>().toList();
}
diff --git a/pkg/analysis_server/test/client/impl/expect_mixin.dart b/pkg/analysis_server/test/client/impl/expect_mixin.dart
index 7f75f64..67cdc1c 100644
--- a/pkg/analysis_server/test/client/impl/expect_mixin.dart
+++ b/pkg/analysis_server/test/client/impl/expect_mixin.dart
@@ -30,7 +30,7 @@
} else if (x is _Predicate<Null>) {
// x is a unary predicate, but expects a specific type
// so wrap it.
- return predicate((a) => (x as dynamic)(a));
+ return predicate((a) => (x as dynamic)(a) as bool);
} else {
return equals(x);
}
diff --git a/pkg/analysis_server/test/stress/replay/operation.dart b/pkg/analysis_server/test/stress/replay/operation.dart
index a83d8b8..b8d58b8 100644
--- a/pkg/analysis_server/test/stress/replay/operation.dart
+++ b/pkg/analysis_server/test/stress/replay/operation.dart
@@ -11,7 +11,7 @@
final String filePath;
/// The overlay used to update the content.
- final dynamic overlay;
+ final Object overlay;
/// Initialize an operation to send an 'analysis.updateContent' request with
/// the given [filePath] and [overlay] as parameters.
diff --git a/pkg/analysis_server/test/stress/utilities/server.dart b/pkg/analysis_server/test/stress/utilities/server.dart
index 888056a..b2eefa3 100644
--- a/pkg/analysis_server/test/stress/utilities/server.dart
+++ b/pkg/analysis_server/test/stress/utilities/server.dart
@@ -766,7 +766,7 @@
return;
}
logger?.log(fromServer, '$trimmedLine');
- var message = asMap(json.decoder.convert(trimmedLine));
+ var message = asMap(json.decoder.convert(trimmedLine) as Object);
if (message.containsKey('id')) {
// The message is a response.
var response = Response.fromJson(message)!;
diff --git a/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart b/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart
index 265ac05..639b3eb 100644
--- a/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart
+++ b/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart
@@ -185,7 +185,7 @@
}
/// Returns matcher that can compare double values.
-Matcher doubleEquals(expected) => _DoubleEquals(expected);
+Matcher doubleEquals(double expected) => _DoubleEquals(expected);
class _DoubleEquals extends Matcher {
final double _value;
diff --git a/pkg/analysis_server/test/tool/lsp_spec/json_test.dart b/pkg/analysis_server/test/tool/lsp_spec/json_test.dart
index 824217e..04a78a6 100644
--- a/pkg/analysis_server/test/tool/lsp_spec/json_test.dart
+++ b/pkg/analysis_server/test/tool/lsp_spec/json_test.dart
@@ -334,7 +334,8 @@
group('fromJson', () {
test('parses JSON for types with unions (left side)', () {
final input = '{"id":1,"method":"shutdown","jsonrpc":"test"}';
- final message = RequestMessage.fromJson(jsonDecode(input));
+ final message =
+ RequestMessage.fromJson(jsonDecode(input) as Map<String, Object?>);
expect(message.id, equals(Either2<num, String>.t1(1)));
expect(message.id.valueEquals(1), isTrue);
expect(message.jsonrpc, 'test');
@@ -343,7 +344,8 @@
test('parses JSON for types with unions (right side)', () {
final input = '{"id":"one","method":"shutdown","jsonrpc":"test"}';
- final message = RequestMessage.fromJson(jsonDecode(input));
+ final message =
+ RequestMessage.fromJson(jsonDecode(input) as Map<String, Object?>);
expect(message.id, equals(Either2<num, String>.t2('one')));
expect(message.id.valueEquals('one'), isTrue);
expect(message.jsonrpc, 'test');
@@ -352,13 +354,15 @@
test('parses JSON with nulls for unions that allow null', () {
final input = '{"id":null,"jsonrpc":"test"}';
- final message = ResponseMessage.fromJson(jsonDecode(input));
+ final message =
+ ResponseMessage.fromJson(jsonDecode(input) as Map<String, Object?>);
expect(message.id, isNull);
});
test('parses JSON with nulls for unions that allow null', () {
final input = '{"method":"test","jsonrpc":"test"}';
- final message = NotificationMessage.fromJson(jsonDecode(input));
+ final message = NotificationMessage.fromJson(
+ jsonDecode(input) as Map<String, Object?>);
expect(message.params, isNull);
});
@@ -370,7 +374,8 @@
version: 111, uri: 'file:///foo/bar.dart'),
position: Position(line: 1, character: 1),
).toJson());
- final params = TextDocumentPositionParams.fromJson(jsonDecode(input));
+ final params = TextDocumentPositionParams.fromJson(
+ jsonDecode(input) as Map<String, Object?>);
expect(params.textDocument,
const TypeMatcher<VersionedTextDocumentIdentifier>());
});
@@ -378,7 +383,8 @@
test('parses JSON with unknown fields', () {
final input =
'{"id":1,"invalidField":true,"method":"foo","jsonrpc":"test"}';
- final message = RequestMessage.fromJson(jsonDecode(input));
+ final message =
+ RequestMessage.fromJson(jsonDecode(input) as Map<String, Object?>);
expect(message.id.valueEquals(1), isTrue);
expect(message.method, equals(Method('foo')));
expect(message.params, isNull);
@@ -401,7 +407,8 @@
workspaceFolders: workspaceFolders,
);
final json = jsonEncode(obj);
- final restoredObj = InitializeParams.fromJson(jsonDecode(json));
+ final restoredObj =
+ InitializeParams.fromJson(jsonDecode(json) as Map<String, Object?>);
final restoredWorkspaceFolders = restoredObj.workspaceFolders!;
expect(restoredWorkspaceFolders, hasLength(workspaceFolders.length));
@@ -420,7 +427,8 @@
endCharacter: 4,
kind: FoldingRangeKind.Comment);
final json = jsonEncode(obj);
- final restoredObj = FoldingRange.fromJson(jsonDecode(json));
+ final restoredObj =
+ FoldingRange.fromJson(jsonDecode(json) as Map<String, Object?>);
expect(restoredObj.startLine, equals(obj.startLine));
expect(restoredObj.startCharacter, equals(obj.startCharacter));
@@ -438,7 +446,8 @@
'fileB': [TextEdit(range: range, newText: 'text B')]
});
final json = jsonEncode(obj);
- final restoredObj = WorkspaceEdit.fromJson(jsonDecode(json));
+ final restoredObj =
+ WorkspaceEdit.fromJson(jsonDecode(json) as Map<String, Object?>);
expect(restoredObj.documentChanges, equals(obj.documentChanges));
expect(restoredObj.changes, equals(obj.changes));
diff --git a/pkg/analysis_server/tool/code_completion/corpus.dart b/pkg/analysis_server/tool/code_completion/corpus.dart
index 2bde6fe..d7f02f2 100644
--- a/pkg/analysis_server/tool/code_completion/corpus.dart
+++ b/pkg/analysis_server/tool/code_completion/corpus.dart
@@ -18,7 +18,7 @@
exit(1);
}
- final repos = [];
+ final repos = <String>[];
if (args.length == 1 && !Directory(args[0]).existsSync()) {
final contents = File(args[0]).readAsStringSync();
repos.addAll(LineSplitter().convert(contents));
@@ -86,7 +86,7 @@
result = await Process.run(
'git', ['clone', '--recurse-submodules', '$repo.git', cloneDir]);
}
- return CloneResult(result.exitCode, cloneDir, msg: result.stderr);
+ return CloneResult(result.exitCode, cloneDir, msg: result.stderr as String);
}
Future<String> _getBody(String url) async => (await _getResponse(url)).body;
@@ -105,11 +105,11 @@
if (_hasPubspec(dir)) {
final packageFile = path.join(dir.path, _package_config);
if (!File(packageFile).existsSync() || forcePubUpdate) {
- print(
- 'Getting pub dependencies for "${path.relative(dir.path, from: _appDir)}"...');
+ final relativeDirPath = path.relative(dir.path, from: _appDir);
+ print('Getting pub dependencies for "$relativeDirPath"...');
final pubRun = await _runPub(dir.path);
if (pubRun.exitCode != 0) {
- print('Error: ' + pubRun.stderr);
+ print('Error: ${pubRun.stderr}');
}
}
}
diff --git a/pkg/analysis_server/tool/instrumentation/log/log.dart b/pkg/analysis_server/tool/instrumentation/log/log.dart
index 503f991..4ede5ea 100644
--- a/pkg/analysis_server/tool/instrumentation/log/log.dart
+++ b/pkg/analysis_server/tool/instrumentation/log/log.dart
@@ -307,7 +307,7 @@
if (entry.isServerStatus) {
var analysisStatus = entry.param('analysis');
if (analysisStatus is Map) {
- if (analysisStatus['isAnalyzing']) {
+ if (analysisStatus['isAnalyzing'] as bool) {
if (analysisStartEntry != null) {
analysisStartEntry.recordProblem(
'Analysis started without being terminated.');
@@ -331,7 +331,7 @@
}
var pubStatus = entry.param('pub');
if (pubStatus is Map) {
- if (pubStatus['isListingPackageDirs']) {
+ if (pubStatus['isListingPackageDirs'] as bool) {
if (pubStartEntry != null) {
pubStartEntry.recordProblem(
'Pub started without previous being terminated.');
@@ -441,9 +441,9 @@
object.forEach((key, value) {
var newIndent = indent + singleIndent;
buffer.write(newIndent);
- _format(buffer, newIndent, key);
+ _format(buffer, newIndent, key as Object);
buffer.write(' : ');
- _format(buffer, newIndent, value);
+ _format(buffer, newIndent, value as Object);
buffer.write('<br>');
});
buffer.write(indent);
@@ -453,7 +453,7 @@
object.forEach((element) {
var newIndent = indent + singleIndent;
buffer.write(newIndent);
- _format(buffer, newIndent, element);
+ _format(buffer, newIndent, element as Object);
buffer.write('<br>');
});
buffer.write(indent);
@@ -578,7 +578,7 @@
} else if (entryKind == InstrumentationLogAdapter.TAG_LOG_ENTRY) {
// Fall through
} else if (entryKind == InstrumentationLogAdapter.TAG_NOTIFICATION) {
- Map requestData = json.decode(components[2]);
+ var requestData = json.decode(components[2]) as Map<Object?, Object?>;
return NotificationEntry(index, timeStamp, requestData);
} else if (entryKind == InstrumentationLogAdapter.TAG_PLUGIN_ERROR) {
return PluginErrorEntry(index, timeStamp, entryKind,
@@ -588,25 +588,25 @@
components.sublist(2, 5), components.sublist(5));
} else if (entryKind ==
InstrumentationLogAdapter.TAG_PLUGIN_NOTIFICATION) {
- Map requestData = json.decode(components[2]);
+ var requestData = json.decode(components[2]) as Map<Object?, Object?>;
return PluginNotificationEntry(
index, timeStamp, requestData, components.sublist(3));
} else if (entryKind == InstrumentationLogAdapter.TAG_PLUGIN_REQUEST) {
- Map requestData = json.decode(components[2]);
+ var requestData = json.decode(components[2]) as Map<Object?, Object?>;
return PluginRequestEntry(
index, timeStamp, requestData, components.sublist(3));
} else if (entryKind == InstrumentationLogAdapter.TAG_PLUGIN_RESPONSE) {
- Map responseData = json.decode(components[2]);
+ var responseData = json.decode(components[2]) as Map<Object?, Object?>;
return PluginResponseEntry(
index, timeStamp, responseData, components.sublist(3));
} else if (entryKind == InstrumentationLogAdapter.TAG_PLUGIN_TIMEOUT) {
return PluginErrorEntry(index, timeStamp, entryKind,
components.sublist(2, 3), components.sublist(3));
} else if (entryKind == InstrumentationLogAdapter.TAG_REQUEST) {
- Map requestData = json.decode(components[2]);
+ var requestData = json.decode(components[2]) as Map<Object?, Object?>;
return RequestEntry(index, timeStamp, requestData);
} else if (entryKind == InstrumentationLogAdapter.TAG_RESPONSE) {
- Map responseData = json.decode(components[2]);
+ var responseData = json.decode(components[2]) as Map<Object?, Object?>;
return ResponseEntry(index, timeStamp, responseData);
} else if (entryKind == InstrumentationLogAdapter.TAG_VERSION) {
// Fall through
@@ -675,7 +675,7 @@
: super(index, timeStamp, notificationData);
/// Return the event field of the request.
- String get event => data['event'];
+ String get event => data['event'] as String;
/// Return `true` if this is a server error notification.
bool get isServerError => event == 'server.error';
@@ -747,7 +747,7 @@
: super(index, timeStamp, notificationData, pluginData);
/// Return the event field of the notification.
- String get event => data['event'];
+ String get event => data['event'] as String;
@override
String get kind => 'PluginNoti';
@@ -773,13 +773,13 @@
: super(index, timeStamp, requestData, pluginData);
/// Return the id field of the request.
- String get id => data['id'];
+ String get id => data['id'] as String;
@override
String get kind => 'PluginReq';
/// Return the method field of the request.
- String get method => data['method'];
+ String get method => data['method'] as String;
/// Return the value of the parameter with the given [parameterName], or
/// `null` if there is no such parameter.
@@ -802,7 +802,7 @@
: super(index, timeStamp, responseData, pluginData);
/// Return the id field of the response.
- String get id => data['id'];
+ String get id => data['id'] as String;
@override
String get kind => 'PluginRes';
@@ -827,16 +827,16 @@
: super(index, timeStamp, requestData);
/// Return the clientRequestTime field of the request.
- int get clientRequestTime => data['clientRequestTime'];
+ int get clientRequestTime => data['clientRequestTime'] as int;
/// Return the id field of the request.
- String get id => data['id'];
+ String get id => data['id'] as String;
@override
String get kind => 'Req';
/// Return the method field of the request.
- String get method => data['method'];
+ String get method => data['method'] as String;
/// Return the value of the parameter with the given [parameterName], or
/// `null` if there is no such parameter.
@@ -858,7 +858,7 @@
: super(index, timeStamp, responseData);
/// Return the id field of the response.
- String get id => data['id'];
+ String get id => data['id'] as String;
@override
String get kind => 'Res';
diff --git a/pkg/analysis_server/tool/instrumentation/log_viewer.dart b/pkg/analysis_server/tool/instrumentation/log_viewer.dart
index f3e5379d..6273c47 100644
--- a/pkg/analysis_server/tool/instrumentation/log_viewer.dart
+++ b/pkg/analysis_server/tool/instrumentation/log_viewer.dart
@@ -70,14 +70,14 @@
void start(List<String> args) {
var parser = createParser();
var options = parser.parse(args);
- if (options[helpFlag]) {
+ if (options[helpFlag] as bool) {
printUsage(parser);
return;
}
var port = defaultPortNumber;
try {
- port = int.parse(options[portOption]);
+ port = int.parse(options[portOption] as String);
} catch (exception) {
printUsage(parser, error: 'Invalid port number');
return;
diff --git a/pkg/analysis_server/tool/instrumentation/page/log_page.dart b/pkg/analysis_server/tool/instrumentation/page/log_page.dart
index 9288cf5..addd9dc 100644
--- a/pkg/analysis_server/tool/instrumentation/page/log_page.dart
+++ b/pkg/analysis_server/tool/instrumentation/page/log_page.dart
@@ -142,7 +142,7 @@
if (entry.isServerStatus) {
var analysisStatus = entry.param('analysis');
if (analysisStatus is Map) {
- if (analysisStatus['isAnalyzing']) {
+ if (analysisStatus['isAnalyzing'] as bool) {
description = '$description <span class="gray">(analyzing)</span>';
} else {
var duration = _getDuration(pairedEntry, entry);
@@ -152,7 +152,7 @@
}
var pubStatus = entry.param('pub');
if (pubStatus is Map) {
- if (pubStatus['isListingPackageDirs']) {
+ if (pubStatus['isListingPackageDirs'] as bool) {
description = '$description <span class="gray">(pub)</span>';
} else {
var duration = _getDuration(pairedEntry, entry);
diff --git a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
index 7b95c29..5383d50 100644
--- a/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
+++ b/pkg/analysis_server/tool/lsp_spec/codegen_dart.dart
@@ -60,7 +60,7 @@
.forEach((namespace) => _namespaces[namespace.name] = namespace);
}
-TypeBase resolveTypeAlias(TypeBase type, {resolveEnumClasses = false}) {
+TypeBase resolveTypeAlias(TypeBase type, {bool resolveEnumClasses = false}) {
if (type is Type) {
// The LSP spec contains type aliases for `integer` and `uinteger` that map
// into the `number` type, with comments stating they must be integers. To
@@ -380,7 +380,7 @@
..writeIndentedln('final ${typeOfValues.dartTypeWithTypeArgs} _value;')
..writeln()
..writeIndentedln(
- 'static bool canParse(Object obj, LspJsonReporter reporter) {')
+ 'static bool canParse(Object? obj, LspJsonReporter reporter) {')
..indent();
if (allowsAnyValue) {
buffer.writeIndentedln('return ');
@@ -866,7 +866,7 @@
} else if (_isSpecType(type)) {
buffer.write('$dartType.canParse($valueCode, $reporter)');
} else if (type is ArrayType) {
- buffer.write('($valueCode is List');
+ buffer.write('($valueCode is List<Object?>');
if (fullDartType != 'Object?') {
// TODO(dantup): If we're happy to assume we never have two lists in a union
// we could skip this bit.
diff --git a/pkg/analysis_server/tool/lsp_spec/generate_all.dart b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
index 24a06ed..f1783c2 100644
--- a/pkg/analysis_server/tool/lsp_spec/generate_all.dart
+++ b/pkg/analysis_server/tool/lsp_spec/generate_all.dart
@@ -16,7 +16,8 @@
Future<void> main(List<String> arguments) async {
final args = argParser.parse(arguments);
- if (args[argHelp]) {
+ var help = args[argHelp] as bool;
+ if (help) {
print(argParser.usage);
return;
}
@@ -189,15 +190,14 @@
Field field(
String name, {
required String type,
- array = false,
- canBeNull = false,
- canBeUndefined = false,
+ bool array = false,
+ bool canBeUndefined = false,
}) {
var fieldType =
array ? ArrayType(Type.identifier(type)) : Type.identifier(type);
return Field(
- null, Token.identifier(name), fieldType, canBeNull, canBeUndefined);
+ null, Token.identifier(name), fieldType, false, canBeUndefined);
}
final customTypes = <AstNode>[
@@ -302,7 +302,8 @@
}
Future<List<AstNode>> getSpecClasses(ArgResults args) async {
- if (args[argDownload]) {
+ var download = args[argDownload] as bool;
+ if (download) {
await downloadSpec();
}
final spec = await readSpec();
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 0a5c264..6a41913 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -2790,10 +2790,7 @@
bool get hasStaticMember => true;
@override
- List<InterfaceType> get interfaces {
- var enumType = library.typeProvider.enumType;
- return enumType != null ? <InterfaceType>[enumType] : const [];
- }
+ List<InterfaceType> get interfaces => const [];
@override
bool get isAbstract => false;
@@ -2834,7 +2831,10 @@
}
@override
- InterfaceType get supertype => library.typeProvider.objectType;
+ InterfaceType get supertype {
+ var enumType = library.typeProvider.enumType;
+ return enumType ?? library.typeProvider.objectType;
+ }
@override
List<TypeParameterElement> get typeParameters =>
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 115365f..276bad0 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -3188,6 +3188,10 @@
/// See [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT].
bool _checkForMixinInheritsNotFromObject(
NamedType mixinName, ClassElement mixinElement) {
+ if (mixinElement.isEnum) {
+ return false;
+ }
+
var mixinSupertype = mixinElement.supertype;
if (mixinSupertype == null || mixinSupertype.isDartCoreObject) {
var mixins = mixinElement.mixins;
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 6463ec1..6d989da 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -7681,8 +7681,7 @@
enum E @5
codeOffset: 0
codeLength: 26
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -12846,8 +12845,7 @@
synthetic @-1
enums
enum E @30
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -15065,8 +15063,7 @@
definingUnit
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -15119,8 +15116,7 @@
definingUnit
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -16087,8 +16083,7 @@
definingUnit
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -16111,8 +16106,7 @@
synthetic toString @-1
returnType: String
enum E @19
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -16369,8 +16363,7 @@
enums
enum E @65
documentationComment: /**\n * Docs\n */
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -16406,8 +16399,7 @@
definingUnit
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -16454,8 +16446,7 @@
definingUnit
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -16515,8 +16506,7 @@
definingUnit
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -16548,8 +16538,7 @@
definingUnit
enums
enum E1 @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -16568,8 +16557,7 @@
synthetic toString @-1
returnType: String
enum E2 @20
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -16655,8 +16643,7 @@
superKeyword: super @0
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -23412,8 +23399,7 @@
definingUnit
enums
enum E @19
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -23483,8 +23469,7 @@
returnType: dynamic
enums
enum E @64
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -23558,8 +23543,7 @@
staticElement: self::@getter::a
staticType: null
token: a @15
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -25055,8 +25039,7 @@
staticElement: self::@getter::foo
staticType: null
token: foo @17
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -26247,8 +26230,7 @@
synthetic @-1
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -27547,8 +27529,7 @@
definingUnit
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -29509,8 +29490,7 @@
synthetic @-1
enums
enum E @16
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -29617,8 +29597,7 @@
synthetic @-1
enums
enum E @27
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -29659,8 +29638,7 @@
synthetic @-1
enums
enum E @42
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -29738,8 +29716,7 @@
synthetic @-1
enums
enum E @27
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -29815,8 +29792,7 @@
synthetic @-1
enums
enum E @27
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
@@ -29960,8 +29936,7 @@
definingUnit
enums
enum E @5
- interfaces
- Enum
+ supertype: Enum
fields
synthetic final index @-1
type: int
diff --git a/pkg/compiler/lib/src/kernel/transformations/late_lowering.dart b/pkg/compiler/lib/src/kernel/transformations/late_lowering.dart
index 18b56dc..bdec099 100644
--- a/pkg/compiler/lib/src/kernel/transformations/late_lowering.dart
+++ b/pkg/compiler/lib/src/kernel/transformations/late_lowering.dart
@@ -280,13 +280,17 @@
Name name = field.name;
Uri fileUri = field.fileUri;
DartType type = field.type;
+ // We need to unbind the canonical name since we reuse the reference but
+ // change the name.
+ field.fieldReference.canonicalName?.unbind();
Field fieldCell = Field.immutable(_mangleFieldCellName(field),
type: InterfaceType(_coreTypes.cellClass, nonNullable),
initializer: _callCellConstructor(
_nameLiteral(name.text, fileOffset), fileOffset),
isFinal: true,
isStatic: true,
- fileUri: fileUri)
+ fileUri: fileUri,
+ fieldReference: field.fieldReference)
..fileOffset = fileOffset
..isNonNullableByDefault = true;
StaticGet fieldCellAccess() =>
@@ -364,6 +368,8 @@
Expression? initializer = field.initializer;
Class enclosingClass = field.enclosingClass!;
+ // We need to unbind the canonical name since we reuse the reference but
+ // change the name.
field.fieldReference.canonicalName?.unbind();
Field backingField = Field.mutable(mangledName,
type: type,
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart
new file mode 100644
index 0000000..eba0279
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2021, 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 'main_lib.dart';
+
+main() {
+ MyInt.a = 42;
+ print(MyInt.a);
+ MyInt.b = 87;
+ print(MyInt.b);
+}
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.strong.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.strong.expect
new file mode 100644
index 0000000..22796ec
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.strong.expect
@@ -0,0 +1,38 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart:8:9: Error: Setter not found: 'a'.
+// MyInt.a = 42;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+import "main_lib.dart" as mai;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic {
+ invalid-expression "pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart:8:9: Error: Setter not found: 'a'.
+ MyInt.a = 42;
+ ^";
+ core::print(mai::_#MyInt|a);
+ mai::MyInt|b = 87;
+ core::print(mai::MyInt|b);
+}
+
+library /*isNonNullableByDefault*/;
+import self as mai;
+import "dart:core" as core;
+import "dart:_late_helper" as _la;
+
+extension MyInt on core::int {
+ static field a = mai::_#MyInt|a;
+ static field b = mai::MyInt|b;
+}
+static final field _la::_Cell _#MyInt|a = new _la::_Cell::named("MyInt|a");
+late static field core::int MyInt|b = 42;
+static get MyInt|a() → core::int
+ return mai::_#MyInt|a.{_la::_Cell::readField}<core::int>(){() → core::int};
+static set MyInt|a(core::int value) → void
+ return mai::_#MyInt|a.{_la::_Cell::value} = value;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.strong.transformed.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.strong.transformed.expect
new file mode 100644
index 0000000..22796ec
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.strong.transformed.expect
@@ -0,0 +1,38 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart:8:9: Error: Setter not found: 'a'.
+// MyInt.a = 42;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+import "main_lib.dart" as mai;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic {
+ invalid-expression "pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart:8:9: Error: Setter not found: 'a'.
+ MyInt.a = 42;
+ ^";
+ core::print(mai::_#MyInt|a);
+ mai::MyInt|b = 87;
+ core::print(mai::MyInt|b);
+}
+
+library /*isNonNullableByDefault*/;
+import self as mai;
+import "dart:core" as core;
+import "dart:_late_helper" as _la;
+
+extension MyInt on core::int {
+ static field a = mai::_#MyInt|a;
+ static field b = mai::MyInt|b;
+}
+static final field _la::_Cell _#MyInt|a = new _la::_Cell::named("MyInt|a");
+late static field core::int MyInt|b = 42;
+static get MyInt|a() → core::int
+ return mai::_#MyInt|a.{_la::_Cell::readField}<core::int>(){() → core::int};
+static set MyInt|a(core::int value) → void
+ return mai::_#MyInt|a.{_la::_Cell::value} = value;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.textual_outline.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.textual_outline.expect
new file mode 100644
index 0000000..82be6bb
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.textual_outline.expect
@@ -0,0 +1,3 @@
+import 'main_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..82be6bb
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.textual_outline_modelled.expect
@@ -0,0 +1,3 @@
+import 'main_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.weak.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.weak.expect
new file mode 100644
index 0000000..22796ec
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.weak.expect
@@ -0,0 +1,38 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart:8:9: Error: Setter not found: 'a'.
+// MyInt.a = 42;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+import "main_lib.dart" as mai;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic {
+ invalid-expression "pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart:8:9: Error: Setter not found: 'a'.
+ MyInt.a = 42;
+ ^";
+ core::print(mai::_#MyInt|a);
+ mai::MyInt|b = 87;
+ core::print(mai::MyInt|b);
+}
+
+library /*isNonNullableByDefault*/;
+import self as mai;
+import "dart:core" as core;
+import "dart:_late_helper" as _la;
+
+extension MyInt on core::int {
+ static field a = mai::_#MyInt|a;
+ static field b = mai::MyInt|b;
+}
+static final field _la::_Cell _#MyInt|a = new _la::_Cell::named("MyInt|a");
+late static field core::int MyInt|b = 42;
+static get MyInt|a() → core::int
+ return mai::_#MyInt|a.{_la::_Cell::readField}<core::int>(){() → core::int};
+static set MyInt|a(core::int value) → void
+ return mai::_#MyInt|a.{_la::_Cell::value} = value;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.weak.outline.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.weak.outline.expect
new file mode 100644
index 0000000..0d8e400
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.weak.outline.expect
@@ -0,0 +1,27 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic
+ ;
+
+library /*isNonNullableByDefault*/;
+import self as self2;
+import "dart:core" as core;
+import "dart:_late_helper" as _la;
+
+extension MyInt on core::int {
+ static field a = self2::_#MyInt|a;
+ static field b = self2::_#MyInt|b;
+}
+static final field _la::_Cell _#MyInt|a = new _la::_Cell::named("MyInt|a");
+static final field _la::_Cell _#MyInt|b = new _la::_Cell::named("MyInt|b");
+static get MyInt|a() → core::int
+ return self2::_#MyInt|a.{_la::_Cell::readField}<core::int>(){() → core::int};
+static set MyInt|a(core::int value) → void
+ return self2::_#MyInt|a.{_la::_Cell::value} = value;
+static get MyInt|b() → core::int
+ return self2::_#MyInt|b.{_la::_Cell::readField}<core::int>(){() → core::int};
+static set MyInt|b(core::int value) → void
+ return self2::_#MyInt|b.{_la::_Cell::value} = value;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.weak.transformed.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.weak.transformed.expect
new file mode 100644
index 0000000..22796ec
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart.weak.transformed.expect
@@ -0,0 +1,38 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart:8:9: Error: Setter not found: 'a'.
+// MyInt.a = 42;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+import "main_lib.dart" as mai;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic {
+ invalid-expression "pkg/front_end/testcases/dart2js/flutter_issue94561/main.dart:8:9: Error: Setter not found: 'a'.
+ MyInt.a = 42;
+ ^";
+ core::print(mai::_#MyInt|a);
+ mai::MyInt|b = 87;
+ core::print(mai::MyInt|b);
+}
+
+library /*isNonNullableByDefault*/;
+import self as mai;
+import "dart:core" as core;
+import "dart:_late_helper" as _la;
+
+extension MyInt on core::int {
+ static field a = mai::_#MyInt|a;
+ static field b = mai::MyInt|b;
+}
+static final field _la::_Cell _#MyInt|a = new _la::_Cell::named("MyInt|a");
+late static field core::int MyInt|b = 42;
+static get MyInt|a() → core::int
+ return mai::_#MyInt|a.{_la::_Cell::readField}<core::int>(){() → core::int};
+static set MyInt|a(core::int value) → void
+ return mai::_#MyInt|a.{_la::_Cell::value} = value;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart
new file mode 100644
index 0000000..eba0279
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2021, 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 'main_lib.dart';
+
+main() {
+ MyInt.a = 42;
+ print(MyInt.a);
+ MyInt.b = 87;
+ print(MyInt.b);
+}
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.strong.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.strong.expect
new file mode 100644
index 0000000..212c4ea
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.strong.expect
@@ -0,0 +1,24 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "main_lib.dart" as mai;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic {
+ mai::MyInt|a = 42;
+ core::print(mai::MyInt|a);
+ mai::MyInt|b = 87;
+ core::print(mai::MyInt|b);
+}
+
+library /*isNonNullableByDefault*/;
+import self as mai;
+import "dart:core" as core;
+
+extension MyInt on core::int {
+ static field a = mai::MyInt|a;
+ static field b = mai::MyInt|b;
+}
+late static field core::int MyInt|a;
+late static field core::int MyInt|b = 42;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.strong.transformed.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.strong.transformed.expect
new file mode 100644
index 0000000..c8646b7
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.strong.transformed.expect
@@ -0,0 +1,29 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "main_lib.dart" as mai;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic {
+ mai::MyInt|a = 42;
+ core::print(mai::MyInt|a);
+ mai::MyInt|b = 87;
+ core::print(mai::MyInt|b);
+}
+
+library /*isNonNullableByDefault*/;
+import self as mai;
+import "dart:core" as core;
+import "dart:_late_helper" as _la;
+
+extension MyInt on core::int {
+ static field a = mai::_#MyInt|a;
+ static field b = mai::MyInt|b;
+}
+static final field _la::_Cell _#MyInt|a = new _la::_Cell::named("MyInt|a");
+late static field core::int MyInt|b = 42;
+static get MyInt|a() → core::int
+ return mai::_#MyInt|a.{_la::_Cell::readField}<core::int>(){() → core::int};
+static set MyInt|a(core::int value) → void
+ return mai::_#MyInt|a.{_la::_Cell::value} = value;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.textual_outline.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.textual_outline.expect
new file mode 100644
index 0000000..82be6bb
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.textual_outline.expect
@@ -0,0 +1,3 @@
+import 'main_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..82be6bb
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.textual_outline_modelled.expect
@@ -0,0 +1,3 @@
+import 'main_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.weak.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.weak.expect
new file mode 100644
index 0000000..212c4ea
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.weak.expect
@@ -0,0 +1,24 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "main_lib.dart" as mai;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic {
+ mai::MyInt|a = 42;
+ core::print(mai::MyInt|a);
+ mai::MyInt|b = 87;
+ core::print(mai::MyInt|b);
+}
+
+library /*isNonNullableByDefault*/;
+import self as mai;
+import "dart:core" as core;
+
+extension MyInt on core::int {
+ static field a = mai::MyInt|a;
+ static field b = mai::MyInt|b;
+}
+late static field core::int MyInt|a;
+late static field core::int MyInt|b = 42;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.weak.outline.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.weak.outline.expect
new file mode 100644
index 0000000..5451823
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.weak.outline.expect
@@ -0,0 +1,18 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic
+ ;
+
+library /*isNonNullableByDefault*/;
+import self as self2;
+import "dart:core" as core;
+
+extension MyInt on core::int {
+ static field a = self2::MyInt|a;
+ static field b = self2::MyInt|b;
+}
+late static field core::int MyInt|a;
+late static field core::int MyInt|b;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.weak.transformed.expect b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.weak.transformed.expect
new file mode 100644
index 0000000..c8646b7
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main.no_link.dart.weak.transformed.expect
@@ -0,0 +1,29 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "main_lib.dart" as mai;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///main_lib.dart";
+
+static method main() → dynamic {
+ mai::MyInt|a = 42;
+ core::print(mai::MyInt|a);
+ mai::MyInt|b = 87;
+ core::print(mai::MyInt|b);
+}
+
+library /*isNonNullableByDefault*/;
+import self as mai;
+import "dart:core" as core;
+import "dart:_late_helper" as _la;
+
+extension MyInt on core::int {
+ static field a = mai::_#MyInt|a;
+ static field b = mai::MyInt|b;
+}
+static final field _la::_Cell _#MyInt|a = new _la::_Cell::named("MyInt|a");
+late static field core::int MyInt|b = 42;
+static get MyInt|a() → core::int
+ return mai::_#MyInt|a.{_la::_Cell::readField}<core::int>(){() → core::int};
+static set MyInt|a(core::int value) → void
+ return mai::_#MyInt|a.{_la::_Cell::value} = value;
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/main_lib.dart b/pkg/front_end/testcases/dart2js/flutter_issue94561/main_lib.dart
new file mode 100644
index 0000000..7fcb8f2
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/main_lib.dart
@@ -0,0 +1,8 @@
+// Copyright (c) 2021, 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 MyInt on int {
+ static late int a;
+ static late int b = 42;
+}
diff --git a/pkg/front_end/testcases/dart2js/flutter_issue94561/test.options b/pkg/front_end/testcases/dart2js/flutter_issue94561/test.options
new file mode 100644
index 0000000..61731a9
--- /dev/null
+++ b/pkg/front_end/testcases/dart2js/flutter_issue94561/test.options
@@ -0,0 +1 @@
+main_lib.dart
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index 4cf39b7..dc9ece8 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -2498,6 +2498,8 @@
writeName(descriptor.name);
writeByte(descriptor.kind.index);
writeByte(descriptor.flags);
+ assert(descriptor.member.canonicalName != null,
+ "No canonical name for ${descriptor}.");
writeNonNullCanonicalNameReference(descriptor.member.canonicalName!);
}
}
diff --git a/pkg/vm/test/transformations/protobuf_aware_treeshaker/treeshaker_test.dart b/pkg/vm/test/transformations/protobuf_aware_treeshaker/treeshaker_test.dart
index 741c2b9..4febdf9 100644
--- a/pkg/vm/test/transformations/protobuf_aware_treeshaker/treeshaker_test.dart
+++ b/pkg/vm/test/transformations/protobuf_aware_treeshaker/treeshaker_test.dart
@@ -92,17 +92,19 @@
);
}
-main() async {
- final testCases = Directory(path.join(
- pkgVmDir,
- 'testcases',
- 'transformations',
- 'type_flow',
- 'transformer',
- 'protobuf_handler',
- 'lib',
- )).listSync().where((f) => f.path.endsWith('_test.dart'));
- for (final entry in testCases) {
- test(entry.path, () => runTestCase(entry.uri));
- }
+main() {
+ group('protobuf-aware-treeshaker', () {
+ final testCases = Directory(path.join(
+ pkgVmDir,
+ 'testcases',
+ 'transformations',
+ 'type_flow',
+ 'transformer',
+ 'protobuf_handler',
+ 'lib',
+ )).listSync().where((f) => f.path.endsWith('_test.dart'));
+ for (final entry in testCases) {
+ test(entry.path, () => runTestCase(entry.uri));
+ }
+ }, timeout: Timeout.none);
}
diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
index dd25e81..8b3999a 100644
--- a/runtime/BUILD.gn
+++ b/runtime/BUILD.gn
@@ -132,6 +132,9 @@
defines += [ "DART_USE_TCMALLOC" ]
include_dirs += [ "../third_party/tcmalloc/gperftools/src" ]
}
+ if (dart_use_mallinfo2) {
+ defines += [ "DART_USE_MALLINFO2" ]
+ }
if (dart_use_compressed_pointers) {
defines += [ "DART_COMPRESSED_POINTERS" ]
diff --git a/runtime/runtime_args.gni b/runtime/runtime_args.gni
index ae564be..8219c51 100644
--- a/runtime/runtime_args.gni
+++ b/runtime/runtime_args.gni
@@ -46,6 +46,10 @@
# the VM enables this only for Linux builds.
dart_use_tcmalloc = false
+ # Whether to use mallinfo2 instead of mallinfo which is deprecated starting
+ # with libc 2.33
+ dart_use_mallinfo2 = false
+
# Whether to link Crashpad library for crash handling. Only supported on
# Windows for now.
dart_use_crashpad = false
diff --git a/runtime/vm/malloc_hooks_tcmalloc.cc b/runtime/vm/malloc_hooks_tcmalloc.cc
index 438e477..3dc3639 100644
--- a/runtime/vm/malloc_hooks_tcmalloc.cc
+++ b/runtime/vm/malloc_hooks_tcmalloc.cc
@@ -341,7 +341,11 @@
bool MallocHooks::GetStats(intptr_t* used,
intptr_t* capacity,
const char** implementation) {
+#if defined(DART_USE_MALLINFO2)
+ struct mallinfo2 info = mallinfo2();
+#else
struct mallinfo info = mallinfo();
+#endif // defined(DART_USE_MALLINFO2)
*used = info.uordblks;
*capacity = *used + info.fordblks;
*implementation = "tcmalloc";
diff --git a/runtime/vm/malloc_hooks_unsupported.cc b/runtime/vm/malloc_hooks_unsupported.cc
index 9650cff..5b666d1 100644
--- a/runtime/vm/malloc_hooks_unsupported.cc
+++ b/runtime/vm/malloc_hooks_unsupported.cc
@@ -70,7 +70,11 @@
}
#endif
#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
+#if defined(DART_USE_MALLINFO2)
+ struct mallinfo2 info = mallinfo2();
+#else
struct mallinfo info = mallinfo();
+#endif // defined(DART_USE_MALLINFO2)
*used = info.uordblks;
*capacity = *used + info.fordblks;
*implementation = "unknown";
diff --git a/tools/VERSION b/tools/VERSION
index 67da428..e066e6c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 16
PATCH 0
-PRERELEASE 86
+PRERELEASE 87
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/gn.py b/tools/gn.py
index dccae52..fe4718d 100755
--- a/tools/gn.py
+++ b/tools/gn.py
@@ -215,6 +215,9 @@
(gn_args['target_cpu'] != 'arm') and
sanitizer == 'none')
+ # Use mallinfo2 if specified on the command line
+ gn_args['dart_use_mallinfo2'] = args.use_mallinfo2
+
if gn_args['target_os'] == 'linux':
if gn_args['target_cpu'] == 'arm':
# Default to -mfloat-abi=hard and -mfpu=neon for arm on Linux as we're
@@ -490,6 +493,11 @@
'-s',
type=str,
help='Comma-separated list of arch=/path/to/sysroot mappings')
+ parser.add_argument('--use-mallinfo2',
+ help='Use mallinfo2 to collect malloc stats.',
+ default=False,
+ dest='use_mallinfo2',
+ action='store_true')
def AddCommonConfigurationArgs(parser):