mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:01:42 +00:00
Fix for exhaustiveness and sealed mixins.
Change-Id: I50916e5e3337638ac55edace6e4f181c8e045a4c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290600 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
2eba00fabb
commit
812b607946
|
@ -113,7 +113,7 @@ class AnalyzerSealedClassOperations
|
|||
@override
|
||||
ClassElement? getSealedClass(DartType type) {
|
||||
Element? element = type.element;
|
||||
if (element is ClassElementImpl && element.isSealed) {
|
||||
if (element is ClassElement && element.isSealed) {
|
||||
return element;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -156,15 +156,13 @@ void f(bool? x) {
|
|||
]);
|
||||
}
|
||||
|
||||
/// TODO(scheglov) Fix it.
|
||||
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/51275')
|
||||
test_alwaysExhaustive_boolNullable_true_false_null() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
void f(bool? x) {
|
||||
switch (x) {
|
||||
case true:
|
||||
case false:
|
||||
case Null:
|
||||
case null:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -343,24 +341,6 @@ void f(M x) {
|
|||
]);
|
||||
}
|
||||
|
||||
/// TODO(scheglov) Fix it.
|
||||
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/51275')
|
||||
test_alwaysExhaustive_sealedMixin_2at2() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
sealed mixin M {}
|
||||
class A with M {}
|
||||
class B with M {}
|
||||
|
||||
void f(M x) {
|
||||
switch (x) {
|
||||
case A():
|
||||
case B():
|
||||
break;
|
||||
}
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
test_alwaysExhaustive_typeVariable_bound_bool_true() async {
|
||||
await assertErrorsInCode(r'''
|
||||
void f<T extends bool>(T x) {
|
||||
|
|
Loading…
Reference in a new issue