mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:49:43 +00:00
[_fe_analyzer_shared] Only show fields of interest in exhaustiveness tests
Only the fields of a scrutinee type that are used in the cases are now shown in the test expectations. When the field is not present, for instance when the scrutinee type is nullable, or the fields are only present on (some of) the subtype of the scrutinee type, the fields are shown to be missing with a `-`. Change-Id: I2d36b230e979dc929d083cfb8f9cdb9f1143d380 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287280 Reviewed-by: Paul Berry <paulberry@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
8a9188aae5
commit
d451cb64c0
|
@ -21,23 +21,22 @@ class Tags {
|
|||
String spacesToText(Space space) => space.toString();
|
||||
|
||||
/// Returns a textual representation for [fields] used for testing.
|
||||
String fieldsToText(Map<String, StaticType> fields) {
|
||||
// TODO(johnniwinther): Enforce that field maps are always sorted.
|
||||
List<String> sortedNames = fields.keys.toList()..sort();
|
||||
String fieldsToText(
|
||||
Map<String, StaticType> fields, Set<String> fieldsOfInterest) {
|
||||
List<String> sortedNames = fieldsOfInterest.toList()..sort();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String comma = '';
|
||||
sb.write('{');
|
||||
for (String name in sortedNames) {
|
||||
if (name.startsWith('_')) {
|
||||
// Avoid implementation specific fields, like `Object._identityHashCode`
|
||||
// and `Enum._name`.
|
||||
// TODO(johnniwinther): Support private fields in the test code.
|
||||
continue;
|
||||
}
|
||||
StaticType? fieldType = fields[name];
|
||||
sb.write(comma);
|
||||
sb.write(name);
|
||||
sb.write(':');
|
||||
sb.write(staticTypeToText(fields[name]!));
|
||||
if (fieldType != null) {
|
||||
sb.write(staticTypeToText(fieldType));
|
||||
} else {
|
||||
sb.write("-");
|
||||
}
|
||||
comma = ',';
|
||||
}
|
||||
sb.write('}');
|
||||
|
|
|
@ -15,38 +15,29 @@ class D extends B {}
|
|||
class E extends B {}
|
||||
|
||||
and(A o1, A o2) {
|
||||
var a = /*
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
type=A
|
||||
*/switch (o1) {
|
||||
var a = /*type=A*/switch (o1) {
|
||||
A() && var a /*space=A*/=> 0,
|
||||
_ /*space=()*/=> 1,
|
||||
};
|
||||
|
||||
var b = /*
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
type=A
|
||||
*/switch (o1) {
|
||||
var b = /*type=A*/switch (o1) {
|
||||
A() && var a /*space=A*/=> 0,
|
||||
};
|
||||
}
|
||||
|
||||
intersectSameClass(A o1, A o2, A o3) {
|
||||
var a = /*
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
type=A
|
||||
*/switch (o1) {
|
||||
var a = /*type=A*/switch (o1) {
|
||||
A() && A() /*space=A*/=> 0,
|
||||
};
|
||||
var b = /*
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
fields={field1:B,field2:B},
|
||||
type=A
|
||||
*/switch (o2) {
|
||||
A(:var field1) && A(:var field2) /*space=A(field1: B, field2: B)*/=> [field1, field2],
|
||||
};
|
||||
var c = /*
|
||||
error=non-exhaustive:A(field1: C, field2: C),
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
fields={field1:B,field2:B},
|
||||
type=A
|
||||
*/switch (o3) {
|
||||
A(:var field1, field2: C()) && A(field1: D(), :var field2) /*space=A(field1: D, field2: C)*/=> 10,
|
||||
|
@ -54,21 +45,18 @@ intersectSameClass(A o1, A o2, A o3) {
|
|||
}
|
||||
|
||||
intersectSubClass(A o1, A o2, A o3) {
|
||||
var a = /*
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
type=A
|
||||
*/switch (o1) {
|
||||
var a = /*type=A*/switch (o1) {
|
||||
Object() && A() /*space=A*/=> 0,
|
||||
};
|
||||
var b = /*
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
fields={field1:B,hashCode:int},
|
||||
type=A
|
||||
*/switch (o2) {
|
||||
A(:var field1) && Object(:var hashCode) /*space=A(field1: B, hashCode: int)*/=> [field1, hashCode],
|
||||
};
|
||||
var c = /*
|
||||
error=non-exhaustive:A(field1: C, field2: C, hashCode: int),
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
fields={field1:B,field2:B,hashCode:int},
|
||||
type=A
|
||||
*/switch (o3) {
|
||||
Object(:var hashCode) && A(:var field1, field2: D())/*space=A(hashCode: int, field1: B, field2: D)*/=> 10,
|
||||
|
@ -77,7 +65,7 @@ intersectSubClass(A o1, A o2, A o3) {
|
|||
|
||||
intersectUnion(A o1, A o2, B o3, B o4) {
|
||||
var a = /*
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
fields={field1:B,field2:B},
|
||||
type=A
|
||||
*/switch (o1) {
|
||||
A(field1: C() || D()) && A(field2: C() || D()) /*space=A(field1: C|D, field2: C|D)*/=> 0,
|
||||
|
@ -85,14 +73,13 @@ intersectUnion(A o1, A o2, B o3, B o4) {
|
|||
A(field1: D() || E()) && A(field2: D() || E()) /*space=A(field1: D|E, field2: D|E)*/=> 2,
|
||||
};
|
||||
var b = /*
|
||||
fields={field1:B,field2:B,hashCode:int,runtimeType:Type},
|
||||
fields={field1:B},
|
||||
type=A
|
||||
*/switch (o2) {
|
||||
A(field1: C() || D()) && A(field1: D() || E()) /*space=A(field1: D|??)*/=> 0,
|
||||
A(field1: C() || E()) && A(field1: C() || E()) /*space=A(field1: C|E|??)*/=> 1,
|
||||
};
|
||||
var c = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={C,D,E},
|
||||
type=B
|
||||
*/switch (o3) {
|
||||
|
@ -100,7 +87,6 @@ intersectUnion(A o1, A o2, B o3, B o4) {
|
|||
B() && (D() || E()) /*space=D|E*/= 1,
|
||||
};
|
||||
var d = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={C,D,E},
|
||||
type=B
|
||||
*/switch (o3) {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
void exhaustiveSwitch(bool b) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
|
@ -25,7 +24,6 @@ const f1 = false;
|
|||
|
||||
void exhaustiveSwitchAliasedBefore(bool b) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
|
@ -43,7 +41,6 @@ void exhaustiveSwitchAliasedBefore(bool b) {
|
|||
|
||||
void exhaustiveSwitchAliasedAfter(bool b) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
|
@ -65,7 +62,6 @@ const f2 = false;
|
|||
void nonExhaustiveSwitch1(bool b) {
|
||||
/*
|
||||
error=non-exhaustive:false,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
|
@ -80,7 +76,6 @@ void nonExhaustiveSwitch1(bool b) {
|
|||
void nonExhaustiveSwitch2(bool b) {
|
||||
/*
|
||||
error=non-exhaustive:true,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
|
@ -95,7 +90,6 @@ void nonExhaustiveSwitch2(bool b) {
|
|||
void nonExhaustiveSwitchWithDefault(bool b) {
|
||||
/*
|
||||
error=non-exhaustive:false,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
|
@ -113,7 +107,6 @@ void nonExhaustiveSwitchWithDefault(bool b) {
|
|||
void exhaustiveNullableSwitch(bool? b) {
|
||||
/*
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -137,7 +130,6 @@ void nonExhaustiveNullableSwitch1(bool? b) {
|
|||
/*
|
||||
error=non-exhaustive:Null,
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -157,7 +149,6 @@ void nonExhaustiveNullableSwitch2(bool? b) {
|
|||
/*
|
||||
error=non-exhaustive:false,
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -175,7 +166,6 @@ void nonExhaustiveNullableSwitch2(bool? b) {
|
|||
|
||||
void unreachableCase1(bool b) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
|
@ -201,7 +191,6 @@ void unreachableCase1(bool b) {
|
|||
void unreachableCase2(bool b) {
|
||||
// TODO(johnniwinther): Should we avoid the unreachable error here?
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
|
@ -224,7 +213,6 @@ void unreachableCase2(bool b) {
|
|||
void unreachableCase3(bool? b) {
|
||||
/*
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,6 @@ class C<Z extends Object> extends A<Z> {}
|
|||
|
||||
exhaustiveGeneric<T1>(A<T1> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<T1>
|
||||
*/
|
||||
|
@ -26,7 +25,6 @@ exhaustiveGeneric<T1>(A<T1> a) {
|
|||
|
||||
exhaustiveDynamic(A<dynamic> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<dynamic>
|
||||
*/
|
||||
|
@ -44,7 +42,6 @@ exhaustiveDynamic(A<dynamic> a) {
|
|||
|
||||
exhaustiveGenericFixed<T2>(A<T2> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<T2>
|
||||
*/
|
||||
|
@ -62,7 +59,6 @@ exhaustiveGenericFixed<T2>(A<T2> a) {
|
|||
|
||||
exhaustiveGenericCatchAll<T3>(A<T3> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<T3>
|
||||
*/
|
||||
|
@ -81,7 +77,6 @@ exhaustiveGenericCatchAll<T3>(A<T3> a) {
|
|||
nonExhaustiveGeneric<T4>(A<T4> a) {
|
||||
/*
|
||||
error=non-exhaustive:C<Object>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<T4>
|
||||
*/
|
||||
|
@ -93,7 +88,6 @@ nonExhaustiveGeneric<T4>(A<T4> a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:B<num>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<T4>
|
||||
*/
|
||||
|
@ -108,7 +102,6 @@ nonExhaustiveGeneric<T4>(A<T4> a) {
|
|||
nonExhaustiveDynamic1(A<dynamic> a) {
|
||||
/*
|
||||
error=non-exhaustive:C<Object>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<dynamic>
|
||||
*/
|
||||
|
@ -123,7 +116,6 @@ nonExhaustiveDynamic1(A<dynamic> a) {
|
|||
nonExhaustiveDynamic2(A<dynamic> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<num>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<dynamic>
|
||||
*/
|
||||
|
@ -138,7 +130,6 @@ nonExhaustiveDynamic2(A<dynamic> a) {
|
|||
nonExhaustiveGenericFixed<T5>(A<T5> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<num>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<T5>
|
||||
*/
|
||||
|
@ -150,7 +141,6 @@ nonExhaustiveGenericFixed<T5>(A<T5> a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:B<num>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<T5>
|
||||
*/
|
||||
|
@ -165,7 +155,6 @@ nonExhaustiveGenericFixed<T5>(A<T5> a) {
|
|||
nonExhaustiveGenericCatchAll<T6, S6>(A<T6> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<num>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<T6>
|
||||
*/
|
||||
|
@ -181,7 +170,6 @@ nonExhaustiveGenericCatchAll<T6, S6>(A<T6> a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:B<num>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<Object>},
|
||||
type=A<T6>
|
||||
*/
|
||||
|
@ -200,7 +188,6 @@ nonExhaustiveGenericCatchAll<T6, S6>(A<T6> a) {
|
|||
nonExhaustiveFixed(A<String> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<num>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C<String>},
|
||||
type=A<String>
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,6 @@ class E extends B {}
|
|||
|
||||
simpleCast(o1, o2) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o1) {
|
||||
|
@ -27,7 +26,6 @@ simpleCast(o1, o2) {
|
|||
};
|
||||
|
||||
var b = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o2) {
|
||||
|
@ -39,7 +37,7 @@ restrictedCase(o1, o2) {
|
|||
// Cast shouldn't match everything, because even though it doesn't throw,
|
||||
// it might not match.
|
||||
var a = /*
|
||||
fields={},
|
||||
fields={field:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o1) {
|
||||
|
@ -49,7 +47,7 @@ restrictedCase(o1, o2) {
|
|||
|
||||
var b = /*
|
||||
error=non-exhaustive:Object,
|
||||
fields={},
|
||||
fields={field:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o2) {
|
||||
|
@ -59,7 +57,6 @@ restrictedCase(o1, o2) {
|
|||
|
||||
sealedCast(B b1, B b2) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={C,D,E},
|
||||
type=B
|
||||
*/switch (b1) {
|
||||
|
@ -68,7 +65,6 @@ sealedCast(B b1, B b2) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:E,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={C,D,E},
|
||||
type=B
|
||||
*/switch (b2) {
|
||||
|
|
|
@ -6,7 +6,6 @@ enum Enum { a, b, c }
|
|||
|
||||
void exhaustiveSwitch(Enum e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -32,7 +31,6 @@ const c1 = Enum.c;
|
|||
|
||||
void exhaustiveSwitchAliasedBefore(Enum e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -54,7 +52,6 @@ void exhaustiveSwitchAliasedBefore(Enum e) {
|
|||
|
||||
void exhaustiveSwitchAliasedAfter(Enum e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -81,7 +78,6 @@ const c2 = Enum.c;
|
|||
void nonExhaustiveSwitch1(Enum e) {
|
||||
/*
|
||||
error=non-exhaustive:Enum.c,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -100,7 +96,6 @@ void nonExhaustiveSwitch1(Enum e) {
|
|||
void nonExhaustiveSwitch2(Enum e) {
|
||||
/*
|
||||
error=non-exhaustive:Enum.b,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -119,7 +114,6 @@ void nonExhaustiveSwitch2(Enum e) {
|
|||
void nonExhaustiveSwitch3(Enum e) {
|
||||
/*
|
||||
error=non-exhaustive:Enum.a,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -138,7 +132,6 @@ void nonExhaustiveSwitch3(Enum e) {
|
|||
void nonExhaustiveSwitch4(Enum e) {
|
||||
/*
|
||||
error=non-exhaustive:Enum.a,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -153,7 +146,6 @@ void nonExhaustiveSwitch4(Enum e) {
|
|||
void nonExhaustiveSwitchWithDefault(Enum e) {
|
||||
/*
|
||||
error=non-exhaustive:Enum.a,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -171,7 +163,6 @@ void nonExhaustiveSwitchWithDefault(Enum e) {
|
|||
void exhaustiveNullableSwitch(Enum? e) {
|
||||
/*
|
||||
expandedSubtypes={Enum.a,Enum.b,Enum.c,Null},
|
||||
fields={},
|
||||
subtypes={Enum,Null},
|
||||
type=Enum?
|
||||
*/
|
||||
|
@ -199,7 +190,6 @@ void nonExhaustiveNullableSwitch1(Enum? e) {
|
|||
/*
|
||||
error=non-exhaustive:Null,
|
||||
expandedSubtypes={Enum.a,Enum.b,Enum.c,Null},
|
||||
fields={},
|
||||
subtypes={Enum,Null},
|
||||
type=Enum?
|
||||
*/
|
||||
|
@ -223,7 +213,6 @@ void nonExhaustiveNullableSwitch2(Enum? e) {
|
|||
/*
|
||||
error=non-exhaustive:Enum.b,
|
||||
expandedSubtypes={Enum.a,Enum.b,Enum.c,Null},
|
||||
fields={},
|
||||
subtypes={Enum,Null},
|
||||
type=Enum?
|
||||
*/
|
||||
|
@ -245,7 +234,6 @@ void nonExhaustiveNullableSwitch2(Enum? e) {
|
|||
|
||||
void unreachableCase1(Enum e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -275,7 +263,6 @@ void unreachableCase1(Enum e) {
|
|||
void unreachableCase2(Enum e) {
|
||||
/*
|
||||
error=non-exhaustive:Enum.c,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -301,7 +288,6 @@ void unreachableCase2(Enum e) {
|
|||
void unreachableCase3(Enum e) {
|
||||
// TODO(johnniwinther): Should we avoid the unreachable error here?
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
@ -328,7 +314,6 @@ void unreachableCase3(Enum e) {
|
|||
void unreachableCase4(Enum? e) {
|
||||
/*
|
||||
expandedSubtypes={Enum.a,Enum.b,Enum.c,Null},
|
||||
fields={},
|
||||
subtypes={Enum,Null},
|
||||
type=Enum?
|
||||
*/
|
||||
|
@ -361,7 +346,6 @@ void unreachableCase4(Enum? e) {
|
|||
|
||||
void unreachableCase5(Enum e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.a,Enum.b,Enum.c},
|
||||
type=Enum
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,6 @@ enum Enum<Z extends A<Z>> {
|
|||
exhaustiveSwitchDynamic(A<dynamic> a, Enum<dynamic> e) {
|
||||
/*
|
||||
expandedSubtypes={B,C,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D<D<dynamic>>},
|
||||
type=A<dynamic>
|
||||
*/
|
||||
|
@ -42,7 +41,6 @@ exhaustiveSwitchDynamic(A<dynamic> a, Enum<dynamic> e) {
|
|||
break;
|
||||
}
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.b,Enum.c,Enum.d1,Enum.d2},
|
||||
type=Enum<dynamic>
|
||||
*/
|
||||
|
@ -69,7 +67,6 @@ exhaustiveSwitchDynamic(A<dynamic> a, Enum<dynamic> e) {
|
|||
exhaustiveSwitchGeneric<T extends A<T>>(A<T> a, Enum<T> e) {
|
||||
/*
|
||||
expandedSubtypes={B,C,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D<D<dynamic>>},
|
||||
type=A<T>
|
||||
*/
|
||||
|
@ -88,7 +85,6 @@ exhaustiveSwitchGeneric<T extends A<T>>(A<T> a, Enum<T> e) {
|
|||
break;
|
||||
}
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.b,Enum.c,Enum.d1,Enum.d2},
|
||||
type=Enum<T>
|
||||
*/switch (e) {
|
||||
|
@ -114,7 +110,6 @@ exhaustiveSwitchGeneric<T extends A<T>>(A<T> a, Enum<T> e) {
|
|||
exhaustiveSwitchBounded<T extends D<T>>(A<T> a, Enum<T> e) {
|
||||
/*
|
||||
expandedSubtypes={D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={D<T>},
|
||||
type=A<T>
|
||||
*/
|
||||
|
@ -129,7 +124,6 @@ exhaustiveSwitchBounded<T extends D<T>>(A<T> a, Enum<T> e) {
|
|||
break;
|
||||
}
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.d1,Enum.d2},
|
||||
type=Enum<T>
|
||||
*/
|
||||
|
@ -148,7 +142,6 @@ exhaustiveSwitchBounded<T extends D<T>>(A<T> a, Enum<T> e) {
|
|||
exhaustiveSwitchCatchAll<T extends A<T>>(A<T> a, Enum<T> e) {
|
||||
/*
|
||||
expandedSubtypes={B,C,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D<D<dynamic>>},
|
||||
type=A<T>
|
||||
*/
|
||||
|
@ -167,7 +160,6 @@ exhaustiveSwitchCatchAll<T extends A<T>>(A<T> a, Enum<T> e) {
|
|||
break;
|
||||
}
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.b,Enum.c,Enum.d1,Enum.d2},
|
||||
type=Enum<T>
|
||||
*/
|
||||
|
@ -191,7 +183,6 @@ nonExhaustiveSwitchDynamic(A<dynamic> a, Enum<dynamic> e) {
|
|||
/*
|
||||
error=non-exhaustive:D1,
|
||||
expandedSubtypes={B,C,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D<D<dynamic>>},
|
||||
type=A<dynamic>
|
||||
*/
|
||||
|
@ -211,7 +202,6 @@ nonExhaustiveSwitchDynamic(A<dynamic> a, Enum<dynamic> e) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:Enum.c,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.b,Enum.c,Enum.d1,Enum.d2},
|
||||
type=Enum<dynamic>
|
||||
*/
|
||||
|
@ -235,7 +225,6 @@ nonExhaustiveSwitchGeneric<T1 extends A<T1>>(A<T1> a, Enum<T1> e) {
|
|||
/*
|
||||
error=non-exhaustive:D1,
|
||||
expandedSubtypes={B,C,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D<D<dynamic>>},
|
||||
type=A<T1>
|
||||
*/
|
||||
|
@ -255,7 +244,6 @@ nonExhaustiveSwitchGeneric<T1 extends A<T1>>(A<T1> a, Enum<T1> e) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:Enum.d1,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.b,Enum.c,Enum.d1,Enum.d2},
|
||||
type=Enum<T1>
|
||||
*/
|
||||
|
@ -279,7 +267,6 @@ nonExhaustiveSwitchBounded<T2 extends D<T2>>(A<T2> a, Enum<T2> e) {
|
|||
/*
|
||||
error=non-exhaustive:D1,
|
||||
expandedSubtypes={D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={D<T2>},
|
||||
type=A<T2>
|
||||
*/
|
||||
|
@ -291,7 +278,6 @@ nonExhaustiveSwitchBounded<T2 extends D<T2>>(A<T2> a, Enum<T2> e) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:Enum.d2,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.d1,Enum.d2},
|
||||
type=Enum<T2>
|
||||
*/
|
||||
|
@ -307,7 +293,6 @@ nonExhaustiveSwitchCatchAll<T3 extends A<T3>>(A<T3> a, Enum<T3> e) {
|
|||
/*
|
||||
error=non-exhaustive:D1,
|
||||
expandedSubtypes={B,C,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D<D<dynamic>>},
|
||||
type=A<T3>
|
||||
*/
|
||||
|
@ -323,7 +308,6 @@ nonExhaustiveSwitchCatchAll<T3 extends A<T3>>(A<T3> a, Enum<T3> e) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:Enum.b,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={Enum.b,Enum.c,Enum.d1,Enum.d2},
|
||||
type=Enum<T3>
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,6 @@ class D<W extends num Function(num)> extends A<W> {}
|
|||
|
||||
exhaustiveCovariant<T>(A<T Function(Never)> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<T Function(Never)>
|
||||
*/
|
||||
|
@ -31,7 +30,6 @@ exhaustiveCovariant<T>(A<T Function(Never)> a) {
|
|||
|
||||
exhaustiveContravariant<T>(A<dynamic Function(T)> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<dynamic Function(T)>
|
||||
*/
|
||||
|
@ -53,7 +51,6 @@ exhaustiveContravariant<T>(A<dynamic Function(T)> a) {
|
|||
|
||||
exhaustiveBivariant<T>(A<T Function(T)> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<T Function(T)>
|
||||
*/
|
||||
|
@ -76,7 +73,6 @@ exhaustiveBivariant<T>(A<T Function(T)> a) {
|
|||
nonExhaustiveCovariant<T>(A<T Function(Never)> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<num Function(dynamic)>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<T Function(Never)>
|
||||
*/
|
||||
|
@ -92,7 +88,6 @@ nonExhaustiveCovariant<T>(A<T Function(Never)> a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:C<dynamic Function(num)>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<T Function(Never)>
|
||||
*/
|
||||
|
@ -108,7 +103,6 @@ nonExhaustiveCovariant<T>(A<T Function(Never)> a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:D<num Function(num)>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<T Function(Never)>
|
||||
*/
|
||||
|
@ -127,7 +121,6 @@ nonExhaustiveCovariant<T>(A<T Function(Never)> a) {
|
|||
nonExhaustiveContravariant<T>(A<dynamic Function(T)> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<num Function(dynamic)>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<dynamic Function(T)>
|
||||
*/
|
||||
|
@ -143,7 +136,6 @@ nonExhaustiveContravariant<T>(A<dynamic Function(T)> a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:C<dynamic Function(num)>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<dynamic Function(T)>
|
||||
*/
|
||||
|
@ -159,7 +151,6 @@ nonExhaustiveContravariant<T>(A<dynamic Function(T)> a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:D<num Function(num)>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<dynamic Function(T)>
|
||||
*/
|
||||
|
@ -178,7 +169,6 @@ nonExhaustiveContravariant<T>(A<dynamic Function(T)> a) {
|
|||
nonExhaustiveBivariant<T>(A<T Function(T)> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<num Function(dynamic)>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<T Function(T)>
|
||||
*/
|
||||
|
@ -194,7 +184,6 @@ nonExhaustiveBivariant<T>(A<T Function(T)> a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:C<dynamic Function(num)>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<T Function(T)>
|
||||
*/
|
||||
|
@ -210,7 +199,6 @@ nonExhaustiveBivariant<T>(A<T Function(T)> a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:D<num Function(num)>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num Function(dynamic)>,C<dynamic Function(num)>,D<num Function(num)>},
|
||||
type=A<T Function(T)>
|
||||
*/
|
||||
|
|
|
@ -11,7 +11,6 @@ class C extends A {}
|
|||
exhaustiveBoolByValue(FutureOr<bool> f) {
|
||||
/*
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/
|
||||
|
@ -31,7 +30,6 @@ exhaustiveBoolByValue(FutureOr<bool> f) {
|
|||
}
|
||||
var a = /*
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/switch (f) {
|
||||
|
@ -44,7 +42,6 @@ exhaustiveBoolByValue(FutureOr<bool> f) {
|
|||
exhaustiveBoolByType(FutureOr<bool> f) {
|
||||
/*
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/
|
||||
|
@ -60,7 +57,6 @@ exhaustiveBoolByType(FutureOr<bool> f) {
|
|||
}
|
||||
/*
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/switch (f) {
|
||||
|
@ -75,7 +71,6 @@ exhaustiveBoolByType(FutureOr<bool> f) {
|
|||
}
|
||||
var a = /*
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/switch (f) {
|
||||
|
@ -88,7 +83,6 @@ nonExhaustiveBool(FutureOr<bool> f) {
|
|||
/*
|
||||
error=non-exhaustive:Future<bool>,
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/
|
||||
|
@ -105,7 +99,6 @@ nonExhaustiveBool(FutureOr<bool> f) {
|
|||
/*
|
||||
error=non-exhaustive:false,
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/
|
||||
|
@ -122,7 +115,6 @@ nonExhaustiveBool(FutureOr<bool> f) {
|
|||
/*
|
||||
error=non-exhaustive:true,
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/
|
||||
|
@ -139,7 +131,6 @@ nonExhaustiveBool(FutureOr<bool> f) {
|
|||
/*
|
||||
error=non-exhaustive:Future<bool>,
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/
|
||||
|
@ -160,7 +151,6 @@ nonExhaustiveBool(FutureOr<bool> f) {
|
|||
var a = /*
|
||||
error=non-exhaustive:Future<bool>,
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/switch (f) {
|
||||
|
@ -170,7 +160,6 @@ nonExhaustiveBool(FutureOr<bool> f) {
|
|||
var b = /*
|
||||
error=non-exhaustive:false,
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/switch (f) {
|
||||
|
@ -180,7 +169,6 @@ nonExhaustiveBool(FutureOr<bool> f) {
|
|||
var c = /*
|
||||
error=non-exhaustive:true,
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/switch (f) {
|
||||
|
@ -190,7 +178,6 @@ nonExhaustiveBool(FutureOr<bool> f) {
|
|||
var d = /*
|
||||
error=non-exhaustive:Future<bool>,
|
||||
expandedSubtypes={true,false,Future<bool>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool,Future<bool>},
|
||||
type=FutureOr<bool>
|
||||
*/switch (f) {
|
||||
|
@ -203,7 +190,6 @@ nonExhaustiveBool(FutureOr<bool> f) {
|
|||
exhaustiveSealedBySubtype(FutureOr<A> f) {
|
||||
/*
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/
|
||||
|
@ -223,7 +209,6 @@ exhaustiveSealedBySubtype(FutureOr<A> f) {
|
|||
}
|
||||
var a = /*
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/switch (f) {
|
||||
|
@ -236,7 +221,6 @@ exhaustiveSealedBySubtype(FutureOr<A> f) {
|
|||
exhaustiveSealedByType(FutureOr<A> f) {
|
||||
/*
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/
|
||||
|
@ -252,7 +236,6 @@ exhaustiveSealedByType(FutureOr<A> f) {
|
|||
}
|
||||
var a = /*
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/switch (f) {
|
||||
|
@ -265,7 +248,6 @@ nonExhaustiveSealed(FutureOr<A> f) {
|
|||
/*
|
||||
error=non-exhaustive:Future<A>,
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/
|
||||
|
@ -282,7 +264,6 @@ nonExhaustiveSealed(FutureOr<A> f) {
|
|||
/*
|
||||
error=non-exhaustive:C,
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/
|
||||
|
@ -299,7 +280,6 @@ nonExhaustiveSealed(FutureOr<A> f) {
|
|||
/*
|
||||
error=non-exhaustive:B,
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/
|
||||
|
@ -316,7 +296,6 @@ nonExhaustiveSealed(FutureOr<A> f) {
|
|||
/*
|
||||
error=non-exhaustive:Future<A>,
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/switch (f) {
|
||||
|
@ -340,7 +319,6 @@ nonExhaustiveSealed(FutureOr<A> f) {
|
|||
var a = /*
|
||||
error=non-exhaustive:Future<A>,
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/switch (f) {
|
||||
|
@ -350,7 +328,6 @@ nonExhaustiveSealed(FutureOr<A> f) {
|
|||
var b = /*
|
||||
error=non-exhaustive:C,
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/switch (f) {
|
||||
|
@ -360,7 +337,6 @@ nonExhaustiveSealed(FutureOr<A> f) {
|
|||
var c = /*
|
||||
error=non-exhaustive:B,
|
||||
expandedSubtypes={B,C,Future<A>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={A,Future<A>},
|
||||
type=FutureOr<A>
|
||||
*/switch (f) {
|
||||
|
@ -371,7 +347,6 @@ nonExhaustiveSealed(FutureOr<A> f) {
|
|||
|
||||
exhaustiveRegular(FutureOr<int> f) {
|
||||
var a = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={int,Future<int>},
|
||||
type=FutureOr<int>
|
||||
*/switch (f) {
|
||||
|
@ -383,7 +358,6 @@ exhaustiveRegular(FutureOr<int> f) {
|
|||
nonExhaustiveRegular(FutureOr<int> f) {
|
||||
var a = /*
|
||||
error=non-exhaustive:Future<int>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={int,Future<int>},
|
||||
type=FutureOr<int>
|
||||
*/switch (f) {
|
||||
|
@ -392,7 +366,6 @@ nonExhaustiveRegular(FutureOr<int> f) {
|
|||
};
|
||||
var b = /*
|
||||
error=non-exhaustive:int,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={int,Future<int>},
|
||||
type=FutureOr<int>
|
||||
*/switch (f) {
|
||||
|
@ -407,7 +380,6 @@ exhaustiveNullable(
|
|||
FutureOr<bool?>? f3) {
|
||||
/*
|
||||
expandedSubtypes={true,false,Future<bool>,Null},
|
||||
fields={},
|
||||
subtypes={FutureOr<bool>,Null},
|
||||
type=FutureOr<bool>?
|
||||
*/
|
||||
|
@ -431,7 +403,6 @@ exhaustiveNullable(
|
|||
}
|
||||
/*
|
||||
expandedSubtypes={true,false,Null,Future<bool?>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool?,Future<bool?>},
|
||||
type=FutureOr<bool?>
|
||||
*/
|
||||
|
@ -455,7 +426,6 @@ exhaustiveNullable(
|
|||
}
|
||||
/*
|
||||
expandedSubtypes={true,false,Null,Future<bool?>},
|
||||
fields={},
|
||||
subtypes={FutureOr<bool?>,Null},
|
||||
type=FutureOr<bool?>?
|
||||
*/
|
||||
|
@ -486,7 +456,6 @@ nonExhaustiveNullable(
|
|||
/*
|
||||
error=non-exhaustive:Null,
|
||||
expandedSubtypes={true,false,Future<bool>,Null},
|
||||
fields={},
|
||||
subtypes={FutureOr<bool>,Null},
|
||||
type=FutureOr<bool>?
|
||||
*/
|
||||
|
@ -507,7 +476,6 @@ nonExhaustiveNullable(
|
|||
/*
|
||||
error=non-exhaustive:Null,
|
||||
expandedSubtypes={true,false,Null,Future<bool?>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool?,Future<bool?>},
|
||||
type=FutureOr<bool?>
|
||||
*/
|
||||
|
@ -528,7 +496,6 @@ nonExhaustiveNullable(
|
|||
/*
|
||||
error=non-exhaustive:Future<bool?>,
|
||||
expandedSubtypes={true,false,Null,Future<bool?>},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={bool?,Future<bool?>},
|
||||
type=FutureOr<bool?>
|
||||
*/
|
||||
|
@ -553,7 +520,6 @@ nonExhaustiveNullable(
|
|||
/*
|
||||
error=non-exhaustive:Null,
|
||||
expandedSubtypes={true,false,Null,Future<bool?>},
|
||||
fields={},
|
||||
subtypes={FutureOr<bool?>,Null},
|
||||
type=FutureOr<bool?>?
|
||||
*/
|
||||
|
@ -574,7 +540,6 @@ nonExhaustiveNullable(
|
|||
/*
|
||||
error=non-exhaustive:Future<bool?>,
|
||||
expandedSubtypes={true,false,Null,Future<bool?>},
|
||||
fields={},
|
||||
subtypes={FutureOr<bool?>,Null},
|
||||
type=FutureOr<bool?>?
|
||||
*/
|
||||
|
|
|
@ -5,55 +5,36 @@
|
|||
class A<X> {}
|
||||
|
||||
switchADynamic(A<dynamic> o) {
|
||||
var a = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<dynamic>
|
||||
*/
|
||||
var a = /*type=A<dynamic>*/
|
||||
switch (o) {
|
||||
A() /*space=A<dynamic>*/=> 0,
|
||||
};
|
||||
var b = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<dynamic>
|
||||
*/
|
||||
var b = /*type=A<dynamic>*/
|
||||
switch (o) {
|
||||
A<dynamic>() /*space=A<dynamic>*/=> 0,
|
||||
};
|
||||
}
|
||||
|
||||
switchANum(A<num> o) {
|
||||
var a = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<num>
|
||||
*/
|
||||
var a = /*type=A<num>*/
|
||||
switch (o) {
|
||||
A() /*space=A<num>*/=> 0,
|
||||
};
|
||||
var b = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<num>
|
||||
*/
|
||||
var b = /*type=A<num>*/
|
||||
switch (o) {
|
||||
A<dynamic>() /*cfe.space=A<num>*//*analyzer.space=A<dynamic>*/=> 0,
|
||||
};
|
||||
var c = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<num>
|
||||
*/
|
||||
var c = /*type=A<num>*/
|
||||
switch (o) {
|
||||
A<num>() /*space=A<num>*/=> 0,
|
||||
};
|
||||
var d1 = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<num>
|
||||
*/
|
||||
var d1 = /*type=A<num>*/
|
||||
switch (o) {
|
||||
A<int>() /*space=A<int>*/=> 0,
|
||||
_ /*space=()*/=> 1,
|
||||
};
|
||||
var d2 = /*
|
||||
error=non-exhaustive:A<num>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<num>
|
||||
*/
|
||||
switch (o) {
|
||||
|
@ -62,38 +43,25 @@ switchANum(A<num> o) {
|
|||
}
|
||||
|
||||
switchAGeneric<T>(A<T> o) {
|
||||
var a = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<T>
|
||||
*/
|
||||
var a = /*type=A<T>*/
|
||||
switch (o) {
|
||||
A() /*space=A<T>*/=> 0,
|
||||
};
|
||||
var b = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<T>
|
||||
*/
|
||||
var b = /*type=A<T>*/
|
||||
switch (o) {
|
||||
A<dynamic>() /*cfe.space=A<T>*//*analyzer.space=A<dynamic>*/=> 0,
|
||||
};
|
||||
var c = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<T>
|
||||
*/
|
||||
var c = /*type=A<T>*/
|
||||
switch (o) {
|
||||
A<T>() /*space=A<T>*/=> 0,
|
||||
};
|
||||
var d1 = /*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<T>
|
||||
*/
|
||||
var d1 = /*type=A<T>*/
|
||||
switch (o) {
|
||||
A<int>() /*space=A<int>*/=> 0,
|
||||
_ /*space=()*/=> 1,
|
||||
};
|
||||
var d2 = /*
|
||||
error=non-exhaustive:A<T>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
type=A<T>
|
||||
*/
|
||||
switch (o) {
|
||||
|
|
|
@ -10,7 +10,6 @@ enum GenericEnum<X> {
|
|||
|
||||
void exhaustiveGenericSwitch(GenericEnum<dynamic> e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={GenericEnum.a,GenericEnum.b,GenericEnum.c},
|
||||
type=GenericEnum<dynamic>
|
||||
*/
|
||||
|
@ -32,7 +31,6 @@ void exhaustiveGenericSwitch(GenericEnum<dynamic> e) {
|
|||
|
||||
void exhaustiveGenericSwitchTyped(GenericEnum<int> e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={GenericEnum.a},
|
||||
type=GenericEnum<int>
|
||||
*/
|
||||
|
@ -46,7 +44,6 @@ void exhaustiveGenericSwitchTyped(GenericEnum<int> e) {
|
|||
|
||||
void exhaustiveGenericSwitchTypeVariable<T1>(GenericEnum<T1> e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={GenericEnum.a,GenericEnum.b,GenericEnum.c},
|
||||
type=GenericEnum<T1>
|
||||
*/
|
||||
|
@ -68,7 +65,6 @@ void exhaustiveGenericSwitchTypeVariable<T1>(GenericEnum<T1> e) {
|
|||
|
||||
void exhaustiveGenericSwitchBounded<T2 extends num>(GenericEnum<T2> e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={GenericEnum.a},
|
||||
type=GenericEnum<T2>
|
||||
*/
|
||||
|
@ -83,7 +79,6 @@ void exhaustiveGenericSwitchBounded<T2 extends num>(GenericEnum<T2> e) {
|
|||
void nonExhaustiveGenericSwitchTypeVariable<T3>(GenericEnum<T3> e) {
|
||||
/*
|
||||
error=non-exhaustive:GenericEnum.c,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={GenericEnum.a,GenericEnum.b,GenericEnum.c},
|
||||
type=GenericEnum<T3>
|
||||
*/
|
||||
|
@ -101,7 +96,6 @@ void nonExhaustiveGenericSwitchTypeVariable<T3>(GenericEnum<T3> e) {
|
|||
|
||||
void exhaustiveGenericSwitchTypeVariableByType<T4>(GenericEnum<T4> e) {
|
||||
/*
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={GenericEnum.a,GenericEnum.b,GenericEnum.c},
|
||||
type=GenericEnum<T4>
|
||||
*/
|
||||
|
@ -123,7 +117,6 @@ void exhaustiveGenericSwitchTypeVariableByType<T4>(GenericEnum<T4> e) {
|
|||
void nonExhaustiveGenericSwitchTypeVariableByType<T5, S5>(GenericEnum<T5> e) {
|
||||
/*
|
||||
error=non-exhaustive:GenericEnum.c,
|
||||
fields={hashCode:int,index:int,runtimeType:Type},
|
||||
subtypes={GenericEnum.a,GenericEnum.b,GenericEnum.c},
|
||||
type=GenericEnum<T5>
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,6 @@ class D4 extends D<bool, bool> {}
|
|||
exhaustiveLevel0<T1>(A<T1> a) {
|
||||
/*
|
||||
expandedSubtypes={B1<T1>,B2,C1,C2<dynamic>,D1<dynamic, dynamic>,D2<dynamic>,D3<dynamic>,D4},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T1>,C,D<dynamic, dynamic>},
|
||||
type=A<T1>
|
||||
*/
|
||||
|
@ -36,7 +35,6 @@ exhaustiveLevel0<T1>(A<T1> a) {
|
|||
exhaustiveLevel0_1<T2>(A<T2> a) {
|
||||
/*
|
||||
expandedSubtypes={B1<T2>,B2,C1,C2<dynamic>,D1<dynamic, dynamic>,D2<dynamic>,D3<dynamic>,D4},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T2>,C,D<dynamic, dynamic>},
|
||||
type=A<T2>
|
||||
*/
|
||||
|
@ -62,7 +60,6 @@ exhaustiveLevel1<T3>(A<T3> a) {
|
|||
/*
|
||||
error=non-exhaustive:D1<dynamic, dynamic>,
|
||||
expandedSubtypes={B1<T3>,B2,C1,C2<dynamic>,D1<dynamic, dynamic>,D2<dynamic>,D3<dynamic>,D4},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T3>,C,D<dynamic, dynamic>},
|
||||
type=A<T3>
|
||||
*/
|
||||
|
@ -84,7 +81,6 @@ exhaustiveLevel1<T3>(A<T3> a) {
|
|||
|
||||
exhaustiveLevel1b<T3>(B<T3> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B1<T3>,B2},
|
||||
type=B<T3>
|
||||
*/
|
||||
|
@ -95,7 +91,6 @@ exhaustiveLevel1b<T3>(B<T3> a) {
|
|||
break;
|
||||
}
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B1<T3>,B2},
|
||||
type=B<T3>
|
||||
*/
|
||||
|
@ -117,7 +112,6 @@ exhaustiveLevel2<T4>(A<T4> a) {
|
|||
/*
|
||||
error=non-exhaustive:D1<dynamic, dynamic>,
|
||||
expandedSubtypes={B1<T4>,B2,C1,C2<dynamic>,D1<dynamic, dynamic>,D2<dynamic>,D3<dynamic>,D4},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T4>,C,D<dynamic, dynamic>},
|
||||
type=A<T4>
|
||||
*/
|
||||
|
@ -159,7 +153,6 @@ exhaustiveLevel2<T4>(A<T4> a) {
|
|||
exhaustiveLevel0_1_2<T5>(A<T5> a) {
|
||||
/*
|
||||
expandedSubtypes={B1<T5>,B2,C1,C2<dynamic>,D1<dynamic, dynamic>,D2<dynamic>,D3<dynamic>,D4},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T5>,C,D<dynamic, dynamic>},
|
||||
type=A<T5>
|
||||
*/switch (a) {
|
||||
|
|
|
@ -14,7 +14,6 @@ void exhaustiveSwitchGeneric<T1>(A<T1> a) {
|
|||
// direct passing of type variables in D.
|
||||
/*
|
||||
error=non-exhaustive:D<dynamic, dynamic>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T1>,C,D<dynamic, dynamic>},
|
||||
type=A<T1>
|
||||
*/
|
||||
|
@ -35,7 +34,6 @@ void exhaustiveSwitchGeneric<T1>(A<T1> a) {
|
|||
}
|
||||
void exhaustiveSwitchGenericCatchAll<T2>(A<T2> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T2>,C,D<dynamic, dynamic>},
|
||||
type=A<T2>
|
||||
*/
|
||||
|
@ -60,7 +58,6 @@ void exhaustiveSwitchGenericBounded<T3 extends String>(A<T3> a) {
|
|||
// direct passing of type variables in D.
|
||||
/*
|
||||
error=non-exhaustive:D<dynamic, dynamic>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T3>,D<dynamic, dynamic>},
|
||||
type=A<T3>
|
||||
*/
|
||||
|
@ -79,7 +76,6 @@ void exhaustiveSwitchGenericBounded<T3 extends String>(A<T3> a) {
|
|||
void nonExhaustiveSwitchWrongGeneric1<T4, S4>(A<T4> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<T4>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T4>,C,D<dynamic, dynamic>},
|
||||
type=A<T4>
|
||||
*/
|
||||
|
@ -102,7 +98,6 @@ void nonExhaustiveSwitchWrongGeneric1<T4, S4>(A<T4> a) {
|
|||
void nonExhaustiveSwitchWrongGeneric2<T5, S5>(A<T5> a) {
|
||||
/*
|
||||
error=non-exhaustive:D<dynamic, dynamic>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<T5>,C,D<dynamic, dynamic>},
|
||||
type=A<T5>
|
||||
*/
|
||||
|
@ -127,7 +122,6 @@ void exhaustiveSwitch3(A<String> a) {
|
|||
// direct passing of type variables in D.
|
||||
/*
|
||||
error=non-exhaustive:D<dynamic, dynamic>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<String>,D<dynamic, dynamic>},
|
||||
type=A<String>
|
||||
*/
|
||||
|
@ -146,7 +140,6 @@ void exhaustiveSwitch3(A<String> a) {
|
|||
void nonExhaustiveSwitch1(A<int> a) {
|
||||
/*
|
||||
error=non-exhaustive:D<dynamic, dynamic>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<int>,C,D<dynamic, dynamic>},
|
||||
type=A<int>
|
||||
*/
|
||||
|
@ -165,7 +158,6 @@ void nonExhaustiveSwitch1(A<int> a) {
|
|||
void nonExhaustiveSwitch2(A<int> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<int>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<int>,C,D<dynamic, dynamic>},
|
||||
type=A<int>
|
||||
*/
|
||||
|
@ -182,7 +174,6 @@ void nonExhaustiveSwitch2(A<int> a) {
|
|||
void nonExhaustiveSwitch3(A<num> a) {
|
||||
/*
|
||||
error=non-exhaustive:D<dynamic, dynamic>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<num>,C,D<dynamic, dynamic>},
|
||||
type=A<num>
|
||||
*/
|
||||
|
@ -205,7 +196,6 @@ void nonExhaustiveSwitch3(A<num> a) {
|
|||
void nonExhaustiveSwitchWithDefault(A<dynamic> a) {
|
||||
/*
|
||||
error=non-exhaustive:B<dynamic>,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<dynamic>,C,D<dynamic, dynamic>},
|
||||
type=A<dynamic>
|
||||
*/
|
||||
|
@ -226,7 +216,6 @@ void exhaustiveNullableSwitch(A<int>? a) {
|
|||
/*
|
||||
error=non-exhaustive:D<dynamic, dynamic>,
|
||||
expandedSubtypes={B<int>,C,D<dynamic, dynamic>,Null},
|
||||
fields={},
|
||||
subtypes={A<int>,Null},
|
||||
type=A<int>?
|
||||
*/
|
||||
|
@ -254,7 +243,6 @@ void nonExhaustiveNullableSwitch1(A<int>? a) {
|
|||
/*
|
||||
error=non-exhaustive:Null,
|
||||
expandedSubtypes={B<int>,C,D<dynamic, dynamic>,Null},
|
||||
fields={},
|
||||
subtypes={A<int>,Null},
|
||||
type=A<int>?
|
||||
*/
|
||||
|
@ -270,7 +258,6 @@ void nonExhaustiveNullableSwitch2(A<int>? a) {
|
|||
/*
|
||||
error=non-exhaustive:D<dynamic, dynamic>,
|
||||
expandedSubtypes={B<int>,C,D<dynamic, dynamic>,Null},
|
||||
fields={},
|
||||
subtypes={A<int>,Null},
|
||||
type=A<int>?
|
||||
*/
|
||||
|
@ -292,7 +279,6 @@ void nonExhaustiveNullableSwitch2(A<int>? a) {
|
|||
|
||||
void unreachableCase1(A<int> a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<int>,C,D<dynamic, dynamic>},
|
||||
type=A<int>
|
||||
*/
|
||||
|
@ -319,7 +305,6 @@ void unreachableCase1(A<int> a) {
|
|||
void unreachableCase2(A<int> a) {
|
||||
// TODO(johnniwinther): Should we avoid the unreachable error here?
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B<int>,C,D<dynamic, dynamic>},
|
||||
type=A<int>
|
||||
*/
|
||||
|
@ -338,7 +323,6 @@ void unreachableCase2(A<int> a) {
|
|||
void unreachableCase3(A<int>? a) {
|
||||
/*
|
||||
expandedSubtypes={B<int>,C,D<dynamic, dynamic>,Null},
|
||||
fields={},
|
||||
subtypes={A<int>,Null},
|
||||
type=A<int>?
|
||||
*/
|
||||
|
|
|
@ -3,13 +3,8 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
untypedList(List list) {
|
||||
var a = /*cfe.
|
||||
var a = /*
|
||||
error=non-exhaustive:List<dynamic>,
|
||||
fields={first:Object?,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<dynamic>,last:Object?,length:int,reversed:Iterable<dynamic>,runtimeType:Type,single:Object?},
|
||||
type=List<dynamic>
|
||||
*//*analyzer.
|
||||
error=non-exhaustive:List<dynamic>,
|
||||
fields={first:Object?,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<dynamic>,last:Object?,length:int,runtimeType:Type},
|
||||
type=List<dynamic>
|
||||
*/switch (list) {
|
||||
[] /*space=??*/=> 0,
|
||||
|
@ -24,13 +19,8 @@ class B extends A {}
|
|||
class C extends A {}
|
||||
|
||||
typedList(List<A> list) {
|
||||
var a = /*cfe.
|
||||
var a = /*
|
||||
error=non-exhaustive:List<A>,
|
||||
fields={first:A,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<A>,last:A,length:int,reversed:Iterable<A>,runtimeType:Type,single:A},
|
||||
type=List<A>
|
||||
*//*analyzer.
|
||||
error=non-exhaustive:List<A>,
|
||||
fields={first:A,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<A>,last:A,length:int,runtimeType:Type},
|
||||
type=List<A>
|
||||
*/switch (list) {
|
||||
[] /*space=??*/=> 0,
|
||||
|
@ -43,24 +33,14 @@ typedList(List<A> list) {
|
|||
}
|
||||
|
||||
restWithSubpattern(List list) {
|
||||
var a = /*cfe.
|
||||
var a = /*
|
||||
error=non-exhaustive:List<dynamic>,
|
||||
fields={first:Object?,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<dynamic>,last:Object?,length:int,reversed:Iterable<dynamic>,runtimeType:Type,single:Object?},
|
||||
type=List<dynamic>
|
||||
*//*analyzer.
|
||||
error=non-exhaustive:List<dynamic>,
|
||||
fields={first:Object?,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<dynamic>,last:Object?,length:int,runtimeType:Type},
|
||||
type=List<dynamic>
|
||||
*/switch (list) {
|
||||
[...var l] /*space=??*/=> l.length,
|
||||
};
|
||||
var b = /*cfe.
|
||||
var b = /*
|
||||
error=non-exhaustive:List<dynamic>,
|
||||
fields={first:Object?,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<dynamic>,last:Object?,length:int,reversed:Iterable<dynamic>,runtimeType:Type,single:Object?},
|
||||
type=List<dynamic>
|
||||
*//*analyzer.
|
||||
error=non-exhaustive:List<dynamic>,
|
||||
fields={first:Object?,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<dynamic>,last:Object?,length:int,runtimeType:Type},
|
||||
type=List<dynamic>
|
||||
*/switch (list) {
|
||||
[...List<String> l] /*space=??*/=> l.length,
|
||||
|
|
|
@ -3,13 +3,8 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
untypedMap(Map map) {
|
||||
var a = /*cfe.
|
||||
var a = /*
|
||||
error=non-exhaustive:Map<dynamic, dynamic>,
|
||||
fields={entries:Iterable<MapEntry<dynamic, dynamic>>,hashCode:int,isEmpty:bool,isNotEmpty:bool,keys:Iterable<dynamic>,length:int,runtimeType:Type,values:Iterable<dynamic>},
|
||||
type=Map<dynamic, dynamic>
|
||||
*//*analyzer.
|
||||
error=non-exhaustive:Map<dynamic, dynamic>,
|
||||
fields={hashCode:int,isEmpty:bool,isNotEmpty:bool,keys:Iterable<dynamic>,length:int,runtimeType:Type,values:Iterable<dynamic>},
|
||||
type=Map<dynamic, dynamic>
|
||||
*/switch (map) {
|
||||
{} /*space=??*/=> 0,
|
||||
|
@ -25,13 +20,8 @@ class B extends A {}
|
|||
class C extends A {}
|
||||
|
||||
typedList(List<A> list) {
|
||||
var a = /*cfe.
|
||||
var a = /*
|
||||
error=non-exhaustive:List<A>,
|
||||
fields={first:A,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<A>,last:A,length:int,reversed:Iterable<A>,runtimeType:Type,single:A},
|
||||
type=List<A>
|
||||
*//*analyzer.
|
||||
error=non-exhaustive:List<A>,
|
||||
fields={first:A,hashCode:int,isEmpty:bool,isNotEmpty:bool,iterator:Iterator<A>,last:A,length:int,runtimeType:Type},
|
||||
type=List<A>
|
||||
*/switch (list) {
|
||||
[] /*space=??*/=> 0,
|
||||
|
|
|
@ -19,7 +19,6 @@ class D2 extends D {}
|
|||
exhaustiveLevel0(A a) {
|
||||
/*
|
||||
expandedSubtypes={B1,B2,C1,C2,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -34,7 +33,6 @@ exhaustiveLevel0(A a) {
|
|||
exhaustiveLevel0_1(A a) {
|
||||
/*
|
||||
expandedSubtypes={B1,B2,C1,C2,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -58,7 +56,6 @@ exhaustiveLevel0_1(A a) {
|
|||
exhaustiveLevel1(A a) {
|
||||
/*
|
||||
expandedSubtypes={B1,B2,C1,C2,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -81,7 +78,6 @@ exhaustiveLevel1(A a) {
|
|||
exhaustiveLevel2(A a) {
|
||||
/*
|
||||
expandedSubtypes={B1,B2,C1,C2,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -116,7 +112,6 @@ exhaustiveLevel2(A a) {
|
|||
exhaustiveLevel0_1_2(A a) {
|
||||
/*
|
||||
expandedSubtypes={B1,B2,C1,C2,D1,D2},
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,6 @@ class D extends B {}
|
|||
|
||||
simpleAssert(o1, o2) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o1) {
|
||||
|
@ -26,7 +25,6 @@ simpleAssert(o1, o2) {
|
|||
};
|
||||
|
||||
var b = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o2) {
|
||||
|
@ -38,7 +36,7 @@ restrictedCase(o1, o2) {
|
|||
// Null assert shouldn't match everything, because even though it doesn't
|
||||
// throw, it might not match.
|
||||
var a = /*
|
||||
fields={},
|
||||
fields={field:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o1) {
|
||||
|
@ -48,7 +46,7 @@ restrictedCase(o1, o2) {
|
|||
|
||||
var b = /*
|
||||
error=non-exhaustive:Object,
|
||||
fields={},
|
||||
fields={field:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o2) {
|
||||
|
@ -59,7 +57,6 @@ restrictedCase(o1, o2) {
|
|||
nullableBool(bool? b1, bool? b2) {
|
||||
/*
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -74,7 +71,6 @@ nullableBool(bool? b1, bool? b2) {
|
|||
/*
|
||||
error=non-exhaustive:false,
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -87,14 +83,13 @@ nullableBool(bool? b1, bool? b2) {
|
|||
|
||||
nullableA(A? a1, A? a2, A? a3) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/switch (a1) {
|
||||
A()! /*space=A?*/=> 0,
|
||||
};
|
||||
var b = /*
|
||||
fields={},
|
||||
fields={field:-},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/switch (a2) {
|
||||
|
@ -102,7 +97,7 @@ nullableA(A? a1, A? a2, A? a3) {
|
|||
};
|
||||
var c = /*
|
||||
error=non-exhaustive:A(field: int),
|
||||
fields={},
|
||||
fields={field:-},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/switch (a3) {
|
||||
|
@ -115,7 +110,6 @@ nullableA(A? a1, A? a2, A? a3) {
|
|||
nullableB(B? b1, B? b2, B? b3) {
|
||||
/*
|
||||
expandedSubtypes={C,D,Null},
|
||||
fields={},
|
||||
subtypes={B,Null},
|
||||
type=B?
|
||||
*/
|
||||
|
@ -126,7 +120,6 @@ nullableB(B? b1, B? b2, B? b3) {
|
|||
}
|
||||
/*
|
||||
expandedSubtypes={C,D,Null},
|
||||
fields={},
|
||||
subtypes={B,Null},
|
||||
type=B?
|
||||
*/
|
||||
|
@ -141,7 +134,6 @@ nullableB(B? b1, B? b2, B? b3) {
|
|||
/*
|
||||
error=non-exhaustive:D,
|
||||
expandedSubtypes={C,D,Null},
|
||||
fields={},
|
||||
subtypes={B,Null},
|
||||
type=B?
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,6 @@ typedef NullableObject = Object?;
|
|||
|
||||
object(o) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
@ -15,7 +14,6 @@ object(o) {
|
|||
};
|
||||
var b = /*
|
||||
error=non-exhaustive:Null,
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
@ -25,7 +23,6 @@ object(o) {
|
|||
|
||||
wildcard(o) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
@ -34,7 +31,6 @@ wildcard(o) {
|
|||
};
|
||||
var b = /*
|
||||
error=non-exhaustive:Null,
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
@ -44,7 +40,6 @@ wildcard(o) {
|
|||
|
||||
or(o) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
@ -53,7 +48,6 @@ or(o) {
|
|||
};
|
||||
var b = /*
|
||||
error=non-exhaustive:Null,
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
@ -63,7 +57,6 @@ or(o) {
|
|||
|
||||
typedVariable(o) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
@ -72,7 +65,6 @@ typedVariable(o) {
|
|||
};
|
||||
var b = /*
|
||||
error=non-exhaustive:Null,
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
@ -82,7 +74,6 @@ typedVariable(o) {
|
|||
|
||||
untypedVariable(o) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
@ -91,7 +82,6 @@ untypedVariable(o) {
|
|||
};
|
||||
var b = /*
|
||||
error=non-exhaustive:Null,
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
|
|
|
@ -17,7 +17,7 @@ class B extends A {
|
|||
|
||||
void exhaustiveSwitch1(A r) {
|
||||
/*
|
||||
fields={a:Enum,b:bool,hashCode:int,runtimeType:Type},
|
||||
fields={a:Enum,b:bool},
|
||||
subtypes={B},
|
||||
type=A
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ void exhaustiveSwitch1(A r) {
|
|||
|
||||
void exhaustiveSwitch2(A r) {
|
||||
/*
|
||||
fields={a:Enum,b:bool,hashCode:int,runtimeType:Type},
|
||||
fields={a:Enum,b:bool},
|
||||
subtypes={B},
|
||||
type=A
|
||||
*/
|
||||
|
@ -70,7 +70,7 @@ void exhaustiveSwitch2(A r) {
|
|||
void nonExhaustiveSwitch1(A r) {
|
||||
/*
|
||||
error=non-exhaustive:B(a: Enum.b, b: false),
|
||||
fields={a:Enum,b:bool,hashCode:int,runtimeType:Type},
|
||||
fields={a:Enum,b:bool},
|
||||
subtypes={B},
|
||||
type=A
|
||||
*/
|
||||
|
@ -93,7 +93,7 @@ void nonExhaustiveSwitch1(A r) {
|
|||
void nonExhaustiveSwitch2(A r) {
|
||||
/*
|
||||
error=non-exhaustive:B(a: Enum.a, b: false),
|
||||
fields={a:Enum,b:bool,hashCode:int,runtimeType:Type},
|
||||
fields={a:Enum,b:bool},
|
||||
subtypes={B},
|
||||
type=A
|
||||
*/
|
||||
|
@ -116,7 +116,7 @@ void nonExhaustiveSwitch2(A r) {
|
|||
void nonExhaustiveSwitchWithDefault(A r) {
|
||||
/*
|
||||
error=non-exhaustive:B(a: Enum.a, b: true),
|
||||
fields={a:Enum,b:bool,hashCode:int,runtimeType:Type},
|
||||
fields={a:Enum,b:bool},
|
||||
subtypes={B},
|
||||
type=A
|
||||
*/
|
||||
|
@ -134,7 +134,7 @@ void nonExhaustiveSwitchWithDefault(A r) {
|
|||
void exhaustiveNullableSwitch(A? r) {
|
||||
/*
|
||||
expandedSubtypes={B,Null},
|
||||
fields={},
|
||||
fields={a:-,b:-},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/
|
||||
|
@ -166,7 +166,7 @@ void nonExhaustiveNullableSwitch1(A? r) {
|
|||
/*
|
||||
error=non-exhaustive:Null,
|
||||
expandedSubtypes={B,Null},
|
||||
fields={},
|
||||
fields={a:-,b:-},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/
|
||||
|
@ -194,7 +194,7 @@ void nonExhaustiveNullableSwitch2(A? r) {
|
|||
/*
|
||||
error=non-exhaustive:B(a: Enum.b, b: false),
|
||||
expandedSubtypes={B,Null},
|
||||
fields={},
|
||||
fields={a:-,b:-},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/
|
||||
|
@ -220,7 +220,7 @@ void nonExhaustiveNullableSwitch2(A? r) {
|
|||
|
||||
void unreachableCase1(A r) {
|
||||
/*
|
||||
fields={a:Enum,b:bool,hashCode:int,runtimeType:Type},
|
||||
fields={a:Enum,b:bool},
|
||||
subtypes={B},
|
||||
type=A
|
||||
*/
|
||||
|
@ -254,7 +254,7 @@ void unreachableCase1(A r) {
|
|||
void unreachableCase2(A r) {
|
||||
// TODO(johnniwinther): Should we avoid the unreachable error here?
|
||||
/*
|
||||
fields={a:Enum,b:bool,hashCode:int,runtimeType:Type},
|
||||
fields={a:Enum,b:bool},
|
||||
subtypes={B},
|
||||
type=A
|
||||
*/
|
||||
|
@ -285,7 +285,7 @@ void unreachableCase2(A r) {
|
|||
void unreachableCase3(A? r) {
|
||||
/*
|
||||
expandedSubtypes={B,Null},
|
||||
fields={},
|
||||
fields={a:-,b:-},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
or(bool b1, bool? b2) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
|
@ -15,7 +14,6 @@ or(bool b1, bool? b2) {
|
|||
|
||||
/*
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -28,7 +26,6 @@ or(bool b1, bool? b2) {
|
|||
|
||||
/*
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -41,7 +38,6 @@ or(bool b1, bool? b2) {
|
|||
|
||||
/*
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -54,7 +50,6 @@ or(bool b1, bool? b2) {
|
|||
|
||||
/*
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -65,7 +60,6 @@ or(bool b1, bool? b2) {
|
|||
|
||||
/*
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -77,7 +71,6 @@ or(bool b1, bool? b2) {
|
|||
/*
|
||||
error=non-exhaustive:false,
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
@ -89,7 +82,6 @@ or(bool b1, bool? b2) {
|
|||
/*
|
||||
error=non-exhaustive:true,
|
||||
expandedSubtypes={true,false,Null},
|
||||
fields={},
|
||||
subtypes={bool,Null},
|
||||
type=bool?
|
||||
*/
|
||||
|
|
|
@ -96,7 +96,7 @@ void nonExhaustiveSwitchWithDefault((Enum, bool) r) {
|
|||
|
||||
void exhaustiveNullableSwitch((Enum, bool)? r) {
|
||||
/*
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
@ -127,7 +127,7 @@ void exhaustiveNullableSwitch((Enum, bool)? r) {
|
|||
void nonExhaustiveNullableSwitch1((Enum, bool)? r) {
|
||||
/*
|
||||
error=non-exhaustive:Null,
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/switch (r) {
|
||||
|
@ -153,7 +153,7 @@ void nonExhaustiveNullableSwitch1((Enum, bool)? r) {
|
|||
void nonExhaustiveNullableSwitch2((Enum, bool)? r) {
|
||||
/*
|
||||
error=non-exhaustive:($1: Enum.b, $2: false),
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
@ -241,7 +241,7 @@ void unreachableCase2((Enum, bool) r) {
|
|||
|
||||
void unreachableCase3((Enum, bool)? r) {
|
||||
/*
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
|
|
@ -92,7 +92,7 @@ void nonExhaustiveSwitchWithDefault((Enum, bool) r) {
|
|||
|
||||
void exhaustiveNullableSwitch((Enum, bool)? r) {
|
||||
/*
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
@ -122,7 +122,7 @@ void exhaustiveNullableSwitch((Enum, bool)? r) {
|
|||
void nonExhaustiveNullableSwitch1((Enum, bool)? r) {
|
||||
/*
|
||||
error=non-exhaustive:Null,
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
@ -149,7 +149,7 @@ void nonExhaustiveNullableSwitch1((Enum, bool)? r) {
|
|||
void nonExhaustiveNullableSwitch2((Enum, bool)? r) {
|
||||
/*
|
||||
error=non-exhaustive:($1: Enum.b, $2: false),
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
@ -237,7 +237,7 @@ void unreachableCase2((Enum, bool) r) {
|
|||
|
||||
void unreachableCase3((Enum, bool)? r) {
|
||||
/*
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
|
|
@ -90,7 +90,7 @@ void nonExhaustiveSwitchWithDefault(({Enum a, bool b}) r) {
|
|||
|
||||
void exhaustiveNullableSwitch(({Enum a, bool b})? r) {
|
||||
/*
|
||||
fields={},
|
||||
fields={a:-,b:-},
|
||||
subtypes={({Enum a, bool b}),Null},
|
||||
type=({Enum a, bool b})?
|
||||
*/
|
||||
|
@ -121,7 +121,7 @@ void exhaustiveNullableSwitch(({Enum a, bool b})? r) {
|
|||
void nonExhaustiveNullableSwitch1(({Enum a, bool b})? r) {
|
||||
/*
|
||||
error=non-exhaustive:Null,
|
||||
fields={},
|
||||
fields={a:-,b:-},
|
||||
subtypes={({Enum a, bool b}),Null},
|
||||
type=({Enum a, bool b})?
|
||||
*/
|
||||
|
@ -148,7 +148,7 @@ void nonExhaustiveNullableSwitch1(({Enum a, bool b})? r) {
|
|||
void nonExhaustiveNullableSwitch2(({Enum a, bool b})? r) {
|
||||
/*
|
||||
error=non-exhaustive:(a: Enum.b, b: false),
|
||||
fields={},
|
||||
fields={a:-,b:-},
|
||||
subtypes={({Enum a, bool b}),Null},
|
||||
type=({Enum a, bool b})?
|
||||
*/
|
||||
|
@ -234,7 +234,7 @@ void unreachableCase2(({Enum a, bool b}) r) {
|
|||
|
||||
void unreachableCase3(({Enum a, bool b})? r) {
|
||||
/*
|
||||
fields={},
|
||||
fields={a:-,b:-},
|
||||
subtypes={({Enum a, bool b}),Null},
|
||||
type=({Enum a, bool b})?
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@ class Class {
|
|||
method(Class c) {
|
||||
/*analyzer.
|
||||
error=non-exhaustive:Class(field: ($1: C, $2: C)),
|
||||
fields={field:(A, A),hashCode:int,runtimeType:Type},
|
||||
fields={field:(A, A)},
|
||||
type=Class
|
||||
*/
|
||||
switch (c) {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
equals(o1, o2) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o1) {
|
||||
|
@ -14,7 +13,6 @@ equals(o1, o2) {
|
|||
|
||||
var b = /*
|
||||
error=non-exhaustive:Object,
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o2) {
|
||||
|
@ -24,7 +22,6 @@ equals(o1, o2) {
|
|||
|
||||
greaterThan(o1, o2) {
|
||||
var a = /*
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o1) {
|
||||
|
@ -34,7 +31,6 @@ greaterThan(o1, o2) {
|
|||
|
||||
var b = /*
|
||||
error=non-exhaustive:Object,
|
||||
fields={},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o2) {
|
||||
|
|
|
@ -11,7 +11,6 @@ enum Enum {a, b}
|
|||
|
||||
void exhaustiveSwitch1(A a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -33,7 +32,6 @@ void exhaustiveSwitch1(A a) {
|
|||
|
||||
void exhaustiveSwitch2(A a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -52,7 +50,6 @@ void exhaustiveSwitch2(A a) {
|
|||
void nonExhaustiveSwitch1(A a) {
|
||||
/*
|
||||
error=non-exhaustive:D,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -71,7 +68,6 @@ void nonExhaustiveSwitch1(A a) {
|
|||
void nonExhaustiveSwitch2(A a) {
|
||||
/*
|
||||
error=non-exhaustive:B,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -90,7 +86,6 @@ void nonExhaustiveSwitch2(A a) {
|
|||
void nonExhaustiveSwitch3(A a) {
|
||||
/*
|
||||
error=non-exhaustive:C,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -109,7 +104,6 @@ void nonExhaustiveSwitch3(A a) {
|
|||
void nonExhaustiveSwitchWithDefault(A a) {
|
||||
/*
|
||||
error=non-exhaustive:C,
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -127,7 +121,6 @@ void nonExhaustiveSwitchWithDefault(A a) {
|
|||
void exhaustiveNullableSwitch(A? a) {
|
||||
/*
|
||||
expandedSubtypes={B,C,D,Null},
|
||||
fields={},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/switch (a) {
|
||||
|
@ -154,7 +147,6 @@ void nonExhaustiveNullableSwitch1(A? a) {
|
|||
/*
|
||||
error=non-exhaustive:Null,
|
||||
expandedSubtypes={B,C,D,Null},
|
||||
fields={},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/
|
||||
|
@ -170,7 +162,6 @@ void nonExhaustiveNullableSwitch2(A? a) {
|
|||
/*
|
||||
error=non-exhaustive:D,
|
||||
expandedSubtypes={B,C,D,Null},
|
||||
fields={},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/
|
||||
|
@ -192,7 +183,6 @@ void nonExhaustiveNullableSwitch2(A? a) {
|
|||
|
||||
void unreachableCase1(A a) {
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -222,7 +212,6 @@ void unreachableCase1(A a) {
|
|||
void unreachableCase2(A a) {
|
||||
// TODO(johnniwinther): Should we avoid the unreachable error here?
|
||||
/*
|
||||
fields={hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C,D},
|
||||
type=A
|
||||
*/
|
||||
|
@ -241,7 +230,6 @@ void unreachableCase2(A a) {
|
|||
void unreachableCase3(A? a) {
|
||||
/*
|
||||
expandedSubtypes={B,C,D,Null},
|
||||
fields={},
|
||||
subtypes={A,Null},
|
||||
type=A?
|
||||
*/
|
||||
|
|
|
@ -111,7 +111,7 @@ void nonExhaustiveSwitchWithDefault((Enum, bool) r) {
|
|||
|
||||
void exhaustiveNullableSwitch((Enum, bool)? r) {
|
||||
/*
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
@ -134,7 +134,7 @@ void exhaustiveNullableSwitch((Enum, bool)? r) {
|
|||
void nonExhaustiveNullableSwitch1((Enum, bool)? r) {
|
||||
/*
|
||||
error=non-exhaustive:Null,
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
@ -149,7 +149,7 @@ void nonExhaustiveNullableSwitch1((Enum, bool)? r) {
|
|||
void nonExhaustiveNullableSwitch2((Enum, bool)? r) {
|
||||
/*
|
||||
error=non-exhaustive:($1: Enum.a, $2: true),
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
@ -221,7 +221,7 @@ void unreachableCase2((Enum, bool) r) {
|
|||
|
||||
void unreachableCase3((Enum, bool)? r) {
|
||||
/*
|
||||
fields={},
|
||||
fields={$1:-,$2:-},
|
||||
subtypes={(Enum, bool),Null},
|
||||
type=(Enum, bool)?
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,6 @@ class C extends A {
|
|||
|
||||
method(A a) {
|
||||
/*
|
||||
fields={field:int,hashCode:int,runtimeType:Type},
|
||||
subtypes={B,C},
|
||||
type=A
|
||||
*/switch (a) {
|
||||
|
@ -27,7 +26,7 @@ method(A a) {
|
|||
/*space=C*/case C():
|
||||
}
|
||||
/*
|
||||
fields={field:int,hashCode:int,runtimeType:Type},
|
||||
fields={field:int},
|
||||
subtypes={B,C},
|
||||
type=A
|
||||
*/switch (a) {
|
||||
|
@ -36,7 +35,7 @@ method(A a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:B,
|
||||
fields={field:int,hashCode:int,runtimeType:Type},
|
||||
fields={field:int},
|
||||
subtypes={B,C},
|
||||
type=A
|
||||
*/switch (a) {
|
||||
|
@ -45,7 +44,7 @@ method(A a) {
|
|||
}
|
||||
/*
|
||||
error=non-exhaustive:C,
|
||||
fields={field:int,hashCode:int,runtimeType:Type},
|
||||
fields={field:int},
|
||||
subtypes={B,C},
|
||||
type=A
|
||||
*/switch (a) {
|
||||
|
|
|
@ -829,6 +829,7 @@ class ConstantVerifier extends RecursiveAstVisitor<void> {
|
|||
exhaustivenessDataForTesting.caseSpaces[caseNode] = caseSpaces[i];
|
||||
}
|
||||
exhaustivenessDataForTesting.switchScrutineeType[node] = scrutineeTypeEx;
|
||||
exhaustivenessDataForTesting.switchCases[node] = caseSpaces;
|
||||
for (var error in errors) {
|
||||
if (error is UnreachableCaseError) {
|
||||
exhaustivenessDataForTesting.errors[caseNodesWithSpace[error.index]] =
|
||||
|
|
|
@ -288,6 +288,9 @@ class ExhaustivenessDataForTesting {
|
|||
/// scrutinee.
|
||||
Map<AstNode, StaticType> switchScrutineeType = {};
|
||||
|
||||
/// Map from switch statement/expression nodes the spaces for its cases.
|
||||
Map<AstNode, List<Space>> switchCases = {};
|
||||
|
||||
/// Map from switch case nodes to the space for its pattern/expression.
|
||||
Map<AstNode, Space> caseSpaces = {};
|
||||
|
||||
|
|
|
@ -68,9 +68,19 @@ class _ExhaustivenessDataExtractor extends AstDataExtractor<Features> {
|
|||
Features features = Features();
|
||||
if (node is SwitchStatement || node is SwitchExpression) {
|
||||
StaticType? scrutineeType = _exhaustivenessData.switchScrutineeType[node];
|
||||
if (scrutineeType != null) {
|
||||
List<Space>? caseSpaces = _exhaustivenessData.switchCases[node];
|
||||
if (scrutineeType != null && caseSpaces != null) {
|
||||
Set<String> fieldsOfInterest = {};
|
||||
for (Space caseSpace in caseSpaces) {
|
||||
for (SingleSpace singleSpace in caseSpace.singleSpaces) {
|
||||
fieldsOfInterest.addAll(singleSpace.fields.keys);
|
||||
}
|
||||
}
|
||||
features[Tags.scrutineeType] = staticTypeToText(scrutineeType);
|
||||
features[Tags.scrutineeFields] = fieldsToText(scrutineeType.fields);
|
||||
if (fieldsOfInterest.isNotEmpty) {
|
||||
features[Tags.scrutineeFields] =
|
||||
fieldsToText(scrutineeType.fields, fieldsOfInterest);
|
||||
}
|
||||
String? subtypes = typesToText(scrutineeType.subtypes);
|
||||
if (subtypes != null) {
|
||||
features[Tags.subtypes] = subtypes;
|
||||
|
|
|
@ -81,8 +81,16 @@ class ExhaustivenessDataExtractor extends CfeDataExtractor<Features> {
|
|||
features[Tags.expandedSubtypes] = expandedSubtypes;
|
||||
}
|
||||
}
|
||||
features[Tags.scrutineeFields] =
|
||||
fieldsToText(result.scrutineeType.fields);
|
||||
Set<String> fieldsOfInterest = {};
|
||||
for (Space caseSpace in result.caseSpaces) {
|
||||
for (SingleSpace singleSpace in caseSpace.singleSpaces) {
|
||||
fieldsOfInterest.addAll(singleSpace.fields.keys);
|
||||
}
|
||||
}
|
||||
if (fieldsOfInterest.isNotEmpty) {
|
||||
features[Tags.scrutineeFields] =
|
||||
fieldsToText(result.scrutineeType.fields, fieldsOfInterest);
|
||||
}
|
||||
for (ExhaustivenessError error in result.errors) {
|
||||
if (error is NonExhaustiveError) {
|
||||
features[Tags.error] = errorToText(error);
|
||||
|
|
Loading…
Reference in a new issue