Skip to content

Commit be5e078

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: Add a failing test case for issue 54388
CC #54388 Change-Id: Ife14cc946ef70f3fe7e01ee4685740f2bcd5dc10 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399843 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]>
1 parent 6f66c12 commit be5e078

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

pkg/analyzer/test/src/diagnostics/non_type_as_type_argument_test.dart

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analyzer/src/error/codes.dart';
6+
import 'package:test/test.dart';
67
import 'package:test_reflective_loader/test_reflective_loader.dart';
78

89
import '../dart/resolution/context_collection_resolution.dart';
@@ -15,6 +16,32 @@ main() {
1516

1617
@reflectiveTest
1718
class NonTypeAsTypeArgumentTest extends PubPackageResolutionTest {
19+
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/54388')
20+
test_issue54388() async {
21+
addTestFile(r'''
22+
sealed class Option<A> {}
23+
24+
final class None implements Option<A> {
25+
const None();
26+
}
27+
28+
A doOption<A>(
29+
A Function(B Function<B>(Option<B>)) eval,
30+
) {
31+
return eval(
32+
<B>(option) => switch (option) {
33+
None() => throw 7,
34+
},
35+
);
36+
}
37+
''');
38+
// When the analyzer stops throwing when resolving this code, there needs to
39+
// be at least one error, as the definition of `class None` refers to a
40+
// non-existent type, `A`.
41+
await expectLater(resolveTestFile(), completes);
42+
expect(result.errors, isNotEmpty);
43+
}
44+
1845
test_notAType() async {
1946
await assertErrorsInCode(r'''
2047
int A = 0;

0 commit comments

Comments
 (0)