Version 2.14.0-342.0.dev Merge commit '90ee35cdf9e5faab80cb87690430dcd673b1231b' into 'dev'
diff --git a/DEPS b/DEPS index f498427..653673b 100644 --- a/DEPS +++ b/DEPS
@@ -72,7 +72,7 @@ "gperftools_revision": "180bfa10d7cb38e8b3784d60943d50e8fcef0dcb", # Revisions of /third_party/* dependencies. - "args_rev": "d8fea36c10ef96797be02e3d132d572445cd86f4", + "args_rev": "0329844afcf3efa9e92a1dc55d7d10226b0fa932", "async_rev": "25a7e2ec39c03622b86918cb9ce3e7d00dd283d1", "bazel_worker_rev": "0885637b037979afbf5bcd05fd748b309fd669c0", "benchmark_harness_rev": "c546dbd9f639f75cd2f75de8df2eb9f8ea15e8e7",
diff --git a/pkg/analysis_server/lib/src/lsp/client_configuration.dart b/pkg/analysis_server/lib/src/lsp/client_configuration.dart index 332330f..9093676 100644 --- a/pkg/analysis_server/lib/src/lsp/client_configuration.dart +++ b/pkg/analysis_server/lib/src/lsp/client_configuration.dart
@@ -2,10 +2,102 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'package:collection/collection.dart'; +import 'package:path/path.dart' as path; + +/// Provides access to both global and resource-specific client configuration. +/// +/// Resource-specific config is currently only supported at the WorkspaceFolder +/// level so when looking up config for a resource, the nearest WorkspaceFolders +/// config will be used. +class LspClientConfiguration { + /// Global settings for the workspace. + /// + /// Used as a fallback for resource settings if no specific config is found + /// for the resource. + LspGlobalClientConfiguration _globalSettings = + LspGlobalClientConfiguration({}); + + /// Settings for each resource. + /// + /// Keys are string paths without trailing path separators (eg. 'C:\foo'). + final Map<String, LspResourceClientConfiguration> _resourceSettings = + <String, LspResourceClientConfiguration>{}; + + /// Pattern for stripping trailing slashes that may be been provided by the + /// client (in WorkspaceFolder URIs) for consistent comparisons. + final _trailingSlashPattern = RegExp(r'[\/]+$'); + + /// Returns the global configuration for the whole workspace. + LspGlobalClientConfiguration get global => _globalSettings; + + /// Returns whether or not the provided new configuration changes any values + /// that would require analysis roots to be updated. + bool affectsAnalysisRoots(LspGlobalClientConfiguration otherConfig) { + return _globalSettings.analysisExcludedFolders != + otherConfig.analysisExcludedFolders; + } + + /// Returns config for a given resource. + /// + /// Because we only support config at the WorkspaceFolder level, this is done + /// by finding the nearest WorkspaceFolder to [resourcePath] and using config + /// for that. + /// + /// If no specific config is available, returns [global]. + LspResourceClientConfiguration forResource(String resourcePath) { + final workspaceFolder = _getWorkspaceFolderPath(resourcePath); + + if (workspaceFolder == null) { + return _globalSettings; + } + + return _resourceSettings[_normaliseFolderPath(workspaceFolder)] ?? + _globalSettings; + } + + /// Replaces all previously known configuration with updated values from the + /// client. + void replace( + Map<String, Object?> globalConfig, + Map<String, Map<String, Object?>> workspaceFolderConfig, + ) { + _globalSettings = LspGlobalClientConfiguration(globalConfig); + + _resourceSettings + ..clear() + ..addAll(workspaceFolderConfig.map( + (key, value) => MapEntry( + _normaliseFolderPath(key), + LspResourceClientConfiguration(value, _globalSettings), + ), + )); + } + + /// Gets the path for the WorkspaceFolder closest to [resourcePath]. + String? _getWorkspaceFolderPath(String resourcePath) { + final candidates = _resourceSettings.keys + .where((wfPath) => + wfPath == _normaliseFolderPath(resourcePath) || + path.isWithin(wfPath, resourcePath)) + .toList(); + candidates.sort((a, b) => -a.length.compareTo(b.length)); + return candidates.firstOrNull; + } + + /// Normalises a folder path to never have a trailing path separator. + String _normaliseFolderPath(String path) => + path.replaceAll(_trailingSlashPattern, ''); +} + /// Wraps the client (editor) configuration to provide stronger typing and /// handling of default values where a setting has not been supplied. -class LspClientConfiguration { - final Map<String, dynamic> _settings = <String, dynamic>{}; +/// +/// Settings in this class are only allowed to be configured at the workspace +/// level (they will be ignored at the resource level). +class LspGlobalClientConfiguration extends LspResourceClientConfiguration { + LspGlobalClientConfiguration(Map<String, Object?> settings) + : super(settings, null); List<String> get analysisExcludedFolders { // This setting is documented as a string array, but because editors are @@ -20,30 +112,48 @@ } } - bool get completeFunctionCalls => _settings['completeFunctionCalls'] ?? false; - bool get enableSdkFormatter => _settings['enableSdkFormatter'] ?? true; - int? get lineLength => _settings['lineLength']; + /// Whether methods/functions in completion should include parens and argument + /// placeholders when used in an invocation context. + bool get completeFunctionCalls => + _settings['completeFunctionCalls'] as bool? ?? false; /// A preview flag for enabling commit characters for completions. /// /// This is a temporary setting to allow this feature to be tested without /// defaulting to on for everybody. bool get previewCommitCharacters => - _settings['previewCommitCharacters'] ?? false; + _settings['previewCommitCharacters'] as bool? ?? false; /// Whether diagnostics should be generated for TODO comments. - bool get showTodos => _settings['showTodos'] ?? false; + bool get showTodos => _settings['showTodos'] as bool? ?? false; +} - /// Returns whether or not the provided new configuration changes any values - /// that would require analysis roots to be updated. - bool affectsAnalysisRoots(Map<String, dynamic> newConfig) { - return _settings['analysisExcludedFolders'] != - newConfig['analysisExcludedFolders']; - } +/// Wraps the client (editor) configuration for a specific resource. +/// +/// Settings in this class are only allowed to be configured either for a +/// resource or for the whole workspace. +/// +/// Right now, we treat "resource" to always mean a WorkspaceFolder since no +/// known editors allow per-file configuration and it allows us to keep the +/// settings cached, invalidated only when WorkspaceFolders change. +class LspResourceClientConfiguration { + final Map<String, Object?> _settings; + final LspResourceClientConfiguration? _fallback; - void replace(Map<String, dynamic> newConfig) { - _settings - ..clear() - ..addAll(newConfig); - } + LspResourceClientConfiguration(this._settings, this._fallback); + + /// Whether to enable the SDK formatter. + /// + /// If this setting is `false`, the formatter will be unregistered with the + /// client. + bool get enableSdkFormatter => + _settings['enableSdkFormatter'] as bool? ?? + _fallback?.enableSdkFormatter ?? + true; + + /// The line length used when formatting documents. + /// + /// If null, the formatters default will be used. + int? get lineLength => + _settings['lineLength'] as int? ?? _fallback?.lineLength; }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart index 9a530d3..e270255 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart
@@ -23,8 +23,8 @@ DidChangeWorkspaceFoldersParams.jsonHandler; @override - ErrorOr<void> handle( - DidChangeWorkspaceFoldersParams params, CancellationToken token) { + Future<ErrorOr<void>> handle( + DidChangeWorkspaceFoldersParams params, CancellationToken token) async { // Don't do anything if our analysis roots are not based on open workspaces. if (!updateAnalysisRoots) { return success(null); @@ -37,7 +37,7 @@ .map((wf) => Uri.parse(wf.uri).toFilePath()) .toList(); - server.updateWorkspaceFolders(added, removed); + await server.updateWorkspaceFolders(added, removed); return success(null); }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart index a1c9fab..2ab3d5d 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart
@@ -261,7 +261,7 @@ /// insert dupes. final completeFunctionCalls = _hasExistingArgList(target.entity) ? false - : server.clientConfiguration.completeFunctionCalls; + : server.clientConfiguration.global.completeFunctionCalls; final results = serverSuggestions.map( (item) { @@ -292,7 +292,7 @@ // depending on how the spec is updated. // https://github.com/microsoft/vscode-languageserver-node/issues/673 includeCommitCharacters: - server.clientConfiguration.previewCommitCharacters, + server.clientConfiguration.global.previewCommitCharacters, completeFunctionCalls: completeFunctionCalls, ); }, @@ -390,8 +390,8 @@ // this should be removed (or made conditional based on a capability) // depending on how the spec is updated. // https://github.com/microsoft/vscode-languageserver-node/issues/673 - includeCommitCharacters: - server.clientConfiguration.previewCommitCharacters, + includeCommitCharacters: server + .clientConfiguration.global.previewCommitCharacters, completeFunctionCalls: completeFunctionCalls, )); results.addAll(setResults);
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart index 1ed3a71..3148284 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart
@@ -32,8 +32,8 @@ return success(null); } - return generateEditsForFormatting( - result, server.clientConfiguration.lineLength); + final lineLength = server.clientConfiguration.forResource(path).lineLength; + return generateEditsForFormatting(result, lineLength); } @override @@ -43,12 +43,15 @@ return success(null); } - if (!server.clientConfiguration.enableSdkFormatter) { - return error(ServerErrorCodes.FeatureDisabled, - 'Formatter was disabled by client settings'); - } - final path = pathOfDoc(params.textDocument); - return path.mapResult((path) => formatFile(path)); + return path.mapResult((path) { + if (!server.clientConfiguration.forResource(path).enableSdkFormatter) { + // Because we now support formatting for just some WorkspaceFolders + // we should silently do nothing for those that are disabled. + return success(null); + } + + return formatFile(path); + }); } }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart index d6f7247..f92433a 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart
@@ -32,9 +32,8 @@ return success(null); } - return generateEditsForFormatting( - result, server.clientConfiguration.lineLength, - range: range); + final lineLength = server.clientConfiguration.forResource(path).lineLength; + return generateEditsForFormatting(result, lineLength, range: range); } @override @@ -44,12 +43,14 @@ return success(null); } - if (!server.clientConfiguration.enableSdkFormatter) { - return error(ServerErrorCodes.FeatureDisabled, - 'Formatter was disabled by client settings'); - } - final path = pathOfDoc(params.textDocument); - return path.mapResult((path) => formatRange(path, params.range)); + return path.mapResult((path) { + if (!server.clientConfiguration.forResource(path).enableSdkFormatter) { + // Because we now support formatting for just some WorkspaceFolders + // we should silently do nothing for those that are disabled. + return success(null); + } + return formatRange(path, params.range); + }); } }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart index 75b7a41..23a7cad 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart
@@ -32,8 +32,8 @@ return success(null); } - return generateEditsForFormatting( - result, server.clientConfiguration.lineLength); + final lineLength = server.clientConfiguration.forResource(path).lineLength; + return generateEditsForFormatting(result, lineLength); } @override @@ -43,12 +43,14 @@ return success(null); } - if (!server.clientConfiguration.enableSdkFormatter) { - return error(ServerErrorCodes.FeatureDisabled, - 'Formatter was disabled by client settings'); - } - final path = pathOfDoc(params.textDocument); - return path.mapResult((path) => formatFile(path)); + return path.mapResult((path) { + if (!server.clientConfiguration.forResource(path).enableSdkFormatter) { + // Because we now support formatting for just some WorkspaceFolders + // we should silently do nothing for those that are disabled. + return success(null); + } + return formatFile(path); + }); } }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart index d842bbb..b0e3ca3 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart
@@ -28,10 +28,8 @@ server, ); - await server.fetchClientConfigurationAndPerformDynamicRegistration(); - if (!server.initializationOptions.onlyAnalyzeProjectsWithOpenFiles) { - server.updateWorkspaceFolders(openWorkspacePaths, const []); + await server.updateWorkspaceFolders(openWorkspacePaths, const []); } return success(null);
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart index 7f381dd..cac5665 100644 --- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart +++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -205,33 +205,49 @@ /// register/unregister requests for any supported/enabled dynamic registrations. Future<void> fetchClientConfigurationAndPerformDynamicRegistration() async { if (clientCapabilities?.configuration ?? false) { + // Take a copy of workspace folders because we need to match up the + // responses to the request by index and it's possible _workspaceFolders + // will change after we sent the request but before we get the response. + final folders = _workspaceFolders.toList(); + // Fetch all configuration we care about from the client. This is just // "dart" for now, but in future this may be extended to include // others (for example "flutter"). final response = await sendRequest( Method.workspace_configuration, ConfigurationParams(items: [ + // Dart settings for each workspace folder. + for (final folder in folders) + ConfigurationItem( + scopeUri: Uri.file(folder).toString(), + section: 'dart', + ), + // Global Dart settings. This comes last to simplify matching up the + // indexes in the results (folder[i] is the i'th item). ConfigurationItem(section: 'dart'), ])); final result = response.result; - // Expect the result to be a single list (to match the single - // ConfigurationItem we requested above) and that it should be - // a standard map of settings. + // Expect the result to be a list with 1 + folders.length items to + // match the request above, and each should be a standard map of settings. // If the above code is extended to support multiple sets of config - // this will need tweaking to handle each group appropriately. + // this will need tweaking to handle the item for each section. if (result != null && result is List<dynamic> && - result.length == 1 && - result.first is Map<String, dynamic>) { - final newConfig = result.first; - final refreshRoots = - clientConfiguration.affectsAnalysisRoots(newConfig); + result.length == 1 + folders.length) { + // Config is stored as a map keyed by the workspace folder, and a key of + // null for the global config + final workspaceFolderConfig = { + for (var i = 0; i < folders.length; i++) + folders[i]: result[i] as Map<String, Object?>? ?? {}, + }; + final newGlobalConfig = result.last as Map<String, Object?>? ?? {}; - clientConfiguration.replace(newConfig); + final oldGlobalConfig = clientConfiguration.global; + clientConfiguration.replace(newGlobalConfig, workspaceFolderConfig); - if (refreshRoots) { + if (clientConfiguration.affectsAnalysisRoots(oldGlobalConfig)) { _refreshAnalysisRoots(); } } @@ -638,14 +654,16 @@ sendServerErrorNotification('Socket error', error, stack); } - void updateWorkspaceFolders( - List<String> addedPaths, List<String> removedPaths) { + Future<void> updateWorkspaceFolders( + List<String> addedPaths, List<String> removedPaths) async { // TODO(dantup): This is currently case-sensitive! _workspaceFolders ..addAll(addedPaths) ..removeAll(removedPaths); + await fetchClientConfigurationAndPerformDynamicRegistration(); + _refreshAnalysisRoots(); } @@ -699,7 +717,7 @@ ? _workspaceFolders.toSet() : _getRootsForOpenFiles(); - final excludedPaths = clientConfiguration.analysisExcludedFolders + final excludedPaths = clientConfiguration.global.analysisExcludedFolders .expand((excludePath) => resourceProvider.pathContext .isAbsolute(excludePath) ? [excludePath] @@ -889,5 +907,5 @@ bool _shouldSendError(protocol.AnalysisError error) => error.code != ErrorType.TODO.name.toLowerCase() || - analysisServer.clientConfiguration.showTodos; + analysisServer.clientConfiguration.global.showTodos; }
diff --git a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart index ca0b352..89f26d4 100644 --- a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart +++ b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
@@ -136,9 +136,10 @@ LspClientCapabilities clientCapabilities) { final codeActionLiteralSupport = clientCapabilities.literalCodeActions; final renameOptionsSupport = clientCapabilities.renameValidation; - final enableFormatter = _server.clientConfiguration.enableSdkFormatter; + final enableFormatter = + _server.clientConfiguration.global.enableSdkFormatter; final previewCommitCharacters = - _server.clientConfiguration.previewCommitCharacters; + _server.clientConfiguration.global.previewCommitCharacters; final dynamicRegistrations = ClientDynamicRegistrations(clientCapabilities.raw); @@ -321,9 +322,10 @@ final registrations = <Registration>[]; - final enableFormatter = _server.clientConfiguration.enableSdkFormatter; + final enableFormatter = + _server.clientConfiguration.global.enableSdkFormatter; final previewCommitCharacters = - _server.clientConfiguration.previewCommitCharacters; + _server.clientConfiguration.global.previewCommitCharacters; /// Helper for creating registrations with IDs. void register(bool condition, Method method, [ToJsonable? options]) {
diff --git a/pkg/analysis_server/test/lsp/client_configuration_test.dart b/pkg/analysis_server/test/lsp/client_configuration_test.dart new file mode 100644 index 0000000..86788dc --- /dev/null +++ b/pkg/analysis_server/test/lsp/client_configuration_test.dart
@@ -0,0 +1,62 @@ +// 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 'package:analysis_server/src/lsp/client_configuration.dart'; +import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart'; +import 'package:test/test.dart'; +import 'package:test_reflective_loader/test_reflective_loader.dart'; + +void main() { + defineReflectiveSuite(() { + defineReflectiveTests(ClientConfigurationTest); + }); +} + +@reflectiveTest +class ClientConfigurationTest with ResourceProviderMixin { + void test_folderConfig() { + final folder = convertPath('/home/test'); + final file = convertPath('/home/test/file.dart'); + final config = LspClientConfiguration(); + config.replace( + {'lineLength': 100}, + { + folder: {'lineLength': 200} + }, + ); + expect(config.forResource(file).lineLength, equals(200)); + } + + void test_folderConfig_globalFallback() { + final file = convertPath('/home/test/file.dart'); + final config = LspClientConfiguration(); + config.replace({'lineLength': 100}, {}); + // Should fall back to the global config. + expect(config.forResource(file).lineLength, equals(100)); + } + + void test_folderConfig_nested() { + final folderOne = convertPath('/one'); + final folderTwo = convertPath('/one/two'); + final folderThree = convertPath('/one/two/three'); + final file = convertPath('/one/two/three/file.dart'); + final config = LspClientConfiguration(); + config.replace( + {'lineLength': 50}, + { + folderOne: {'lineLength': 100}, + folderThree: {'lineLength': 300}, + folderTwo: {'lineLength': 200}, + }, + ); + // Should use the inner-most folder (folderThree). + expect(config.forResource(file).lineLength, equals(300)); + } + + void test_globalConfig() { + final config = LspClientConfiguration(); + config.replace({'lineLength': 100}, {}); + expect(config.global.lineLength, equals(100)); + } +}
diff --git a/pkg/analysis_server/test/lsp/format_test.dart b/pkg/analysis_server/test/lsp/format_test.dart index 741a740..5ba380f 100644 --- a/pkg/analysis_server/test/lsp/format_test.dart +++ b/pkg/analysis_server/test/lsp/format_test.dart
@@ -309,6 +309,97 @@ await expectFormattedContents(mainFileUri, contents, expectedLongLines); } + Future<void> test_lineLength_outsideWorkspaceFolders() async { + const contents = ''' +main() { + print('123456789 ''123456789 ''123456789 '); +} +'''; + const expectedContents = ''' +main() { + print( + '123456789 ' + '123456789 ' + '123456789 '); +} +'''; + + await provideConfig( + () => initialize( + // Use empty roots so the test file is not inside any known + // WorkspaceFolder. + allowEmptyRootUri: true, + workspaceCapabilities: withDidChangeConfigurationDynamicRegistration( + withConfigurationSupport(emptyWorkspaceClientCapabilities)), + ), + // Global config (this should be used). + {'lineLength': 10}, + ); + await openFile(mainFileUri, contents); + await expectFormattedContents(mainFileUri, contents, expectedContents); + } + + Future<void> test_lineLength_workspaceFolderSpecified() async { + const contents = ''' +main() { + print('123456789 ''123456789 ''123456789 '); +} +'''; + const expectedContents = ''' +main() { + print( + '123456789 ' + '123456789 ' + '123456789 '); +} +'''; + + await provideConfig( + () => initialize( + workspaceCapabilities: withDidChangeConfigurationDynamicRegistration( + withConfigurationSupport(emptyWorkspaceClientCapabilities))), + // Global config. + {'lineLength': 200}, + folderConfig: { + // WorkspaceFolder config for this project (this should be used). + projectFolderPath: {'lineLength': 10}, + }, + ); + await openFile(mainFileUri, contents); + await expectFormattedContents(mainFileUri, contents, expectedContents); + } + + Future<void> test_lineLength_workspaceFolderUnspecified() async { + const contents = ''' +main() { + print('123456789 ''123456789 ''123456789 '); +} +'''; + const expectedContents = ''' +main() { + print( + '123456789 ' + '123456789 ' + '123456789 '); +} +'''; + + await provideConfig( + () => initialize( + workspaceCapabilities: withDidChangeConfigurationDynamicRegistration( + withConfigurationSupport(emptyWorkspaceClientCapabilities))), + // Global config (this should be used). + {'lineLength': 10}, + folderConfig: { + // WorkspaceFolder config for this project that doesn't specific + // lineLength. + projectFolderPath: {'someOtherValue': 'foo'}, + }, + ); + await openFile(mainFileUri, contents); + await expectFormattedContents(mainFileUri, contents, expectedContents); + } + Future<void> test_minimalEdits_addWhitespace() async { // Check we only get one edit to add the required whitespace and not // an entire document replacement.
diff --git a/pkg/analysis_server/test/lsp/server_abstract.dart b/pkg/analysis_server/test/lsp/server_abstract.dart index ad2d20b..a7a8ea0 100644 --- a/pkg/analysis_server/test/lsp/server_abstract.dart +++ b/pkg/analysis_server/test/lsp/server_abstract.dart
@@ -1458,14 +1458,34 @@ /// Calls the supplied function and responds to any `workspace/configuration` /// request with the supplied config. - Future<ResponseMessage> provideConfig(Future<ResponseMessage> Function() f, - FutureOr<Map<String, dynamic>> config) { + Future<ResponseMessage> provideConfig( + Future<ResponseMessage> Function() f, + FutureOr<Map<String, Object?>> globalConfig, { + FutureOr<Map<String, Map<String, Object?>>>? folderConfig, + }) { return handleExpectedRequest<ResponseMessage, ConfigurationParams, - List<Map<String, dynamic>>>( + List<Map<String, Object?>>>( Method.workspace_configuration, ConfigurationParams.fromJson, f, - handler: (configurationParams) async => [await config], + handler: (configurationParams) async { + // We must respond to the request for config with items that match the + // request. For any item in the request without a folder, we will return + // the global config. For any item in the request with a folder we will + // return the config for that item in the map, or fall back to the global + // config if it does not exist. + final global = await globalConfig; + final folders = await folderConfig; + return configurationParams.items.map( + (requestedConfig) { + final uri = requestedConfig.scopeUri; + final path = uri != null ? Uri.parse(uri).toFilePath() : null; + // Use the config the test provided for this path, or fall back to + // global. + return (folders != null ? folders[path] : null) ?? global; + }, + ).toList(); + }, ); }
diff --git a/pkg/analysis_server/test/lsp/test_all.dart b/pkg/analysis_server/test/lsp/test_all.dart index fbdd56c..752d3f1 100644 --- a/pkg/analysis_server/test/lsp/test_all.dart +++ b/pkg/analysis_server/test/lsp/test_all.dart
@@ -8,6 +8,7 @@ import 'analyzer_status_test.dart' as analyzer_status; import 'cancel_request_test.dart' as cancel_request; import 'change_workspace_folders_test.dart' as change_workspace_folders; +import 'client_configuration_test.dart' as client_configuration; import 'closing_labels_test.dart' as closing_labels; import 'code_actions_assists_test.dart' as code_actions_assists; import 'code_actions_fixes_test.dart' as code_actions_fixes; @@ -48,6 +49,7 @@ analyzer_status.main(); cancel_request.main(); change_workspace_folders.main(); + client_configuration.main(); closing_labels.main(); code_actions_assists.main(); code_actions_fixes.main();
diff --git a/pkg/analysis_server/test/src/cider/fixes_test.dart b/pkg/analysis_server/test/src/cider/fixes_test.dart index fa71e62..4e57e14 100644 --- a/pkg/analysis_server/test/src/cider/fixes_test.dart +++ b/pkg/analysis_server/test/src/cider/fixes_test.dart
@@ -48,7 +48,7 @@ '''); // The file was resolved only once, even though we have 2 errors. - expect(fileResolver.testView!.resolvedFiles, [convertPath(testPath)]); + expect(fileResolver.testView!.resolvedLibraries, [convertPath(testPath)]); } Future<void> test_createMethod() async {
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart index 4743b03..c7726fb 100644 --- a/pkg/analyzer/lib/src/dart/analysis/driver.dart +++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -80,7 +80,7 @@ /// TODO(scheglov) Clean up the list of implicitly analyzed files. class AnalysisDriver implements AnalysisDriverGeneric { /// The version of data format, should be incremented on every format change. - static const int DATA_VERSION = 162; + static const int DATA_VERSION = 161; /// The number of exception contexts allowed to write. Once this field is /// zero, we stop writing any new exception contexts in this process.
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart index a1800cd..666d9be 100644 --- a/pkg/analyzer/lib/src/dart/element/element.dart +++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -969,13 +969,6 @@ @override LineInfo? lineInfo; - /// The path of the file which is derived from the [source], and in addition - /// to source declarations contains also declarations added by running - /// macro(s). - /// - /// Might be `null` if there is no corresponding macro-produced file. - String? macroPath; - /// The source of the library containing this compilation unit. /// /// This is the same as the source of the containing [LibraryElement], @@ -2368,16 +2361,6 @@ /// children of this element's parent. String get identifier => name!; - /// Return `true` if this element was created from a declaration that - /// exists in a macro-generated code, but not in the source code. - bool get isFromMacro { - return hasModifier(Modifier.IS_FROM_MACRO); - } - - set isFromMacro(bool isFromMacro) { - setModifier(Modifier.IS_FROM_MACRO, isFromMacro); - } - bool get isNonFunctionTypeAliasesEnabled { return library!.featureSet.isEnabled(Feature.nonfunction_type_aliases); } @@ -4298,26 +4281,23 @@ /// type being referred to is the return type. static const Modifier IMPLICIT_TYPE = Modifier('IMPLICIT_TYPE', 16); - /// Indicates that this element was created from macro-generated code. - static const Modifier IS_FROM_MACRO = Modifier('IS_FROM_MACRO', 17); - /// Indicates that modifier 'lazy' was applied to the element. - static const Modifier LATE = Modifier('LATE', 18); + static const Modifier LATE = Modifier('LATE', 17); /// Indicates that a class is a mixin application. - static const Modifier MIXIN_APPLICATION = Modifier('MIXIN_APPLICATION', 19); + static const Modifier MIXIN_APPLICATION = Modifier('MIXIN_APPLICATION', 18); /// Indicates that the pseudo-modifier 'set' was applied to the element. - static const Modifier SETTER = Modifier('SETTER', 20); + static const Modifier SETTER = Modifier('SETTER', 19); /// Indicates that the modifier 'static' was applied to the element. - static const Modifier STATIC = Modifier('STATIC', 21); + static const Modifier STATIC = Modifier('STATIC', 20); /// Indicates that the element does not appear in the source code but was /// implicitly created. For example, if a class does not define any /// constructors, an implicit zero-argument constructor will be created and it /// will be marked as being synthetic. - static const Modifier SYNTHETIC = Modifier('SYNTHETIC', 22); + static const Modifier SYNTHETIC = Modifier('SYNTHETIC', 21); static const List<Modifier> values = [ ABSTRACT, @@ -4336,7 +4316,6 @@ HAS_INITIALIZER, HAS_PART_OF_DIRECTIVE, IMPLICIT_TYPE, - IS_FROM_MACRO, LATE, MIXIN_APPLICATION, SETTER,
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart index aa4627e..d52742b 100644 --- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart +++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -507,7 +507,7 @@ ); }); - testView?.addResolvedFile(path); + testView?.addResolvedLibrary(path); late Map<FileState, UnitAnalysisResult> results; @@ -762,13 +762,13 @@ } class FileResolverTestView { - /// The paths of files which were resolved. + /// The paths of libraries which were resolved. /// - /// The file path is added every time when it is resolved. - final List<String> resolvedFiles = []; + /// The library path is added every time when it is resolved. + final List<String> resolvedLibraries = []; - void addResolvedFile(String path) { - resolvedFiles.add(path); + void addResolvedLibrary(String path) { + resolvedLibraries.add(path); } }
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart index b4880fb..3ad6c31 100644 --- a/pkg/analyzer/lib/src/generated/error_verifier.dart +++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -518,8 +518,9 @@ _withEnclosingExecutable(element, () { _checkForInvalidModifierOnBody( node.body, CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR); - _checkForConstConstructorWithNonFinalField(node, element); - _checkForConstConstructorWithNonConstSuper(node); + if (!_checkForConstConstructorWithNonConstSuper(node)) { + _checkForConstConstructorWithNonFinalField(node, element); + } _constructorFieldsVerifier.verify(node); _checkForRedirectingConstructorErrorCodes(node); _checkForMultipleSuperInitializers(node); @@ -1851,23 +1852,40 @@ /// are no invocations of non-'const' super constructors, and that there are /// no instance variables mixed in. /// + /// Return `true` if an error is reported here, and the caller should stop + /// checking the constructor for constant-related errors. + /// /// See [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER], and /// [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD]. - void _checkForConstConstructorWithNonConstSuper( + bool _checkForConstConstructorWithNonConstSuper( ConstructorDeclaration constructor) { if (!_enclosingExecutable.isConstConstructor) { - return; + return false; } // OK, const factory, checked elsewhere if (constructor.factoryKeyword != null) { - return; + return false; } // check for mixins var instanceFields = <FieldElement>[]; for (var mixin in _enclosingClass!.mixins) { - instanceFields.addAll(mixin.element.fields - .where((field) => !field.isStatic && !field.isSynthetic)); + instanceFields.addAll(mixin.element.fields.where((field) { + if (field.isStatic) { + return false; + } + if (field.isSynthetic) { + return false; + } + // From the abstract and external fields specification: + // > An abstract instance variable declaration D is treated as an + // > abstract getter declaration and possibly an abstract setter + // > declaration. The setter is included if and only if D is non-final. + if (field.isAbstract && field.isFinal) { + return false; + } + return true; + })); } if (instanceFields.length == 1) { var field = instanceFields.single; @@ -1875,7 +1893,7 @@ CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD, constructor.returnType, ["'${field.enclosingElement.name}.${field.name}'"]); - return; + return true; } else if (instanceFields.length > 1) { var fieldNames = instanceFields .map((field) => "'${field.enclosingElement.name}.${field.name}'") @@ -1884,7 +1902,7 @@ CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELDS, constructor.returnType, [fieldNames]); - return; + return true; } // try to find and check super constructor invocation @@ -1892,26 +1910,26 @@ if (initializer is SuperConstructorInvocation) { var element = initializer.staticElement; if (element == null || element.isConst) { - return; + return false; } errorReporter.reportErrorForNode( CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER, initializer, [element.enclosingElement.displayName]); - return; + return true; } } // no explicit super constructor invocation, check default constructor var supertype = _enclosingClass!.supertype; if (supertype == null) { - return; + return false; } if (supertype.isDartCoreObject) { - return; + return false; } var unnamedConstructor = supertype.element.unnamedConstructor; if (unnamedConstructor == null || unnamedConstructor.isConst) { - return; + return false; } // default constructor is not 'const', report problem @@ -1919,6 +1937,7 @@ CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER, constructor.returnType, [supertype]); + return true; } /// Verify that if the given [constructor] declaration is 'const' then there @@ -1935,10 +1954,6 @@ if (!classElement.hasNonFinalField) { return; } - // TODO(brianwilkerson) Stop generating - // CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD when either - // CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER or - // CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD is also generated. errorReporter.reportErrorForName( CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, constructor);
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart index 73cc7f3..576627a 100644 --- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart +++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -77,8 +77,8 @@ inCompound = true; compound = node; if (node.declaredElement!.isEmptyStruct) { - _errorReporter - .reportErrorForNode(FfiCode.EMPTY_STRUCT, node, [node.name]); + _errorReporter.reportErrorForNode( + FfiCode.EMPTY_STRUCT, node.name, [node.name.name]); } if (className == _structClassName) { _validatePackedAnnotation(node.metadata); @@ -544,8 +544,8 @@ _errorReporter.reportErrorForNode( FfiCode.MUST_BE_A_SUBTYPE, node, [TPrime, F, 'asFunction']); } - _validateFfiLeafCallUsesNoHandles(node.argumentList.arguments, TPrime, - node); + _validateFfiLeafCallUsesNoHandles( + node.argumentList.arguments, TPrime, node); } _validateIsLeafIsConst(node); } @@ -637,8 +637,8 @@ } } - void _validateFfiLeafCallUsesNoHandles(NodeList<Expression> args, - DartType nativeType, AstNode errorNode) { + void _validateFfiLeafCallUsesNoHandles( + NodeList<Expression> args, DartType nativeType, AstNode errorNode) { if (args.isNotEmpty) { for (final arg in args) { if (arg is NamedExpression) { @@ -715,6 +715,8 @@ } else if (declaredType.isCompoundSubtype) { final clazz = (declaredType as InterfaceType).element; if (clazz.isEmptyStruct) { + // TODO(brianwilkerson) There are no tests for this branch. Ensure + // that the diagnostic is correct and add tests. _errorReporter .reportErrorForNode(FfiCode.EMPTY_STRUCT, node, [clazz.name]); } @@ -750,8 +752,13 @@ final DartType T = node.typeArgumentTypes![0]; if (!_isValidFfiNativeFunctionType(T)) { - _errorReporter.reportErrorForNode( - FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE, node, [T, 'fromFunction']); + AstNode errorNode = node.methodName; + var typeArgument = node.typeArguments?.arguments[0]; + if (typeArgument != null) { + errorNode = typeArgument; + } + _errorReporter.reportErrorForNode(FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE, + errorNode, [T, 'fromFunction']); return; } @@ -810,7 +817,7 @@ /// `DynamicLibrary.lookupFunction<S, F>()`. void _validateLookupFunction(MethodInvocation node) { final typeArguments = node.typeArguments?.arguments; - if (typeArguments?.length != 2) { + if (typeArguments == null || typeArguments.length != 2) { // There are other diagnostics reported against the invocation and the // diagnostics generated below might be inaccurate, so don't report them. return; @@ -820,19 +827,19 @@ final DartType S = argTypes[0]; final DartType F = argTypes[1]; if (!_isValidFfiNativeFunctionType(S)) { - final AstNode errorNode = typeArguments![0]; + final AstNode errorNode = typeArguments[0]; _errorReporter.reportErrorForNode(FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE, errorNode, [S, 'lookupFunction']); return; } if (!_validateCompatibleFunctionTypes(F, S)) { - final AstNode errorNode = typeArguments![1]; + final AstNode errorNode = typeArguments[1]; _errorReporter.reportErrorForNode( FfiCode.MUST_BE_A_SUBTYPE, errorNode, [S, F, 'lookupFunction']); } _validateIsLeafIsConst(node); - _validateFfiLeafCallUsesNoHandles(node.argumentList.arguments, S, - typeArguments![0]); + _validateFfiLeafCallUsesNoHandles( + node.argumentList.arguments, S, typeArguments[0]); } /// Validate that none of the [annotations] are from `dart:ffi`.
diff --git a/pkg/analyzer/lib/src/summary2/bundle_reader.dart b/pkg/analyzer/lib/src/summary2/bundle_reader.dart index 211a94c..4448606 100644 --- a/pkg/analyzer/lib/src/summary2/bundle_reader.dart +++ b/pkg/analyzer/lib/src/summary2/bundle_reader.dart
@@ -31,7 +31,6 @@ class BundleReader { final SummaryDataReader _reader; final Map<Uri, Uint8List> _unitsInformativeBytes; - final Map<Uri, Uint8List> _macroUnitsInformativeBytes; final Map<String, LibraryReader> libraryMap = {}; @@ -39,10 +38,8 @@ required LinkedElementFactory elementFactory, required Uint8List resolutionBytes, Map<Uri, Uint8List> unitsInformativeBytes = const {}, - Map<Uri, Uint8List> macroUnitsInformativeBytes = const {}, }) : _reader = SummaryDataReader(resolutionBytes), - _unitsInformativeBytes = unitsInformativeBytes, - _macroUnitsInformativeBytes = macroUnitsInformativeBytes { + _unitsInformativeBytes = unitsInformativeBytes { _reader.offset = _reader.bytes.length - 4 * 4; var baseResolutionOffset = _reader.readUInt32(); var librariesOffset = _reader.readUInt32(); @@ -73,7 +70,6 @@ elementFactory: elementFactory, reader: _reader, unitsInformativeBytes: _unitsInformativeBytes, - macroUnitsInformativeBytes: _macroUnitsInformativeBytes, baseResolutionOffset: baseResolutionOffset, referenceReader: referenceReader, reference: reference, @@ -88,7 +84,6 @@ ApplyConstantOffsets? applyConstantOffsets; void Function()? _readMembers; void Function()? applyInformativeDataToMembers; - void Function()? applyInformativeDataToMacroMembers; ClassElementLinkedData({ required Reference reference, @@ -111,9 +106,6 @@ applyInformativeDataToMembers?.call(); applyInformativeDataToMembers = null; - - applyInformativeDataToMacroMembers?.call(); - applyInformativeDataToMacroMembers = null; } } @@ -424,7 +416,6 @@ final LinkedElementFactory _elementFactory; final SummaryDataReader _reader; final Map<Uri, Uint8List> _unitsInformativeBytes; - final Map<Uri, Uint8List> _macroUnitsInformativeBytes; final int _baseResolutionOffset; final _ReferenceReader _referenceReader; final Reference _reference; @@ -439,7 +430,6 @@ required LinkedElementFactory elementFactory, required SummaryDataReader reader, required Map<Uri, Uint8List> unitsInformativeBytes, - required Map<Uri, Uint8List> macroUnitsInformativeBytes, required int baseResolutionOffset, required _ReferenceReader referenceReader, required Reference reference, @@ -448,7 +438,6 @@ }) : _elementFactory = elementFactory, _reader = reader, _unitsInformativeBytes = unitsInformativeBytes, - _macroUnitsInformativeBytes = macroUnitsInformativeBytes, _baseResolutionOffset = baseResolutionOffset, _referenceReader = referenceReader, _reference = reference, @@ -509,10 +498,6 @@ InformativeDataApplier(_elementFactory, _unitsInformativeBytes) .applyTo(libraryElement); - InformativeDataApplier(_elementFactory, _macroUnitsInformativeBytes, - onlyIfFromMacro: true) - .applyTo(libraryElement); - return libraryElement; } @@ -1233,7 +1218,6 @@ unitElement.uri = _reader.readOptionalStringReference(); unitElement.isSynthetic = _reader.readBool(); unitElement.sourceContent = _reader.readOptionalStringUtf8(); - unitElement.macroPath = _reader.readOptionalStringUtf8(); _readClasses(unitElement, unitReference); _readEnums(unitElement, unitReference);
diff --git a/pkg/analyzer/lib/src/summary2/bundle_writer.dart b/pkg/analyzer/lib/src/summary2/bundle_writer.dart index 35d4cce..a88940b 100644 --- a/pkg/analyzer/lib/src/summary2/bundle_writer.dart +++ b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
@@ -441,7 +441,6 @@ _sink._writeOptionalStringReference(unitElement.uri); _sink.writeBool(unitElement.isSynthetic); _sink.writeOptionalStringUtf8(unitElement.sourceContent); - _sink.writeOptionalStringUtf8(unitElement.macroPath); _resolutionSink._writeAnnotationList(unitElement.metadata); _writeList(unitElement.classes, _writeClassElement); _writeList(unitElement.enums, _writeEnumElement);
diff --git a/pkg/analyzer/lib/src/summary2/element_builder.dart b/pkg/analyzer/lib/src/summary2/element_builder.dart index 2d5d9c2..3737f6e 100644 --- a/pkg/analyzer/lib/src/summary2/element_builder.dart +++ b/pkg/analyzer/lib/src/summary2/element_builder.dart
@@ -56,21 +56,6 @@ _unitElement.typeAliases = _enclosingContext.typeAliases; } - void buildDeclarationElementsMacro(CompilationUnit? unit) { - if (unit == null) { - return; - } - - _visitPropertyFirst<TopLevelVariableDeclaration>(unit.declarations); - - _unitElement.classes = _mergeElements( - _unitElement.classes, - _enclosingContext.classes, - ); - - // TODO(scheglov) other top-level elements - } - /// Build exports and imports, metadata into [_libraryElement]. void buildLibraryElementChildren(CompilationUnit unit) { unit.directives.accept(this); @@ -987,41 +972,6 @@ node?.accept(this); } - /// Return a new list that includes [sourceElements] plus elements - /// with not yet existing names from [macroElements]. - List<T> _mergeElements<T extends Element>( - List<T> sourceElements, - List<T> macroElements, - ) { - var result = <T>[]; - - var sourceMap = <String, T>{}; - for (var element in sourceElements) { - var name = element.name; - if (name != null) { - result.add(element); - sourceMap[name] = element; - } - } - - for (var element in macroElements) { - var sourceElement = sourceMap[element.name]; - if (sourceElement == null) { - (element as ElementImpl).isFromMacro = true; - result.add(element); - } else if (sourceElement is ClassElementImpl && - element is ClassElementImpl) { - sourceElement.methods = _mergeElements( - sourceElement.methods, - element.methods, - ); - } - // TODO(scheglov) Other class members. - } - - return result; - } - Uri? _selectAbsoluteUri(NamespaceDirective directive) { var relativeUriStr = _selectRelativeUri( directive.configurations,
diff --git a/pkg/analyzer/lib/src/summary2/element_flags.dart b/pkg/analyzer/lib/src/summary2/element_flags.dart index a2bce77..e808000 100644 --- a/pkg/analyzer/lib/src/summary2/element_flags.dart +++ b/pkg/analyzer/lib/src/summary2/element_flags.dart
@@ -8,14 +8,12 @@ class ClassElementFlags { static const int _isAbstract = 1 << 0; - static const int _isFromMacro = 1 << 1; - static const int _isMixinApplication = 1 << 2; - static const int _isSimplyBounded = 1 << 3; + static const int _isMixinApplication = 1 << 1; + static const int _isSimplyBounded = 1 << 2; static void read(SummaryDataReader reader, ClassElementImpl element) { var byte = reader.readByte(); element.isAbstract = (byte & _isAbstract) != 0; - element.isFromMacro = (byte & _isFromMacro) != 0; element.isMixinApplication = (byte & _isMixinApplication) != 0; element.isSimplyBounded = (byte & _isSimplyBounded) != 0; } @@ -23,7 +21,6 @@ static void write(BufferedSink sink, ClassElementImpl element) { var result = 0; result |= element.isAbstract ? _isAbstract : 0; - result |= element.isFromMacro ? _isFromMacro : 0; result |= element.isMixinApplication ? _isMixinApplication : 0; result |= element.isSimplyBounded ? _isSimplyBounded : 0; sink.writeByte(result); @@ -164,9 +161,8 @@ static const int _isAbstract = 1 << 1; static const int _isAsynchronous = 1 << 2; static const int _isExternal = 1 << 3; - static const int _isFromMacro = 1 << 4; - static const int _isGenerator = 1 << 5; - static const int _isStatic = 1 << 6; + static const int _isGenerator = 1 << 4; + static const int _isStatic = 1 << 5; static void read(SummaryDataReader reader, MethodElementImpl element) { var byte = reader.readByte(); @@ -174,7 +170,6 @@ element.isAbstract = (byte & _isAbstract) != 0; element.isAsynchronous = (byte & _isAsynchronous) != 0; element.isExternal = (byte & _isExternal) != 0; - element.isFromMacro = (byte & _isFromMacro) != 0; element.isGenerator = (byte & _isGenerator) != 0; element.isStatic = (byte & _isStatic) != 0; } @@ -185,7 +180,6 @@ result |= element.isAbstract ? _isAbstract : 0; result |= element.isAsynchronous ? _isAsynchronous : 0; result |= element.isExternal ? _isExternal : 0; - result |= element.isFromMacro ? _isFromMacro : 0; result |= element.isGenerator ? _isGenerator : 0; result |= element.isStatic ? _isStatic : 0; sink.writeByte(result);
diff --git a/pkg/analyzer/lib/src/summary2/informative_data.dart b/pkg/analyzer/lib/src/summary2/informative_data.dart index fda2dbc..1dd1e5f 100644 --- a/pkg/analyzer/lib/src/summary2/informative_data.dart +++ b/pkg/analyzer/lib/src/summary2/informative_data.dart
@@ -55,16 +55,12 @@ class InformativeDataApplier { final LinkedElementFactory _elementFactory; - final Map<Uri, Uint8List> _unitsInformativeBytes; - - /// Apply only to elements that are from macro-generated code. - final bool _onlyIfFromMacro; + final Map<Uri, Uint8List> _unitsInformativeBytes2; InformativeDataApplier( this._elementFactory, - this._unitsInformativeBytes, { - bool onlyIfFromMacro = false, - }) : _onlyIfFromMacro = onlyIfFromMacro; + this._unitsInformativeBytes2, + ); void applyTo(LibraryElementImpl libraryElement) { if (_elementFactory.isApplyingInformativeData) { @@ -76,7 +72,7 @@ for (var i = 0; i < unitElements.length; i++) { var unitElement = unitElements[i] as CompilationUnitElementImpl; var unitUri = unitElement.source.uri; - var unitInfoBytes = _unitsInformativeBytes[unitUri]; + var unitInfoBytes = _unitsInformativeBytes2[unitUri]; if (unitInfoBytes != null) { var unitReader = SummaryDataReader(unitInfoBytes); var unitInfo = _InfoUnit(unitReader); @@ -181,37 +177,28 @@ _InfoClassDeclaration info, ) { element as ClassElementImpl; - var linkedData = element.linkedData as ClassElementLinkedData; - if (_shouldApply(element)) { - element.setCodeRange(info.codeOffset, info.codeLength); - element.nameOffset = info.nameOffset; - element.documentationComment = info.documentationComment; - _applyToTypeParameters( - element.typeParameters_unresolved, - info.typeParameters, - ); + element.setCodeRange(info.codeOffset, info.codeLength); + element.nameOffset = info.nameOffset; + element.documentationComment = info.documentationComment; + _applyToTypeParameters( + element.typeParameters_unresolved, + info.typeParameters, + ); - linkedData.applyConstantOffsets = ApplyConstantOffsets( - info.constantOffsets, - (applier) { - applier.applyToMetadata(element); - applier.applyToTypeParameters(element.typeParameters); - }, - ); - linkedData.applyInformativeDataToMembers = () { - _applyToConstructors(element.constructors, info.constructors); - _applyToFields(element.fields, info.fields); - _applyToAccessors(element.accessors, info.accessors); - _applyToMethods(element.methods, info.methods); - }; - } else { - linkedData.applyInformativeDataToMacroMembers = () { - _applyToConstructors(element.constructors, info.constructors); - _applyToFields(element.fields, info.fields); - _applyToAccessors(element.accessors, info.accessors); - _applyToMethods(element.methods, info.methods); - }; - } + var linkedData = element.linkedData as ClassElementLinkedData; + linkedData.applyConstantOffsets = ApplyConstantOffsets( + info.constantOffsets, + (applier) { + applier.applyToMetadata(element); + applier.applyToTypeParameters(element.typeParameters); + }, + ); + linkedData.applyInformativeDataToMembers = () { + _applyToConstructors(element.constructors, info.constructors); + _applyToFields(element.fields, info.fields); + _applyToAccessors(element.accessors, info.accessors); + _applyToMethods(element.methods, info.methods); + }; } void _applyToClassTypeAlias( @@ -521,10 +508,6 @@ infoList, (element, info) { element as MethodElementImpl; - if (!_shouldApply(element)) { - return; - } - element.setCodeRange(info.codeOffset, info.codeLength); element.nameOffset = info.nameOffset; element.documentationComment = info.documentationComment; @@ -644,10 +627,6 @@ }, ); } - - bool _shouldApply(ElementImpl element) { - return !_onlyIfFromMacro || element.isFromMacro; - } } class _InfoClassDeclaration {
diff --git a/pkg/analyzer/lib/src/summary2/library_builder.dart b/pkg/analyzer/lib/src/summary2/library_builder.dart index 12df589..ba1e230 100644 --- a/pkg/analyzer/lib/src/summary2/library_builder.dart +++ b/pkg/analyzer/lib/src/summary2/library_builder.dart
@@ -110,12 +110,6 @@ elementBuilder.buildLibraryElementChildren(linkingUnit.node); } elementBuilder.buildDeclarationElements(linkingUnit.node); - - ElementBuilder( - libraryBuilder: this, - unitReference: linkingUnit.reference, - unitElement: linkingUnit.element, - ).buildDeclarationElementsMacro(linkingUnit.macroNode); } _declareDartCoreDynamicNever(); } @@ -174,7 +168,6 @@ linkingUnit.node.featureSet.isEnabled(Feature.non_nullable), ); linkingUnit.node.accept(resolver); - linkingUnit.macroNode?.accept(resolver); } } @@ -253,7 +246,6 @@ var linkingUnits = <LinkingUnit>[]; for (var inputUnit in inputLibrary.units) { var unitNode = inputUnit.unit as ast.CompilationUnitImpl; - var unitMacroNode = inputUnit.macro?.unit as ast.CompilationUnitImpl?; var unitElement = CompilationUnitElementImpl(); unitElement.isSynthetic = inputUnit.isSynthetic; @@ -261,7 +253,6 @@ unitElement.lineInfo = unitNode.lineInfo; unitElement.source = inputUnit.source; unitElement.sourceContent = inputUnit.sourceContent; - unitElement.macroPath = inputUnit.macro?.path; unitElement.uri = inputUnit.partUriStr; unitElement.setCodeRange(0, unitNode.length); @@ -275,7 +266,6 @@ isDefiningUnit: isDefiningUnit, reference: unitReference, node: unitNode, - macroNode: unitMacroNode, element: unitElement, ), ); @@ -307,7 +297,6 @@ final bool isDefiningUnit; final Reference reference; final ast.CompilationUnitImpl node; - final ast.CompilationUnitImpl? macroNode; final CompilationUnitElementImpl element; LinkingUnit({ @@ -315,7 +304,6 @@ required this.isDefiningUnit, required this.reference, required this.node, - required this.macroNode, required this.element, }); }
diff --git a/pkg/analyzer/lib/src/summary2/link.dart b/pkg/analyzer/lib/src/summary2/link.dart index 3b51acc..f0b0174 100644 --- a/pkg/analyzer/lib/src/summary2/link.dart +++ b/pkg/analyzer/lib/src/summary2/link.dart
@@ -251,7 +251,6 @@ final String? sourceContent; final bool isSynthetic; final ast.CompilationUnit unit; - final LinkInputUnitMacro? macro; LinkInputUnit({ required this.partDirectiveIndex, @@ -260,7 +259,6 @@ this.sourceContent, required this.isSynthetic, required this.unit, - this.macro, }); Uri get uri => source.uri; @@ -268,19 +266,6 @@ String get uriStr => '$uri'; } -class LinkInputUnitMacro { - /// The path of the file that was parsed into [unit]. - /// We don't need complete [Source] because this file does not have a - /// separate [Uri], it is a reflection of the source file. - final String path; - final ast.CompilationUnit unit; - - LinkInputUnitMacro({ - required this.path, - required this.unit, - }); -} - class LinkResult { @Deprecated('This field is not used anymore') final Uint8List astBytes = Uint8List(0);
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart index 0944438..6e07a14 100644 --- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart +++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -673,34 +673,34 @@ var path = convertPath('/workspace/dart/test/lib/test.dart'); // No resolved files yet. - expect(fileResolver.testView!.resolvedFiles, isEmpty); + expect(fileResolver.testView!.resolvedLibraries, isEmpty); // No cached, will resolve once. expect(getTestErrors().errors, hasLength(1)); - expect(fileResolver.testView!.resolvedFiles, [path]); + expect(fileResolver.testView!.resolvedLibraries, [path]); // Has cached, will be not resolved again. expect(getTestErrors().errors, hasLength(1)); - expect(fileResolver.testView!.resolvedFiles, [path]); + expect(fileResolver.testView!.resolvedLibraries, [path]); // New resolver. // Still has cached, will be not resolved. createFileResolver(); expect(getTestErrors().errors, hasLength(1)); - expect(fileResolver.testView!.resolvedFiles, <Object>[]); + expect(fileResolver.testView!.resolvedLibraries, <Object>[]); // Change the file, new resolver. // With changed file the previously cached result cannot be used. addTestFile('var a = c;'); createFileResolver(); expect(getTestErrors().errors, hasLength(1)); - expect(fileResolver.testView!.resolvedFiles, [path]); + expect(fileResolver.testView!.resolvedLibraries, [path]); // New resolver. // Still has cached, will be not resolved. createFileResolver(); expect(getTestErrors().errors, hasLength(1)); - expect(fileResolver.testView!.resolvedFiles, <Object>[]); + expect(fileResolver.testView!.resolvedLibraries, <Object>[]); } test_getErrors_reuse_changeDependency() { @@ -716,15 +716,15 @@ var path = convertPath('/workspace/dart/test/lib/test.dart'); // No resolved files yet. - expect(fileResolver.testView!.resolvedFiles, isEmpty); + expect(fileResolver.testView!.resolvedLibraries, isEmpty); // No cached, will resolve once. expect(getTestErrors().errors, hasLength(1)); - expect(fileResolver.testView!.resolvedFiles, [path]); + expect(fileResolver.testView!.resolvedLibraries, [path]); // Has cached, will be not resolved again. expect(getTestErrors().errors, hasLength(1)); - expect(fileResolver.testView!.resolvedFiles, [path]); + expect(fileResolver.testView!.resolvedLibraries, [path]); // Change the dependency, new resolver. // The signature of the result is different. @@ -734,13 +734,13 @@ '''); createFileResolver(); expect(getTestErrors().errors, hasLength(1)); - expect(fileResolver.testView!.resolvedFiles, [path]); + expect(fileResolver.testView!.resolvedLibraries, [path]); // New resolver. // Still has cached, will be not resolved. createFileResolver(); expect(getTestErrors().errors, hasLength(1)); - expect(fileResolver.testView!.resolvedFiles, <Object>[]); + expect(fileResolver.testView!.resolvedLibraries, <Object>[]); } test_getLibraryByUri() { @@ -1060,20 +1060,20 @@ // No resolved files yet. var testView = fileResolver.testView!; - expect(testView.resolvedFiles, isEmpty); + expect(testView.resolvedLibraries, isEmpty); await resolveFile2(path); var result1 = result; // The file was resolved. - expect(testView.resolvedFiles, [path]); + expect(testView.resolvedLibraries, [path]); // The result is cached. expect(fileResolver.cachedResults, contains(path)); // Ask again, no changes, not resolved. await resolveFile2(path); - expect(testView.resolvedFiles, [path]); + expect(testView.resolvedLibraries, [path]); // The same result was returned. expect(result, same(result1)); @@ -1084,7 +1084,7 @@ // The was a change to a file, no matter which, resolve again. await resolveFile2(path); - expect(testView.resolvedFiles, [path, path]); + expect(testView.resolvedLibraries, [path, path]); // Get should get a new result. expect(result, isNot(same(result1))); @@ -1103,7 +1103,7 @@ // No resolved files yet. var testView = fileResolver.testView!; - expect(testView.resolvedFiles, isEmpty); + expect(testView.resolvedLibraries, isEmpty); fileResolver.resolve( path: b_path, @@ -1112,7 +1112,7 @@ ); // The file was resolved. - expect(testView.resolvedFiles, [a_path]); + expect(testView.resolvedLibraries, [a_path]); // The completion location was set, so not units are resolved. // So, the result should not be cached.
diff --git a/pkg/analyzer/test/src/diagnostics/const_constructor_with_mixin_with_field_test.dart b/pkg/analyzer/test/src/diagnostics/const_constructor_with_mixin_with_field_test.dart index 73e81a8..08b1904 100644 --- a/pkg/analyzer/test/src/diagnostics/const_constructor_with_mixin_with_field_test.dart +++ b/pkg/analyzer/test/src/diagnostics/const_constructor_with_mixin_with_field_test.dart
@@ -15,6 +15,37 @@ @reflectiveTest class ConstConstructorWithMixinWithFieldTest extends PubPackageResolutionTest { + test_class_instance_abstract() async { + await assertErrorsInCode(''' +mixin A { + abstract int a; +} + +class B with A { + @override + int a; + const B(this.a); +} +''', [ + error( + CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD, 77, 1), + ]); + } + + test_class_instance_abstract_final() async { + await assertNoErrorsInCode(''' +mixin A { + abstract final int a; +} + +class B with A { + @override + final int a; + const B(this.a); +} +'''); + } + test_class_instance_final() async { await assertErrorsInCode(''' class A { @@ -64,7 +95,6 @@ const B(); } ''', [ - error(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, 62, 1), error( CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD, 62, 1), ]); @@ -81,7 +111,6 @@ const B(); } ''', [ - error(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, 71, 1), error( CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELDS, 71, 1), ]); @@ -119,7 +148,6 @@ const X(); } ''', [ - error(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, 62, 1), error( CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD, 62, 1), ]);
diff --git a/pkg/analyzer/test/src/diagnostics/const_constructor_with_non_final_field_test.dart b/pkg/analyzer/test/src/diagnostics/const_constructor_with_non_final_field_test.dart index 4d4f331..0b5cf6e 100644 --- a/pkg/analyzer/test/src/diagnostics/const_constructor_with_non_final_field_test.dart +++ b/pkg/analyzer/test/src/diagnostics/const_constructor_with_non_final_field_test.dart
@@ -15,35 +15,6 @@ @reflectiveTest class ConstConstructorWithNonFinalFieldTest extends PubPackageResolutionTest { - test_mixin() async { - await assertErrorsInCode(r''' -class A { - var a; -} -class B extends Object with A { - const B(); -} -''', [ - error(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, 61, 1), - error( - CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD, 61, 1), - ]); - } - - test_super() async { - await assertErrorsInCode(r''' -class A { - var a; -} -class B extends A { - const B(); -} -''', [ - error(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, 49, 1), - error(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER, 49, 1), - ]); - } - test_this_named() async { await assertErrorsInCode(r''' class A {
diff --git a/pkg/analyzer/test/src/diagnostics/must_be_a_native_function_type_test.dart b/pkg/analyzer/test/src/diagnostics/must_be_a_native_function_type_test.dart index c46e611..ced28b0 100644 --- a/pkg/analyzer/test/src/diagnostics/must_be_a_native_function_type_test.dart +++ b/pkg/analyzer/test/src/diagnostics/must_be_a_native_function_type_test.dart
@@ -25,7 +25,7 @@ } } ''', [ - error(FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE, 89, 26), + error(FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE, 110, 1), ]); }
diff --git a/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart b/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart index ab9e982..026be64 100644 --- a/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart +++ b/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart
@@ -51,7 +51,7 @@ class S extends Struct {} class C implements S {} ''', [ - error(FfiCode.EMPTY_STRUCT, 19, 25), + error(FfiCode.EMPTY_STRUCT, 25, 1), error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 64, 1), ]); } @@ -62,7 +62,7 @@ class S extends Union {} class C implements S {} ''', [ - error(FfiCode.EMPTY_STRUCT, 19, 24), + error(FfiCode.EMPTY_STRUCT, 25, 1), error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 63, 1), ]); } @@ -76,7 +76,7 @@ class S extends Struct {} class C with S {} ''', [ - error(FfiCode.EMPTY_STRUCT, 19, 25), + error(FfiCode.EMPTY_STRUCT, 25, 1), error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 58, 1), error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH, 58, 1), ]); @@ -88,7 +88,7 @@ class S extends Union {} class C with S {} ''', [ - error(FfiCode.EMPTY_STRUCT, 19, 24), + error(FfiCode.EMPTY_STRUCT, 25, 1), error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 57, 1), error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH, 57, 1), ]);
diff --git a/pkg/analyzer/test/src/summary/element_text.dart b/pkg/analyzer/test/src/summary/element_text.dart index 982f6c8..acbd956 100644 --- a/pkg/analyzer/test/src/summary/element_text.dart +++ b/pkg/analyzer/test/src/summary/element_text.dart
@@ -269,7 +269,6 @@ void _writeClassElement(ClassElement e) { _writeIndentedLine(() { - _writeFromMacro(e); _writeIf(e.isAbstract && !e.isMixin, 'abstract '); _writeIf(!e.isSimplyBounded, 'notSimplyBounded '); @@ -471,10 +470,6 @@ _assertNonSyntheticElementSelf(e); } - void _writeFromMacro(Element e) { - _writeIf((e as ElementImpl).isFromMacro, 'fromMacro '); - } - void _writeFunctionElement(FunctionElement e) { _writeIndentedLine(() { _writeIf(e.isExternal, 'external '); @@ -546,7 +541,6 @@ void _writeMethodElement(MethodElement e) { _writeIndentedLine(() { - _writeFromMacro(e); _writeIf(e.isSynthetic, 'synthetic '); _writeIf(e.isStatic, 'static '); _writeIf(e.isAbstract, 'abstract ');
diff --git a/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart b/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart index 2466ab4..3a95b46 100644 --- a/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart +++ b/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
@@ -100,17 +100,10 @@ _addNonDartLibraries({}, inputLibraries, source); var unitsInformativeBytes = <Uri, Uint8List>{}; - var macroUnitsInformativeBytes = <Uri, Uint8List>{}; for (var inputLibrary in inputLibraries) { for (var inputUnit in inputLibrary.units) { var informativeBytes = writeUnitInformative(inputUnit.unit); unitsInformativeBytes[inputUnit.uri] = informativeBytes; - - var macroUnit = inputUnit.macro?.unit; - if (macroUnit != null) { - var informativeBytes = writeUnitInformative(macroUnit); - macroUnitsInformativeBytes[inputUnit.uri] = informativeBytes; - } } } @@ -145,7 +138,6 @@ BundleReader( elementFactory: elementFactory, unitsInformativeBytes: unitsInformativeBytes, - macroUnitsInformativeBytes: macroUnitsInformativeBytes, resolutionBytes: linkResult.resolutionBytes, ), ); @@ -164,31 +156,12 @@ List<LinkInputUnit> units, FeatureSet featureSet, ) { - LinkInputUnitMacro? definingUnitMacro; - { - var macroSource = sourceFactory.resolveUri( - definingSource, - definingSource.shortName.replaceAll('.dart', '.macro_dart'), - ); - var macroPath = macroSource?.fullName; - if (macroPath != null) { - var text = _readSafely(macroPath); - if (text.isNotEmpty) { - definingUnitMacro = LinkInputUnitMacro( - path: macroPath, - unit: parseText(text, featureSet), - ); - } - } - } - units.add( LinkInputUnit( partDirectiveIndex: null, source: definingSource, isSynthetic: false, unit: definingUnit, - macro: definingUnitMacro, ), );
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart index ae5fbb6..caee60d 100644 --- a/pkg/analyzer/test/src/summary/resynthesize_common.dart +++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -21246,96 +21246,6 @@ '''); } - test_macro_addClass() async { - newFile('/test.macro_dart', content: r''' -class A {} -class B {} -'''); - var library = await checkLibrary(''' -class A {} -'''); - checkElementText(library, r''' -library - definingUnit - classes - class A @6 - constructors - synthetic @-1 - fromMacro class B @17 - constructors - synthetic @-1 -'''); - _assertMacroPath( - library.definingCompilationUnit, - convertPath('/test.macro_dart'), - ); - } - - test_macro_addToClass_addMethod() async { - newFile('/test.macro_dart', content: r''' -class A { - void foo() {} - void bar(int a) {} -} -'''); - var library = await checkLibrary(''' -class A { - void foo() {} -} -'''); - checkElementText(library, r''' -library - definingUnit - classes - class A @6 - constructors - synthetic @-1 - methods - foo @17 - returnType: void - fromMacro bar @33 - parameters - requiredPositional a @41 - type: int - returnType: void -'''); - } - - test_macro_addToClass_addMethod_offsets() async { - newFile('/test.macro_dart', content: r''' -class A { - void foo() {} - void bar(int a) {} -} -'''); - var library = await checkLibrary(''' -/// shift -class A { - void foo() {} -} -'''); - // The source code has an additional comment, and offsets of the - // elements that are declared in the source correspond to the state - // of the source code, not a (slightly) out of date macro-generated code. - checkElementText(library, r''' -library - definingUnit - classes - class A @16 - documentationComment: /// shift - constructors - synthetic @-1 - methods - foo @27 - returnType: void - fromMacro bar @33 - parameters - requiredPositional a @41 - type: int - returnType: void -'''); - } - test_main_class() async { var library = await checkLibrary('class main {}'); checkElementText(library, r''' @@ -33668,11 +33578,6 @@ '''); } - void _assertMacroPath(CompilationUnitElement unitElement, String expected) { - unitElement as CompilationUnitElementImpl; - expect(unitElement.macroPath, expected); - } - void _assertTypeStr(DartType type, String expected) { var typeStr = type.getDisplayString(withNullability: true); expect(typeStr, expected);
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart index d660d94..4495763 100644 --- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart +++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
@@ -352,17 +352,15 @@ /// Generates a simple header that provides the compiler's build id. js.Comment buildGeneratedBy() { - StringBuffer flavor = new StringBuffer(); - flavor.write('fast startup emitter'); - // TODO(johnniwinther): Remove this flavor. - flavor.write(', strong'); + final flavor = StringBuffer(); + flavor.write(_options.nullSafetyMode); if (_options.trustPrimitives) flavor.write(', trust primitives'); if (_options.omitImplicitChecks) flavor.write(', omit checks'); if (_options.laxRuntimeTypeToString) { flavor.write(', lax runtime type'); } if (_options.useContentSecurityPolicy) flavor.write(', CSP'); - return new js.Comment(generatedBy(_options, flavor: '$flavor')); + return js.Comment(generatedBy(_options, flavor: '$flavor')); } js.Statement buildDeferredInitializerGlobal() {
diff --git a/pkg/front_end/lib/src/fasta/builder/class_builder.dart b/pkg/front_end/lib/src/fasta/builder/class_builder.dart index acf8fb5..8a3759b 100644 --- a/pkg/front_end/lib/src/fasta/builder/class_builder.dart +++ b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
@@ -349,8 +349,7 @@ void build(String ignore, Builder declaration) { MemberBuilder member = declaration as MemberBuilder; member.buildOutlineExpressions( - library, coreTypes, delayedActionPerformers, - clonedFunctionNodes); + library, coreTypes, delayedActionPerformers, clonedFunctionNodes); } MetadataBuilder.buildAnnotations( @@ -1131,6 +1130,10 @@ @override Constructor? lookupConstructor(Name name, {bool isSuper: false}) { + if (name.text == "new") { + name = new Name("", name.library); + } + Class? instanceClass = cls; if (isSuper) { instanceClass = instanceClass.superclass;
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart index 88490a6..37348d5 100644 --- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart +++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -1054,6 +1054,9 @@ ? "" : nameOrQualified as String; } + if (libraryBuilder.enableConstructorTearOffsInLibrary) { + suffix = suffix == "new" ? "" : suffix; + } declaration = currentClass!.constructors.local[suffix]; declaration = handleDuplicatedName(declaration, token); checkBuilder(token, declaration, nameOrQualified);
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart index 4cc93c2..a4c8a0e 100644 --- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart +++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -129,9 +129,7 @@ List<String>? popIdentifierList(int count) { if (count == 0) return null; - List<String> list = new List<String>.filled( - count, - /* dummyValue = */ ''); + List<String> list = new List<String>.filled(count, /* dummyValue = */ ''); bool isParserRecovery = false; for (int i = count - 1; i >= 0; i--) { popCharOffset(); @@ -1808,11 +1806,7 @@ checkEmpty(beginToken.charOffset); if (fieldInfos == null) return; libraryBuilder.addFields( - metadata, - modifiers, - /* isTopLevel = */ true, - type, - fieldInfos); + metadata, modifiers, /* isTopLevel = */ true, type, fieldInfos); } @override @@ -1873,11 +1867,7 @@ List<MetadataBuilder>? metadata = pop() as List<MetadataBuilder>?; if (fieldInfos == null) return; libraryBuilder.addFields( - metadata, - modifiers, - /* isTopLevel = */ false, - type, - fieldInfos); + metadata, modifiers, /* isTopLevel = */ false, type, fieldInfos); } List<FieldInfo>? popFieldInfos(int count) { @@ -2232,13 +2222,15 @@ @override void handleNewAsIdentifier(Token token) { - // TODO(johnniwinther, paulberry): disable this error when the - // "constructor-tearoffs" feature is enabled. - addProblem( - templateExperimentNotEnabled.withArguments('constructor-tearoffs', - libraryBuilder.enableConstructorTearOffsVersionInLibrary.toText()), - token.charOffset, - token.length); + if (!libraryBuilder.enableConstructorTearOffsInLibrary) { + addProblem( + templateExperimentNotEnabled.withArguments( + 'constructor-tearoffs', + libraryBuilder.enableConstructorTearOffsVersionInLibrary + .toText()), + token.charOffset, + token.length); + } } }
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart index 102a830..c4c13ce 100644 --- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart +++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -644,6 +644,9 @@ prefix = name as String; suffix = null; } + if (enableConstructorTearOffsInLibrary) { + suffix = suffix == "new" ? "" : suffix; + } if (prefix == className) { return suffix ?? ""; }
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart new file mode 100644 index 0000000..52f4e5c --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart
@@ -0,0 +1,23 @@ +// 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. + +class A { + A.new(); +} + +class B { + B(); +} + +class C { + C(); + C.new(); // Error. +} + +class D { + D.new(); + D(); // Error. +} + +main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect new file mode 100644 index 0000000..7e82eb9 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect
@@ -0,0 +1,42 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:15:3: Error: 'C' is already declared in this scope. +// C.new(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:14:3: Context: Previous declaration of 'C'. +// C(); +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:20:3: Error: 'D' is already declared in this scope. +// D(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:19:3: Context: Previous declaration of 'D'. +// D.new(); +// ^ +// +import self as self; +import "dart:core" as core; + +class A extends core::Object { + constructor •() → self::A + : super core::Object::•() + ; +} +class B extends core::Object { + constructor •() → self::B + : super core::Object::•() + ; +} +class C extends core::Object { + constructor •() → self::C + : super core::Object::•() + ; +} +class D extends core::Object { + constructor •() → self::D + : super core::Object::•() + ; +} +static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect new file mode 100644 index 0000000..7e82eb9 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect
@@ -0,0 +1,42 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:15:3: Error: 'C' is already declared in this scope. +// C.new(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:14:3: Context: Previous declaration of 'C'. +// C(); +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:20:3: Error: 'D' is already declared in this scope. +// D(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:19:3: Context: Previous declaration of 'D'. +// D.new(); +// ^ +// +import self as self; +import "dart:core" as core; + +class A extends core::Object { + constructor •() → self::A + : super core::Object::•() + ; +} +class B extends core::Object { + constructor •() → self::B + : super core::Object::•() + ; +} +class C extends core::Object { + constructor •() → self::C + : super core::Object::•() + ; +} +class D extends core::Object { + constructor •() → self::D + : super core::Object::•() + ; +} +static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect new file mode 100644 index 0000000..e970626 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect
@@ -0,0 +1,15 @@ +class A { + A.new(); +} +class B { + B(); +} +class C { + C(); + C.new(); +} +class D { + D.new(); + D(); +} +main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.expect new file mode 100644 index 0000000..7e82eb9 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.expect
@@ -0,0 +1,42 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:15:3: Error: 'C' is already declared in this scope. +// C.new(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:14:3: Context: Previous declaration of 'C'. +// C(); +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:20:3: Error: 'D' is already declared in this scope. +// D(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:19:3: Context: Previous declaration of 'D'. +// D.new(); +// ^ +// +import self as self; +import "dart:core" as core; + +class A extends core::Object { + constructor •() → self::A + : super core::Object::•() + ; +} +class B extends core::Object { + constructor •() → self::B + : super core::Object::•() + ; +} +class C extends core::Object { + constructor •() → self::C + : super core::Object::•() + ; +} +class D extends core::Object { + constructor •() → self::D + : super core::Object::•() + ; +} +static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.outline.expect new file mode 100644 index 0000000..47a2971 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.outline.expect
@@ -0,0 +1,39 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:15:3: Error: 'C' is already declared in this scope. +// C.new(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:14:3: Context: Previous declaration of 'C'. +// C(); +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:20:3: Error: 'D' is already declared in this scope. +// D(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:19:3: Context: Previous declaration of 'D'. +// D.new(); +// ^ +// +import self as self; +import "dart:core" as core; + +class A extends core::Object { + constructor •() → self::A + ; +} +class B extends core::Object { + constructor •() → self::B + ; +} +class C extends core::Object { + constructor •() → self::C + ; +} +class D extends core::Object { + constructor •() → self::D + ; +} +static method main() → dynamic + ;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.transformed.expect new file mode 100644 index 0000000..7e82eb9 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.transformed.expect
@@ -0,0 +1,42 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:15:3: Error: 'C' is already declared in this scope. +// C.new(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:14:3: Context: Previous declaration of 'C'. +// C(); +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:20:3: Error: 'D' is already declared in this scope. +// D(); // Error. +// ^ +// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:19:3: Context: Previous declaration of 'D'. +// D.new(); +// ^ +// +import self as self; +import "dart:core" as core; + +class A extends core::Object { + constructor •() → self::A + : super core::Object::•() + ; +} +class B extends core::Object { + constructor •() → self::B + : super core::Object::•() + ; +} +class C extends core::Object { + constructor •() → self::C + : super core::Object::•() + ; +} +class D extends core::Object { + constructor •() → self::D + : super core::Object::•() + ; +} +static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.strong.expect index b0293c7..b589af6 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.strong.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.strong.expect
@@ -2,43 +2,20 @@ // // Problems in library: // -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// // pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:20:5: Error: Expected ';' after this. // A x3 f3(); // ^^ // -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:12:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments. -// class B extends A {} -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild, self::A::redirectingTwice]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A : super core::Object::•() ; static factory redirectingFactory() → self::A - let dynamic #redirecting_factory = "A.new" in invalid-expression; + let dynamic #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let dynamic #redirecting_factory = self::B::• in invalid-expression; static factory redirectingTwice() → self::A @@ -46,7 +23,7 @@ } class B extends self::A { synthetic constructor •() → self::B - : invalid-initializer + : super self::A::•() ; } static method test() → dynamic {
diff --git a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.strong.transformed.expect index 44e6acc..a3c5d1d 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.strong.transformed.expect
@@ -2,43 +2,20 @@ // // Problems in library: // -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// // pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:20:5: Error: Expected ';' after this. // A x3 f3(); // ^^ // -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:12:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments. -// class B extends A {} -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild, self::A::redirectingTwice]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A : super core::Object::•() ; static factory redirectingFactory() → self::A - let core::String* #redirecting_factory = "A.new" in invalid-expression; + let Never #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let Never #redirecting_factory = self::B::• in invalid-expression; static factory redirectingTwice() → self::A @@ -46,7 +23,7 @@ } class B extends self::A { synthetic constructor •() → self::B - : invalid-initializer + : super self::A::•() ; } static method test() → dynamic {
diff --git a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.expect index b0293c7..b589af6 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.expect
@@ -2,43 +2,20 @@ // // Problems in library: // -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// // pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:20:5: Error: Expected ';' after this. // A x3 f3(); // ^^ // -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:12:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments. -// class B extends A {} -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild, self::A::redirectingTwice]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A : super core::Object::•() ; static factory redirectingFactory() → self::A - let dynamic #redirecting_factory = "A.new" in invalid-expression; + let dynamic #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let dynamic #redirecting_factory = self::B::• in invalid-expression; static factory redirectingTwice() → self::A @@ -46,7 +23,7 @@ } class B extends self::A { synthetic constructor •() → self::B - : invalid-initializer + : super self::A::•() ; } static method test() → dynamic {
diff --git a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.outline.expect index b9415d3..e80d672 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.outline.expect
@@ -1,35 +1,13 @@ library /*isNonNullableByDefault*/; -// -// Problems in library: -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild, self::A::redirectingTwice]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A ; static factory redirectingFactory() → self::A - let dynamic #redirecting_factory = "A.new" in invalid-expression; + let dynamic #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let dynamic #redirecting_factory = self::B::• in invalid-expression; static factory redirectingTwice() → self::A
diff --git a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.transformed.expect index 44e6acc..a3c5d1d 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.weak.transformed.expect
@@ -2,43 +2,20 @@ // // Problems in library: // -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// // pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:20:5: Error: Expected ';' after this. // A x3 f3(); // ^^ // -// pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart:12:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments. -// class B extends A {} -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild, self::A::redirectingTwice]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A : super core::Object::•() ; static factory redirectingFactory() → self::A - let core::String* #redirecting_factory = "A.new" in invalid-expression; + let Never #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let Never #redirecting_factory = self::B::• in invalid-expression; static factory redirectingTwice() → self::A @@ -46,7 +23,7 @@ } class B extends self::A { synthetic constructor •() → self::B - : invalid-initializer + : super self::A::•() ; } static method test() → dynamic {
diff --git a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart index c8527be..5784e0a 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart +++ b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart
@@ -16,7 +16,7 @@ const C.new(this.x); } -class D extend C { +class D extends C { D(int x) : super.new(x * 2); }
diff --git a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.strong.expect index 8bde084..50ef75f8 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.strong.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.strong.expect
@@ -1,139 +1,52 @@ library /*isNonNullableByDefault*/; -// -// Problems in library: -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:9:26: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.redirecting() : this.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:16:11: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// const C.new(this.x); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:19:9: Error: Expected 'extends' instead of this. -// class D extend C { -// ^^^^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:20: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// D(int x) : super.new(x * 2); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:14: Error: Superclass has no constructor named 'Object.new'. -// D(int x) : super.new(x * 2); -// ^^^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:25:11: Error: Method not found: 'C.new'. -// const C.new(1); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:26:9: Error: Method not found: 'C.new'. -// new C.new(1); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:28:14: Error: Getter not found: 'new'. -// var f1 = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:30:14: Error: Getter not found: 'new'. -// var f3 = C.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:37:23: Error: Getter not found: 'new'. -// A Function() g1 = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:39:28: Error: Getter not found: 'new'. -// C Function(int x) g3 = C.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:12:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments. -// class B extends A {} -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A : super core::Object::•() ; constructor redirecting() → self::A - : this self::A::new() + : this self::A::•() ; static factory redirectingFactory() → self::A - let dynamic #redirecting_factory = "A.new" in invalid-expression; + let dynamic #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let dynamic #redirecting_factory = self::B::• in invalid-expression; } class B extends self::A { synthetic constructor •() → self::B - : invalid-initializer + : super self::A::•() ; } class C extends core::Object /*hasConstConstructor*/ { final field core::int x; - const constructor new(core::int x) → self::C + const constructor •(core::int x) → self::C : self::C::x = x, super core::Object::•() ; } -class D extends core::Object { +class D extends self::C { constructor •(core::int x) → self::D - : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:14: Error: Superclass has no constructor named 'Object.new'. - D(int x) : super.new(x * 2); - ^^^^^" + : super self::C::•(x.{core::num::*}(2){(core::num) → core::int}) ; } static method test() → dynamic { new self::D::•(1); - invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:25:11: Error: Method not found: 'C.new'. - const C.new(1); - ^^^"; - invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:26:9: Error: Method not found: 'C.new'. - new C.new(1); - ^^^"; - dynamic f1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:28:14: Error: Getter not found: 'new'. - var f1 = A.new; - ^^^"; - () → self::B f2 = #C1; - dynamic f3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:30:14: Error: Getter not found: 'new'. - var f3 = C.new; - ^^^"; - (core::int) → self::D f4 = #C2; - f1{dynamic}.call(); + #C2; + new self::C::•(1); + () → self::A f1 = #C3; + () → self::B f2 = #C4; + (core::int) → self::C f3 = #C5; + (core::int) → self::D f4 = #C6; + f1(){() → self::A}; f2(){() → self::B}; - f3{dynamic}.call(1); + f3(1){(core::int) → self::C}; f4(1){(core::int) → self::D}; - () → self::A g1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:37:23: Error: Getter not found: 'new'. - A Function() g1 = A.new; - ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A; - () → self::B g2 = #C1; - (core::int) → self::C g3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:39:28: Error: Getter not found: 'new'. - C Function(int x) g3 = C.new; - ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::C; - (core::int) → self::D g4 = #C2; + () → self::A g1 = #C3; + () → self::B g2 = #C4; + (core::int) → self::C g3 = #C5; + (core::int) → self::D g4 = #C6; g1(){() → self::A}; g2(){() → self::B}; g3(1){(core::int) → self::C}; @@ -142,6 +55,16 @@ static method main() → dynamic {} constants { - #C1 = constructor-tearoff self::B::• - #C2 = constructor-tearoff self::D::• + #C1 = 1 + #C2 = self::C {x:#C1} + #C3 = constructor-tearoff self::A::• + #C4 = constructor-tearoff self::B::• + #C5 = constructor-tearoff self::C::• + #C6 = constructor-tearoff self::D::• } + + +Constructor coverage from constants: +org-dartlang-testcase:///unnamed_constructor.dart: +- C. (from org-dartlang-testcase:///unnamed_constructor.dart:16:9) +- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.strong.transformed.expect index be73c25..44b6f22 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.strong.transformed.expect
@@ -1,139 +1,52 @@ library /*isNonNullableByDefault*/; -// -// Problems in library: -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:9:26: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.redirecting() : this.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:16:11: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// const C.new(this.x); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:19:9: Error: Expected 'extends' instead of this. -// class D extend C { -// ^^^^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:20: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// D(int x) : super.new(x * 2); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:14: Error: Superclass has no constructor named 'Object.new'. -// D(int x) : super.new(x * 2); -// ^^^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:25:11: Error: Method not found: 'C.new'. -// const C.new(1); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:26:9: Error: Method not found: 'C.new'. -// new C.new(1); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:28:14: Error: Getter not found: 'new'. -// var f1 = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:30:14: Error: Getter not found: 'new'. -// var f3 = C.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:37:23: Error: Getter not found: 'new'. -// A Function() g1 = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:39:28: Error: Getter not found: 'new'. -// C Function(int x) g3 = C.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:12:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments. -// class B extends A {} -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A : super core::Object::•() ; constructor redirecting() → self::A - : this self::A::new() + : this self::A::•() ; static factory redirectingFactory() → self::A - let core::String* #redirecting_factory = "A.new" in invalid-expression; + let Never #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let Never #redirecting_factory = self::B::• in invalid-expression; } class B extends self::A { synthetic constructor •() → self::B - : invalid-initializer + : super self::A::•() ; } class C extends core::Object /*hasConstConstructor*/ { final field core::int x; - const constructor new(core::int x) → self::C + const constructor •(core::int x) → self::C : self::C::x = x, super core::Object::•() ; } -class D extends core::Object { +class D extends self::C { constructor •(core::int x) → self::D - : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:14: Error: Superclass has no constructor named 'Object.new'. - D(int x) : super.new(x * 2); - ^^^^^" + : super self::C::•(x.{core::num::*}(2){(core::num) → core::int}) ; } static method test() → dynamic { new self::D::•(1); - invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:25:11: Error: Method not found: 'C.new'. - const C.new(1); - ^^^"; - invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:26:9: Error: Method not found: 'C.new'. - new C.new(1); - ^^^"; - dynamic f1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:28:14: Error: Getter not found: 'new'. - var f1 = A.new; - ^^^"; - () → self::B f2 = #C1; - dynamic f3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:30:14: Error: Getter not found: 'new'. - var f3 = C.new; - ^^^"; - (core::int) → self::D f4 = #C2; - f1{dynamic}.call(); + #C2; + new self::C::•(1); + () → self::A f1 = #C3; + () → self::B f2 = #C4; + (core::int) → self::C f3 = #C5; + (core::int) → self::D f4 = #C6; + f1(){() → self::A}; f2(){() → self::B}; - f3{dynamic}.call(1); + f3(1){(core::int) → self::C}; f4(1){(core::int) → self::D}; - () → self::A g1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:37:23: Error: Getter not found: 'new'. - A Function() g1 = A.new; - ^^^"; - () → self::B g2 = #C1; - (core::int) → self::C g3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:39:28: Error: Getter not found: 'new'. - C Function(int x) g3 = C.new; - ^^^"; - (core::int) → self::D g4 = #C2; + () → self::A g1 = #C3; + () → self::B g2 = #C4; + (core::int) → self::C g3 = #C5; + (core::int) → self::D g4 = #C6; g1(){() → self::A}; g2(){() → self::B}; g3(1){(core::int) → self::C}; @@ -142,6 +55,16 @@ static method main() → dynamic {} constants { - #C1 = constructor-tearoff self::B::• - #C2 = constructor-tearoff self::D::• + #C1 = 1 + #C2 = self::C {x:#C1} + #C3 = constructor-tearoff self::A::• + #C4 = constructor-tearoff self::B::• + #C5 = constructor-tearoff self::C::• + #C6 = constructor-tearoff self::D::• } + + +Constructor coverage from constants: +org-dartlang-testcase:///unnamed_constructor.dart: +- C. (from org-dartlang-testcase:///unnamed_constructor.dart:16:9) +- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline.expect index d70331c..3e34a96 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline.expect
@@ -9,7 +9,7 @@ final int x; const C.new(this.x); } -class D extend C { +class D extends C { D(int x) : super.new(x * 2); } test() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.expect index 8bde084..50ef75f8 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.expect
@@ -1,139 +1,52 @@ library /*isNonNullableByDefault*/; -// -// Problems in library: -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:9:26: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.redirecting() : this.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:16:11: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// const C.new(this.x); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:19:9: Error: Expected 'extends' instead of this. -// class D extend C { -// ^^^^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:20: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// D(int x) : super.new(x * 2); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:14: Error: Superclass has no constructor named 'Object.new'. -// D(int x) : super.new(x * 2); -// ^^^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:25:11: Error: Method not found: 'C.new'. -// const C.new(1); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:26:9: Error: Method not found: 'C.new'. -// new C.new(1); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:28:14: Error: Getter not found: 'new'. -// var f1 = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:30:14: Error: Getter not found: 'new'. -// var f3 = C.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:37:23: Error: Getter not found: 'new'. -// A Function() g1 = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:39:28: Error: Getter not found: 'new'. -// C Function(int x) g3 = C.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:12:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments. -// class B extends A {} -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A : super core::Object::•() ; constructor redirecting() → self::A - : this self::A::new() + : this self::A::•() ; static factory redirectingFactory() → self::A - let dynamic #redirecting_factory = "A.new" in invalid-expression; + let dynamic #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let dynamic #redirecting_factory = self::B::• in invalid-expression; } class B extends self::A { synthetic constructor •() → self::B - : invalid-initializer + : super self::A::•() ; } class C extends core::Object /*hasConstConstructor*/ { final field core::int x; - const constructor new(core::int x) → self::C + const constructor •(core::int x) → self::C : self::C::x = x, super core::Object::•() ; } -class D extends core::Object { +class D extends self::C { constructor •(core::int x) → self::D - : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:14: Error: Superclass has no constructor named 'Object.new'. - D(int x) : super.new(x * 2); - ^^^^^" + : super self::C::•(x.{core::num::*}(2){(core::num) → core::int}) ; } static method test() → dynamic { new self::D::•(1); - invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:25:11: Error: Method not found: 'C.new'. - const C.new(1); - ^^^"; - invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:26:9: Error: Method not found: 'C.new'. - new C.new(1); - ^^^"; - dynamic f1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:28:14: Error: Getter not found: 'new'. - var f1 = A.new; - ^^^"; - () → self::B f2 = #C1; - dynamic f3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:30:14: Error: Getter not found: 'new'. - var f3 = C.new; - ^^^"; - (core::int) → self::D f4 = #C2; - f1{dynamic}.call(); + #C2; + new self::C::•(1); + () → self::A f1 = #C3; + () → self::B f2 = #C4; + (core::int) → self::C f3 = #C5; + (core::int) → self::D f4 = #C6; + f1(){() → self::A}; f2(){() → self::B}; - f3{dynamic}.call(1); + f3(1){(core::int) → self::C}; f4(1){(core::int) → self::D}; - () → self::A g1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:37:23: Error: Getter not found: 'new'. - A Function() g1 = A.new; - ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A; - () → self::B g2 = #C1; - (core::int) → self::C g3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:39:28: Error: Getter not found: 'new'. - C Function(int x) g3 = C.new; - ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::C; - (core::int) → self::D g4 = #C2; + () → self::A g1 = #C3; + () → self::B g2 = #C4; + (core::int) → self::C g3 = #C5; + (core::int) → self::D g4 = #C6; g1(){() → self::A}; g2(){() → self::B}; g3(1){(core::int) → self::C}; @@ -142,6 +55,16 @@ static method main() → dynamic {} constants { - #C1 = constructor-tearoff self::B::• - #C2 = constructor-tearoff self::D::• + #C1 = 1 + #C2 = self::C {x:#C1} + #C3 = constructor-tearoff self::A::• + #C4 = constructor-tearoff self::B::• + #C5 = constructor-tearoff self::C::• + #C6 = constructor-tearoff self::D::• } + + +Constructor coverage from constants: +org-dartlang-testcase:///unnamed_constructor.dart: +- C. (from org-dartlang-testcase:///unnamed_constructor.dart:16:9) +- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.outline.expect index aa40cc6..b0b2882 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.outline.expect
@@ -1,56 +1,15 @@ library /*isNonNullableByDefault*/; -// -// Problems in library: -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:9:26: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.redirecting() : this.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:16:11: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// const C.new(this.x); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:19:9: Error: Expected 'extends' instead of this. -// class D extend C { -// ^^^^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:20: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// D(int x) : super.new(x * 2); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A ; constructor redirecting() → self::A ; static factory redirectingFactory() → self::A - let dynamic #redirecting_factory = "A.new" in invalid-expression; + let dynamic #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let dynamic #redirecting_factory = self::B::• in invalid-expression; } @@ -60,11 +19,11 @@ } class C extends core::Object /*hasConstConstructor*/ { final field core::int x; - const constructor new(core::int x) → self::C + const constructor •(core::int x) → self::C : self::C::x = x, super core::Object::•() ; } -class D extends core::Object { +class D extends self::C { constructor •(core::int x) → self::D ; }
diff --git a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.transformed.expect index be73c25..44b6f22 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.weak.transformed.expect
@@ -1,139 +1,52 @@ library /*isNonNullableByDefault*/; -// -// Problems in library: -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:6:5: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactory() = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:8:43: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// factory A.redirectingFactoryChild() = B.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:9:26: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// A.redirecting() : this.new(); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:16:11: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// const C.new(this.x); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:19:9: Error: Expected 'extends' instead of this. -// class D extend C { -// ^^^^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:20: Error: This requires the 'constructor-tearoffs' language feature to be enabled. -// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'. -// D(int x) : super.new(x * 2); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:7:36: Error: Redirection constructor target not found: 'A.new' -// factory A.redirectingFactory() = A.new; -// ^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:14: Error: Superclass has no constructor named 'Object.new'. -// D(int x) : super.new(x * 2); -// ^^^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:25:11: Error: Method not found: 'C.new'. -// const C.new(1); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:26:9: Error: Method not found: 'C.new'. -// new C.new(1); -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:28:14: Error: Getter not found: 'new'. -// var f1 = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:30:14: Error: Getter not found: 'new'. -// var f3 = C.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:37:23: Error: Getter not found: 'new'. -// A Function() g1 = A.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:39:28: Error: Getter not found: 'new'. -// C Function(int x) g3 = C.new; -// ^^^ -// -// pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:12:7: Error: The superclass, 'A', has no unnamed constructor that takes no arguments. -// class B extends A {} -// ^ -// import self as self; import "dart:core" as core; class A extends core::Object { static final field dynamic _redirecting# = <dynamic>[self::A::redirectingFactory, self::A::redirectingFactoryChild]/*isLegacy*/; - constructor new() → self::A + constructor •() → self::A : super core::Object::•() ; constructor redirecting() → self::A - : this self::A::new() + : this self::A::•() ; static factory redirectingFactory() → self::A - let core::String* #redirecting_factory = "A.new" in invalid-expression; + let Never #redirecting_factory = self::A::• in invalid-expression; static factory redirectingFactoryChild() → self::A let Never #redirecting_factory = self::B::• in invalid-expression; } class B extends self::A { synthetic constructor •() → self::B - : invalid-initializer + : super self::A::•() ; } class C extends core::Object /*hasConstConstructor*/ { final field core::int x; - const constructor new(core::int x) → self::C + const constructor •(core::int x) → self::C : self::C::x = x, super core::Object::•() ; } -class D extends core::Object { +class D extends self::C { constructor •(core::int x) → self::D - : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:20:14: Error: Superclass has no constructor named 'Object.new'. - D(int x) : super.new(x * 2); - ^^^^^" + : super self::C::•(x.{core::num::*}(2){(core::num) → core::int}) ; } static method test() → dynamic { new self::D::•(1); - invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:25:11: Error: Method not found: 'C.new'. - const C.new(1); - ^^^"; - invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:26:9: Error: Method not found: 'C.new'. - new C.new(1); - ^^^"; - dynamic f1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:28:14: Error: Getter not found: 'new'. - var f1 = A.new; - ^^^"; - () → self::B f2 = #C1; - dynamic f3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:30:14: Error: Getter not found: 'new'. - var f3 = C.new; - ^^^"; - (core::int) → self::D f4 = #C2; - f1{dynamic}.call(); + #C2; + new self::C::•(1); + () → self::A f1 = #C3; + () → self::B f2 = #C4; + (core::int) → self::C f3 = #C5; + (core::int) → self::D f4 = #C6; + f1(){() → self::A}; f2(){() → self::B}; - f3{dynamic}.call(1); + f3(1){(core::int) → self::C}; f4(1){(core::int) → self::D}; - () → self::A g1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:37:23: Error: Getter not found: 'new'. - A Function() g1 = A.new; - ^^^"; - () → self::B g2 = #C1; - (core::int) → self::C g3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart:39:28: Error: Getter not found: 'new'. - C Function(int x) g3 = C.new; - ^^^"; - (core::int) → self::D g4 = #C2; + () → self::A g1 = #C3; + () → self::B g2 = #C4; + (core::int) → self::C g3 = #C5; + (core::int) → self::D g4 = #C6; g1(){() → self::A}; g2(){() → self::B}; g3(1){(core::int) → self::C}; @@ -142,6 +55,16 @@ static method main() → dynamic {} constants { - #C1 = constructor-tearoff self::B::• - #C2 = constructor-tearoff self::D::• + #C1 = 1 + #C2 = self::C {x:#C1} + #C3 = constructor-tearoff self::A::• + #C4 = constructor-tearoff self::B::• + #C5 = constructor-tearoff self::C::• + #C6 = constructor-tearoff self::D::• } + + +Constructor coverage from constants: +org-dartlang-testcase:///unnamed_constructor.dart: +- C. (from org-dartlang-testcase:///unnamed_constructor.dart:16:9) +- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status index a8a4fb3..08d5069 100644 --- a/pkg/front_end/testcases/textual_outline.status +++ b/pkg/front_end/testcases/textual_outline.status
@@ -24,6 +24,7 @@ const_functions/const_functions_const_ctor_error: FormatterCrash const_functions/const_functions_const_factory: FormatterCrash constructor_tearoffs/explicit_instantiation_errors: FormatterCrash +constructor_tearoffs/explicit_new_as_unnamed: FormatterCrash constructor_tearoffs/generic_tearoff_with_context: FormatterCrash constructor_tearoffs/generic_tearoff_without_context: FormatterCrash constructor_tearoffs/identical_instantiated_function_tearoffs: FormatterCrash
diff --git a/runtime/bin/process_android.cc b/runtime/bin/process_android.cc index 874d99a..16955e9 100644 --- a/runtime/bin/process_android.cc +++ b/runtime/bin/process_android.cc
@@ -1109,6 +1109,7 @@ } void ProcessInfoList::Init() { + active_processes_ = NULL; ASSERT(ProcessInfoList::mutex_ == nullptr); ProcessInfoList::mutex_ = new Mutex(); } @@ -1120,6 +1121,9 @@ } void ExitCodeHandler::Init() { + running_ = false; + process_count_ = 0; + terminate_done_ = false; ASSERT(ExitCodeHandler::monitor_ == nullptr); ExitCodeHandler::monitor_ = new Monitor(); } @@ -1136,6 +1140,7 @@ ASSERT(signal_mutex == nullptr); signal_mutex = new Mutex(); + signal_handlers = NULL; ASSERT(Process::global_exit_code_mutex_ == nullptr); Process::global_exit_code_mutex_ = new Mutex();
diff --git a/runtime/bin/process_fuchsia.cc b/runtime/bin/process_fuchsia.cc index f87c28c..de4433c 100644 --- a/runtime/bin/process_fuchsia.cc +++ b/runtime/bin/process_fuchsia.cc
@@ -826,6 +826,7 @@ void Process::ClearSignalHandlerByFd(intptr_t fd, Dart_Port port) {} void ProcessInfoList::Init() { + active_processes_ = NULL; ASSERT(ProcessInfoList::mutex_ == nullptr); ProcessInfoList::mutex_ = new Mutex(); } @@ -837,6 +838,9 @@ } void ExitCodeHandler::Init() { + port_ = ZX_HANDLE_INVALID; + running_ = false; + terminate_done_ = false; ASSERT(ExitCodeHandler::monitor_ == nullptr); ExitCodeHandler::monitor_ = new Monitor(); }
diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc index c20649e..95a9c86 100644 --- a/runtime/bin/process_linux.cc +++ b/runtime/bin/process_linux.cc
@@ -1105,6 +1105,7 @@ } void ProcessInfoList::Init() { + active_processes_ = NULL; ASSERT(ProcessInfoList::mutex_ == nullptr); ProcessInfoList::mutex_ = new Mutex(); } @@ -1116,6 +1117,9 @@ } void ExitCodeHandler::Init() { + running_ = false; + process_count_ = 0; + terminate_done_ = false; ASSERT(ExitCodeHandler::monitor_ == nullptr); ExitCodeHandler::monitor_ = new Monitor(); } @@ -1132,6 +1136,7 @@ ASSERT(signal_mutex == nullptr); signal_mutex = new Mutex(); + signal_handlers = NULL; ASSERT(Process::global_exit_code_mutex_ == nullptr); Process::global_exit_code_mutex_ = new Mutex();
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc index f20c589..6bbbfae 100644 --- a/runtime/bin/process_macos.cc +++ b/runtime/bin/process_macos.cc
@@ -1141,6 +1141,7 @@ } void ProcessInfoList::Init() { + active_processes_ = NULL; ASSERT(ProcessInfoList::mutex_ == nullptr); ProcessInfoList::mutex_ = new Mutex(); } @@ -1152,6 +1153,9 @@ } void ExitCodeHandler::Init() { + running_ = false; + process_count_ = 0; + terminate_done_ = false; ASSERT(ExitCodeHandler::monitor_ == nullptr); ExitCodeHandler::monitor_ = new Monitor(); } @@ -1168,6 +1172,7 @@ ASSERT(signal_mutex == nullptr); signal_mutex = new Mutex(); + signal_handlers = NULL; ASSERT(Process::global_exit_code_mutex_ == nullptr); Process::global_exit_code_mutex_ = new Mutex();
diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc index 1e3a02c..c34b003 100644 --- a/runtime/bin/process_win.cc +++ b/runtime/bin/process_win.cc
@@ -1096,6 +1096,7 @@ } void ProcessInfoList::Init() { + active_processes_ = nullptr; ASSERT(ProcessInfoList::mutex_ == nullptr); ProcessInfoList::mutex_ = new Mutex(); } @@ -1109,11 +1110,13 @@ void Process::Init() { ProcessInfoList::Init(); + signal_handlers = NULL; ASSERT(signal_mutex == nullptr); signal_mutex = new Mutex(); ASSERT(initialized_mutex == nullptr); initialized_mutex = new Mutex(); + load_attempted = false; ASSERT(Process::global_exit_code_mutex_ == nullptr); Process::global_exit_code_mutex_ = new Mutex();
diff --git a/tests/language/const/constructor_mixin2_test.dart b/tests/language/const/constructor_mixin2_test.dart index a7bc863..873141d 100644 --- a/tests/language/const/constructor_mixin2_test.dart +++ b/tests/language/const/constructor_mixin2_test.dart
@@ -15,8 +15,6 @@ { const B(foo) : super(foo); // ^ -// [analyzer] COMPILE_TIME_ERROR.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD -// ^ // [analyzer] COMPILE_TIME_ERROR.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD // ^ // [cfe] A constant constructor can't call a non-constant super constructor.
diff --git a/tests/language_2/const/constructor_mixin2_test.dart b/tests/language_2/const/constructor_mixin2_test.dart index 5794d86..de57333 100644 --- a/tests/language_2/const/constructor_mixin2_test.dart +++ b/tests/language_2/const/constructor_mixin2_test.dart
@@ -17,8 +17,6 @@ { const B(foo) : super(foo); // ^ -// [analyzer] COMPILE_TIME_ERROR.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD -// ^ // [analyzer] COMPILE_TIME_ERROR.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD // ^ // [cfe] A constant constructor can't call a non-constant super constructor.
diff --git a/tools/VERSION b/tools/VERSION index 6197956..f4cab42 100644 --- a/tools/VERSION +++ b/tools/VERSION
@@ -27,5 +27,5 @@ MAJOR 2 MINOR 14 PATCH 0 -PRERELEASE 341 +PRERELEASE 342 PRERELEASE_PATCH 0 \ No newline at end of file