mirror of
https://github.com/dart-lang/sdk
synced 2024-10-01 19:19:16 +00:00
Include null suffix in Cider error verifier diagnostics.
Bug: https://buganizer.corp.google.com/issues/223932544 Change-Id: I860ee8b85a9ff6505df988df2ab50fe025d4a95e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237402 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Keerti Parthasarathy <keertip@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
fb1210590b
commit
c4752d7f20
|
@ -434,7 +434,11 @@ class LibraryAnalyzer {
|
|||
ErrorReporter _getErrorReporter(FileState file) {
|
||||
return _errorReporters.putIfAbsent(file, () {
|
||||
RecordingErrorListener listener = _getErrorListener(file);
|
||||
return ErrorReporter(listener, file.source);
|
||||
return ErrorReporter(
|
||||
listener,
|
||||
file.source,
|
||||
isNonNullableByDefault: _libraryElement.isNonNullableByDefault,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -363,6 +363,17 @@ p.dynamic f() {}
|
|||
''');
|
||||
}
|
||||
|
||||
test_errors_hasNullSuffix() {
|
||||
assertErrorsInCode(r'''
|
||||
String f(Map<int, String> a) {
|
||||
return a[0];
|
||||
}
|
||||
''', [
|
||||
error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 40, 4,
|
||||
messageContains: ["'String'", 'String?']),
|
||||
]);
|
||||
}
|
||||
|
||||
test_findReferences_class() async {
|
||||
var aPath = convertPath('/workspace/dart/test/lib/a.dart');
|
||||
newFile2(aPath, r'''
|
||||
|
|
Loading…
Reference in a new issue