Version 2.15.0-102.0.dev
Merge commit 'c1f63c05b829fcc1378bcc62f1c38227481b9908' into 'dev'
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
index e9701cd..763de40 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart
@@ -14165,10 +14165,10 @@
}
/// The pattern matches a file only.
- static const file = FileOperationPatternKind(r'file');
+ static const file = FileOperationPatternKind('file');
/// The pattern matches a folder only.
- static const folder = FileOperationPatternKind(r'folder');
+ static const folder = FileOperationPatternKind('folder');
Object toJson() => _value;
@@ -14786,13 +14786,13 @@
}
/// Folding range for a comment
- static const Comment = FoldingRangeKind(r'comment');
+ static const Comment = FoldingRangeKind('comment');
/// Folding range for a imports or includes
- static const Imports = FoldingRangeKind(r'imports');
+ static const Imports = FoldingRangeKind('imports');
/// Folding range for a region (e.g. `#region`)
- static const Region = FoldingRangeKind(r'region');
+ static const Region = FoldingRangeKind('region');
Object toJson() => _value;
@@ -17957,18 +17957,18 @@
static bool canParse(Object obj, LspJsonReporter reporter) {
switch (obj) {
- case r'plaintext':
- case r'markdown':
+ case 'plaintext':
+ case 'markdown':
return true;
}
return false;
}
/// Plain text is supported as a content format
- static const PlainText = MarkupKind._(r'plaintext');
+ static const PlainText = MarkupKind._('plaintext');
/// Markdown is supported as a content format
- static const Markdown = MarkupKind._(r'markdown');
+ static const Markdown = MarkupKind._('markdown');
Object toJson() => _value;
@@ -18163,16 +18163,16 @@
static const progress = Method(r'$/progress');
/// Constant for the 'initialize' method.
- static const initialize = Method(r'initialize');
+ static const initialize = Method('initialize');
/// Constant for the 'initialized' method.
- static const initialized = Method(r'initialized');
+ static const initialized = Method('initialized');
/// Constant for the 'shutdown' method.
- static const shutdown = Method(r'shutdown');
+ static const shutdown = Method('shutdown');
/// Constant for the 'exit' method.
- static const exit = Method(r'exit');
+ static const exit = Method('exit');
/// Constant for the '$/logTrace' method.
static const logTrace = Method(r'$/logTrace');
@@ -18181,231 +18181,231 @@
static const setTrace = Method(r'$/setTrace');
/// Constant for the 'window/showMessage' method.
- static const window_showMessage = Method(r'window/showMessage');
+ static const window_showMessage = Method('window/showMessage');
/// Constant for the 'window/showMessageRequest' method.
- static const window_showMessageRequest = Method(r'window/showMessageRequest');
+ static const window_showMessageRequest = Method('window/showMessageRequest');
/// Constant for the 'window/showDocument' method.
- static const window_showDocument = Method(r'window/showDocument');
+ static const window_showDocument = Method('window/showDocument');
/// Constant for the 'window/logMessage' method.
- static const window_logMessage = Method(r'window/logMessage');
+ static const window_logMessage = Method('window/logMessage');
/// Constant for the 'window/workDoneProgress/create' method.
static const window_workDoneProgress_create =
- Method(r'window/workDoneProgress/create');
+ Method('window/workDoneProgress/create');
/// Constant for the 'window/workDoneProgress/cancel' method.
static const window_workDoneProgress_cancel =
- Method(r'window/workDoneProgress/cancel');
+ Method('window/workDoneProgress/cancel');
/// Constant for the 'telemetry/event' method.
- static const telemetry_event = Method(r'telemetry/event');
+ static const telemetry_event = Method('telemetry/event');
/// Constant for the 'client/registerCapability' method.
- static const client_registerCapability = Method(r'client/registerCapability');
+ static const client_registerCapability = Method('client/registerCapability');
/// Constant for the 'client/unregisterCapability' method.
static const client_unregisterCapability =
- Method(r'client/unregisterCapability');
+ Method('client/unregisterCapability');
/// Constant for the 'workspace/workspaceFolders' method.
static const workspace_workspaceFolders =
- Method(r'workspace/workspaceFolders');
+ Method('workspace/workspaceFolders');
/// Constant for the 'workspace/didChangeWorkspaceFolders' method.
static const workspace_didChangeWorkspaceFolders =
- Method(r'workspace/didChangeWorkspaceFolders');
+ Method('workspace/didChangeWorkspaceFolders');
/// Constant for the 'workspace/didChangeConfiguration' method.
static const workspace_didChangeConfiguration =
- Method(r'workspace/didChangeConfiguration');
+ Method('workspace/didChangeConfiguration');
/// Constant for the 'workspace/configuration' method.
- static const workspace_configuration = Method(r'workspace/configuration');
+ static const workspace_configuration = Method('workspace/configuration');
/// Constant for the 'workspace/didChangeWatchedFiles' method.
static const workspace_didChangeWatchedFiles =
- Method(r'workspace/didChangeWatchedFiles');
+ Method('workspace/didChangeWatchedFiles');
/// Constant for the 'workspace/symbol' method.
- static const workspace_symbol = Method(r'workspace/symbol');
+ static const workspace_symbol = Method('workspace/symbol');
/// Constant for the 'workspace/executeCommand' method.
- static const workspace_executeCommand = Method(r'workspace/executeCommand');
+ static const workspace_executeCommand = Method('workspace/executeCommand');
/// Constant for the 'workspace/applyEdit' method.
- static const workspace_applyEdit = Method(r'workspace/applyEdit');
+ static const workspace_applyEdit = Method('workspace/applyEdit');
/// Constant for the 'workspace/willCreateFiles' method.
- static const workspace_willCreateFiles = Method(r'workspace/willCreateFiles');
+ static const workspace_willCreateFiles = Method('workspace/willCreateFiles');
/// Constant for the 'workspace/didCreateFiles' method.
- static const workspace_didCreateFiles = Method(r'workspace/didCreateFiles');
+ static const workspace_didCreateFiles = Method('workspace/didCreateFiles');
/// Constant for the 'workspace/willRenameFiles' method.
- static const workspace_willRenameFiles = Method(r'workspace/willRenameFiles');
+ static const workspace_willRenameFiles = Method('workspace/willRenameFiles');
/// Constant for the 'workspace/didRenameFiles' method.
- static const workspace_didRenameFiles = Method(r'workspace/didRenameFiles');
+ static const workspace_didRenameFiles = Method('workspace/didRenameFiles');
/// Constant for the 'workspace/willDeleteFiles' method.
- static const workspace_willDeleteFiles = Method(r'workspace/willDeleteFiles');
+ static const workspace_willDeleteFiles = Method('workspace/willDeleteFiles');
/// Constant for the 'workspace/didDeleteFiles' method.
- static const workspace_didDeleteFiles = Method(r'workspace/didDeleteFiles');
+ static const workspace_didDeleteFiles = Method('workspace/didDeleteFiles');
/// Constant for the 'textDocument/didOpen' method.
- static const textDocument_didOpen = Method(r'textDocument/didOpen');
+ static const textDocument_didOpen = Method('textDocument/didOpen');
/// Constant for the 'textDocument/didChange' method.
- static const textDocument_didChange = Method(r'textDocument/didChange');
+ static const textDocument_didChange = Method('textDocument/didChange');
/// Constant for the 'textDocument/willSave' method.
- static const textDocument_willSave = Method(r'textDocument/willSave');
+ static const textDocument_willSave = Method('textDocument/willSave');
/// Constant for the 'textDocument/willSaveWaitUntil' method.
static const textDocument_willSaveWaitUntil =
- Method(r'textDocument/willSaveWaitUntil');
+ Method('textDocument/willSaveWaitUntil');
/// Constant for the 'textDocument/didSave' method.
- static const textDocument_didSave = Method(r'textDocument/didSave');
+ static const textDocument_didSave = Method('textDocument/didSave');
/// Constant for the 'textDocument/didClose' method.
- static const textDocument_didClose = Method(r'textDocument/didClose');
+ static const textDocument_didClose = Method('textDocument/didClose');
/// Constant for the 'textDocument/publishDiagnostics' method.
static const textDocument_publishDiagnostics =
- Method(r'textDocument/publishDiagnostics');
+ Method('textDocument/publishDiagnostics');
/// Constant for the 'textDocument/completion' method.
- static const textDocument_completion = Method(r'textDocument/completion');
+ static const textDocument_completion = Method('textDocument/completion');
/// Constant for the 'completionItem/resolve' method.
- static const completionItem_resolve = Method(r'completionItem/resolve');
+ static const completionItem_resolve = Method('completionItem/resolve');
/// Constant for the 'textDocument/hover' method.
- static const textDocument_hover = Method(r'textDocument/hover');
+ static const textDocument_hover = Method('textDocument/hover');
/// Constant for the 'textDocument/signatureHelp' method.
static const textDocument_signatureHelp =
- Method(r'textDocument/signatureHelp');
+ Method('textDocument/signatureHelp');
/// Constant for the 'textDocument/declaration' method.
- static const textDocument_declaration = Method(r'textDocument/declaration');
+ static const textDocument_declaration = Method('textDocument/declaration');
/// Constant for the 'textDocument/definition' method.
- static const textDocument_definition = Method(r'textDocument/definition');
+ static const textDocument_definition = Method('textDocument/definition');
/// Constant for the 'textDocument/typeDefinition' method.
static const textDocument_typeDefinition =
- Method(r'textDocument/typeDefinition');
+ Method('textDocument/typeDefinition');
/// Constant for the 'textDocument/implementation' method.
static const textDocument_implementation =
- Method(r'textDocument/implementation');
+ Method('textDocument/implementation');
/// Constant for the 'textDocument/references' method.
- static const textDocument_references = Method(r'textDocument/references');
+ static const textDocument_references = Method('textDocument/references');
/// Constant for the 'textDocument/documentHighlight' method.
static const textDocument_documentHighlight =
- Method(r'textDocument/documentHighlight');
+ Method('textDocument/documentHighlight');
/// Constant for the 'textDocument/documentSymbol' method.
static const textDocument_documentSymbol =
- Method(r'textDocument/documentSymbol');
+ Method('textDocument/documentSymbol');
/// Constant for the 'textDocument/codeAction' method.
- static const textDocument_codeAction = Method(r'textDocument/codeAction');
+ static const textDocument_codeAction = Method('textDocument/codeAction');
/// Constant for the 'codeAction/resolve' method.
- static const codeAction_resolve = Method(r'codeAction/resolve');
+ static const codeAction_resolve = Method('codeAction/resolve');
/// Constant for the 'textDocument/codeLens' method.
- static const textDocument_codeLens = Method(r'textDocument/codeLens');
+ static const textDocument_codeLens = Method('textDocument/codeLens');
/// Constant for the 'codeLens/resolve' method.
- static const codeLens_resolve = Method(r'codeLens/resolve');
+ static const codeLens_resolve = Method('codeLens/resolve');
/// Constant for the 'workspace/codeLens/refresh' method.
static const workspace_codeLens_refresh =
- Method(r'workspace/codeLens/refresh');
+ Method('workspace/codeLens/refresh');
/// Constant for the 'textDocument/documentLink' method.
- static const textDocument_documentLink = Method(r'textDocument/documentLink');
+ static const textDocument_documentLink = Method('textDocument/documentLink');
/// Constant for the 'documentLink/resolve' method.
- static const documentLink_resolve = Method(r'documentLink/resolve');
+ static const documentLink_resolve = Method('documentLink/resolve');
/// Constant for the 'textDocument/documentColor' method.
static const textDocument_documentColor =
- Method(r'textDocument/documentColor');
+ Method('textDocument/documentColor');
/// Constant for the 'textDocument/colorPresentation' method.
static const textDocument_colorPresentation =
- Method(r'textDocument/colorPresentation');
+ Method('textDocument/colorPresentation');
/// Constant for the 'textDocument/formatting' method.
- static const textDocument_formatting = Method(r'textDocument/formatting');
+ static const textDocument_formatting = Method('textDocument/formatting');
/// Constant for the 'textDocument/rangeFormatting' method.
static const textDocument_rangeFormatting =
- Method(r'textDocument/rangeFormatting');
+ Method('textDocument/rangeFormatting');
/// Constant for the 'textDocument/onTypeFormatting' method.
static const textDocument_onTypeFormatting =
- Method(r'textDocument/onTypeFormatting');
+ Method('textDocument/onTypeFormatting');
/// Constant for the 'textDocument/rename' method.
- static const textDocument_rename = Method(r'textDocument/rename');
+ static const textDocument_rename = Method('textDocument/rename');
/// Constant for the 'textDocument/prepareRename' method.
static const textDocument_prepareRename =
- Method(r'textDocument/prepareRename');
+ Method('textDocument/prepareRename');
/// Constant for the 'textDocument/foldingRange' method.
- static const textDocument_foldingRange = Method(r'textDocument/foldingRange');
+ static const textDocument_foldingRange = Method('textDocument/foldingRange');
/// Constant for the 'textDocument/selectionRange' method.
static const textDocument_selectionRange =
- Method(r'textDocument/selectionRange');
+ Method('textDocument/selectionRange');
/// Constant for the 'textDocument/prepareCallHierarchy' method.
static const textDocument_prepareCallHierarchy =
- Method(r'textDocument/prepareCallHierarchy');
+ Method('textDocument/prepareCallHierarchy');
/// Constant for the 'callHierarchy/incomingCalls' method.
static const callHierarchy_incomingCalls =
- Method(r'callHierarchy/incomingCalls');
+ Method('callHierarchy/incomingCalls');
/// Constant for the 'callHierarchy/outgoingCalls' method.
static const callHierarchy_outgoingCalls =
- Method(r'callHierarchy/outgoingCalls');
+ Method('callHierarchy/outgoingCalls');
/// Constant for the 'textDocument/semanticTokens/full' method.
static const textDocument_semanticTokens_full =
- Method(r'textDocument/semanticTokens/full');
+ Method('textDocument/semanticTokens/full');
/// Constant for the 'textDocument/semanticTokens/full/delta' method.
static const textDocument_semanticTokens_full_delta =
- Method(r'textDocument/semanticTokens/full/delta');
+ Method('textDocument/semanticTokens/full/delta');
/// Constant for the 'textDocument/semanticTokens/range' method.
static const textDocument_semanticTokens_range =
- Method(r'textDocument/semanticTokens/range');
+ Method('textDocument/semanticTokens/range');
/// Constant for the 'workspace/semanticTokens/refresh' method.
static const workspace_semanticTokens_refresh =
- Method(r'workspace/semanticTokens/refresh');
+ Method('workspace/semanticTokens/refresh');
/// Constant for the 'textDocument/linkedEditingRange' method.
static const textDocument_linkedEditingRange =
- Method(r'textDocument/linkedEditingRange');
+ Method('textDocument/linkedEditingRange');
/// Constant for the 'textDocument/moniker' method.
- static const textDocument_moniker = Method(r'textDocument/moniker');
+ static const textDocument_moniker = Method('textDocument/moniker');
Object toJson() => _value;
@@ -18629,14 +18629,14 @@
}
/// The moniker represent a symbol that is imported into a project
- static const import = MonikerKind(r'import');
+ static const import = MonikerKind('import');
/// The moniker represents a symbol that is exported from a project
- static const export = MonikerKind(r'export');
+ static const export = MonikerKind('export');
/// The moniker represents a symbol that is local to a project (e.g. a local
/// variable of a function, a class not visible outside the project, ...)
- static const local = MonikerKind(r'local');
+ static const local = MonikerKind('local');
Object toJson() => _value;
@@ -22624,16 +22624,16 @@
return obj is String;
}
- static const declaration = SemanticTokenModifiers(r'declaration');
- static const definition = SemanticTokenModifiers(r'definition');
- static const readonly = SemanticTokenModifiers(r'readonly');
- static const static = SemanticTokenModifiers(r'static');
- static const deprecated = SemanticTokenModifiers(r'deprecated');
- static const abstract = SemanticTokenModifiers(r'abstract');
- static const async = SemanticTokenModifiers(r'async');
- static const modification = SemanticTokenModifiers(r'modification');
- static const documentation = SemanticTokenModifiers(r'documentation');
- static const defaultLibrary = SemanticTokenModifiers(r'defaultLibrary');
+ static const declaration = SemanticTokenModifiers('declaration');
+ static const definition = SemanticTokenModifiers('definition');
+ static const readonly = SemanticTokenModifiers('readonly');
+ static const static = SemanticTokenModifiers('static');
+ static const deprecated = SemanticTokenModifiers('deprecated');
+ static const abstract = SemanticTokenModifiers('abstract');
+ static const async = SemanticTokenModifiers('async');
+ static const modification = SemanticTokenModifiers('modification');
+ static const documentation = SemanticTokenModifiers('documentation');
+ static const defaultLibrary = SemanticTokenModifiers('defaultLibrary');
Object toJson() => _value;
@@ -22657,31 +22657,31 @@
return obj is String;
}
- static const namespace = SemanticTokenTypes(r'namespace');
+ static const namespace = SemanticTokenTypes('namespace');
/// Represents a generic type. Acts as a fallback for types which can't be
/// mapped to a specific type like class or enum.
- static const type = SemanticTokenTypes(r'type');
- static const class_ = SemanticTokenTypes(r'class');
- static const enum_ = SemanticTokenTypes(r'enum');
- static const interface = SemanticTokenTypes(r'interface');
- static const struct = SemanticTokenTypes(r'struct');
- static const typeParameter = SemanticTokenTypes(r'typeParameter');
- static const parameter = SemanticTokenTypes(r'parameter');
- static const variable = SemanticTokenTypes(r'variable');
- static const property = SemanticTokenTypes(r'property');
- static const enumMember = SemanticTokenTypes(r'enumMember');
- static const event = SemanticTokenTypes(r'event');
- static const function = SemanticTokenTypes(r'function');
- static const method = SemanticTokenTypes(r'method');
- static const macro = SemanticTokenTypes(r'macro');
- static const keyword = SemanticTokenTypes(r'keyword');
- static const modifier = SemanticTokenTypes(r'modifier');
- static const comment = SemanticTokenTypes(r'comment');
- static const string = SemanticTokenTypes(r'string');
- static const number = SemanticTokenTypes(r'number');
- static const regexp = SemanticTokenTypes(r'regexp');
- static const operator = SemanticTokenTypes(r'operator');
+ static const type = SemanticTokenTypes('type');
+ static const class_ = SemanticTokenTypes('class');
+ static const enum_ = SemanticTokenTypes('enum');
+ static const interface = SemanticTokenTypes('interface');
+ static const struct = SemanticTokenTypes('struct');
+ static const typeParameter = SemanticTokenTypes('typeParameter');
+ static const parameter = SemanticTokenTypes('parameter');
+ static const variable = SemanticTokenTypes('variable');
+ static const property = SemanticTokenTypes('property');
+ static const enumMember = SemanticTokenTypes('enumMember');
+ static const event = SemanticTokenTypes('event');
+ static const function = SemanticTokenTypes('function');
+ static const method = SemanticTokenTypes('method');
+ static const macro = SemanticTokenTypes('macro');
+ static const keyword = SemanticTokenTypes('keyword');
+ static const modifier = SemanticTokenTypes('modifier');
+ static const comment = SemanticTokenTypes('comment');
+ static const string = SemanticTokenTypes('string');
+ static const number = SemanticTokenTypes('number');
+ static const regexp = SemanticTokenTypes('regexp');
+ static const operator = SemanticTokenTypes('operator');
Object toJson() => _value;
@@ -30437,7 +30437,7 @@
return obj is String;
}
- static const Relative = TokenFormat(r'relative');
+ static const Relative = TokenFormat('relative');
Object toJson() => _value;
@@ -30876,19 +30876,19 @@
}
/// The moniker is only unique inside a document
- static const document = UniquenessLevel(r'document');
+ static const document = UniquenessLevel('document');
/// The moniker is unique inside a project for which a dump got created
- static const project = UniquenessLevel(r'project');
+ static const project = UniquenessLevel('project');
/// The moniker is unique inside the group to which a project belongs
- static const group = UniquenessLevel(r'group');
+ static const group = UniquenessLevel('group');
/// The moniker is unique inside the moniker scheme.
- static const scheme = UniquenessLevel(r'scheme');
+ static const scheme = UniquenessLevel('scheme');
/// The moniker is globally unique
- static const global = UniquenessLevel(r'global');
+ static const global = UniquenessLevel('global');
Object toJson() => _value;
diff --git a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
index f889c0f..28bf1c5 100644
--- a/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
+++ b/pkg/analysis_server/tool/lsp_spec/typescript_parser.dart
@@ -95,13 +95,12 @@
String get name => nameToken.lexeme;
String get valueAsLiteral {
- if (type.dartType == 'String') {
- // Write strings as raw strings, since some have dollars in them (eg. for
- // LSP method names). valueToken.lexeme already includes the quotes as
- // read from the spec.
- return 'r${valueToken.lexeme}';
+ var lexeme = valueToken.lexeme;
+ if (type.dartType == 'String' && lexeme.contains(r'$')) {
+ // lexeme already includes the quotes as read from the spec.
+ return 'r$lexeme';
} else {
- return valueToken.lexeme;
+ return lexeme;
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
index 36a49fe..8d7a644 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -478,17 +478,16 @@
"Try moving the library directive before any other directives.");
const ParserErrorCode _LITERAL_WITH_CLASS = ParserErrorCode(
- 'LITERAL_WITH_CLASS',
- r"The name of the class '#lexeme' can't be included in a #string literal.",
+ 'LITERAL_WITH_CLASS', r"A #string literal can't be prefixed by '#lexeme'.",
correction: "Try removing '#lexeme'");
const ParserErrorCode _LITERAL_WITH_CLASS_AND_NEW = ParserErrorCode(
'LITERAL_WITH_CLASS_AND_NEW',
- r"Neither 'new' nor the name of the class '#lexeme' can be included in a #string literal.",
+ r"A #string literal can't be prefixed by 'new #lexeme'.",
correction: "Try removing 'new' and '#lexeme'");
const ParserErrorCode _LITERAL_WITH_NEW = ParserErrorCode(
- 'LITERAL_WITH_NEW', r"A literal can't use 'new'.",
+ 'LITERAL_WITH_NEW', r"A literal can't be prefixed by 'new'.",
correction: "Try removing 'new'");
const ParserErrorCode _MEMBER_WITH_CLASS_NAME = ParserErrorCode(
diff --git a/pkg/analyzer/lib/src/generated/super_context.dart b/pkg/analyzer/lib/src/generated/super_context.dart
index 461d250..8902ebb 100644
--- a/pkg/analyzer/lib/src/generated/super_context.dart
+++ b/pkg/analyzer/lib/src/generated/super_context.dart
@@ -39,6 +39,10 @@
: SuperContext.static;
} else if (node is ConstructorFieldInitializer) {
return SuperContext.static;
+ } else if (node is FieldDeclaration) {
+ return node.staticKeyword == null && node.fields.lateKeyword != null
+ ? SuperContext.valid
+ : SuperContext.static;
} else if (node is MethodDeclaration) {
if (node.isStatic) {
return SuperContext.static;
diff --git a/pkg/analyzer/lib/src/summary2/top_level_inference.dart b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
index 7c85b60d..6640e26 100644
--- a/pkg/analyzer/lib/src/summary2/top_level_inference.dart
+++ b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
@@ -384,7 +384,7 @@
if (node.initializer != null) {
var inferenceNode =
- _VariableInferenceNode(_walker, _unitElement, _scope, node);
+ _VariableInferenceNode(_walker, _unitElement, _scope, element, node);
_walker._nodes[element] = inferenceNode;
(element as PropertyInducingElementImpl).typeInference =
_PropertyInducingElementTypeInference(inferenceNode);
@@ -413,6 +413,7 @@
final CompilationUnitElementImpl _unitElement;
final TypeSystemImpl _typeSystem;
final Scope _scope;
+ final PropertyInducingElement _element;
final VariableDeclaration _node;
@override
@@ -422,6 +423,7 @@
this._walker,
this._unitElement,
this._scope,
+ this._element,
this._node,
) : _typeSystem = _unitElement.library.typeSystem;
@@ -502,8 +504,12 @@
}
void _resolveInitializer({required bool forDependencies}) {
- var astResolver =
- AstResolver(_walker._linker, _unitElement, _scope, _node.initializer!);
+ var enclosingElement = _element.enclosingElement;
+ var enclosingClassElement =
+ enclosingElement is ClassElement ? enclosingElement : null;
+ var astResolver = AstResolver(
+ _walker._linker, _unitElement, _scope, _node.initializer!,
+ enclosingClassElement: enclosingClassElement);
astResolver.resolveExpression(() => _node.initializer!,
buildElements: forDependencies);
}
diff --git a/pkg/analyzer/test/src/diagnostics/super_in_invalid_context_test.dart b/pkg/analyzer/test/src/diagnostics/super_in_invalid_context_test.dart
index 67ab6d0..321b5e8 100644
--- a/pkg/analyzer/test/src/diagnostics/super_in_invalid_context_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/super_in_invalid_context_test.dart
@@ -23,6 +23,60 @@
]);
}
+ test_class_field_instance() async {
+ await assertErrorsInCode('''
+class A {
+ int get foo => 0;
+}
+
+class B extends A {
+ var f = super.foo;
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 63, 5),
+ ]);
+ }
+
+ test_class_field_instance_late() async {
+ await assertNoErrorsInCode('''
+class A {
+ int foo() => 0;
+}
+
+class B extends A {
+ late var f = super.foo();
+}
+''');
+ }
+
+ test_class_field_static() async {
+ await assertErrorsInCode('''
+class A {
+ int get foo => 0;
+}
+
+class B extends A {
+ static var f = super.foo;
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 70, 5),
+ ]);
+ }
+
+ test_class_field_static_late() async {
+ await assertErrorsInCode('''
+class A {
+ int get foo => 0;
+}
+
+class B extends A {
+ static late var f = super.foo;
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 75, 5),
+ ]);
+ }
+
test_constructorFieldInitializer() async {
await assertErrorsInCode(r'''
class A {
@@ -37,6 +91,34 @@
]);
}
+ test_extension_field_static() async {
+ await assertErrorsInCode('''
+class A {
+ int get foo => 0;
+}
+
+extension E on int {
+ static var f = super.foo;
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 71, 5),
+ ]);
+ }
+
+ test_extension_field_static_late() async {
+ await assertErrorsInCode('''
+class A {
+ int get foo => 0;
+}
+
+extension E on int {
+ static late var f = super.foo;
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 76, 5),
+ ]);
+ }
+
test_factoryConstructor() async {
await assertErrorsInCode(r'''
class A {
@@ -67,6 +149,60 @@
]);
}
+ test_mixin_field_instance() async {
+ await assertErrorsInCode('''
+class A {
+ int get foo => 0;
+}
+
+mixin M on A {
+ var f = super.foo;
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 58, 5),
+ ]);
+ }
+
+ test_mixin_field_instance_late() async {
+ await assertNoErrorsInCode('''
+class A {
+ int get foo => 0;
+}
+
+mixin M on A {
+ late var f = super.foo;
+}
+''');
+ }
+
+ test_mixin_field_static() async {
+ await assertErrorsInCode('''
+class A {
+ int get foo => 0;
+}
+
+mixin M on A {
+ static var f = super.foo;
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 65, 5),
+ ]);
+ }
+
+ test_mixin_field_static_late() async {
+ await assertErrorsInCode('''
+class A {
+ int get foo => 0;
+}
+
+mixin M on A {
+ static late var f = super.foo;
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 70, 5),
+ ]);
+ }
+
test_staticMethod() async {
await assertErrorsInCode(r'''
class A {
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 87594bb..41c6205 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -2158,6 +2158,85 @@
''');
}
+ test_class_fields_late_inference_usingSuper_methodInvocation() async {
+ var library = await checkLibrary('''
+class A {
+ int foo() => 0;
+}
+
+class B extends A {
+ late var f = super.foo();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ constructors
+ synthetic @-1
+ methods
+ foo @16
+ returnType: int
+ class B @37
+ supertype: A
+ fields
+ late f @62
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get f @-1
+ returnType: int
+ synthetic set f @-1
+ parameters
+ requiredPositional _f @-1
+ type: int
+ returnType: void
+''');
+ }
+
+ test_class_fields_late_inference_usingSuper_propertyAccess() async {
+ var library = await checkLibrary('''
+class A {
+ int get foo => 0;
+}
+
+class B extends A {
+ late var f = super.foo;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ fields
+ synthetic foo @-1
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ get foo @20
+ returnType: int
+ class B @39
+ supertype: A
+ fields
+ late f @64
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get f @-1
+ returnType: int
+ synthetic set f @-1
+ parameters
+ requiredPositional _f @-1
+ type: int
+ returnType: void
+''');
+ }
+
test_class_getter_abstract() async {
var library = await checkLibrary('abstract class C { int get x; }');
checkElementText(library, r'''
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index dbea6f0..0297cf8 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -4695,11 +4695,15 @@
@override
js_ast.Expression visitSuperPropertyGet(SuperPropertyGet node) {
var target = node.interfaceTarget;
- var jsTarget = _emitSuperTarget(target);
if (_reifyTearoff(target)) {
- return runtimeCall('bind(this, #, #)', [jsTarget.selector, jsTarget]);
+ if (_superAllowed) {
+ var jsTarget = _emitSuperTarget(target);
+ return runtimeCall('bind(this, #, #)', [jsTarget.selector, jsTarget]);
+ } else {
+ return _emitSuperTearoff(target);
+ }
}
- return jsTarget;
+ return _emitSuperTarget(target);
}
@override
@@ -5318,6 +5322,10 @@
// If we can't emit `super` in this context, generate a helper that does it
// for us, and call the helper.
+ //
+ // NOTE: This is intended to help in the cases of calling a `super` getter,
+ // setter, or method. For the case of tearing off a `super` method in
+ // contexts where `super` isn't allowed, see [_emitSuperTearoff].
var name = member.name.text;
var jsMethod = _superHelpers.putIfAbsent(name, () {
var isAccessor = member is Procedure ? member.isAccessor : true;
@@ -5351,6 +5359,25 @@
return js_ast.PropertyAccess(js_ast.This(), jsMethod.name);
}
+ /// Generates a helper method that is inserted into the class that binds a
+ /// tearoff of [member] from `super` and returns a call to the helper.
+ ///
+ /// This method assumes `super` is not allowed in the current context.
+ // TODO(nshahan) Replace with a kernel transform and synthetic method filters
+ // for devtools.
+ js_ast.Expression _emitSuperTearoff(Member member) {
+ var jsName = _emitMemberName(member.name.text, member: member);
+ var name = '_#super#tearOff#${member.name.text}';
+ var jsMethod = _superHelpers.putIfAbsent(name, () {
+ var jsReturnValue =
+ runtimeCall('bind(this, #, super[#])', [jsName, jsName]);
+ var fn = js.fun('function() { return #; }', [jsReturnValue]);
+ name = js_ast.friendlyNameForDartOperator[name] ?? name;
+ return js_ast.Method(_emitTemporaryId(name), fn);
+ });
+ return js_ast.Call(js_ast.PropertyAccess(js_ast.This(), jsMethod.name), []);
+ }
+
/// If [e] is a [TypeLiteral] or a [TypeLiteralConstant] expression, return
/// the underlying [DartType], otherwise returns null.
// TODO(sigmund,nshahan): remove all uses of type literals in the runtime
diff --git a/runtime/vm/compiler/backend/type_propagator_test.cc b/runtime/vm/compiler/backend/type_propagator_test.cc
index 66bd3bd..96c3ac0 100644
--- a/runtime/vm/compiler/backend/type_propagator_test.cc
+++ b/runtime/vm/compiler/backend/type_propagator_test.cc
@@ -541,6 +541,8 @@
FlowGraphTypePropagator::Propagate(H.flow_graph()); // Should not crash.
}
+#if defined(DART_PRECOMPILER)
+
// This test verifies that LoadStaticField for non-nullable field
// is non-nullable with sound null safety.
// Regression test for https://github.com/dart-lang/sdk/issues/47119.
@@ -588,4 +590,6 @@
EXPECT_PROPERTY(load->AsLoadStaticField()->Type(), !it.is_nullable());
}
+#endif // defined(DART_PRECOMPILER)
+
} // namespace dart
diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc
index a3d8b32..d190c80 100644
--- a/runtime/vm/os_thread.cc
+++ b/runtime/vm/os_thread.cc
@@ -20,9 +20,7 @@
Mutex* OSThread::thread_list_lock_ = NULL;
bool OSThread::creation_enabled_ = false;
-#if defined(HAS_C11_THREAD_LOCAL)
thread_local ThreadState* OSThread::current_vm_thread_ = NULL;
-#endif
OSThread::OSThread()
: BaseThread(true),
@@ -282,14 +280,12 @@
// Provides thread-local destructors.
SetThreadLocal(thread_key_, reinterpret_cast<uword>(value));
-#if defined(HAS_C11_THREAD_LOCAL)
// Allows the C compiler more freedom to optimize.
if ((value != NULL) && !value->is_os_thread()) {
current_vm_thread_ = static_cast<Thread*>(value);
} else {
current_vm_thread_ = NULL;
}
-#endif
}
OSThreadIterator::OSThreadIterator() {
diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h
index 7601cdc..b1019e8 100644
--- a/runtime/vm/os_thread.h
+++ b/runtime/vm/os_thread.h
@@ -12,11 +12,6 @@
#include "vm/allocation.h"
#include "vm/globals.h"
-// On iOS, thread_local requires iOS 9+.
-#if !DART_HOST_OS_IOS
-#define HAS_C11_THREAD_LOCAL 1
-#endif
-
// Declare the OS-specific types ahead of defining the generic classes.
#if defined(DART_HOST_OS_ANDROID)
#include "vm/os_thread_android.h"
@@ -182,9 +177,7 @@
}
static void SetCurrent(OSThread* current) { SetCurrentTLS(current); }
-#if defined(HAS_C11_THREAD_LOCAL)
static ThreadState* CurrentVMThread() { return current_vm_thread_; }
-#endif
// TODO(5411455): Use flag to override default value and Validate the
// stack size by querying OS.
@@ -308,9 +301,7 @@
static OSThread* thread_list_head_;
static bool creation_enabled_;
-#if defined(HAS_C11_THREAD_LOCAL)
static thread_local ThreadState* current_vm_thread_;
-#endif
friend class IsolateGroup; // to access set_thread(Thread*).
friend class OSThreadIterator;
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index d5f56ee..4277ee7 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -282,15 +282,7 @@
// The currently executing thread, or NULL if not yet initialized.
static Thread* Current() {
-#if defined(HAS_C11_THREAD_LOCAL)
return static_cast<Thread*>(OSThread::CurrentVMThread());
-#else
- BaseThread* thread = OSThread::GetCurrentTLS();
- if (thread == NULL || thread->is_os_thread()) {
- return NULL;
- }
- return static_cast<Thread*>(thread);
-#endif
}
// Makes the current thread enter 'isolate'.
diff --git a/runtime/vm/thread_state.h b/runtime/vm/thread_state.h
index 58e57aa..e83bc26 100644
--- a/runtime/vm/thread_state.h
+++ b/runtime/vm/thread_state.h
@@ -25,15 +25,7 @@
public:
// The currently executing thread, or NULL if not yet initialized.
static ThreadState* Current() {
-#if defined(HAS_C11_THREAD_LOCAL)
return OSThread::CurrentVMThread();
-#else
- BaseThread* thread = OSThread::GetCurrentTLS();
- if (thread == NULL || thread->is_os_thread()) {
- return NULL;
- }
- return static_cast<ThreadState*>(thread);
-#endif
}
explicit ThreadState(bool is_os_thread);
diff --git a/sdk/lib/core/duration.dart b/sdk/lib/core/duration.dart
index b85de35..5303bbe 100644
--- a/sdk/lib/core/duration.dart
+++ b/sdk/lib/core/duration.dart
@@ -261,35 +261,27 @@
/// d.toString(); // "1:10:00.000500"
/// ```
String toString() {
- var buffer = List<String>.filled(9, "");
var microseconds = inMicroseconds;
var hours = microseconds ~/ microsecondsPerHour;
microseconds = microseconds.remainder(microsecondsPerHour);
if (microseconds < 0) microseconds = -microseconds;
- var hoursString = hours.toString();
- buffer
- ..[0] = hoursString
- ..[1] = ":";
var minutes = microseconds ~/ microsecondsPerMinute;
microseconds = microseconds.remainder(microsecondsPerMinute);
- if (minutes < 10) buffer[2] = "0";
- buffer
- ..[3] = minutes.toString()
- ..[4] = ":";
+ var minutesPadding = minutes < 10 ? "0" : "";
var seconds = microseconds ~/ microsecondsPerSecond;
microseconds = microseconds.remainder(microsecondsPerSecond);
- if (seconds < 10) buffer[5] = "0";
- buffer
- ..[6] = seconds.toString()
- ..[7] = "."
- ..[8] = microseconds.toString().padLeft(6, "0");
- return buffer.join("");
+ var secondsPadding = seconds < 10 ? "0" : "";
+
+ var paddedMicroseconds = microseconds.toString().padLeft(6, "0");
+ return "$hours:"
+ "$minutesPadding$minutes:"
+ "$secondsPadding$seconds.$paddedMicroseconds";
}
/// Whether this [Duration] is negative.
diff --git a/tools/VERSION b/tools/VERSION
index c2f4478..d226819 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 101
+PRERELEASE 102
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index bb7ce34..cc0f243 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -279,6 +279,7 @@
"out/DebugAndroidARM/",
"out/DebugAndroidARM_X64/",
"out/DebugAndroidARM64/",
+ "out/DebugAndroidARM64C/",
"out/ReleaseIA32/",
"out/ReleaseX64/",
"out/ReleaseX64C/",
@@ -289,6 +290,7 @@
"out/ReleaseAndroidARM/",
"out/ReleaseAndroidARM_X64/",
"out/ReleaseAndroidARM64/",
+ "out/ReleaseAndroidARM64C/",
"out/ReleaseASANX64/",
"out/ReleaseLSANX64/",
"out/ReleaseMSANX64/",
@@ -304,6 +306,7 @@
"out/ProductSIMARM_X64/",
"out/ProductAndroidARM/",
"out/ProductAndroidARM64/",
+ "out/ProductAndroidARM64C/",
"xcodebuild/DebugIA32/",
"xcodebuild/DebugSIMARM/",
"xcodebuild/DebugSIMARM64/",