Skip to content

Commit

Permalink
analyzer: Add a failing test case for issue 54388
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
srawlins authored and Commit Queue committed Dec 12, 2024
1 parent 6f66c12 commit be5e078
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

import 'package:analyzer/src/error/codes.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

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

@reflectiveTest
class NonTypeAsTypeArgumentTest extends PubPackageResolutionTest {
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/54388')
test_issue54388() async {
addTestFile(r'''
sealed class Option<A> {}
final class None implements Option<A> {
const None();
}
A doOption<A>(
A Function(B Function<B>(Option<B>)) eval,
) {
return eval(
<B>(option) => switch (option) {
None() => throw 7,
},
);
}
''');
// When the analyzer stops throwing when resolving this code, there needs to
// be at least one error, as the definition of `class None` refers to a
// non-existent type, `A`.
await expectLater(resolveTestFile(), completes);
expect(result.errors, isNotEmpty);
}

test_notAType() async {
await assertErrorsInCode(r'''
int A = 0;
Expand Down

0 comments on commit be5e078

Please sign in to comment.