mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 15:39:54 +00:00
[cfe] Add test for switch on generic enum
Change-Id: I9ac215a4a0e24f4d1a7a5cfe043fe071fbed5002 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277980 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
9383820f15
commit
7cc63e4afe
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
enum Enum<T> {
|
||||
a<num>(),
|
||||
b<String>(),
|
||||
c<bool>(),
|
||||
}
|
||||
|
||||
method1(Enum<dynamic> e) {
|
||||
switch (e) {
|
||||
case Enum.a:
|
||||
case Enum.b:
|
||||
case Enum.c:
|
||||
}
|
||||
}
|
||||
|
||||
method2(Enum<num> e) {
|
||||
switch (e) {
|
||||
case Enum.a:
|
||||
case Enum.b:
|
||||
case Enum.c:
|
||||
}
|
||||
}
|
||||
|
||||
method3(Enum<int> e) {
|
||||
switch (e) {
|
||||
case Enum.a:
|
||||
case Enum.b:
|
||||
case Enum.c:
|
||||
}
|
||||
}
|
||||
|
||||
method4<T>(Enum<T> e) {
|
||||
switch (e) {
|
||||
case Enum.a:
|
||||
case Enum.b:
|
||||
case Enum.c:
|
||||
}
|
||||
}
|
||||
|
||||
method5<T extends num>(Enum<T> e) {
|
||||
switch (e) {
|
||||
case Enum.a:
|
||||
case Enum.b:
|
||||
case Enum.c:
|
||||
}
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:22:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:23:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:29:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:30:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:31:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:37:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:38:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:39:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:45:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:46:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:47:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class Enum<T extends core::Object? = dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::Enum<dynamic>> values = #C10;
|
||||
enum-element static const field self::Enum<core::num> a = #C3;
|
||||
enum-element static const field self::Enum<core::String> b = #C6;
|
||||
enum-element static const field self::Enum<core::bool> c = #C9;
|
||||
const constructor •(core::int #index, core::String #name) → self::Enum<self::Enum::T%>
|
||||
: super core::_Enum::•(#index, #name)
|
||||
;
|
||||
method _enumToString() → core::String
|
||||
return "Enum.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method method1(self::Enum<dynamic> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L1:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
static method method2(self::Enum<core::num> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
static method method3(self::Enum<core::int> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L3:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
static method method4<T extends core::Object? = dynamic>(self::Enum<self::method4::T%> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L4:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
static method method5<T extends core::num>(self::Enum<self::method5::T> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L5:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = "a"
|
||||
#C3 = self::Enum<core::num> {index:#C1, _name:#C2}
|
||||
#C4 = 1
|
||||
#C5 = "b"
|
||||
#C6 = self::Enum<core::String> {index:#C4, _name:#C5}
|
||||
#C7 = 2
|
||||
#C8 = "c"
|
||||
#C9 = self::Enum<core::bool> {index:#C7, _name:#C8}
|
||||
#C10 = <self::Enum<dynamic>>[#C3, #C6, #C9]
|
||||
}
|
||||
|
||||
|
||||
Constructor coverage from constants:
|
||||
org-dartlang-testcase:///generic_enum_switch.dart:
|
||||
- Enum. (from org-dartlang-testcase:///generic_enum_switch.dart:5:6)
|
||||
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart)
|
||||
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
|
|
@ -0,0 +1,171 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:22:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:23:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:29:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:30:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:31:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:37:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:38:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:39:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:45:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:46:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:47:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class Enum<T extends core::Object? = dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::Enum<dynamic>> values = #C10;
|
||||
enum-element static const field self::Enum<core::num> a = #C3;
|
||||
enum-element static const field self::Enum<core::String> b = #C6;
|
||||
enum-element static const field self::Enum<core::bool> c = #C9;
|
||||
const constructor •(core::int #index, core::String #name) → self::Enum<self::Enum::T%>
|
||||
: super core::_Enum::•(#index, #name)
|
||||
;
|
||||
method _enumToString() → core::String
|
||||
return "Enum.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method method1(self::Enum<dynamic> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L1:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
static method method2(self::Enum<core::num> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
static method method3(self::Enum<core::int> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L3:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
static method method4<T extends core::Object? = dynamic>(self::Enum<self::method4::T%> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L4:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
static method method5<T extends core::num>(self::Enum<self::method5::T> e) → dynamic {
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L5:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = "a"
|
||||
#C3 = self::Enum<core::num> {index:#C1, _name:#C2}
|
||||
#C4 = 1
|
||||
#C5 = "b"
|
||||
#C6 = self::Enum<core::String> {index:#C4, _name:#C5}
|
||||
#C7 = 2
|
||||
#C8 = "c"
|
||||
#C9 = self::Enum<core::bool> {index:#C7, _name:#C8}
|
||||
#C10 = <self::Enum<dynamic>>[#C3, #C6, #C9]
|
||||
}
|
||||
|
||||
|
||||
Constructor coverage from constants:
|
||||
org-dartlang-testcase:///generic_enum_switch.dart:
|
||||
- Enum. (from org-dartlang-testcase:///generic_enum_switch.dart:5:6)
|
||||
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart)
|
||||
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
|
|
@ -0,0 +1,11 @@
|
|||
enum Enum<T> {
|
||||
a<num>(),
|
||||
b<String>(),
|
||||
c<bool>(),
|
||||
}
|
||||
|
||||
method1(Enum<dynamic> e) {}
|
||||
method2(Enum<num> e) {}
|
||||
method3(Enum<int> e) {}
|
||||
method4<T>(Enum<T> e) {}
|
||||
method5<T extends num>(Enum<T> e) {}
|
|
@ -0,0 +1,11 @@
|
|||
enum Enum<T> {
|
||||
a<num>(),
|
||||
b<String>(),
|
||||
c<bool>(),
|
||||
}
|
||||
|
||||
method1(Enum<dynamic> e) {}
|
||||
method2(Enum<num> e) {}
|
||||
method3(Enum<int> e) {}
|
||||
method4<T>(Enum<T> e) {}
|
||||
method5<T extends num>(Enum<T> e) {}
|
|
@ -0,0 +1,202 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:22:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:23:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:29:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:30:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:31:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:37:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:38:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:39:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:45:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:46:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:47:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
class Enum<T extends core::Object? = dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::Enum<dynamic>> values = #C10;
|
||||
enum-element static const field self::Enum<core::num> a = #C3;
|
||||
enum-element static const field self::Enum<core::String> b = #C6;
|
||||
enum-element static const field self::Enum<core::bool> c = #C9;
|
||||
const constructor •(core::int #index, core::String #name) → self::Enum<self::Enum::T%>
|
||||
: super core::_Enum::•(#index, #name)
|
||||
;
|
||||
method _enumToString() → core::String
|
||||
return "Enum.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method method1(self::Enum<dynamic> e) → dynamic {
|
||||
#L1:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L1;
|
||||
}
|
||||
#L3:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method2(self::Enum<core::num> e) → dynamic {
|
||||
#L4:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L5:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L4;
|
||||
}
|
||||
#L6:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method3(self::Enum<core::int> e) → dynamic {
|
||||
#L7:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L8:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L7;
|
||||
}
|
||||
#L9:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method4<T extends core::Object? = dynamic>(self::Enum<self::method4::T%> e) → dynamic {
|
||||
#L10:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L11:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L10;
|
||||
}
|
||||
#L12:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method5<T extends core::num>(self::Enum<self::method5::T> e) → dynamic {
|
||||
#L13:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L14:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L13;
|
||||
}
|
||||
#L15:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = "a"
|
||||
#C3 = self::Enum<core::num*> {index:#C1, _name:#C2}
|
||||
#C4 = 1
|
||||
#C5 = "b"
|
||||
#C6 = self::Enum<core::String*> {index:#C4, _name:#C5}
|
||||
#C7 = 2
|
||||
#C8 = "c"
|
||||
#C9 = self::Enum<core::bool*> {index:#C7, _name:#C8}
|
||||
#C10 = <self::Enum<dynamic>*>[#C3, #C6, #C9]
|
||||
}
|
||||
|
||||
|
||||
Constructor coverage from constants:
|
||||
org-dartlang-testcase:///generic_enum_switch.dart:
|
||||
- Enum. (from org-dartlang-testcase:///generic_enum_switch.dart:5:6)
|
||||
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart)
|
||||
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
|
|
@ -0,0 +1,202 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:22:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:23:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:29:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:30:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:31:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:37:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:38:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:39:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:45:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:46:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:47:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
class Enum<T extends core::Object? = dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::Enum<dynamic>> values = #C10;
|
||||
enum-element static const field self::Enum<core::num> a = #C3;
|
||||
enum-element static const field self::Enum<core::String> b = #C6;
|
||||
enum-element static const field self::Enum<core::bool> c = #C9;
|
||||
const constructor •(core::int #index, core::String #name) → self::Enum<self::Enum::T%>
|
||||
: super core::_Enum::•(#index, #name)
|
||||
;
|
||||
method _enumToString() → core::String
|
||||
return "Enum.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method method1(self::Enum<dynamic> e) → dynamic {
|
||||
#L1:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L1;
|
||||
}
|
||||
#L3:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method2(self::Enum<core::num> e) → dynamic {
|
||||
#L4:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L5:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L4;
|
||||
}
|
||||
#L6:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method3(self::Enum<core::int> e) → dynamic {
|
||||
#L7:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L8:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L7;
|
||||
}
|
||||
#L9:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method4<T extends core::Object? = dynamic>(self::Enum<self::method4::T%> e) → dynamic {
|
||||
#L10:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L11:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L10;
|
||||
}
|
||||
#L12:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method5<T extends core::num>(self::Enum<self::method5::T> e) → dynamic {
|
||||
#L13:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L14:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L13;
|
||||
}
|
||||
#L15:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = "a"
|
||||
#C3 = self::Enum<core::num*> {index:#C1, _name:#C2}
|
||||
#C4 = 1
|
||||
#C5 = "b"
|
||||
#C6 = self::Enum<core::String*> {index:#C4, _name:#C5}
|
||||
#C7 = 2
|
||||
#C8 = "c"
|
||||
#C9 = self::Enum<core::bool*> {index:#C7, _name:#C8}
|
||||
#C10 = <self::Enum<dynamic>*>[#C3, #C6, #C9]
|
||||
}
|
||||
|
||||
|
||||
Constructor coverage from constants:
|
||||
org-dartlang-testcase:///generic_enum_switch.dart:
|
||||
- Enum. (from org-dartlang-testcase:///generic_enum_switch.dart:5:6)
|
||||
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart)
|
||||
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
|
|
@ -0,0 +1,33 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class Enum<T extends core::Object? = dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::Enum<dynamic>> values = const <self::Enum<dynamic>>[self::Enum::a, self::Enum::b, self::Enum::c];
|
||||
enum-element static const field self::Enum<core::num> a = const self::Enum::•<core::num>(0, "a");
|
||||
enum-element static const field self::Enum<core::String> b = const self::Enum::•<core::String>(1, "b");
|
||||
enum-element static const field self::Enum<core::bool> c = const self::Enum::•<core::bool>(2, "c");
|
||||
const constructor •(core::int #index, core::String #name) → self::Enum<self::Enum::T%>
|
||||
: super core::_Enum::•(#index, #name)
|
||||
;
|
||||
method _enumToString() → core::String
|
||||
return "Enum.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method method1(self::Enum<dynamic> e) → dynamic
|
||||
;
|
||||
static method method2(self::Enum<core::num> e) → dynamic
|
||||
;
|
||||
static method method3(self::Enum<core::int> e) → dynamic
|
||||
;
|
||||
static method method4<T extends core::Object? = dynamic>(self::Enum<self::method4::T%> e) → dynamic
|
||||
;
|
||||
static method method5<T extends core::num>(self::Enum<self::method5::T> e) → dynamic
|
||||
;
|
||||
|
||||
|
||||
Extra constant evaluation status:
|
||||
Evaluated: ListLiteral @ org-dartlang-testcase:///generic_enum_switch.dart:5:6 -> ListConstant(const <Enum<dynamic>*>[const Enum<num*>{_Enum.index: 0, _Enum._name: "a"}, const Enum<String*>{_Enum.index: 1, _Enum._name: "b"}, const Enum<bool*>{_Enum.index: 2, _Enum._name: "c"}])
|
||||
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///generic_enum_switch.dart:6:3 -> InstanceConstant(const Enum<num*>{_Enum.index: 0, _Enum._name: "a"})
|
||||
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///generic_enum_switch.dart:7:3 -> InstanceConstant(const Enum<String*>{_Enum.index: 1, _Enum._name: "b"})
|
||||
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///generic_enum_switch.dart:8:3 -> InstanceConstant(const Enum<bool*>{_Enum.index: 2, _Enum._name: "c"})
|
||||
Extra constant evaluation: evaluated: 9, effectively constant: 4
|
|
@ -0,0 +1,202 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:22:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:23:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<num>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:20:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:29:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:30:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:31:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<int>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:28:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:37:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:38:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:39:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:36:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:45:15: Error: Type 'Enum<num>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.a:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:46:15: Error: Type 'Enum<String>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.b:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:47:15: Error: Type 'Enum<bool>' of the case expression is not a subtype of type 'Enum<T>' of this switch expression.
|
||||
// - 'Enum' is from 'pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart'.
|
||||
// case Enum.c:
|
||||
// ^
|
||||
// pkg/front_end/testcases/enhanced_enums/generic_enum_switch.dart:44:11: Context: The switch expression is here.
|
||||
// switch (e) {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
class Enum<T extends core::Object? = dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::Enum<dynamic>> values = #C10;
|
||||
enum-element static const field self::Enum<core::num> a = #C3;
|
||||
enum-element static const field self::Enum<core::String> b = #C6;
|
||||
enum-element static const field self::Enum<core::bool> c = #C9;
|
||||
const constructor •(core::int #index, core::String #name) → self::Enum<self::Enum::T%>
|
||||
: super core::_Enum::•(#index, #name)
|
||||
;
|
||||
method _enumToString() → core::String
|
||||
return "Enum.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method method1(self::Enum<dynamic> e) → dynamic {
|
||||
#L1:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L1;
|
||||
}
|
||||
#L3:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method2(self::Enum<core::num> e) → dynamic {
|
||||
#L4:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L5:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L4;
|
||||
}
|
||||
#L6:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method3(self::Enum<core::int> e) → dynamic {
|
||||
#L7:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L8:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L7;
|
||||
}
|
||||
#L9:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method4<T extends core::Object? = dynamic>(self::Enum<self::method4::T%> e) → dynamic {
|
||||
#L10:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L11:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L10;
|
||||
}
|
||||
#L12:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
static method method5<T extends core::num>(self::Enum<self::method5::T> e) → dynamic {
|
||||
#L13:
|
||||
switch(e) /*isExplicitlyExhaustive*/ {
|
||||
#L14:
|
||||
case #C3:
|
||||
case #C6:
|
||||
case #C9:
|
||||
{
|
||||
break #L13;
|
||||
}
|
||||
#L15:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable enum type.");
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = "a"
|
||||
#C3 = self::Enum<core::num*> {index:#C1, _name:#C2}
|
||||
#C4 = 1
|
||||
#C5 = "b"
|
||||
#C6 = self::Enum<core::String*> {index:#C4, _name:#C5}
|
||||
#C7 = 2
|
||||
#C8 = "c"
|
||||
#C9 = self::Enum<core::bool*> {index:#C7, _name:#C8}
|
||||
#C10 = <self::Enum<dynamic>*>[#C3, #C6, #C9]
|
||||
}
|
||||
|
||||
|
||||
Constructor coverage from constants:
|
||||
org-dartlang-testcase:///generic_enum_switch.dart:
|
||||
- Enum. (from org-dartlang-testcase:///generic_enum_switch.dart:5:6)
|
||||
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart)
|
||||
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
|
Loading…
Reference in a new issue