test to validate deferred elements can't be used in constant contexts

Change-Id: Iadc534f9f99943e60966e18867010a56df9065d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244281
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
pq 2022-05-10 20:16:43 +00:00 committed by Commit Bot
parent e630a3adef
commit b0f9470a83

View file

@ -154,6 +154,29 @@ class CanBeConstInstanceCreationTest extends AbstractLinterContextTest {
expect(context.canBeConst(node), expectedResult);
}
@FailingTest(issue: 'https://github.com/dart-lang/linter/issues/3389')
void test_deferred_argument() async {
await resolveFileCode('$testPackageLibPath/a.dart', r'''
class A {
const A();
}
const aa = A();
''');
await resolve(r'''
import 'a.dart' deferred as a;
class B {
const B(Object a);
}
main() {
print(B(a.aa));
}
''');
assertCanBeConst('B(a.aa)', false);
}
void test_false_argument_invocation() async {
await resolve('''
class A {}