Version 3.13.0-106.0.dev Merge 0a5604c223486499e79bd3f582ac3896a02146fc into dev
diff --git a/docs/process/breaking-changes.md b/docs/process/breaking-changes.md index 6bcb00d..41420ee 100644 --- a/docs/process/breaking-changes.md +++ b/docs/process/breaking-changes.md
@@ -70,8 +70,8 @@ ### Step 1: Announcement * Create an issue in the - [Dart SDK issue tracker](https://github.com/dart-lang/sdk/issues) labelled - `breaking-change-request` containing the following: + [Dart SDK issue tracker](https://github.com/dart-lang/sdk/issues/new?template=6_breaking_change.yml) + labelled `breaking-change-request` containing the following: * The intended change in behavior.
diff --git a/pkg/analysis_server/integration_test/lsp/handle_test.dart b/pkg/analysis_server/integration_test/lsp/handle_test.dart index f6f7996..2d29c39 100644 --- a/pkg/analysis_server/integration_test/lsp/handle_test.dart +++ b/pkg/analysis_server/integration_test/lsp/handle_test.dart
@@ -32,6 +32,17 @@ /// functionality are in `test/lsp`. @reflectiveTest class LspOverLegacyRequestTest extends AbstractLspOverLegacyTest { + Future<void> test_diagnosticServer() async { + await standardAnalysisSetup(); + await analysisFinished; + + var server = await getDiagnosticServer(); + + expect(server.port, isNotNull); + expect(server.port, isNonZero); + expect(server.port, isPositive); + } + Future<void> test_error_invalidLspRequest() async { await standardAnalysisSetup(); await analysisFinished;
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart index f0d9e39..a1d2e2e 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart
@@ -8,7 +8,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart'; class DiagnosticServerHandler - extends LspMessageHandler<void, DartDiagnosticServer> { + extends SharedMessageHandler<void, DartDiagnosticServer> { DiagnosticServerHandler(super.server); @override @@ -18,6 +18,10 @@ LspJsonHandler<void> get jsonHandler => nullJsonHandler; @override + // Only allow the editors to call this, don't expose to DTD etc. + bool get requiresTrustedCaller => true; + + @override Future<ErrorOr<DartDiagnosticServer>> handle( void params, MessageInfo message,
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart index dcc073a..11611f7 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart
@@ -97,7 +97,6 @@ PrepareRenameHandler.new, RenameHandler.new, FoldingHandler.new, - DiagnosticServerHandler.new, WorkspaceDidChangeConfigurationMessageHandler.new, ReanalyzeHandler.new, SelectionRangeHandler.new, @@ -127,6 +126,7 @@ CodeActionHandler.new, CodeLensHandler.new, ConnectToDtdHandler.new, + DiagnosticServerHandler.new, DocumentColorHandler.new, DocumentColorPresentationHandler.new, DocumentHighlightsHandler.new,
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart index 75c173f..59c337f 100644 --- a/pkg/analyzer/lib/src/dart/analysis/driver.dart +++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -280,6 +280,9 @@ bool _disposed = false; + /// Whether memory-expensive data has been discarded. + bool _hasDiscardedMemoryExpensiveData = false; + /// A map that associates files to corresponding analysis options. final AnalysisOptionsMap analysisOptionsMap; @@ -676,6 +679,10 @@ } void discardMemoryExpensiveData() { + if (_hasDiscardedMemoryExpensiveData) { + return; + } + _hasDiscardedMemoryExpensiveData = true; currentSession.clearHierarchies(); libraryContext.elementFactory.discardLibraryManifestInstances(); } @@ -2757,6 +2764,8 @@ shouldDiscardMemoryExpensiveDataOnIdle) { driver.discardMemoryExpensiveData(); } + } else { + driver._hasDiscardedMemoryExpensiveData = false; } }
diff --git a/pkg/analyzer_cli/lib/src/error_formatter.dart b/pkg/analyzer_cli/lib/src/error_formatter.dart index a1fafef..68d9f71 100644 --- a/pkg/analyzer_cli/lib/src/error_formatter.dart +++ b/pkg/analyzer_cli/lib/src/error_formatter.dart
@@ -8,7 +8,6 @@ import 'package:analyzer/diagnostic/diagnostic.dart'; import 'package:analyzer/error/error.dart'; import 'package:analyzer/source/line_info.dart'; -import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart'; import 'package:analyzer_cli/src/ansi.dart'; import 'package:analyzer_cli/src/options.dart'; import 'package:path/path.dart' as path; @@ -223,6 +222,12 @@ /// be filtered. DiagnosticSeverity? _computeSeverity(Diagnostic diagnostic) => _severityProcessor(diagnostic); + + // TODO(scheglov): We should add `LineInfo` to `DiagnosticMessage`. + LineInfo _getLineInfo(ErrorsResult result, String filePath) { + var fileResult = result.session.getFile(filePath) as FileResult; + return fileResult.lineInfo; + } } class HumanErrorFormatter extends ErrorFormatter { @@ -322,23 +327,16 @@ } var contextMessages = <ContextMessage>[]; for (var message in error.contextMessages) { - // TODO(scheglov): We should add `LineInfo` to `DiagnosticMessage`. - var session = result.session.analysisContext; - if (session is DriverBasedAnalysisContext) { - var fileResult = session.driver.getFileSync(message.filePath); - if (fileResult is FileResult) { - var lineInfo = fileResult.lineInfo; - var location = lineInfo.getLocation(message.offset); - contextMessages.add( - ContextMessage( - message.filePath, - message.messageText(includeUrl: true), - location.lineNumber, - location.columnNumber, - ), - ); - } - } + var lineInfo = _getLineInfo(result, message.filePath); + var location = lineInfo.getLocation(message.offset); + contextMessages.add( + ContextMessage( + message.filePath, + message.messageText(includeUrl: true), + location.lineNumber, + location.columnNumber, + ), + ); } batchedErrors.add( @@ -413,9 +411,7 @@ var diagnostics = <Map<String, dynamic>>[]; for (var result in results) { - var errors = result.diagnostics; - var lineInfo = result.lineInfo; - for (var error in errors) { + for (var error in result.diagnostics) { var severity = _computeSeverity(error); if (severity == null) { continue; @@ -427,7 +423,7 @@ contextMessage.filePath, contextMessage.offset, contextMessage.length, - lineInfo, + _getLineInfo(result, contextMessage.filePath), ), 'message': contextMessage.messageText(includeUrl: true), }); @@ -443,7 +439,7 @@ problemMessage.filePath, problemMessage.offset, problemMessage.length, - lineInfo, + result.lineInfo, ), 'problemMessage': problemMessage.messageText(includeUrl: true), if (error.correctionMessage != null)
diff --git a/pkg/analyzer_cli/test/reporter_test.dart b/pkg/analyzer_cli/test/reporter_test.dart index 26998ca..ce59903 100644 --- a/pkg/analyzer_cli/test/reporter_test.dart +++ b/pkg/analyzer_cli/test/reporter_test.dart
@@ -34,6 +34,48 @@ await super.tearDown(); } + Future<void> test_human_contextMessage_otherFile() async { + var options = CommandLineOptions.parse(resourceProvider, [ + '--dart-sdk=${sdkRoot.path}', + '--verbose', + 'test.dart', + ])!; + var reporter = HumanErrorFormatter(out, options, stats); + + var libFile = newFile('$testPackageRootPath/lib/lib.dart', r''' +class C { + final int? foo; + C(this.foo); +} +'''); + + newFile(testFile.path, r''' +import 'lib.dart'; +void f(C c) { + if (c.foo != null) { + c.foo.isEven; + } +} +'''); + + var errorsResult = await _getErrorsResultForFile(testFile); + await reporter.formatErrors([errorsResult]); + reporter.flush(); + + expect( + out.toString().trim(), + contains( + "error • The property 'isEven' can't be unconditionally accessed because the receiver can be 'null'. • package:test/test.dart:4:11 • unchecked_use_of_nullable_value", + ), + ); + expect( + out.toString().trim(), + contains( + " 'foo' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field at ${libFile.path}:2:14", + ), + ); + } + Future<void> test_human_error() async { var options = CommandLineOptions.parse(resourceProvider, [ '--dart-sdk=${sdkRoot.path}', @@ -107,6 +149,73 @@ ); } + Future<void> test_json_contextMessage_otherFile() async { + var options = CommandLineOptions.parse(resourceProvider, [ + '--format=json', + '--dart-sdk=${sdkRoot.path}', + 'test.dart', + ])!; + var reporter = JsonErrorFormatter(out, options, stats); + + var libFile = newFile('$testPackageRootPath/lib/lib.dart', r''' +class C { + final int? foo; + C(this.foo); +} +'''); + + newFile(testFile.path, r''' +import 'lib.dart'; +void f(C c) { + if (c.foo != null) { + c.foo.isEven; + } +} +'''); + + var errorsResult = await _getErrorsResultForFile(testFile); + await reporter.formatErrors([errorsResult]); + reporter.flush(); + + var expected = { + 'version': 1, + 'diagnostics': [ + { + 'code': 'unchecked_use_of_nullable_value', + 'severity': 'ERROR', + 'type': 'COMPILE_TIME_ERROR', + 'location': { + 'file': testFile.path, + 'range': { + 'start': {'offset': 66, 'line': 4, 'column': 11}, + 'end': {'offset': 72, 'line': 4, 'column': 17}, + }, + }, + 'problemMessage': + "The property 'isEven' can't be unconditionally accessed because the receiver can be 'null'.", + 'correctionMessage': + "Try making the access conditional (using '?.') or adding a null check to the target ('!').", + 'contextMessages': [ + { + 'location': { + 'file': libFile.path, + 'range': { + 'start': {'offset': 23, 'line': 2, 'column': 14}, + 'end': {'offset': 26, 'line': 2, 'column': 17}, + }, + }, + 'message': + "'foo' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field", + }, + ], + 'documentation': + 'https://dart.dev/diagnostics/unchecked_use_of_nullable_value', + }, + ], + }; + expect(json.decode(out.toString().trim()), expected); + } + Future<void> test_json_error() async { var options = CommandLineOptions.parse(resourceProvider, [ '--format=json',
diff --git a/pkg/test_runner/lib/src/command_output.dart b/pkg/test_runner/lib/src/command_output.dart index 1023b01..97f7ae5 100644 --- a/pkg/test_runner/lib/src/command_output.dart +++ b/pkg/test_runner/lib/src/command_output.dart
@@ -625,15 +625,6 @@ ); for (var context in error.contextMessages) { - // TODO(rnystrom): Include these when static error tests get support - // for errors/context in other files. - if (context.file != error.file) { - DebugLogger.warning( - "Context messages in other files not currently supported.", - ); - continue; - } - staticError.contextMessages.add( StaticError( ErrorSource.context,
diff --git a/pkg/test_runner/lib/src/static_error.dart b/pkg/test_runner/lib/src/static_error.dart index e714a61..9036295 100644 --- a/pkg/test_runner/lib/src/static_error.dart +++ b/pkg/test_runner/lib/src/static_error.dart
@@ -4,8 +4,6 @@ import 'dart:io'; -// Only needed so that [TestFile] can be referenced in doc comments. -import 'package:collection/collection.dart' show IterableExtension; import 'package:path/path.dart' as p; import 'test_file.dart'; @@ -112,8 +110,101 @@ static List<StaticError> parseExpectations({ required String path, required String source, + }) { + var parsed = parseExpectationsUnattached(path: path, source: source); + return attachContextExpectations([parsed], rootPath: path); + } + + /// Parses static error expectations without attaching context messages. + /// + /// This is used by [TestFile] to parse a root test and its helper files + /// before resolving cross-file context relationships. + static ParsedStaticErrorExpectations parseExpectationsUnattached({ + required String path, + required String source, }) => _ErrorExpectationParser(path: path, source: source)._parse(); + /// Normalizes [path] the same way [StaticError] stores paths, so callers can + /// compare raw file paths with [path], [contextPaths], and [contextOwnerPath]. + static String normalizePath(String path) => + p.relative(path, from: Directory.current.path); + + /// Attaches parsed context messages to their owning errors. + static List<StaticError> attachContextExpectations( + Iterable<ParsedStaticErrorExpectations> parsedFiles, { + required String rootPath, + }) { + var parsedByPath = {for (var parsed in parsedFiles) parsed.path: parsed}; + + // Go through the errors in each file and attach their contexts. + var root = normalizePath(rootPath); + var errors = <StaticError>[]; + var attachedContexts = Set<StaticError>.identity(); + + for (var parsed in parsedFiles) { + errors.addAll(parsed.errors); + for (var error in parsed.errors) { + var number = parsed.numberOf(error); + if (number == null) continue; + + var hasContext = false; + var expectedContextPaths = [error.path, ...error.contextPaths]; + for (var contextPath in expectedContextPaths) { + var contextFile = parsedByPath[contextPath]; + if (contextFile == null) { + throw FormatException( + "Context file $contextPath was not parsed for numbered " + "error $number '${error.message}'.", + ); + } + + var contexts = contextFile.contextMessages.where((context) { + return contextFile.numberOf(context) == number && + context.contextOwnerPath == error.path; + }).toList(); + + if (contextPath != error.path && contexts.isEmpty) { + throw FormatException( + "No context with number $number in " + "$contextPath for '${error.message}'.", + ); + } + + for (var context in contexts) { + error.contextMessages.add(context); + attachedContexts.add(context); + hasContext = true; + } + } + + if (!hasContext) { + throw FormatException( + "Missing context for numbered error $number " + "'${error.message}'.", + ); + } + } + } + + // Make sure every context ended up associated with an error. + for (var parsed in parsedFiles) { + for (var context in parsed.contextMessages) { + if (attachedContexts.contains(context)) continue; + + var ownerPath = context.contextOwnerPath; + if (ownerPath == root || parsedByPath.containsKey(ownerPath)) { + var number = parsed.numberOf(context); + throw FormatException( + "No error with number $number for context " + "message '${context.message}'.", + ); + } + } + } + + return errors; + } + /// Determines whether all [actualErrors] match the given [expectedErrors]. /// /// If they match, returns `null`. Otherwise returns a string describing the @@ -290,6 +381,15 @@ /// Additional context messages associated with this error. final List<StaticError> contextMessages = []; + /// Additional files to search for context messages owned by this error. + final List<String> contextPaths; + + /// The path of the error that owns this context message. + /// + /// For same-file context messages this defaults to [path]. For cross-file + /// context messages this comes from the `for` clause. + final String contextOwnerPath; + /// The zero-based numbers of the lines in the [TestFile] containing comments /// that were parsed to produce this error. /// @@ -315,7 +415,11 @@ required this.column, this.length = 0, Set<int>? sourceLines, - }) : path = p.relative(path, from: Directory.current.path), + Iterable<String> contextPaths = const [], + String? contextOwnerPath, + }) : path = normalizePath(path), + contextPaths = [for (var path in contextPaths) normalizePath(path)], + contextOwnerPath = normalizePath(contextOwnerPath ?? path), sourceLines = {...?sourceLines}; /// A textual description of this error's location. @@ -383,12 +487,12 @@ if (length == 0 && other.length > 0) return 1; if (length > 0 && other.length == 0) return -1; if (length != other.length) return length.compareTo(other.length); - if (source != other.source) { return source.marker.compareTo(other.source.marker); } - return message.compareTo(other.message); + if (message != other.message) return message.compareTo(other.message); + return path.compareTo(other.path); } @override @@ -408,12 +512,7 @@ } @override - int get hashCode => - 3 * line.hashCode + - 5 * column.hashCode + - 7 * length.hashCode + - 11 * source.hashCode + - 13 * message.hashCode; + int get hashCode => Object.hash(line, column, length, source, message, path); /// Returns true if [actual]'s message matches this one. /// @@ -488,6 +587,43 @@ } } +/// Static error markers parsed from one file before context attachment. +class ParsedStaticErrorExpectations { + final String path; + final List<StaticError> errors; + final List<StaticError> contextMessages; + final Map<StaticError, int> _numbers; + + ParsedStaticErrorExpectations._({ + required String path, + required this.errors, + required this.contextMessages, + required this._numbers, + }) : path = StaticError.normalizePath(path); + + int? numberOf(StaticError error) => _numbers[error]; +} + + + +String _resolveMarkerPath(String containingPath, String markerPath) { + return p.normalize(p.join(p.dirname(containingPath), markerPath)); +} + +class _ErrorMarker { + final ErrorSource source; + final int? number; + final List<String> seePaths; + final String? forPath; + + _ErrorMarker({ + required this.source, + required this.number, + required this.seePaths, + required this.forPath, + }); +} + class _ErrorExpectationParser { /// Marks the location of an expected error, like so: /// @@ -518,10 +654,23 @@ ); /// Matches the beginning of an error message, like `// [analyzer]`. + static final _errorMessageRegExp = RegExp(r"^\s*// \[([^\]]+)\]\s*(.*)"); + + /// Matches the content inside the brackets of an error message marker. /// - /// May have an optional number like `// [cfe 32]`. - static final _errorMessageRegExp = RegExp( - r"^\s*// \[(\w+)(?:\s+(\d+))?\]\s*(.*)", + /// Examples: + /// - `analyzer` + /// - `cfe 1` + /// - `analyzer 1 see helper.dart` + /// - `context 1 for helper.dart` + /// + /// Captures: + /// 1. The source name (`analyzer`, `cfe`, `web`, `context`). + /// 2. The optional error or context number. + /// 3. The optional clause type (`see` or `for`). + /// 4. The optional path or paths in the clause. + static final _markerBodyRegExp = RegExp( + r"^(\w+)(?:\s+(\d+)(?:\s+(see|for)\s+(.+))?)?$", ); /// An analyzer error code is a dotted identifier or the magic string @@ -555,7 +704,7 @@ _ErrorExpectationParser({required this.path, required String source}) : _lines = source.split("\n"); - List<StaticError> _parse() { + ParsedStaticErrorExpectations _parse() { // Read all the lines. while (_canPeek(0)) { var sourceLine = _peek(0); @@ -593,8 +742,12 @@ _advance(); } - _attachContext(); - return _errors; + return ParsedStaticErrorExpectations._( + path: path, + errors: _errors, + contextMessages: _contextMessages, + numbers: _errorNumbers, + ); } /// Finishes parsing a series of error expectations after parsing a location. @@ -609,20 +762,32 @@ // Allow errors for multiple front-ends to share the same location marker. while (_canPeek(1)) { - var match = _errorMessageRegExp.firstMatch(_peek(1)); + var nextLine = _peek(1); + if (_explicitLocationRegExp.hasMatch(nextLine)) break; + + var match = _errorMessageRegExp.firstMatch(nextLine); if (match == null) break; - var number = match[2] != null ? int.parse(match[2]!) : null; + var marker = _parseMarker(match[1]!); + var number = marker.number; + var source = marker.source; - var sourceName = match[1]!; - var source = - ErrorSource.find(sourceName) ?? - _fail("Unknown front end '[$sourceName]'."); if (source == ErrorSource.context && number == null) { _fail("Context messages must have an error number."); } + if (source == ErrorSource.context && marker.seePaths.isNotEmpty) { + _fail("Context messages cannot have a 'see' clause."); + } + if (source != ErrorSource.context && marker.forPath != null) { + _fail("Only context messages can have a 'for' clause."); + } + if (source != ErrorSource.context && + marker.seePaths.isNotEmpty && + number == null) { + _fail("Only numbered errors can have a 'see' clause."); + } - var message = StringBuffer(match[3]!); + var message = StringBuffer(match[2]!); _advance(); var sourceLines = {locationLine, _currentLine}; @@ -650,6 +815,12 @@ column: column, length: errorLength, sourceLines: sourceLines, + contextPaths: marker.seePaths.map( + (path) => _resolveMarkerPath(this.path, path), + ), + contextOwnerPath: marker.forPath == null + ? null + : _resolveMarkerPath(this.path, marker.forPath!), ); if (number != null) { @@ -680,41 +851,27 @@ } } - /// Attach context messages to their errors and validate that everything lines - /// up. - void _attachContext() { - for (var contextMessage in _contextMessages) { - var number = _errorNumbers[contextMessage]; + /// Parses the content inside the brackets of an error message marker. + /// + /// See [_markerBodyRegExp] for the expected format and examples. + _ErrorMarker _parseMarker(String body) { + var match = _markerBodyRegExp.firstMatch(body.trim()); + if (match == null) _fail("Invalid error marker '[$body]'."); - var error = _errors.firstWhereOrNull( - (error) => _errorNumbers[error] == number, - ); - if (error == null) { - throw FormatException( - "No error with number $number for context " - "message '${contextMessage.message}'.", - ); - } - - error.contextMessages.add(contextMessage); - } - - // Make sure every numbered error does have some context, otherwise the - // number is pointless. - for (var error in _errors) { - var number = _errorNumbers[error]; - if (number == null) continue; - - var hasContext = _contextMessages.any( - (context) => _errorNumbers[context] == number, - ); - if (!hasContext) { - throw FormatException( - "Missing context for numbered error $number " - "'${error.message}'.", - ); - } - } + var sourceName = match[1]!; + var source = + ErrorSource.find(sourceName) ?? + _fail("Unknown front end '[$sourceName]'."); + var clause = match[3]; + var clauseValue = match[4]; + return _ErrorMarker( + source: source, + number: match[2] == null ? null : int.parse(match[2]!), + seePaths: clause == 'see' + ? clauseValue!.split(',').map((path) => path.trim()).toList() + : const [], + forPath: clause == 'for' ? clauseValue!.trim() : null, + ); } bool _canPeek(int offset) => _currentLine + offset < _lines.length;
diff --git a/pkg/test_runner/lib/src/test_file.dart b/pkg/test_runner/lib/src/test_file.dart index 4002ea7..154150f 100644 --- a/pkg/test_runner/lib/src/test_file.dart +++ b/pkg/test_runner/lib/src/test_file.dart
@@ -377,22 +377,40 @@ /// Parse expectations from the file with [path]. /// /// Recurses to follow local (not `dart:` or `package:`) imports. - static List<StaticError> _parseExpectations( + static List<StaticError> _parseExpectations(String path) { + var parsed = <ParsedStaticErrorExpectations>[]; + _parseExpectationFiles(path, parsed: parsed); + return StaticError.attachContextExpectations(parsed, rootPath: path); + } + + /// Recursively parses expectation files starting from [path]. + /// + /// This follows local imports and explicit context paths in errors to find + /// all files that might contain expectations for the test. + /// + /// [parsed] accumulates the results. [alreadyParsed] is used to prevent + /// infinite recursion in case of circular references. + static void _parseExpectationFiles( String path, { + required List<ParsedStaticErrorExpectations> parsed, Set<String>? alreadyParsed, }) { alreadyParsed ??= {}; var file = File(path); var pathUri = Uri.parse(path); // Missing files set no expectations. - if (!file.existsSync()) return []; + if (!file.existsSync()) return; // Catch import loops. - if (!alreadyParsed.add(pathUri.toString())) return []; + if (!alreadyParsed.add(StaticError.normalizePath(path))) return; // Parse one file. var contents = File(path).readAsStringSync(); - var result = StaticError.parseExpectations(path: path, source: contents); + var result = StaticError.parseExpectationsUnattached( + path: path, + source: contents, + ); + parsed.add(result); // Parse imports and recurse. var matches = _localFileRegExp.allMatches(contents); @@ -401,11 +419,22 @@ // Broken import paths set no expectations. if (localPath == null) continue; var uriString = pathUri.resolve(localPath.path).toString(); - result.addAll( - _parseExpectations(uriString, alreadyParsed: alreadyParsed), + _parseExpectationFiles( + uriString, + parsed: parsed, + alreadyParsed: alreadyParsed, ); } - return result; + + for (var error in result.errors) { + for (var contextPath in error.contextPaths) { + _parseExpectationFiles( + contextPath, + parsed: parsed, + alreadyParsed: alreadyParsed, + ); + } + } } /// A special fake test file for representing a VM unit test written in C++.
diff --git a/pkg/test_runner/lib/src/update_errors.dart b/pkg/test_runner/lib/src/update_errors.dart index d2fa5bc..f0e9220 100644 --- a/pkg/test_runner/lib/src/update_errors.dart +++ b/pkg/test_runner/lib/src/update_errors.dart
@@ -1,6 +1,8 @@ // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'package:path/path.dart' as p; + import 'static_error.dart'; /// Matches end of leading indentation in a line. @@ -25,12 +27,27 @@ List<StaticError> errors, { Set<ErrorSource> remove = const {}, bool includeContext = false, + String? contextOwnerPath, + Iterable<String> contextOwnerPaths = const [], }) { + var currentPath = StaticError.normalizePath(path); + var normalizedContextOwnerPaths = { + if (contextOwnerPath != null) StaticError.normalizePath(contextOwnerPath), + for (var path in contextOwnerPaths) StaticError.normalizePath(path), + }; + var inputErrors = errors; + var inputHasErrorsForCurrentPath = inputErrors.any( + (error) => + error.path == currentPath || + error.contextMessages.any((context) => context.path == currentPath), + ); + // Split the existing errors into kept and deleted lists. - var existingErrors = StaticError.parseExpectations( + var existingParsed = StaticError.parseExpectationsUnattached( source: source, path: path, ); + var existingErrors = _attachLocalContexts(existingParsed); var keptErrors = <StaticError>[]; var removedErrors = <StaticError>[]; for (var error in existingErrors) { @@ -67,31 +84,46 @@ } } - // Merge the new errors with the preserved ones. - errors = [...errors, ...keptErrors]; - - // Group errors by the line where they appear. - var errorMap = <int, List<StaticError>>{}; - for (var error in errors) { - // -1 to translate from one-based to zero-based index. - errorMap.putIfAbsent(error.line - 1, () => []).add(error); - - // Flatten out and include context messages. - if (includeContext) { - for (var context in error.contextMessages) { - // -1 to translate from one-based to zero-based index. - errorMap.putIfAbsent(context.line - 1, () => []).add(context); + if (normalizedContextOwnerPaths.isNotEmpty) { + for (var context in existingParsed.contextMessages) { + if (normalizedContextOwnerPaths.contains(context.contextOwnerPath)) { + context.sourceLines.forEach(removeLine); } } } - // If there are multiple errors on the same line, order them - // deterministically. - for (var errorList in errorMap.values) { - errorList.sort(); + // Merge the new errors with the preserved ones. + errors = [...inputErrors, ...keptErrors]; + + // Group errors by the line where they appear. + var errorMap = <int, List<StaticError>>{}; + for (var error in errors) { + if (error.path == currentPath || + (!inputHasErrorsForCurrentPath && inputErrors.contains(error))) { + // -1 to translate from one-based to zero-based index. + errorMap.putIfAbsent(error.line - 1, () => []).add(error); + } + + // Flatten out and include context messages. + if (includeContext) { + for (var context in error.contextMessages) { + if (context.path == currentPath || + (!inputHasErrorsForCurrentPath && inputErrors.contains(error))) { + // -1 to translate from one-based to zero-based index. + errorMap.putIfAbsent(context.line - 1, () => []).add(context); + } + } + } } - var errorNumbers = _numberErrors(errors); + var errorNumbers = _ErrorNumbers(errors); + + // If there are multiple errors on the same line, order them + // deterministically. Context messages that share a location are ordered by + // their numeric context number, not by message text. + for (var errorList in errorMap.values) { + errorList.sort((a, b) => _compareErrors(a, b, errorNumbers)); + } // Rebuild the source file a line at a time. var previousIndent = 0; @@ -156,6 +188,23 @@ var line = "$comment [${error.source.marker}"; if (includeContext && errorNumbers.containsKey(error)) { line += " ${errorNumbers[error]}"; + if (error.isContext) { + var owner = errorNumbers.ownerOf(error); + if (owner != null && owner.path != error.path) { + line += " for ${_markerPath(from: error.path, to: owner.path)}"; + } + } else { + var contextPaths = { + for (var contextMessage in error.contextMessages) + if (contextMessage.path != error.path) contextMessage.path, + }; + if (contextPaths.isNotEmpty) { + line += + " see ${contextPaths.map((path) { + return _markerPath(from: error.path, to: path); + }).join(', ')}"; + } + } } line += "] ${errorLines[0]}"; result.add(line); @@ -177,27 +226,86 @@ return result.join("\n"); } -/// Assigns unique numbers to all [errors] that have context messages, as well -/// as their context messages. -Map<StaticError, int> _numberErrors(List<StaticError> errors) { - // Note: if the same context message appears multiple times at the same - // location, there will be distinct (non-identical) StaticError instances - // that compare equal. We use `Map.identity` to ensure that we can associate - // each with its own context number. - var result = Map<StaticError, int>.identity(); - var number = 1; - for (var error in errors) { - if (error.contextMessages.isEmpty) continue; - - result[error] = number; - for (var context in error.contextMessages) { - result[context] = number; +int _compareErrors(StaticError a, StaticError b, _ErrorNumbers errorNumbers) { + if (a.isContext && b.isContext) { + var aNumber = errorNumbers[a]; + var bNumber = errorNumbers[b]; + if (aNumber != null && bNumber != null && aNumber != bNumber) { + return aNumber.compareTo(bNumber); } - - number++; } - return result; + return a.compareTo(b); +} + +List<StaticError> _attachLocalContexts(ParsedStaticErrorExpectations parsed) { + for (var error in parsed.errors) { + var number = parsed.numberOf(error); + if (number == null) continue; + + for (var context in parsed.contextMessages) { + if (parsed.numberOf(context) == number && + context.contextOwnerPath == error.path && + context.path == error.path) { + error.contextMessages.add(context); + } + } + } + + return parsed.errors; +} + +String _markerPath({required String from, required String to}) { + return p.relative(to, from: p.dirname(from)).replaceAll(r'\', '/'); +} + +/// Manages the assignment of numeric IDs to errors and their context messages. +/// +/// When updating error expectations, errors that have context messages +/// are assigned numbers to link them together (e.g., `[analyzer 1]`). This +/// class tracks those assignments. +/// +/// Note: if the same context message appears multiple times at the same +/// location, there will be distinct (non-identical) [StaticError] instances +/// that compare equal. We use [Map.identity] to ensure that we can associate +/// each with its own context number. +class _ErrorNumbers { + final _numbers = Map<StaticError, int>.identity(); + final _owners = Map<StaticError, StaticError>.identity(); + + /// Assigns unique numbers to all [errors] that have context messages, as well + /// as their context messages. + factory _ErrorNumbers(List<StaticError> errors) { + var result = _ErrorNumbers._(); + + var nextNumberByOwner = <String, int>{}; + for (var error in errors) { + if (error.contextMessages.isEmpty) continue; + + var number = nextNumberByOwner.update( + error.path, + (number) => number + 1, + ifAbsent: () => 1, + ); + + result._numbers[error] = number; + + for (var context in error.contextMessages) { + result._numbers[context] = number; + result._owners[context] = error; + } + } + + return result; + } + + _ErrorNumbers._(); + + bool containsKey(StaticError error) => _numbers.containsKey(error); + + int? operator [](StaticError error) => _numbers[error]; + + StaticError? ownerOf(StaticError context) => _owners[context]; } /// Returns the number of characters of leading spaces in [line].
diff --git a/pkg/test_runner/test/parse_error_test.dart b/pkg/test_runner/test/parse_error_test.dart index 19d82be..6b90acc 100644 --- a/pkg/test_runner/test/parse_error_test.dart +++ b/pkg/test_runner/test/parse_error_test.dart
@@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; import 'dart:io'; import 'package:expect/expect.dart'; @@ -24,12 +25,75 @@ void main() { // TODO(55202): Add general testing of CFE and analyzer error parsing. + testAnalyzerErrors(); testCfeErrors(); testDart2jsCompilerErrors(); testDart2WasmCompilerErrors(); testDevCompilerErrors(); } +void testAnalyzerErrors() { + var errors = <StaticError>[]; + AnalysisCommandOutput.parseErrors( + jsonEncode({ + 'version': 1, + 'diagnostics': [ + { + 'severity': 'ERROR', + 'type': 'COMPILE_TIME_ERROR', + 'code': 'bad', + 'problemMessage': 'Primary message.', + 'location': _location('main_test.dart', 1, 3, 2, 10), + 'contextMessages': [ + { + 'message': 'Context message.', + 'location': _location('helper.dart', 5, 7, 20, 4), + }, + ], + }, + ], + }), + errors, + ); + + Expect.equals(1, errors.length); + _checkError( + errors.single, + path: 'main_test.dart', + line: 1, + column: 3, + message: 'COMPILE_TIME_ERROR.BAD', + ); + Expect.equals(1, errors.single.contextMessages.length); + _checkError( + errors.single.contextMessages.single, + path: 'helper.dart', + line: 5, + column: 7, + message: 'Context message.', + ); +} + +Map<String, Object> _location( + String file, + int line, + int column, + int offset, + int length, +) { + return { + 'file': file, + 'range': { + 'start': {'line': line, 'column': column, 'offset': offset}, + 'end': { + 'line': line, + 'column': column + length, + 'offset': offset + length, + }, + }, + }; +} + void testCfeErrors() { _testMultipleCfeErrors(); }
diff --git a/pkg/test_runner/test/test_file_test.dart b/pkg/test_runner/test/test_file_test.dart index df7f9c1..91c9103 100644 --- a/pkg/test_runner/test/test_file_test.dart +++ b/pkg/test_runner/test/test_file_test.dart
@@ -741,6 +741,154 @@ /\/ ^^^ /\/ [cfe 1] Error. """); + + // Cross-file context messages. + { + late String rootPath; + late String helperPath; + var file = createTestFile( + path: "cross_file_test.dart", + source: """ +import 'helper.dart'; + +void f(C c) { + c.value.isEven; + /\/ ^^^^^^ + /\/ [analyzer 1 see helper.dart] Error.BAD +} +""", + additionalFiles: { + "helper.dart": """ +class C { + int? get value => 0; + /\/ ^^^^^ + /\/ [context 1 for cross_file_test.dart] Context in helper. +} +""", + }, + onPaths: (root, additionalPaths) { + rootPath = root; + helperPath = additionalPaths["helper.dart"]!; + }, + ); + Expect.listEquals([ + makeError( + path: rootPath, + line: 4, + column: 11, + length: 6, + analyzerError: "Error.BAD", + context: [ + makeError( + path: helperPath, + line: 2, + column: 12, + length: 5, + contextError: "Context in helper.", + ), + ], + ).toString(), + ], file.expectedErrors.map((error) => error.toString()).toList()); + } + + // A cross-file context owned by another root is inert. + { + var file = createTestFile( + path: "cross_file_test.dart", + source: """ +import 'helper.dart'; +""", + additionalFiles: { + "helper.dart": """ +class C { + int? get value => 0; + /\/ ^^^^^ + /\/ [context 1 for other_test.dart] Context in helper. +} +""", + }, + ); + Expect.isTrue(file.expectedErrors.isEmpty); + } + + // The cross-file relationship must be bidirectional. + expectThrowsFormatExceptionContains( + () => createTestFile( + path: "cross_file_test.dart", + source: """ +import 'helper.dart'; + +void f(C c) { + c.value.isEven; + /\/ ^^^^^^ + /\/ [analyzer 1] Error.BAD +} +""", + additionalFiles: { + "helper.dart": """ +class C { + int? get value => 0; + /\/ ^^^^^ + /\/ [context 1 for cross_file_test.dart] Context in helper. +} +""", + }, + ), + ["Missing context for numbered error 1", "Error.BAD"], + ); + + // A context owned by the root must have a matching numbered error. + expectThrowsFormatExceptionContains( + () => createTestFile( + path: "cross_file_test.dart", + source: """ +import 'helper.dart'; +""", + additionalFiles: { + "helper.dart": """ +class C { + int? get value => 0; + /\/ ^^^^^ + /\/ [context 1 for cross_file_test.dart] Context in helper. +} +""", + }, + ), + ["No error with number 1", "Context in helper."], + ); + + // A parsed `see` file must contain a matching context marker. + expectThrowsFormatExceptionContains( + () => createTestFile( + path: "cross_file_test.dart", + source: """ +bad.use; +/\/ ^^^ +/\/ [analyzer 1 see helper.dart] Error.BAD +""", + additionalFiles: { + "helper.dart": """ +class C { + int? get value => 0; +} +""", + }, + ), + ["No context with number 1", "helper.dart", "Error.BAD"], + ); + + // A `see` path must point to a parsed context file. + expectThrowsFormatExceptionContains( + () => createTestFile( + path: "cross_file_test.dart", + source: """ +bad.use; +/\/ ^^^ +/\/ [analyzer 1 see missing_helper.dart] Error.BAD +""", + ), + ["Context file", "missing_helper.dart", "was not parsed", "Error.BAD"], + ); } void testIsRuntimeTest() { @@ -883,6 +1031,22 @@ Expect.throwsFormatException(() => createTestFile(source: source)); } +void expectThrowsFormatExceptionContains( + void Function() callback, + List<String> expectedSubstrings, +) { + try { + callback(); + } on FormatException catch (error) { + for (var expectedSubstring in expectedSubstrings) { + Expect.contains(expectedSubstring, error.message); + } + return; + } + + Expect.fail("Expected a FormatException."); +} + void expectParseThrows(String source) { Expect.throws(() => createTestFile(source: source)); }
diff --git a/pkg/test_runner/test/update_errors_test.dart b/pkg/test_runner/test/update_errors_test.dart index 798d28e..1b6396f 100644 --- a/pkg/test_runner/test/update_errors_test.dart +++ b/pkg/test_runner/test/update_errors_test.dart
@@ -536,6 +536,62 @@ """, ); + // Sorts context messages by their numeric context number. + expectUpdate( + """ +var bad; + +use1; + +use2; +""", + errors: [ + makeError( + line: 3, + column: 1, + length: 4, + analyzerError: "first.error", + context: [ + makeError( + line: 1, + column: 5, + length: 3, + contextError: "zzz context.", + ), + ], + ), + makeError( + line: 5, + column: 1, + length: 4, + analyzerError: "second.error", + context: [ + makeError( + line: 1, + column: 5, + length: 3, + contextError: "aaa context.", + ), + ], + ), + ], + includeContext: true, + expected: """ +var bad; +/\/ ^^^ +/\/ [context 1] zzz context. +/\/ [context 2] aaa context. + +use1; +/\/ [error column 1, length 4] +/\/ [analyzer 1] first.error + +use2; +/\/ [error column 1, length 4] +/\/ [analyzer 2] second.error +""", + ); + // Removes context messages for removed errors. expectUpdate( """ @@ -674,6 +730,153 @@ int third = "boo"; """, ); + + // Writes cross-file context markers with bidirectional references. + var errors = [ + makeError( + path: 'main_test.dart', + line: 3, + column: 9, + length: 6, + analyzerError: "some.error", + context: [ + makeError( + path: 'helper.dart', + line: 2, + column: 12, + length: 5, + contextError: "Helper context.", + ), + ], + ), + ]; + var root = updateErrorExpectations( + 'main_test.dart', + """ +import 'helper.dart'; + +bad.use; +""", + errors, + includeContext: true, + contextOwnerPath: 'main_test.dart', + ); + Expect.stringEquals(""" +import 'helper.dart'; + +bad.use; +/\/ ^^^^^^ +/\/ [analyzer 1 see helper.dart] some.error +""", root); + var helper = updateErrorExpectations( + 'helper.dart', + """ +class C { + int? get value => 0; +} +""", + errors, + includeContext: true, + contextOwnerPath: 'main_test.dart', + ); + Expect.stringEquals(""" +class C { + int? get value => 0; + /\/ ^^^^^ + /\/ [context 1 for main_test.dart] Helper context. +} +""", helper); + + // Keeps numbers scoped to the owning root when several roots share a helper. + errors = [ + makeError( + path: 'a_test.dart', + line: 3, + column: 9, + length: 6, + analyzerError: "a.error", + context: [ + makeError( + path: 'helper.dart', + line: 2, + column: 12, + length: 5, + contextError: "Context for a.", + ), + ], + ), + makeError( + path: 'b_test.dart', + line: 3, + column: 9, + length: 6, + analyzerError: "b.error", + context: [ + makeError( + path: 'helper.dart', + line: 2, + column: 12, + length: 5, + contextError: "Context for b.", + ), + ], + ), + ]; + root = updateErrorExpectations( + 'a_test.dart', + """ +import 'helper.dart'; + +bad.use; +""", + errors, + includeContext: true, + contextOwnerPaths: {'a_test.dart', 'b_test.dart'}, + ); + Expect.stringEquals(""" +import 'helper.dart'; + +bad.use; +/\/ ^^^^^^ +/\/ [analyzer 1 see helper.dart] a.error +""", root); + var otherRoot = updateErrorExpectations( + 'b_test.dart', + """ +import 'helper.dart'; + +bad.use; +""", + errors, + includeContext: true, + contextOwnerPaths: {'a_test.dart', 'b_test.dart'}, + ); + Expect.stringEquals(""" +import 'helper.dart'; + +bad.use; +/\/ ^^^^^^ +/\/ [analyzer 1 see helper.dart] b.error +""", otherRoot); + helper = updateErrorExpectations( + 'helper.dart', + """ +class C { + int? get value => 0; +} +""", + errors, + includeContext: true, + contextOwnerPaths: {'a_test.dart', 'b_test.dart'}, + ); + Expect.stringEquals(""" +class C { + int? get value => 0; + /\/ ^^^^^ + /\/ [context 1 for a_test.dart] Context for a. + /\/ [context 1 for b_test.dart] Context for b. +} +""", helper); } void regression() {
diff --git a/pkg/test_runner/test/utils.dart b/pkg/test_runner/test/utils.dart index eb9d945..c2e3c14 100644 --- a/pkg/test_runner/test/utils.dart +++ b/pkg/test_runner/test/utils.dart
@@ -17,12 +17,23 @@ required String source, String path = "some_test.dart", String suite = "language", + Map<String, String> additionalFiles = const {}, + void Function(String rootPath, Map<String, String> additionalPaths)? onPaths, }) { var suitePath = Path(tempDir.path).append(suite); + var additionalPaths = <String, String>{}; + for (var entry in additionalFiles.entries) { + var additionalPath = suitePath.append(entry.key).toNativePath(); + additionalPaths[entry.key] = additionalPath; + File(additionalPath) + ..parent.createSync(recursive: true) + ..writeAsStringSync(entry.value); + } path = suitePath.append(path).toNativePath(); File(path) ..parent.createSync(recursive: true) ..writeAsStringSync(source); + onPaths?.call(path, additionalPaths); return TestFile.read(suitePath.absolute, path); }
diff --git a/pkg/test_runner/tool/update_static_error_tests.dart b/pkg/test_runner/tool/update_static_error_tests.dart index c888935..df94aa3 100644 --- a/pkg/test_runner/tool/update_static_error_tests.dart +++ b/pkg/test_runner/tool/update_static_error_tests.dart
@@ -165,15 +165,19 @@ } print('Updating test files...'); + var pendingUpdates = <Path, _PendingUpdate>{}; for (var testFile in testFiles) { - _updateErrors( - testFile, - [ - if (insertSources.contains(ErrorSource.analyzer)) - ...?analyzerErrors[testFile], - if (insertSources.contains(ErrorSource.cfe)) ...?cfeErrors[testFile], - if (insertSources.contains(ErrorSource.web)) ...?webErrors[testFile], - ], + _collectUpdate(pendingUpdates, testFile, [ + if (insertSources.contains(ErrorSource.analyzer)) + ...?analyzerErrors[testFile], + if (insertSources.contains(ErrorSource.cfe)) ...?cfeErrors[testFile], + if (insertSources.contains(ErrorSource.web)) ...?webErrors[testFile], + ], includeContext: includeContext); + } + + for (var update in pendingUpdates.values) { + _writeUpdate( + update, remove: removeSources, includeContext: includeContext, dryRun: dryRun, @@ -223,8 +227,7 @@ if (!file.path.endsWith(".dart")) continue; - // Canonicalize the path in the same way StaticError does, so it matches. - var f = p.relative(file.path, from: Directory.current.path); + var f = StaticError.normalizePath(file.path); var testFile = TestFile.read(Path("."), f); if (testFile.isMultitest) { @@ -531,43 +534,87 @@ return errors; } -/// Update the static error expectations in [testFile]. +/// Collect the files that need to be updated for [testFile]. /// -/// Adds [errors] to the file and removes any existing errors that are in from -/// the sources in [remove]. -/// -/// If [includeContext] is `true`, then includes context messages in the -/// resulting test. If [dryRun] is `false`, then writes the result to disk. -/// Otherwise, prints the resulting test file. -void _updateErrors( +/// Each selected root test owns a slice of any shared helper files it touches. +/// The updater analyzes all roots before rewriting, so each touched file must +/// be written once using all selected owners; otherwise newly inserted comments +/// shift the line numbers for diagnostics collected from later roots. +void _collectUpdate( + Map<Path, _PendingUpdate> pendingUpdates, TestFile testFile, List<StaticError> errors, { - required Set<ErrorSource> remove, required bool includeContext, - required bool dryRun, }) { // Error expectations can be in imported libraries or part files. Iterate // over the set of paths that is the main file path plus all paths mentioned // in expectations, updating them. - var paths = {testFile.path, for (var error in errors) Path(error.path)}; + var paths = { + testFile.path, + for (var error in errors) Path(error.path), + if (includeContext) + for (var error in errors) + for (var context in error.contextMessages) Path(context.path), + }; for (var path in paths) { - var nativePath = path.toNativePath(); - var file = File(nativePath); - var pathErrors = errors.where((e) => Path(e.path) == path).toList(); - var result = updateErrorExpectations( - nativePath, - file.readAsStringSync(), - pathErrors, - remove: remove, - includeContext: includeContext, - ); + var update = pendingUpdates.putIfAbsent(path, () => _PendingUpdate(path)); + update.contextOwnerPaths.add(testFile.path.toNativePath()); + update.addErrors(errors); + } +} - if (dryRun) { - print(result); - } else { - file.writeAsString(result); - print('- $nativePath (${_plural(pathErrors, 'error')})'); +/// Update the static error expectations in [update]. +/// +/// Adds the collected errors to the file and removes any existing errors that +/// are in from the sources in [remove]. +/// +/// If [includeContext] is `true`, then includes context messages in the +/// resulting test. If [dryRun] is `false`, then writes the result to disk. +/// Otherwise, prints the resulting test file. +void _writeUpdate( + _PendingUpdate update, { + required Set<ErrorSource> remove, + required bool includeContext, + required bool dryRun, +}) { + var path = update.path; + var nativePath = path.toNativePath(); + var file = File(nativePath); + var pathErrors = update.errors + .where( + (error) => + Path(error.path) == path || + error.contextMessages.any((context) => Path(context.path) == path), + ) + .toList(); + var result = updateErrorExpectations( + nativePath, + file.readAsStringSync(), + update.errors, + remove: remove, + includeContext: includeContext, + contextOwnerPaths: update.contextOwnerPaths, + ); + + if (dryRun) { + print(result); + } else { + file.writeAsStringSync(result); + print('- $nativePath (${_plural(pathErrors, 'error')})'); + } +} + +class _PendingUpdate { + final Path path; + final List<StaticError> errors = []; + final Set<String> contextOwnerPaths = {}; + + _PendingUpdate(this.path); + + void addErrors(List<StaticError> errors) { + for (var error in errors) { + if (!this.errors.contains(error)) this.errors.add(error); } } }
diff --git a/runtime/tests/concurrency/stress_test_list.json b/runtime/tests/concurrency/stress_test_list.json index a99aa99..740aa24 100644 --- a/runtime/tests/concurrency/stress_test_list.json +++ b/runtime/tests/concurrency/stress_test_list.json
@@ -3151,7 +3151,6 @@ "../../../tests/lib/async/future_or_type_test.dart", "../../../tests/lib/async/future_record_extension_test.dart", "../../../tests/lib/async/future_regression_48493_test.dart", - "../../../tests/lib/async/future_test.dart", "../../../tests/lib/async/future_timeout_test.dart", "../../../tests/lib/async/future_value_chain2_test.dart", "../../../tests/lib/async/future_value_chain3_test.dart",
diff --git a/tests/language/class_modifiers/base/base_class_inside_not_base_final_sealed_error_test.dart b/tests/language/class_modifiers/base/base_class_inside_not_base_final_sealed_error_test.dart index 71285ad..4d14e28 100644 --- a/tests/language/class_modifiers/base/base_class_inside_not_base_final_sealed_error_test.dart +++ b/tests/language/class_modifiers/base/base_class_inside_not_base_final_sealed_error_test.dart
@@ -6,6 +6,9 @@ // sealed. base class BaseClass {} +// ^^^^^^^^^ +// [context 1] The type 'SubtypeOfBase' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 2] The type 'SubtypeOfBase' is a subtype of 'BaseClass', and 'BaseClass' is defined here. base mixin BaseMixin {} @@ -34,7 +37,7 @@ mixin MixinImplementsIndirect implements SubtypeOfBase {} // ^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 1] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinImplementsIndirect' must be 'base' because the supertype 'BaseClass' is 'base'. class With with BaseMixin {} @@ -66,5 +69,5 @@ class IndirectSubtype extends SubtypeOfBase {} // ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 2] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'IndirectSubtype' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'.
diff --git a/tests/language/class_modifiers/base/base_class_syntax_error_test.dart b/tests/language/class_modifiers/base/base_class_syntax_error_test.dart index 7209d7e..00b4d15 100644 --- a/tests/language/class_modifiers/base/base_class_syntax_error_test.dart +++ b/tests/language/class_modifiers/base/base_class_syntax_error_test.dart
@@ -42,6 +42,7 @@ // ^^^^ // [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN // [cfe] Expected ';' after this. +// [context 1] The first definition of this name. base abstract class BaseAbstractClass {} // [error column 1, length 4] @@ -76,7 +77,7 @@ base typedef EnumTypedef = Enum; // [error column 1, length 4] -// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION +// [analyzer 1] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION // [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN // [analyzer] SYNTACTIC_ERROR.MISSING_CONST_FINAL_VAR_OR_TYPE // [cfe] 'base' is already declared in this scope.
diff --git a/tests/language/class_modifiers/base_transitivity/base_class_different_library_error_test.dart b/tests/language/class_modifiers/base_transitivity/base_class_different_library_error_test.dart index bac4c1a..e7e0599 100644 --- a/tests/language/class_modifiers/base_transitivity/base_class_different_library_error_test.dart +++ b/tests/language/class_modifiers/base_transitivity/base_class_different_library_error_test.dart
@@ -201,66 +201,66 @@ class SimpleSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 1 see shared_library_definitions.dart] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. interface class InterfaceSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 2 see shared_library_definitions.dart] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. // Implementing through a sealed class. class SimpleSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 3 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseClass' can't be implemented outside of its library because it's a base class. base class BaseSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 4 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseClass' can't be implemented outside of its library because it's a base class. interface class InterfaceSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 5 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseClass' can't be implemented outside of its library because it's a base class. final class FinalSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 6 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseClass' can't be implemented outside of its library because it's a base class. sealed class SealedSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 7 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseClass' can't be implemented outside of its library because it's a base class. mixin class MixinClassSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 8 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseClass' can't be implemented outside of its library because it's a base class. base mixin class BaseMixinClassSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 9 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseClass' can't be implemented outside of its library because it's a base class. mixin MixinSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 10 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseClass' can't be implemented outside of its library because it's a base class. base mixin BaseMixinSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 11 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseClass' can't be implemented outside of its library because it's a base class. // Using a sealed class as an `on` type mixin MixinSealedExtendOn on SealedExtend {} // ^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 12 see shared_library_definitions.dart] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinSealedExtendOn' must be 'base' because the supertype 'BaseClass' is 'base'. // Implementing via an on type (valid).
diff --git a/tests/language/class_modifiers/base_transitivity/base_class_same_library_error_test.dart b/tests/language/class_modifiers/base_transitivity/base_class_same_library_error_test.dart index 4c0d800..81218b7 100644 --- a/tests/language/class_modifiers/base_transitivity/base_class_same_library_error_test.dart +++ b/tests/language/class_modifiers/base_transitivity/base_class_same_library_error_test.dart
@@ -7,6 +7,18 @@ class SimpleClass {} base class BaseClass {} +// ^^^^^^^^^ +// [context 1] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 2] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 3] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 4] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 5] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 6] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 7] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 8] The type 'SealedImplement' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 9] The type 'SealedImplement' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 10] The type 'SealedImplement' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 11] The type 'SealedImplement' is a subtype of 'BaseClass', and 'BaseClass' is defined here. mixin _MixinOnObject {} @@ -33,41 +45,41 @@ class SimpleSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 1] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. interface class InterfaceSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 2] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. // Implementing through a sealed class. class SimpleSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 3] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedExtendImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. interface class InterfaceSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 4] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedExtendImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. mixin class MixinClassSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 5] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'MixinClassSealedExtendImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. mixin MixinSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 6] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinSealedExtendImplement' must be 'base' because the supertype 'BaseClass' is 'base'. // Using a sealed class as an `on` type mixin MixinSealedExtendOn on SealedExtend {} // ^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 7] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinSealedExtendOn' must be 'base' because the supertype 'BaseClass' is 'base'. // Extending via an anonymous mixin class. @@ -116,24 +128,24 @@ class SimpleSealedImplementExtend extends SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 8] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedImplementExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. interface class InterfaceSealedImplementExtend extends SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 9] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedImplementExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. // Implementing through a sealed class. class SimpleSealedImplementImplement implements SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 10] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedImplementImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. interface class InterfaceSealedImplementImplement implements SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 11] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedImplementImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseClass' is 'base'. // Implementing with a mixin class.
diff --git a/tests/language/class_modifiers/base_transitivity/base_mixin_class_different_library_error_test.dart b/tests/language/class_modifiers/base_transitivity/base_mixin_class_different_library_error_test.dart index 842baf5..693b1921 100644 --- a/tests/language/class_modifiers/base_transitivity/base_mixin_class_different_library_error_test.dart +++ b/tests/language/class_modifiers/base_transitivity/base_mixin_class_different_library_error_test.dart
@@ -199,66 +199,66 @@ class SimpleSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 1 see shared_library_definitions.dart] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. interface class InterfaceSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 2 see shared_library_definitions.dart] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. // Implementing through a sealed class. class SimpleSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 3 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. base class BaseSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 4 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. interface class InterfaceSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 5 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. final class FinalSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 6 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. sealed class SealedSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 7 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. mixin class MixinClassSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 8 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. base mixin class BaseMixinClassSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 9 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. mixin MixinSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 10 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. base mixin BaseMixinSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 11 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. // Using a sealed class as an `on` type mixin MixinSealedExtendOn on SealedExtend {} // ^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 12 see shared_library_definitions.dart] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinSealedExtendOn' must be 'base' because the supertype 'BaseMixinClass' is 'base'. // Implementing via an on type (valid). @@ -645,43 +645,43 @@ class SimpleSealedMixinClassApplyImplement implements SealedMixinClassApply {} // ^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 13 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. base class BaseSealedMixinClassApplyImplement implements SealedMixinClassApply {} // ^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 14 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. interface class InterfaceSealedMixinClassApplyImplement implements SealedMixinClassApply {} // ^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 15 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. final class FinalSealedMixinClassApplyImplement implements SealedMixinClassApply {} // ^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 16 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. sealed class SealedSealedMixinClassApplyImplement implements SealedMixinClassApply {} // ^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 17 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. base mixin class BaseMixinClassSealedMixinClassApplyImplement implements SealedMixinClassApply {} // ^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 18 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. base mixin BaseMixinSealedMixinClassApplyImplement implements SealedMixinClassApply {} // ^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 19 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. /// It is an error to use BaseMixinClass as a mixin application, if the result @@ -740,41 +740,41 @@ class SimpleSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 20 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. base class BaseSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 21 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. interface class InterfaceSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 22 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. final class FinalSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 23 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. sealed class SealedSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 24 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. base mixin class BaseMixinClassSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 25 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class. base mixin BaseMixinSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 26 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'BaseMixinClass' can't be implemented outside of its library because it's a base class.
diff --git a/tests/language/class_modifiers/base_transitivity/base_mixin_class_same_library_error_test.dart b/tests/language/class_modifiers/base_transitivity/base_mixin_class_same_library_error_test.dart index 9e008cb..ef7678a 100644 --- a/tests/language/class_modifiers/base_transitivity/base_mixin_class_same_library_error_test.dart +++ b/tests/language/class_modifiers/base_transitivity/base_mixin_class_same_library_error_test.dart
@@ -7,6 +7,18 @@ class SimpleClass {} base mixin class BaseMixinClass {} +// ^^^^^^^^^^^^^^ +// [context 1] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 2] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 3] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 4] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 5] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 6] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 7] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 8] The type 'SealedImplement' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 9] The type 'SealedImplement' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 10] The type 'SealedImplement' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 11] The type 'SealedImplement' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. mixin _MixinOnObject {} @@ -33,41 +45,41 @@ class SimpleSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 1] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. interface class InterfaceSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 2] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. // Implementing through a sealed class. class SimpleSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 3] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedExtendImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. interface class InterfaceSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 4] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedExtendImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. mixin class MixinClassSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 5] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'MixinClassSealedExtendImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. mixin MixinSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 6] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinSealedExtendImplement' must be 'base' because the supertype 'BaseMixinClass' is 'base'. // Using a sealed class as an `on` type mixin MixinSealedExtendOn on SealedExtend {} // ^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 7] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinSealedExtendOn' must be 'base' because the supertype 'BaseMixinClass' is 'base'. // Extending via an anonymous mixin class. @@ -119,24 +131,24 @@ class SimpleSealedImplementExtend extends SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 8] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedImplementExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. interface class InterfaceSealedImplementExtend extends SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 9] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedImplementExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. // Implementing through a sealed class. class SimpleSealedImplementImplement implements SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 10] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedImplementImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. interface class InterfaceSealedImplementImplement implements SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 11] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedImplementImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixinClass' is 'base'. // Implementing with a mixin class.
diff --git a/tests/language/class_modifiers/base_transitivity/base_mixin_different_library_error_test.dart b/tests/language/class_modifiers/base_transitivity/base_mixin_different_library_error_test.dart index 714a499..a258741 100644 --- a/tests/language/class_modifiers/base_transitivity/base_mixin_different_library_error_test.dart +++ b/tests/language/class_modifiers/base_transitivity/base_mixin_different_library_error_test.dart
@@ -289,39 +289,39 @@ class SimpleSealedMixinApplyImplement implements SealedMixinApply {} // ^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 1 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. base class BaseSealedMixinApplyImplement implements SealedMixinApply {} // ^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 2 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. interface class InterfaceSealedMixinApplyImplement implements SealedMixinApply {} // ^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 3 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. final class FinalSealedMixinApplyImplement implements SealedMixinApply {} // ^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 4 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. sealed class SealedSealedMixinApplyImplement implements SealedMixinApply {} // ^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 5 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. base mixin class BaseMixinClassSealedMixinApplyImplement implements SealedMixinApply {} // ^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 6 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. base mixin BaseMixinSealedMixinApplyImplement implements SealedMixinApply {} // ^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 7 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. /// It is an error to use BaseMixin as a mixin application, if the result @@ -377,41 +377,41 @@ class SimpleSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 8 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. base class BaseSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 9 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. interface class InterfaceSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 10 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. final class FinalSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 11 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. sealed class SealedSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 12 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. base mixin class BaseMixinClassSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 13 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin. base mixin BaseMixinSealedMixinApplicationImplement implements SealedMixinApplication {} // ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY +// [analyzer 14 see shared_library_definitions.dart] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The mixin 'BaseMixin' can't be implemented outside of its library because it's a base mixin.
diff --git a/tests/language/class_modifiers/base_transitivity/base_mixin_same_library_error_test.dart b/tests/language/class_modifiers/base_transitivity/base_mixin_same_library_error_test.dart index 0801e38..8b604cb 100644 --- a/tests/language/class_modifiers/base_transitivity/base_mixin_same_library_error_test.dart +++ b/tests/language/class_modifiers/base_transitivity/base_mixin_same_library_error_test.dart
@@ -7,6 +7,11 @@ class SimpleClass {} base mixin BaseMixin {} +// ^^^^^^^^^ +// [context 1] The type 'SealedImplement' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 2] The type 'SealedImplement' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 3] The type 'SealedImplement' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 4] The type 'SealedImplement' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. mixin _MixinOnObject {} @@ -33,24 +38,24 @@ class SimpleSealedImplementExtend extends SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 1] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedImplementExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixin' is 'base'. interface class InterfaceSealedImplementExtend extends SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 2] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedImplementExtend' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixin' is 'base'. // Implementing through a sealed class. class SimpleSealedImplementImplement implements SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 3] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedImplementImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixin' is 'base'. interface class InterfaceSealedImplementImplement implements SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 4] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedImplementImplement' must be 'base', 'final' or 'sealed' because the supertype 'BaseMixin' is 'base'. // Implementing with a mixin class.
diff --git a/tests/language/class_modifiers/base_transitivity/final_class_same_library_error_test.dart b/tests/language/class_modifiers/base_transitivity/final_class_same_library_error_test.dart index ce3e2df..d61a957 100644 --- a/tests/language/class_modifiers/base_transitivity/final_class_same_library_error_test.dart +++ b/tests/language/class_modifiers/base_transitivity/final_class_same_library_error_test.dart
@@ -7,6 +7,18 @@ class SimpleClass {} final class FinalClass {} +// ^^^^^^^^^^ +// [context 1] The type 'SealedExtend' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 2] The type 'SealedExtend' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 3] The type 'SealedExtend' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 4] The type 'SealedExtend' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 5] The type 'SealedExtend' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 6] The type 'SealedExtend' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 7] The type 'SealedExtend' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 8] The type 'SealedImplement' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 9] The type 'SealedImplement' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 10] The type 'SealedImplement' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 11] The type 'SealedImplement' is a subtype of 'FinalClass', and 'FinalClass' is defined here. mixin _MixinOnObject {} @@ -33,41 +45,41 @@ class SimpleSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 1] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'. interface class InterfaceSealedExtendExtend extends SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 2] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedExtendExtend' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'. // Implementing through a sealed class. class SimpleSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 3] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedExtendImplement' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'. interface class InterfaceSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 4] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedExtendImplement' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'. mixin class MixinClassSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 5] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'MixinClassSealedExtendImplement' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'. mixin MixinSealedExtendImplement implements SealedExtend {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 6] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinSealedExtendImplement' must be 'base' because the supertype 'FinalClass' is 'final'. // Using a sealed class as an `on` type mixin MixinSealedExtendOn on SealedExtend {} // ^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 7] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinSealedExtendOn' must be 'base' because the supertype 'FinalClass' is 'final'. // Extending via an anonymous mixin class. @@ -117,24 +129,24 @@ class SimpleSealedImplementExtend extends SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 8] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedImplementExtend' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'. interface class InterfaceSealedImplementExtend extends SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 9] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedImplementExtend' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'. // Implementing through a sealed class. class SimpleSealedImplementImplement implements SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 10] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'SimpleSealedImplementImplement' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'. interface class InterfaceSealedImplementImplement implements SealedImplement {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 11] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'InterfaceSealedImplementImplement' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'. // Implementing with a mixin class.
diff --git a/tests/language/class_modifiers/base_transitivity/shared_library_definitions.dart b/tests/language/class_modifiers/base_transitivity/shared_library_definitions.dart index fdea034..a5d31ab 100644 --- a/tests/language/class_modifiers/base_transitivity/shared_library_definitions.dart +++ b/tests/language/class_modifiers/base_transitivity/shared_library_definitions.dart
@@ -10,11 +10,66 @@ interface class InterfaceClass {} base class BaseClass {} +// ^^^^^^^^^ +// [context 1 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 2 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 3 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 4 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 5 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 6 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 7 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 8 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 9 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 10 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 11 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. +// [context 12 for base_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseClass', and 'BaseClass' is defined here. final class FinalClass {} sealed class SealedClass {} base mixin class BaseMixinClass {} +// ^^^^^^^^^^^^^^ +// [context 1 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 2 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 3 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 4 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 5 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 6 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 7 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 8 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 9 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 10 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 11 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 12 for base_mixin_class_different_library_error_test.dart] The type 'SealedExtend' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 13 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinClassApply' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 14 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinClassApply' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 15 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinClassApply' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 16 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinClassApply' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 17 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinClassApply' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 18 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinClassApply' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 19 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinClassApply' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 20 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 21 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 22 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 23 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 24 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 25 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. +// [context 26 for base_mixin_class_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixinClass', and 'BaseMixinClass' is defined here. base mixin BaseMixin {} +// ^^^^^^^^^ +// [context 1 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApply' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 2 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApply' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 3 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApply' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 4 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApply' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 5 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApply' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 6 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApply' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 7 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApply' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 8 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 9 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 10 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 11 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 12 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 13 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here. +// [context 14 for base_mixin_different_library_error_test.dart] The type 'SealedMixinApplication' is a subtype of 'BaseMixin', and 'BaseMixin' is defined here.
diff --git a/tests/language/class_modifiers/final/final_class_inside_not_base_final_sealed_error_test.dart b/tests/language/class_modifiers/final/final_class_inside_not_base_final_sealed_error_test.dart index 56dcfd4..74e3d87 100644 --- a/tests/language/class_modifiers/final/final_class_inside_not_base_final_sealed_error_test.dart +++ b/tests/language/class_modifiers/final/final_class_inside_not_base_final_sealed_error_test.dart
@@ -6,6 +6,9 @@ // sealed. final class FinalClass {} +// ^^^^^^^^^^ +// [context 1] The type 'SubtypeOfFinal' is a subtype of 'FinalClass', and 'FinalClass' is defined here. +// [context 2] The type 'SubtypeOfFinal' is a subtype of 'FinalClass', and 'FinalClass' is defined here. base class BaseClass extends FinalClass {} @@ -30,7 +33,7 @@ mixin MixinImplementsIndirect implements SubtypeOfFinal {} // ^^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 1] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The mixin 'MixinImplementsIndirect' must be 'base' because the supertype 'FinalClass' is 'final'. mixin On on FinalClass {} @@ -47,5 +50,5 @@ class IndirectSubtype extends SubtypeOfFinal {} // ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED +// [analyzer 2] COMPILE_TIME_ERROR.SUBTYPE_OF_BASE_OR_FINAL_IS_NOT_BASE_FINAL_OR_SEALED // [cfe] The type 'IndirectSubtype' must be 'base', 'final' or 'sealed' because the supertype 'FinalClass' is 'final'.
diff --git a/tests/language/class_modifiers/mixin/mixin_class_generative_constructor_error_test.dart b/tests/language/class_modifiers/mixin/mixin_class_generative_constructor_error_test.dart index 5692292..1b25c1c 100644 --- a/tests/language/class_modifiers/mixin/mixin_class_generative_constructor_error_test.dart +++ b/tests/language/class_modifiers/mixin/mixin_class_generative_constructor_error_test.dart
@@ -18,28 +18,28 @@ final int foo; MixinClassNamed.named(this.foo); - // [error column 3, length 21] - // [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_NON_TRIVIAL_GENERATIVE_CONSTRUCTOR // [error column 3, length 15] // [cfe] Can't use 'MixinClassNamed' as a mixin because it has constructors. + // [error column 3, length 21] + // [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_NON_TRIVIAL_GENERATIVE_CONSTRUCTOR } mixin class MixinClassRedirect { int foo = 0; MixinClassRedirect.named(int f) { - // [error column 3, length 24] - // [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_NON_TRIVIAL_GENERATIVE_CONSTRUCTOR // [error column 3, length 18] // [cfe] Can't use 'MixinClassRedirect' as a mixin because it has constructors. + // [error column 3, length 24] + // [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_NON_TRIVIAL_GENERATIVE_CONSTRUCTOR this.foo = f; } MixinClassRedirect.x(int f) : this.named(f); - // [error column 3, length 20] - // [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_NON_TRIVIAL_GENERATIVE_CONSTRUCTOR // [error column 3, length 18] // [cfe] Can't use 'MixinClassRedirect' as a mixin because it has constructors. + // [error column 3, length 20] + // [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_NON_TRIVIAL_GENERATIVE_CONSTRUCTOR } mixin class MixinClassExternal {
diff --git a/tests/language/class_modifiers/mixin/mixin_class_syntax_error_test.dart b/tests/language/class_modifiers/mixin/mixin_class_syntax_error_test.dart index 3f79bf5..99c04c0 100644 --- a/tests/language/class_modifiers/mixin/mixin_class_syntax_error_test.dart +++ b/tests/language/class_modifiers/mixin/mixin_class_syntax_error_test.dart
@@ -12,6 +12,7 @@ // [analyzer] SYNTACTIC_ERROR.MISSING_CONST_FINAL_VAR_OR_TYPE // [cfe] Expected ';' after this. // [cfe] Variables must be declared using the keywords 'const', 'final', 'var' or a type name. +// [context 1] The first definition of this name. // ^^^ // [analyzer] COMPILE_TIME_ERROR.NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD // [cfe] Field 'foo' should be initialized because its type 'int' doesn't allow null. @@ -23,7 +24,7 @@ mixin void bar2(); //^^^^^ -// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION +// [analyzer 1] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION // [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN // [analyzer] SYNTACTIC_ERROR.MISSING_CONST_FINAL_VAR_OR_TYPE // [cfe] 'mixin' is already declared in this scope.
diff --git a/tests/language/inference_update_2/why_not_promoted_public_error_test.dart b/tests/language/inference_update_2/why_not_promoted_public_error_test.dart index b27590f3..2f512a4 100644 --- a/tests/language/inference_update_2/why_not_promoted_public_error_test.dart +++ b/tests/language/inference_update_2/why_not_promoted_public_error_test.dart
@@ -13,7 +13,7 @@ final int? i; // ^ // [context 1] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field - // [context 2] 'i' refers to a public property so it couldn't be promoted. + // [context 3] 'i' refers to a public property so it couldn't be promoted. ClassInSameLibrary(this.i); } @@ -22,7 +22,7 @@ c.i.isEven; // ^^^^^^ // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // [cfe 2] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // [cfe 3] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } } @@ -30,7 +30,7 @@ if (c.i != null) { c.i.isEven; // ^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 2 see why_not_promoted_public_lib.dart] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // [cfe] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. } }
diff --git a/tests/language/inference_update_2/why_not_promoted_public_lib.dart b/tests/language/inference_update_2/why_not_promoted_public_lib.dart index 3523276..2219252 100644 --- a/tests/language/inference_update_2/why_not_promoted_public_lib.dart +++ b/tests/language/inference_update_2/why_not_promoted_public_lib.dart
@@ -6,5 +6,7 @@ class ClassInOtherLibrary { final int? i; + // ^ + // [context 2 for why_not_promoted_public_error_test.dart] 'i' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field ClassInOtherLibrary(this.i); }
diff --git a/tests/language/why_not_promoted/argument_type_not_assignable_nullability_error_test.dart b/tests/language/why_not_promoted/argument_type_not_assignable_nullability_error_test.dart index 2eefa08..015dc72 100644 --- a/tests/language/why_not_promoted/argument_type_not_assignable_nullability_error_test.dart +++ b/tests/language/why_not_promoted/argument_type_not_assignable_nullability_error_test.dart
@@ -8,6 +8,8 @@ class C1 { int? bad; + // ^^^ + // [context 1] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field f(int i) {} } @@ -15,13 +17,15 @@ if (c.bad == null) return; c.f(c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 1] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] The argument type 'int?' can't be assigned to the parameter type 'int'. } class C2 { int? bad; + // ^^^ + // [context 2] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field f([int i = 0]) {} } @@ -29,13 +33,15 @@ if (c.bad == null) return; c.f(c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 2] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] The argument type 'int?' can't be assigned to the parameter type 'int'. } class C3 { int? bad; + // ^^^ + // [context 3] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field f({required int i}) {} } @@ -43,13 +49,15 @@ if (c.bad == null) return; c.f(i: c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 3] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] The argument type 'int?' can't be assigned to the parameter type 'int'. } class C4 { int? bad; + // ^^^ + // [context 4] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field f({int i = 0}) {} } @@ -57,13 +65,15 @@ if (c.bad == null) return; c.f(i: c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 4] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] The argument type 'int?' can't be assigned to the parameter type 'int'. } class C5 { List<int>? bad; + // ^^^ + // [context 5] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field f<T>(List<T> x) {} } @@ -71,13 +81,15 @@ if (c.bad == null) return; c.f(c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 5] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] The argument type 'List<int>?' can't be assigned to the parameter type 'List<int>'. } class C6 { int? bad; + // ^^^ + // [context 6] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field C6(int i); } @@ -85,13 +97,15 @@ if (c.bad == null) return null; return C6(c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 6] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] The argument type 'int?' can't be assigned to the parameter type 'int'. } class C7 { int? bad; + // ^^^ + // [context 7] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field C7(int i); } @@ -99,20 +113,22 @@ if (c.bad == null) return null; return new C7(c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 7] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] The argument type 'int?' can't be assigned to the parameter type 'int'. } class C8 { int? bad; + // ^^^ + // [context 8] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } userDefinableBinaryOpRhs(C8 c) { if (c.bad == null) return; 1 + c.bad; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 8] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'num'. } @@ -155,6 +171,9 @@ class C11 { bool? bad; + // ^^^ + // [context 9] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 10] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field f(bool b) {} } @@ -162,18 +181,21 @@ if (c.bad == null) return; c.f(c.bad && b); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 9] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. c.f(b && c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 10] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C12 { bool? bad; + // ^^^ + // [context 11] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 12] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field f(bool b) {} } @@ -181,40 +203,46 @@ if (c.bad == null) return; c.f(c.bad || b); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 11] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. c.f(b || c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 12] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C13 { bool? bad; + // ^^^ + // [context 13] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } assertStatementCondition(C13 c) { if (c.bad == null) return; assert(c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 13] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C14 { bool? bad; + // ^^^ + // [context 14] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field C14.assertInitializerCondition(C14 c) : bad = c.bad!, assert(c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 14] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C15 { bool? bad; + // ^^^ + // [context 15] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field f(bool b) {} } @@ -222,41 +250,48 @@ if (c.bad == null) return; c.f(!c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 15] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C16 { bool? bad; + // ^^^ + // [context 16] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 17] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 18] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 19] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } forLoopCondition(C16 c) { if (c.bad == null) return; for (; c.bad;) {} // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 16] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. [for (; c.bad;) null]; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 17] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. ({for (; c.bad;) null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 18] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. ({for (; c.bad;) null: null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 19] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C17 { bool? bad; + // ^^^ + // [context 20] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field f(int i) {} } @@ -264,160 +299,187 @@ if (c.bad == null) return; c.f(c.bad ? 1 : 2); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 20] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C18 { bool? bad; + // ^^^ + // [context 21] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } doLoopCondition(C18 c) { if (c.bad == null) return; do {} while (c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 21] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C19 { bool? bad; + // ^^^ + // [context 22] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 23] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 24] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 25] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } ifCondition(C19 c) { if (c.bad == null) return; if (c.bad) {} // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 22] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. [if (c.bad) null]; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 23] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. ({if (c.bad) null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 24] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. ({if (c.bad) null: null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 25] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C20 { bool? bad; + // ^^^ + // [context 26] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } whileCondition(C20 c) { if (c.bad == null) return; while (c.bad) {} // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 26] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'. } class C21 { int? bad; + // ^^^ + // [context 27] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } assignmentRhs(C21 c, int i) { if (c.bad == null) return; i = c.bad; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 27] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C22 { int? bad; + // ^^^ + // [context 28] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } variableInitializer(C22 c) { if (c.bad == null) return; int i = c.bad; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 28] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C23 { int? bad; + // ^^^ + // [context 29] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field final int x; final int y; C23.constructorInitializer(C23 c) : x = c.bad!, y = c.bad; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.FIELD_INITIALIZER_NOT_ASSIGNABLE + // [analyzer 29] COMPILE_TIME_ERROR.FIELD_INITIALIZER_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C24 { int? bad; + // ^^^ + // [context 30] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 31] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 32] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 33] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } forVariableInitializer(C24 c) { if (c.bad == null) return; for (int i = c.bad; false;) {} // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 30] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. [for (int i = c.bad; false;) null]; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 31] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. ({for (int i = c.bad; false;) null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 32] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. ({for (int i = c.bad; false;) null: null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 33] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C25 { int? bad; + // ^^^ + // [context 34] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 35] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 36] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 37] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } forAssignmentInitializer(C25 c, int i) { if (c.bad == null) return; for (i = c.bad; false;) {} // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 34] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. [for (i = c.bad; false;) null]; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 35] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. ({for (i = c.bad; false;) null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 36] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. ({for (i = c.bad; false;) null: null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 37] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C26 { int? bad; + // ^^^ + // [context 38] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } compoundAssignmentRhs(C26 c) { @@ -425,95 +487,109 @@ if (c.bad == null) return; n += c.bad; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 38] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'num'. } class C27 { int? bad; + // ^^^ + // [context 39] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } indexGet(C27 c, List<int> values) { if (c.bad == null) return; values[c.bad]; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 39] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C28 { int? bad; + // ^^^ + // [context 40] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } indexSet(C28 c, List<int> values) { if (c.bad == null) return; values[c.bad] = 0; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 40] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C29 { int? bad; + // ^^^ + // [context 41] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } indexSetCompound(C29 c, List<int> values) { if (c.bad == null) return; values[c.bad] += 1; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 41] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C30 { int? bad; + // ^^^ + // [context 42] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } indexSetIfNull(C30 c, List<int?> values) { if (c.bad == null) return; values[c.bad] ??= 1; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 42] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C31 { int? bad; + // ^^^ + // [context 43] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 44] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } indexSetPreIncDec(C31 c, List<int> values) { if (c.bad == null) return; ++values[c.bad]; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 43] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. --values[c.bad]; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 44] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C32 { int? bad; + // ^^^ + // [context 45] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 46] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } indexSetPostIncDec(C32 c, List<int> values) { if (c.bad == null) return; values[c.bad]++; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 45] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. values[c.bad]--; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 46] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } @@ -524,19 +600,23 @@ class C33 { int? bad; + // ^^^ + // [context 47] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } explicitExtensionInvocation(C33 c) { if (c.bad == null) return; E33(c.bad).f(); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE + // [analyzer 47] COMPILE_TIME_ERROR.EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. } class C34 { int? bad; + // ^^^ + // [context 48] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field C34(int value); } @@ -544,20 +624,22 @@ int other; D34(C34 c) : other = c.bad!, super(c.bad); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [analyzer 48] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE // ^ // [cfe] The argument type 'int?' can't be assigned to the parameter type 'int'. } class C35 { int? bad; + // ^^^ + // [context 49] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } indexSetRhs(C35 c, List<int> x) { if (c.bad == null) return; x[0] = c.bad; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [analyzer 49] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // ^ // [cfe] A value of type 'int?' can't be assigned to a variable of type 'int'. }
diff --git a/tests/language/why_not_promoted/for_in_loop_type_not_iterable_nullability_error_test.dart b/tests/language/why_not_promoted/for_in_loop_type_not_iterable_nullability_error_test.dart index 98e8080..90a67cd6 100644 --- a/tests/language/why_not_promoted/for_in_loop_type_not_iterable_nullability_error_test.dart +++ b/tests/language/why_not_promoted/for_in_loop_type_not_iterable_nullability_error_test.dart
@@ -9,13 +9,22 @@ class C1 { List<int>? bad; + // ^^^ + // [context 1] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 2] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 3] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 4] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 5] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 6] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 7] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field + // [context 8] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } forStatement(C1 c) { if (c.bad == null) return; for (var x in c.bad) {} // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>'. } @@ -24,7 +33,7 @@ if (c.bad == null) return; [for (var x in c.bad) null]; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>'. } @@ -33,7 +42,7 @@ if (c.bad == null) return; <dynamic>{for (var x in c.bad) null}; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 3] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>'. } @@ -42,7 +51,7 @@ if (c.bad == null) return; <dynamic, dynamic>{for (var x in c.bad) null: null}; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 4] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>'. } @@ -51,7 +60,7 @@ if (c.bad == null) return; ({for (var x in c.bad) null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 5] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>'. } @@ -60,7 +69,7 @@ if (c.bad == null) return; ({for (var x in c.bad) null: null}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 6] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>'. } @@ -69,7 +78,7 @@ if (c.bad == null) return; ({for (var x in c.bad) ...list}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 7] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>'. } @@ -78,7 +87,7 @@ if (c.bad == null) return; ({for (var x in c.bad) ...map}); // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 8] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // ^ // [cfe] The type 'List<int>?' used in the 'for' loop must implement 'Iterable<dynamic>'. }
diff --git a/tests/language/why_not_promoted/invalid_assignment_error_nullability_error_test.dart b/tests/language/why_not_promoted/invalid_assignment_error_nullability_error_test.dart index 2d21711..ed802e9 100644 --- a/tests/language/why_not_promoted/invalid_assignment_error_nullability_error_test.dart +++ b/tests/language/why_not_promoted/invalid_assignment_error_nullability_error_test.dart
@@ -9,13 +9,15 @@ class C1 { List<int>? bad; + // ^^^ + // [context 1] 'bad' refers to a public property so it couldn't be promoted. See http://dart.dev/go/non-promo-public-field } test(C1 c) sync* { if (c.bad == null) return; yield* c.bad; // ^^^^^ - // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE // [analyzer] COMPILE_TIME_ERROR.YIELD_OF_INVALID_TYPE // ^ // [cfe] A value of type 'List<int>?' can't be assigned to a variable of type 'Iterable<dynamic>'.
diff --git a/tests/language/why_not_promoted/this_error_test.dart b/tests/language/why_not_promoted/this_error_test.dart index c4f1587..b3711a0 100644 --- a/tests/language/why_not_promoted/this_error_test.dart +++ b/tests/language/why_not_promoted/this_error_test.dart
@@ -15,8 +15,8 @@ this.isEven; // ^^^^^^ // [analyzer 1] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // [context 1] 'this' can't be promoted. See http://dart.dev/go/non-promo-this // [cfe 3] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // [context 1] 'this' can't be promoted. See http://dart.dev/go/non-promo-this // [context 3] 'this' can't be promoted. } @@ -25,8 +25,8 @@ isEven; // [error column 5, length 6] // [analyzer 2] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // [context 2] 'this' can't be promoted. See http://dart.dev/go/non-promo-this // [cfe 4] Property 'isEven' cannot be accessed on 'int?' because it is potentially null. + // [context 2] 'this' can't be promoted. See http://dart.dev/go/non-promo-this // [context 4] 'this' can't be promoted. } }
diff --git a/tools/VERSION b/tools/VERSION index dd2c35a..38b9fb0 100644 --- a/tools/VERSION +++ b/tools/VERSION
@@ -27,5 +27,5 @@ MAJOR 3 MINOR 13 PATCH 0 -PRERELEASE 105 +PRERELEASE 106 PRERELEASE_PATCH 0