Fix false positive for sdk constraints (issue 35290)
Change-Id: I64164cb97b88dcc0431237cf3a45831fb668c2c5 Reviewed-on: https://dart-review.googlesource.com/c/85620 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
3428cc6dae
commit
ec5b4bad99
@@ -43,6 +43,16 @@ class SdkConstraintVerifier extends RecursiveAstVisitor<void> {
|
||||
bool get checkFutureAndStream =>
|
||||
_checkFutureAndStream ??= !before_2_1_0.intersect(_versionRange).isEmpty;
|
||||
|
||||
@override
|
||||
void visitHideCombinator(HideCombinator node) {
|
||||
// Don't flag references to either `Future` or `Stream` within a combinator.
|
||||
}
|
||||
|
||||
@override
|
||||
void visitShowCombinator(ShowCombinator node) {
|
||||
// Don't flag references to either `Future` or `Stream` within a combinator.
|
||||
}
|
||||
|
||||
@override
|
||||
void visitSimpleIdentifier(SimpleIdentifier node) {
|
||||
if (node.inDeclarationContext()) {
|
||||
|
||||
@@ -69,7 +69,7 @@ Future<int> zero() async => 0;
|
||||
|
||||
test_lessThan_explicitImportOfCore() async {
|
||||
await verifyVersion('2.0.0', '''
|
||||
import 'dart:core';
|
||||
import 'dart:core' show Future, int;
|
||||
|
||||
Future<int> zero() async => 0;
|
||||
''', errorCodes: [HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE]);
|
||||
@@ -102,4 +102,28 @@ part of lib;
|
||||
Future<int> zero() async => 0;
|
||||
''', errorCodes: [HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE]);
|
||||
}
|
||||
|
||||
test_lessThan_onlyReferencedInExport_hide() async {
|
||||
await verifyVersion('2.0.0', '''
|
||||
export 'dart:async' hide Future;
|
||||
''');
|
||||
}
|
||||
|
||||
test_lessThan_onlyReferencedInExport_show() async {
|
||||
await verifyVersion('2.0.0', '''
|
||||
export 'dart:async' show Future;
|
||||
''');
|
||||
}
|
||||
|
||||
test_lessThan_onlyReferencedInImport_hide() async {
|
||||
await verifyVersion('2.0.0', '''
|
||||
import 'dart:core' hide Future;
|
||||
''');
|
||||
}
|
||||
|
||||
test_lessThan_onlyReferencedInImport_show() async {
|
||||
await verifyVersion('2.0.0', '''
|
||||
import 'dart:core' show Future;
|
||||
''');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user