blob: eb2bdcd2a62f9d58029880d0bcec8025e4fab0bd [file] [log] [blame]
library;
//
// Problems in library:
//
// pkg/front_end/testcases/patterns/exhaustiveness/bool_switch.dart:17:11: Error: The type 'bool' is not exhaustively matched by the switch cases since it doesn't match 'false'.
// Try adding a default case or cases that match 'false'.
// switch (b) /* Error */ {
// ^
//
// pkg/front_end/testcases/patterns/exhaustiveness/bool_switch.dart:25:11: Error: The type 'bool' is not exhaustively matched by the switch cases since it doesn't match 'true'.
// Try adding a default case or cases that match 'true'.
// switch (b) /* Error */ {
// ^
//
// pkg/front_end/testcases/patterns/exhaustiveness/bool_switch.dart:58:11: Error: The type 'bool?' is not exhaustively matched by the switch cases since it doesn't match 'null'.
// Try adding a default case or cases that match 'null'.
// switch (b) /* Error */ {
// ^
//
// pkg/front_end/testcases/patterns/exhaustiveness/bool_switch.dart:69:11: Error: The type 'bool?' is not exhaustively matched by the switch cases since it doesn't match 'false'.
// Try adding a default case or cases that match 'false'.
// switch (b) /* Error */ {
// ^
//
import self as self;
import "dart:core" as core;
import "dart:_internal" as _in;
static method exhaustiveSwitch(core::bool b) void {
#L1:
switch(b) /* isExplicitlyExhaustive, core::bool */ {
#L2:
case #C1:
{
core::print("true");
break #L1;
}
#L3:
case #C2:
{
core::print("false");
break #L1;
}
#L4:
default:
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
}
}
static method nonExhaustiveSwitch1(core::bool b) void {
#L5:
switch(b) /* isExplicitlyExhaustive, core::bool */ {
#L6:
case #C1:
{
core::print("true");
break #L5;
}
#L7:
default:
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
}
}
static method nonExhaustiveSwitch2(core::bool b) void {
#L8:
switch(b) /* isExplicitlyExhaustive, core::bool */ {
#L9:
case #C2:
{
core::print("false");
break #L8;
}
#L10:
default:
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
}
}
static method nonExhaustiveSwitchWithDefault(core::bool b) void {
#L11:
switch(b) /* core::bool */ {
#L12:
case #C1:
{
core::print("true");
break #L11;
}
#L13:
default:
{
core::print("default");
break #L11;
}
}
}
static method exhaustiveNullableSwitch(core::bool? b) void {
#L14:
switch(b) /* isExplicitlyExhaustive, core::bool? */ {
#L15:
case #C1:
{
core::print("true");
break #L14;
}
#L16:
case #C2:
{
core::print("false");
break #L14;
}
#L17:
case #C3:
{
core::print("null");
break #L14;
}
#L18:
default:
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
}
}
static method nonExhaustiveNullableSwitch1(core::bool? b) void {
#L19:
switch(b) /* isExplicitlyExhaustive, core::bool? */ {
#L20:
case #C1:
{
core::print("true");
break #L19;
}
#L21:
case #C2:
{
core::print("false");
break #L19;
}
#L22:
default:
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
}
}
static method nonExhaustiveNullableSwitch2(core::bool? b) void {
#L23:
switch(b) /* isExplicitlyExhaustive, core::bool? */ {
#L24:
case #C1:
{
core::print("true");
break #L23;
}
#L25:
case #C3:
{
core::print("null");
break #L23;
}
#L26:
default:
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
}
}
static method unreachableCase1(core::bool b) void {
#L27:
switch(b) /* isExplicitlyExhaustive, core::bool */ {
#L28:
case #C1:
{
core::print("true1");
break #L27;
}
#L29:
case #C2:
{
core::print("false");
break #L27;
}
#L30:
case #C1:
{
core::print("true2");
break #L27;
}
#L31:
default:
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
}
}
static method unreachableCase2(core::bool b) void {
#L32:
switch(b) /* isExplicitlyExhaustive, core::bool */ {
#L33:
case #C1:
{
core::print("true");
break #L32;
}
#L34:
case #C2:
{
core::print("false");
break #L32;
}
#L35:
case #C3:
{
core::print("null");
break #L32;
}
#L36:
default:
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
}
}
static method unreachableCase3(core::bool? b) void {
#L37:
switch(b) /* isExplicitlyExhaustive, core::bool? */ {
#L38:
case #C1:
{
core::print("true");
break #L37;
}
#L39:
case #C2:
{
core::print("false");
break #L37;
}
#L40:
case #C3:
{
core::print("null1");
break #L37;
}
#L41:
case #C3:
{
core::print("null2");
break #L37;
}
#L42:
default:
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
}
}
constants {
#C1 = true
#C2 = false
#C3 = null
}