mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:16:51 +00:00
[_fe_analyzer_shared] Support intersection types in exhaustiveness
This adds handling of type variables with bounds and intersection types in exhaustiveness checking. These are handled using [WrappedStaticType]s where the type variable is the implied type and the bound is the wrapped type from which the subtypes are computed, thereby supporting sealed types in the bounds. The change also includes some cleanups a fixes found during implementation, amongst these a fix to no longer cache the map/list type identities objects. These were not used as identities, similar to the value identities used for enum and bool values, but instead as restrictions on the the static type. These have therefore been renamed to Map/ListTypeRestriction to reflect that. Closes https://github.com/dart-lang/language/issues/2878 Closes #51819 Change-Id: I56e94e4f0dc6695288ab978687d8c95835535b8d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291220 Reviewed-by: Paul Berry <paulberry@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
0936bceaa0
commit
8d78983ef6
|
@ -89,6 +89,10 @@ abstract class TypeOperations<Type extends Object> {
|
|||
/// Returns `true` if [type] has a simple name that can be used as the type
|
||||
/// of an object pattern.
|
||||
bool hasSimpleName(Type type);
|
||||
|
||||
/// Returns the bound of [type] if is a type variable or a promoted type
|
||||
/// variable. Otherwise returns `null`.
|
||||
Type? getTypeVariableBound(Type type);
|
||||
}
|
||||
|
||||
/// Interface for looking up fields and their corresponding [StaticType]s of
|
||||
|
@ -209,6 +213,11 @@ class ExhaustivenessCache<
|
|||
} else {
|
||||
staticType =
|
||||
new TypeBasedStaticType(typeOperations, this, nonNullable);
|
||||
Type? bound = typeOperations.getTypeVariableBound(type);
|
||||
if (bound != null) {
|
||||
staticType =
|
||||
new WrappedStaticType(getStaticType(bound), staticType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,24 +266,23 @@ class ExhaustivenessCache<
|
|||
return staticType;
|
||||
}
|
||||
|
||||
/// Returns a [StaticType] of the list [type] with the given [identity] .
|
||||
StaticType getListStaticType(Type type, ListTypeIdentity<Type> identity) {
|
||||
/// Returns a [StaticType] of the list [type] with the given [restriction] .
|
||||
StaticType getListStaticType(
|
||||
Type type, ListTypeRestriction<Type> restriction) {
|
||||
Type nonNullable = typeOperations.getNonNullable(type);
|
||||
StaticType staticType = _uniqueTypeMap[identity] ??=
|
||||
new ListPatternStaticType(
|
||||
typeOperations, this, nonNullable, identity, identity.toString());
|
||||
StaticType staticType = new ListPatternStaticType(
|
||||
typeOperations, this, nonNullable, restriction, restriction.toString());
|
||||
if (typeOperations.isNullable(type)) {
|
||||
staticType = staticType.nullable;
|
||||
}
|
||||
return staticType;
|
||||
}
|
||||
|
||||
/// Returns a [StaticType] of the map [type] with the given [identity] .
|
||||
StaticType getMapStaticType(Type type, MapTypeIdentity<Type> identity) {
|
||||
/// Returns a [StaticType] of the map [type] with the given [restriction] .
|
||||
StaticType getMapStaticType(Type type, MapTypeRestriction<Type> restriction) {
|
||||
Type nonNullable = typeOperations.getNonNullable(type);
|
||||
StaticType staticType = _uniqueTypeMap[identity] ??=
|
||||
new MapPatternStaticType(
|
||||
typeOperations, this, nonNullable, identity, identity.toString());
|
||||
StaticType staticType = new MapPatternStaticType(
|
||||
typeOperations, this, nonNullable, restriction, restriction.toString());
|
||||
if (typeOperations.isNullable(type)) {
|
||||
staticType = staticType.nullable;
|
||||
}
|
||||
|
@ -353,11 +361,11 @@ mixin SpaceCreator<Pattern extends Object, Type extends Object> {
|
|||
return staticType;
|
||||
}
|
||||
|
||||
/// Creates the [StaticType] for the list [type] with the given [identity].
|
||||
StaticType createListType(Type type, ListTypeIdentity<Type> identity);
|
||||
/// Creates the [StaticType] for the list [type] with the given [restriction].
|
||||
StaticType createListType(Type type, ListTypeRestriction<Type> restriction);
|
||||
|
||||
/// Creates the [StaticType] for the map [type] with the given [identity].
|
||||
StaticType createMapType(Type type, MapTypeIdentity<Type> identity);
|
||||
/// Creates the [StaticType] for the map [type] with the given [restriction].
|
||||
StaticType createMapType(Type type, MapTypeRestriction<Type> restriction);
|
||||
|
||||
/// Creates the [Space] for [pattern] at the given [path].
|
||||
///
|
||||
|
@ -571,7 +579,7 @@ mixin SpaceCreator<Pattern extends Object, Type extends Object> {
|
|||
typeArgumentText = '';
|
||||
}
|
||||
|
||||
ListTypeIdentity<Type> identity = new ListTypeIdentity(
|
||||
ListTypeRestriction<Type> identity = new ListTypeRestriction(
|
||||
elementType, typeArgumentText,
|
||||
size: headSize + tailSize, hasRest: hasRest);
|
||||
|
||||
|
@ -630,7 +638,7 @@ mixin SpaceCreator<Pattern extends Object, Type extends Object> {
|
|||
typeArgumentsText = '';
|
||||
}
|
||||
|
||||
MapTypeIdentity<Type> identity = new MapTypeIdentity(
|
||||
MapTypeRestriction<Type> identity = new MapTypeRestriction(
|
||||
keyType, valueType, entries.keys.toSet(), typeArgumentsText,
|
||||
hasRest: hasRest);
|
||||
StaticType staticType = createMapType(type, identity);
|
||||
|
|
|
@ -85,13 +85,13 @@ class ListTypeStaticType<Type extends Object>
|
|||
typeArgumentText = '<${_typeOperations.typeToString(elementType)}>';
|
||||
}
|
||||
for (int size = 0; size < maxSize; size++) {
|
||||
ListTypeIdentity<Type> identity = new ListTypeIdentity(
|
||||
ListTypeRestriction<Type> identity = new ListTypeRestriction(
|
||||
elementType, typeArgumentText,
|
||||
size: size, hasRest: false);
|
||||
subtypes.add(new ListPatternStaticType<Type>(
|
||||
_typeOperations, _fieldLookup, _type, identity, identity.toString()));
|
||||
}
|
||||
ListTypeIdentity<Type> identity = new ListTypeIdentity(
|
||||
ListTypeRestriction<Type> identity = new ListTypeRestriction(
|
||||
elementType, typeArgumentText,
|
||||
size: maxSize, hasRest: true);
|
||||
subtypes.add(new ListPatternStaticType<Type>(
|
||||
|
@ -100,10 +100,10 @@ class ListTypeStaticType<Type extends Object>
|
|||
}
|
||||
}
|
||||
|
||||
/// [StaticType] for a list pattern type using a [ListTypeIdentity] for its
|
||||
/// [StaticType] for a list pattern type using a [ListTypeRestriction] for its
|
||||
/// uniqueness.
|
||||
class ListPatternStaticType<Type extends Object>
|
||||
extends RestrictedStaticType<Type, ListTypeIdentity<Type>> {
|
||||
extends RestrictedStaticType<Type, ListTypeRestriction<Type>> {
|
||||
ListPatternStaticType(super.typeOperations, super.fieldLookup, super.type,
|
||||
super.restriction, super.name);
|
||||
|
||||
|
@ -206,19 +206,19 @@ class ListPatternStaticType<Type extends Object>
|
|||
}
|
||||
}
|
||||
|
||||
/// Identity object used for creating a unique [ListPatternStaticType] for a
|
||||
/// Restriction object used for creating a unique [ListPatternStaticType] for a
|
||||
/// list pattern.
|
||||
///
|
||||
/// The uniqueness is defined by the element type, the number of elements at the
|
||||
/// start of the list, whether the list pattern has a rest element, and the
|
||||
/// number elements at the end of the list, after the rest element.
|
||||
class ListTypeIdentity<Type extends Object> implements Restriction<Type> {
|
||||
class ListTypeRestriction<Type extends Object> implements Restriction<Type> {
|
||||
final Type elementType;
|
||||
final int size;
|
||||
final bool hasRest;
|
||||
final String typeArgumentText;
|
||||
|
||||
ListTypeIdentity(this.elementType, this.typeArgumentText,
|
||||
ListTypeRestriction(this.elementType, this.typeArgumentText,
|
||||
{required this.size, required this.hasRest});
|
||||
|
||||
@override
|
||||
|
@ -233,7 +233,7 @@ class ListTypeIdentity<Type extends Object> implements Restriction<Type> {
|
|||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
return other is ListTypeIdentity<Type> &&
|
||||
return other is ListTypeRestriction<Type> &&
|
||||
elementType == other.elementType &&
|
||||
size == other.size &&
|
||||
hasRest == other.hasRest;
|
||||
|
@ -242,7 +242,7 @@ class ListTypeIdentity<Type extends Object> implements Restriction<Type> {
|
|||
@override
|
||||
bool isSubtypeOf(TypeOperations<Type> typeOperations, Restriction other) {
|
||||
if (other.isUnrestricted) return true;
|
||||
if (other is! ListTypeIdentity<Type>) return false;
|
||||
if (other is! ListTypeRestriction<Type>) return false;
|
||||
if (!typeOperations.isSubtypeOf(elementType, other.elementType)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
part of '../types.dart';
|
||||
|
||||
/// [StaticType] for a map pattern type using a [MapTypeIdentity] for its
|
||||
/// [StaticType] for a map pattern type using a [MapTypeRestriction] for its
|
||||
/// uniqueness.
|
||||
class MapPatternStaticType<Type extends Object>
|
||||
extends RestrictedStaticType<Type, MapTypeIdentity<Type>> {
|
||||
extends RestrictedStaticType<Type, MapTypeRestriction<Type>> {
|
||||
MapPatternStaticType(super.typeOperations, super.fieldLookup, super.type,
|
||||
super.restriction, super.name);
|
||||
|
||||
|
@ -79,7 +79,7 @@ class MapPatternStaticType<Type extends Object>
|
|||
}
|
||||
}
|
||||
|
||||
/// Identity object used for creating a unique [MapPatternStaticType] for a
|
||||
/// Restriction object used for creating a unique [MapPatternStaticType] for a
|
||||
/// map pattern.
|
||||
///
|
||||
/// The uniqueness is defined by the key and value types, the key values of
|
||||
|
@ -87,14 +87,14 @@ class MapPatternStaticType<Type extends Object>
|
|||
///
|
||||
/// This identity ensures that we can detect overlap between map patterns with
|
||||
/// the same set of keys.
|
||||
class MapTypeIdentity<Type extends Object> implements Restriction<Type> {
|
||||
class MapTypeRestriction<Type extends Object> implements Restriction<Type> {
|
||||
final Type keyType;
|
||||
final Type valueType;
|
||||
final Set<MapKey> keys;
|
||||
final bool hasRest;
|
||||
final String typeArgumentsText;
|
||||
|
||||
MapTypeIdentity(
|
||||
MapTypeRestriction(
|
||||
this.keyType, this.valueType, this.keys, this.typeArgumentsText,
|
||||
{required this.hasRest});
|
||||
|
||||
|
@ -111,7 +111,7 @@ class MapTypeIdentity<Type extends Object> implements Restriction<Type> {
|
|||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
if (other is! MapTypeIdentity<Type>) return false;
|
||||
if (other is! MapTypeRestriction<Type>) return false;
|
||||
if (keyType != other.keyType ||
|
||||
valueType != other.valueType ||
|
||||
hasRest != other.hasRest) {
|
||||
|
@ -124,7 +124,7 @@ class MapTypeIdentity<Type extends Object> implements Restriction<Type> {
|
|||
@override
|
||||
bool isSubtypeOf(TypeOperations<Type> typeOperations, Restriction other) {
|
||||
if (other.isUnrestricted) return true;
|
||||
if (other is! MapTypeIdentity<Type>) return false;
|
||||
if (other is! MapTypeRestriction<Type>) return false;
|
||||
if (!typeOperations.isSubtypeOf(keyType, other.keyType)) return false;
|
||||
if (!typeOperations.isSubtypeOf(valueType, other.valueType)) return false;
|
||||
if (other.hasRest) {
|
||||
|
|
228
pkg/_fe_analyzer_shared/test/exhaustiveness/data/intersect.dart
Normal file
228
pkg/_fe_analyzer_shared/test/exhaustiveness/data/intersect.dart
Normal file
|
@ -0,0 +1,228 @@
|
|||
// Copyright (c) 2023, 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.
|
||||
|
||||
exhaustiveBoundedTypeVariableByValue<T extends bool>(T x1, T x2) {
|
||||
/*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=true*/
|
||||
case true:
|
||||
/*space=false*/
|
||||
case false:
|
||||
break;
|
||||
}
|
||||
return /*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
true /*space=true*/ => 0,
|
||||
false /*space=false*/ => 1,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustiveBoundedTypeVariableByType<T extends bool>(T x1, T x2) {
|
||||
/*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=bool*/
|
||||
case T():
|
||||
break;
|
||||
}
|
||||
return /*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
T() /*space=bool*/ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
nonExhaustiveBoundedTypeVariable<T extends bool>(T x1, T x2) {
|
||||
/*
|
||||
error=non-exhaustive:false,
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=true*/
|
||||
case true:
|
||||
break;
|
||||
}
|
||||
return /*
|
||||
error=non-exhaustive:false,
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
true /*space=true*/ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustiveBoundedTypeVariableByBound<T extends bool>(T x1, T x2) {
|
||||
/*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=bool*/
|
||||
case bool():
|
||||
break;
|
||||
}
|
||||
return /*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
bool() /*space=bool*/ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
nonExhaustiveBoundedTypeVariableByOtherType<T extends bool, S extends bool>(
|
||||
T x1, T x2) {
|
||||
/*
|
||||
error=non-exhaustive:true,
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=bool*/
|
||||
case S():
|
||||
break;
|
||||
}
|
||||
return /*
|
||||
error=non-exhaustive:true,
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
S() /*space=bool*/ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustivePromotedTypeVariableByValue<T>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
/*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=true*/
|
||||
case true:
|
||||
/*space=false*/
|
||||
case false:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = /*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
true /*space=true*/ => 0,
|
||||
false /*space=false*/ => 1,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exhaustivePromotedTypeVariableByType<T>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
/*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=bool*/
|
||||
case T():
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = /*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
T() /*space=bool*/ => 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
nonExhaustivePromotedTypeVariable<T>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
/*
|
||||
error=non-exhaustive:false,
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=true*/
|
||||
case true:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = /*
|
||||
error=non-exhaustive:false,
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
true /*space=true*/ => 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exhaustivePromotedTypeVariableByBound<T>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
/*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=bool*/
|
||||
case bool():
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = /*
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
bool() /*space=bool*/ => 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
nonExhaustivePromotedTypeVariableByOtherType<T, S extends bool>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
/*
|
||||
error=non-exhaustive:true,
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x1) {
|
||||
/*space=bool*/
|
||||
case S():
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = /*
|
||||
error=non-exhaustive:true,
|
||||
subtypes={true,false},
|
||||
type=bool
|
||||
*/
|
||||
switch (x2) {
|
||||
S() /*space=bool*/ => 0,
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2023, 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.
|
||||
|
||||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
|
||||
(/*
|
||||
subtypes={<int>[...]},
|
||||
type=List<int>
|
||||
*/
|
||||
switch (list) {
|
||||
[...] /*space=<[...List<int>]>*/ => 1,
|
||||
});
|
||||
|
||||
(/*
|
||||
subtypes={<int>[],<int>[(), ...]},
|
||||
type=List<int>
|
||||
*/
|
||||
switch (list) {
|
||||
[] /*space=<[]>*/ => 1,
|
||||
[_, ...] /*space=<[int, ...List<int>]>*/ => 2,
|
||||
});
|
||||
|
||||
(/*
|
||||
subtypes={<int>[],<int>[()],<int>[(), (), ...]},
|
||||
type=List<int>
|
||||
*/
|
||||
switch (list) {
|
||||
[] /*space=<[]>*/ => 1,
|
||||
[_] /*space=<[int]>*/ => 2,
|
||||
[_, ..., _] /*space=<[int, ...List<int>, int]>*/ => 3,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
print(subs(list));
|
||||
print(perms(list));
|
||||
print(equals(list, list));
|
||||
}
|
||||
|
||||
List<List<A>> subs<A>(
|
||||
List<A> list) => /*
|
||||
subtypes={<A>[],<A>[(), ...]},
|
||||
type=List<A>
|
||||
*/
|
||||
switch (list) {
|
||||
[] /*space=<[]>*/ => [],
|
||||
[var x, ...var xs] /*space=<[Object?, ...List<A>]>*/ => [
|
||||
for (var ys in subs(xs)) ...[
|
||||
[x] + ys,
|
||||
ys
|
||||
],
|
||||
[x]
|
||||
],
|
||||
};
|
||||
|
||||
List<List<A>> perms<A>(
|
||||
List<A> list) => /*
|
||||
subtypes={<A>[],<A>[(), ...]},
|
||||
type=List<A>
|
||||
*/
|
||||
switch (list) {
|
||||
[] || [_] /*space=<[]|[Object?]>*/ => [list],
|
||||
[var x, ...var xs] /*space=<[Object?, ...List<A>]>*/ => [
|
||||
for (var i = 0; i < list.length; i++)
|
||||
for (var perm in perms(xs)) [...perm.take(i), x, ...perm.skip(i)]
|
||||
],
|
||||
};
|
||||
|
||||
bool equals<A>(
|
||||
List<A> a,
|
||||
List<A>
|
||||
b) => /*
|
||||
fields={$1:List<A>,$2:List<A>},
|
||||
type=(List<A>, List<A>)
|
||||
*/
|
||||
switch ((a, b)) {
|
||||
([], []) /*space=([], [])*/ => true,
|
||||
([_, ...], []) /*space=([Object?, ...List<A>], [])*/ => false,
|
||||
([], [_, ...]) /*space=([], [Object?, ...List<A>])*/ => false,
|
||||
(
|
||||
[var l, ...var ls],
|
||||
[var r, ...var rs]
|
||||
) /*space=([Object?, ...List<A>], [Object?, ...List<A>])*/ =>
|
||||
l == r && equals(ls, rs),
|
||||
};
|
|
@ -0,0 +1,63 @@
|
|||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
print(f(list));
|
||||
print(subs(list));
|
||||
print(perms(list));
|
||||
print(equals(list, list));
|
||||
}
|
||||
|
||||
List<X> f<X>(List<X> list) => /*
|
||||
subtypes={<X>[...]},
|
||||
type=List<X>
|
||||
*/
|
||||
switch (list) {
|
||||
[] /*space=<[]>*/ => [],
|
||||
[...] /*space=<[...List<X>]>*/ => [],
|
||||
};
|
||||
|
||||
List<List<A>> subs<A>(
|
||||
List<A> list) => /*
|
||||
subtypes={<A>[],<A>[(), ...]},
|
||||
type=List<A>
|
||||
*/
|
||||
switch (list) {
|
||||
[] /*space=<[]>*/ => [],
|
||||
[var x, ...var xs] /*space=<[Object?, ...List<A>]>*/ => [
|
||||
for (var ys in subs(xs)) ...[
|
||||
[x] + ys,
|
||||
ys
|
||||
],
|
||||
[x]
|
||||
],
|
||||
};
|
||||
|
||||
List<List<A>> perms<A>(
|
||||
List<A> list) => /*
|
||||
subtypes={<A>[],<A>[(), ...]},
|
||||
type=List<A>
|
||||
*/
|
||||
switch (list) {
|
||||
[] || [_] /*space=<[]|[Object?]>*/ => [list],
|
||||
[var x, ...var xs] /*space=<[Object?, ...List<A>]>*/ => [
|
||||
for (var i = 0; i < list.length; i++)
|
||||
for (var perm in perms(xs)) [...perm.take(i), x, ...perm.skip(i)]
|
||||
],
|
||||
};
|
||||
|
||||
bool equals<A>(
|
||||
List<A> a,
|
||||
List<A>
|
||||
b) => /*
|
||||
fields={$1:List<A>,$2:List<A>},
|
||||
type=(List<A>, List<A>)
|
||||
*/
|
||||
switch ((a, b)) {
|
||||
([], []) /*space=([], [])*/ => true,
|
||||
([_, ...], []) /*space=([Object?, ...List<A>], [])*/ => false,
|
||||
([], [_, ...]) /*space=([], [Object?, ...List<A>])*/ => false,
|
||||
(
|
||||
[var l, ...var ls],
|
||||
[var r, ...var rs]
|
||||
) /*space=([Object?, ...List<A>], [Object?, ...List<A>])*/ =>
|
||||
l == r && equals(ls, rs),
|
||||
};
|
|
@ -0,0 +1,20 @@
|
|||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
print(subs(list));
|
||||
}
|
||||
|
||||
List<List<A>> subs<A>(
|
||||
List<A> list) => /*
|
||||
subtypes={<A>[],<A>[(), ...]},
|
||||
type=List<A>
|
||||
*/
|
||||
switch (list) {
|
||||
[] /*space=<[]>*/ => [],
|
||||
[var x, ...var xs] /*space=<[Object?, ...List<A>]>*/ => [
|
||||
for (var ys in subs(xs)) ...[
|
||||
[x] + ys,
|
||||
ys
|
||||
],
|
||||
[x]
|
||||
],
|
||||
};
|
|
@ -0,0 +1,53 @@
|
|||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
print(subs(list));
|
||||
print(perms(list));
|
||||
print(equals(list, list));
|
||||
}
|
||||
|
||||
List<List<A>> subs<A>(
|
||||
List<A> list) => /*
|
||||
subtypes={<A>[],<A>[(), ...]},
|
||||
type=List<A>
|
||||
*/
|
||||
switch (list) {
|
||||
<A>[] /*space=<A>[]*/ => [],
|
||||
<A>[var x, ...var xs] /*space=<A>[Object?, ...List<A>]*/ => [
|
||||
for (var ys in subs(xs)) ...[
|
||||
[x] + ys,
|
||||
ys
|
||||
],
|
||||
[x]
|
||||
],
|
||||
};
|
||||
|
||||
List<List<A>> perms<A>(
|
||||
List<A> list) => /*
|
||||
subtypes={<A>[],<A>[(), ...]},
|
||||
type=List<A>
|
||||
*/
|
||||
switch (list) {
|
||||
<A>[] || <A>[_] /*space=<A>[]|<A>[Object?]*/ => [list],
|
||||
<A>[var x, ...var xs] /*space=<A>[Object?, ...List<A>]*/ => [
|
||||
for (var i = 0; i < list.length; i++)
|
||||
for (var perm in perms(xs)) [...perm.take(i), x, ...perm.skip(i)]
|
||||
],
|
||||
};
|
||||
|
||||
bool equals<A>(
|
||||
List<A> a,
|
||||
List<A>
|
||||
b) => /*
|
||||
fields={$1:List<A>,$2:List<A>},
|
||||
type=(List<A>, List<A>)
|
||||
*/
|
||||
switch ((a, b)) {
|
||||
(<A>[], <A>[]) /*space=(<A>[], <A>[])*/ => true,
|
||||
(<A>[_, ...], <A>[]) /*space=(<A>[Object?, ...List<A>], <A>[])*/ => false,
|
||||
(<A>[], <A>[_, ...]) /*space=(<A>[], <A>[Object?, ...List<A>])*/ => false,
|
||||
(
|
||||
<A>[var l, ...var ls],
|
||||
<A>[var r, ...var rs]
|
||||
) /*space=(<A>[Object?, ...List<A>], <A>[Object?, ...List<A>])*/ =>
|
||||
l == r && equals(ls, rs),
|
||||
};
|
|
@ -26,9 +26,9 @@ typedList(List<A> list) {
|
|||
[] /*space=<[]>*/=> 0,
|
||||
[B b] /*space=<[B]>*/=> 1,
|
||||
[C c] /*space=<[C]>*/=> 2,
|
||||
[_, _] /*space=<[(), ()]>*/=> 3,
|
||||
[B b, ..., _] /*space=<[B, ...List<dynamic>, ()]>*/=> 4,
|
||||
[C c, ..., _] /*space=<[C, ...List<dynamic>, ()]>*/=> 5,
|
||||
[_, _] /*space=<[A, A]>*/=> 3,
|
||||
[B b, ..., _] /*space=<[B, ...List<A>, A]>*/=> 4,
|
||||
[C c, ..., _] /*space=<[C, ...List<A>, A]>*/=> 5,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ exhaustiveSealed(List<A> list) {
|
|||
[] /*space=<[]>*/=> 0,
|
||||
[B()] /*space=<[B]>*/=> 1,
|
||||
[C()] /*space=<[C]>*/=> 2,
|
||||
[_, _, ...] /*space=<[(), (), ...List<dynamic>]>*/=> 3,
|
||||
[_, _, ...] /*space=<[A, A, ...List<A>]>*/=> 3,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ nonExhaustiveSealed(List<A> list) {
|
|||
*/switch (list) {
|
||||
[] /*space=<[]>*/=> 0,
|
||||
[B()] /*space=<[B]>*/=> 1,
|
||||
[_, _, ...] /*space=<[(), (), ...List<dynamic>]>*/=> 3,
|
||||
[_, _, ...] /*space=<[A, A, ...List<A>]>*/=> 3,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -377,9 +377,12 @@ reachableRest(List<A> list) {
|
|||
type=List<A>
|
||||
*/switch (list) {
|
||||
[] /*space=<[]>*/=> 0,
|
||||
[B(), ...] /*space=<[B, ...List<dynamic>]>*/=> 1,
|
||||
[..., B()] /*space=<[...List<dynamic>, B]>*/=> 2,
|
||||
[C(), ...] /*space=<[C, ...List<dynamic>]>*/=> 3,
|
||||
[..., C()] /*space=<[...List<dynamic>, C]>*/=> 4,
|
||||
[B(), ...] /*space=<[B, ...List<A>]>*/=> 1,
|
||||
[..., B()] /*space=<[...List<A>, B]>*/=> 2,
|
||||
[C(), ...] /*space=<[C, ...List<A>]>*/=> 3,
|
||||
[..., C()] /*
|
||||
error=unreachable,
|
||||
space=<[...List<A>, C]>
|
||||
*/=> 4,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,110 +3,119 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
untypedMap(Map map) {
|
||||
var a = /*type=Map<dynamic, dynamic>*/switch (map) {
|
||||
{} /*space={}*/=> 0,
|
||||
{1: _} /*space={1: ()}*/=> 1,
|
||||
{1: _, 2: _} /*space={1: (), 2: ()}*/=> 2,
|
||||
{1: _, 2: _, ...} /*space={1: (), 2: (), ...}*/=> 3,
|
||||
{...} /*space={...}*/=> 4:
|
||||
var a = /*type=Map<dynamic, dynamic>*/ switch (map) {
|
||||
{} /*space={}*/ => 0,
|
||||
{1: _} /*space={1: ()}*/ => 1,
|
||||
{1: _, 2: _} /*space={1: (), 2: ()}*/ => 2,
|
||||
{1: _, 2: _, ...} /*space={1: (), 2: (), ...}*/ => 3,
|
||||
{...} /*space={...}*/ => 4,
|
||||
};
|
||||
var b = /*type=Map<dynamic, dynamic>*/switch (map) {
|
||||
{...} /*space={...}*/=> 0,
|
||||
var b = /*type=Map<dynamic, dynamic>*/ switch (map) {
|
||||
{...} /*space={...}*/ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
sealed class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
class C extends A {}
|
||||
|
||||
typedMap(Map<int, A> map) {
|
||||
var a = /*
|
||||
error=non-exhaustive:Map<int, A>(),
|
||||
type=Map<int, A>
|
||||
*/switch (map) {
|
||||
{} /*space={}*/=> 0,
|
||||
{0: B b} /*space={0: B}*/=> 1,
|
||||
{0: C c} /*space={0: C}*/=> 2,
|
||||
{0: _, 1: _} /*cfe.space={0: A, 1: A}*//*analyzer.space={0: (), 1: ()}*/=> 3,
|
||||
{0: B b, ... } /*space={0: B, ...}*/=> 4,
|
||||
{0: C c, ... _} /*space={0: C, ...}*/=> 5,
|
||||
*/
|
||||
switch (map) {
|
||||
{} /*space={}*/ => 0,
|
||||
{0: B b} /*space={0: B}*/ => 1,
|
||||
{0: C c} /*space={0: C}*/ => 2,
|
||||
{0: _, 1: _} /*space={0: A, 1: A}*/ => 3,
|
||||
{0: B b, ...} /*space={0: B, ...}*/ => 4,
|
||||
{0: C c, ..._} /*space={0: C, ...}*/ => 5,
|
||||
};
|
||||
|
||||
var b = /*type=Map<int, A>*/switch (map) {
|
||||
{...} /*space={...}*/=> 0,
|
||||
var b = /*type=Map<int, A>*/ switch (map) {
|
||||
{...} /*space={...}*/ => 0,
|
||||
};
|
||||
var c = /*
|
||||
error=non-exhaustive:Map<int, A>(),
|
||||
type=Map<int, A>
|
||||
*/switch (map) {
|
||||
<int, B>{...} /*space=<int, B>{...}*/=> 0,
|
||||
*/
|
||||
switch (map) {
|
||||
<int, B>{...} /*space=<int, B>{...}*/ => 0,
|
||||
};
|
||||
var d = /*type=Map<int, B>*/switch (map) {
|
||||
{...} /*space={...}*/=> 0,
|
||||
var d = /*type=Map<int, B>*/ switch (map) {
|
||||
{...} /*space={...}*/ => 0,
|
||||
{1: _} /*
|
||||
error=unreachable,
|
||||
space={1: ()}
|
||||
*/=> 1,
|
||||
{2: _, ...} /*cfe.
|
||||
space={1: B}
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
{2: _, ...} /*
|
||||
error=unreachable,
|
||||
space={2: B, ...}
|
||||
*//*analyzer.
|
||||
error=unreachable,
|
||||
space={2: (), ...}
|
||||
*/=> 2,
|
||||
*/
|
||||
=>
|
||||
2,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustiveRestOnly(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
{...} /*space={...}*/=> 0,
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
{...} /*space={...}*/ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
unreachableAfterRestOnly(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
{...} /*space={...}*/=> 0,
|
||||
{0: _} /*cfe.
|
||||
error=unreachable,
|
||||
space={0: A}
|
||||
*//*analyzer.
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
{...} /*space={...}*/ => 0,
|
||||
{0: _} /*
|
||||
error=unreachable,
|
||||
space={0: ()}
|
||||
*/=> 1,
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
};
|
||||
}
|
||||
|
||||
unreachableAfterRestOnlyTyped(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
{...} /*space={...}*/=> 0,
|
||||
<int, String>{0: _} /*
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
{...} /*space={...}*/ => 0,
|
||||
<int, String>{
|
||||
0: _
|
||||
} /*
|
||||
error=unreachable,
|
||||
space=<int, String>{0: String}
|
||||
*/=> 1,
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
};
|
||||
}
|
||||
|
||||
unreachableAfterRestOnlyEmpty(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
{...} /*space={...}*/=> 0,
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
{...} /*space={...}*/ => 0,
|
||||
{} /*
|
||||
error=unreachable,
|
||||
space={}
|
||||
*/=> 1,
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
};
|
||||
}
|
||||
|
||||
unreachableAfterRestSameKeys(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
{0: _, ...} /*cfe.space={0: A, ...}*//*analyzer.space={0: (), ...}*/=> 0,
|
||||
{0: _} /*cfe.
|
||||
error=unreachable,
|
||||
space={0: A}
|
||||
*//*analyzer.
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
{0: _, ...} /*space={0: (), ...}*/ => 0,
|
||||
{0: _} /*
|
||||
error=unreachable,
|
||||
space={0: ()}
|
||||
*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -114,29 +123,31 @@ nonExhaustiveAfterRestSameKeys(Map o) {
|
|||
return /*
|
||||
error=non-exhaustive:Map<dynamic, dynamic>(),
|
||||
type=Map<dynamic, dynamic>
|
||||
*/switch (o) {
|
||||
{0: _, ...} /*cfe.space={0: A, ...}*//*analyzer.space={0: (), ...}*/=> 0,
|
||||
{0: _} /*cfe.
|
||||
error=unreachable,
|
||||
space={0: A}
|
||||
*//*analyzer.
|
||||
*/
|
||||
switch (o) {
|
||||
{0: _, ...} /*space={0: (), ...}*/ => 0,
|
||||
{0: _} /*
|
||||
error=unreachable,
|
||||
space={0: ()}
|
||||
*/=> 1,
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
};
|
||||
}
|
||||
|
||||
unreachableAfterRestMoreKeys(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
{0: _, ...} /*cfe.space={0: A, ...}*//*analyzer.space={0: (), ...}*/=> 0,
|
||||
{0: _, 1: _} /*cfe.
|
||||
error=unreachable,
|
||||
space={0: A, 1: A}
|
||||
*//*analyzer.
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
{0: _, ...} /*space={0: (), ...}*/ => 0,
|
||||
{
|
||||
0: _,
|
||||
1: _
|
||||
} /*
|
||||
error=unreachable,
|
||||
space={0: (), 1: ()}
|
||||
*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -144,26 +155,28 @@ nonExhaustiveAfterRestMoreKeys(Map o) {
|
|||
return /*
|
||||
error=non-exhaustive:Map<dynamic, dynamic>(),
|
||||
type=Map<dynamic, dynamic>
|
||||
*/switch (o) {
|
||||
{0: _, ...} /*cfe.space={0: A, ...}*//*analyzer.space={0: (), ...}*/=> 0,
|
||||
{0: _, 1: _} /*cfe.
|
||||
error=unreachable,
|
||||
space={0: A, 1: A}
|
||||
*//*analyzer.
|
||||
*/
|
||||
switch (o) {
|
||||
{0: _, ...} /*space={0: (), ...}*/ => 0,
|
||||
{0: _, 1: _} /*
|
||||
error=unreachable,
|
||||
space={0: (), 1: ()}
|
||||
*/=> 1,
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
};
|
||||
}
|
||||
|
||||
unreachableAfterSameKeys(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
{0: _} /*cfe.space={0: A}*//*analyzer.space={0: ()}*/=> 0,
|
||||
{0: 1} /*cfe.space={0: 1}*//*analyzer.
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
{0: _} /*space={0: ()}*/ => 0,
|
||||
{0: 1} /*
|
||||
error=unreachable,
|
||||
space={0: 1}
|
||||
*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -171,20 +184,23 @@ nonExhaustiveAfterSameKeys(Map o) {
|
|||
return /*
|
||||
error=non-exhaustive:Map<dynamic, dynamic>(),
|
||||
type=Map<dynamic, dynamic>
|
||||
*/switch (o) {
|
||||
{0: _} /*cfe.space={0: A}*//*analyzer.space={0: ()}*/=> 0,
|
||||
{0: 1} /*cfe.space={0: 1}*//*analyzer.
|
||||
*/
|
||||
switch (o) {
|
||||
{0: _} /*space={0: ()}*/ => 0,
|
||||
{0: 1} /*
|
||||
error=unreachable,
|
||||
space={0: 1}
|
||||
*/=> 1,
|
||||
*/
|
||||
=>
|
||||
1,
|
||||
};
|
||||
}
|
||||
|
||||
reachableAfterRestOnlyDifferentTypes(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
<int, String>{...} /*space=<int, String>{...}*/=> 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
<int, String>{...} /*space=<int, String>{...}*/ => 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/ => 1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -192,17 +208,18 @@ nonExhaustiveAfterRestOnlyDifferentTypes(Map o) {
|
|||
return /*
|
||||
error=non-exhaustive:Map<dynamic, dynamic>(),
|
||||
type=Map<dynamic, dynamic>
|
||||
*/switch (o) {
|
||||
<int, String>{...} /*space=<int, String>{...}*/=> 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/=> 1,
|
||||
*/
|
||||
switch (o) {
|
||||
<int, String>{...} /*space=<int, String>{...}*/ => 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/ => 1,
|
||||
};
|
||||
}
|
||||
|
||||
reachableAfterRestOnlyEmptyDifferentTypes(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
<int, String>{...} /*space=<int, String>{...}*/=> 0,
|
||||
<int, bool>{} /*space=<int, bool>{}*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
<int, String>{...} /*space=<int, String>{...}*/ => 0,
|
||||
<int, bool>{} /*space=<int, bool>{}*/ => 1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -210,33 +227,34 @@ nonExhaustiveAfterRestOnlyEmptyDifferentTypes(Map o) {
|
|||
return /*
|
||||
error=non-exhaustive:Map<dynamic, dynamic>(),
|
||||
type=Map<dynamic, dynamic>
|
||||
*/switch (o) {
|
||||
<int, String>{...} /*space=<int, String>{...}*/=> 0,
|
||||
<int, bool>{} /*space=<int, bool>{}*/=> 1,
|
||||
*/
|
||||
switch (o) {
|
||||
<int, String>{...} /*space=<int, String>{...}*/ => 0,
|
||||
<int, bool>{} /*space=<int, bool>{}*/ => 1,
|
||||
};
|
||||
}
|
||||
|
||||
reachableAfterRestDifferentTypes(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
<int, String>{0: _, ...} /*space=<int, String>{0: String, ...}*/=> 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
<int, String>{0: _, ...} /*space=<int, String>{0: String, ...}*/ => 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/ => 1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
nonExhaustiveAfterRestDifferentTypes(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
<int, String>{0: _, ...} /*space=<int, String>{0: String, ...}*/=> 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
<int, String>{0: _, ...} /*space=<int, String>{0: String, ...}*/ => 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/ => 1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
reachableAfterRestDifferentKeys(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
{0: _, ...} /*cfe.space={0: A, ...}*//*analyzer.space={0: (), ...}*/=> 0,
|
||||
{1: _} /*space={1: ()}*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
{0: _, ...} /*space={0: (), ...}*/ => 0,
|
||||
{1: _} /*space={1: ()}*/ => 1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -244,17 +262,18 @@ nonExhaustiveAfterRestDifferentKeys(Map o) {
|
|||
return /*
|
||||
error=non-exhaustive:Map<dynamic, dynamic>(),
|
||||
type=Map<dynamic, dynamic>
|
||||
*/switch (o) {
|
||||
{0: _, ...} /*cfe.space={0: A, ...}*//*analyzer.space={0: (), ...}*/=> 0,
|
||||
{1: _} /*space={1: ()}*/=> 1,
|
||||
*/
|
||||
switch (o) {
|
||||
{0: _, ...} /*space={0: (), ...}*/ => 0,
|
||||
{1: _} /*space={1: ()}*/ => 1,
|
||||
};
|
||||
}
|
||||
|
||||
reachableAfterDifferentKeys(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
{0: _} /*cfe.space={0: A}*//*analyzer.space={0: ()}*/=> 0,
|
||||
{1: _} /*space={1: ()}*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
{0: _} /*space={0: ()}*/ => 0,
|
||||
{1: _} /*space={1: ()}*/ => 1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -262,17 +281,18 @@ nonExhaustiveAfterDifferentKeys(Map o) {
|
|||
return /*
|
||||
error=non-exhaustive:Map<dynamic, dynamic>(),
|
||||
type=Map<dynamic, dynamic>
|
||||
*/switch (o) {
|
||||
{0: _} /*cfe.space={0: A}*//*analyzer.space={0: ()}*/=> 0,
|
||||
{1: _} /*space={1: ()}*/=> 1,
|
||||
*/
|
||||
switch (o) {
|
||||
{0: _} /*space={0: ()}*/ => 0,
|
||||
{1: _} /*space={1: ()}*/ => 1,
|
||||
};
|
||||
}
|
||||
|
||||
reachableAfterDifferentTypes(Map o) {
|
||||
return /*type=Map<dynamic, dynamic>*/switch (o) {
|
||||
<int, String>{0: _} /*space=<int, String>{0: String}*/=> 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/=> 1,
|
||||
{...} /*space={...}*/=> 2,
|
||||
return /*type=Map<dynamic, dynamic>*/ switch (o) {
|
||||
<int, String>{0: _} /*space=<int, String>{0: String}*/ => 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/ => 1,
|
||||
{...} /*space={...}*/ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -280,8 +300,9 @@ nonExhaustiveAfterDifferentTypes(Map o) {
|
|||
return /*
|
||||
error=non-exhaustive:Map<dynamic, dynamic>(),
|
||||
type=Map<dynamic, dynamic>
|
||||
*/switch (o) {
|
||||
<int, String>{0: _} /*space=<int, String>{0: String}*/=> 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/=> 1,
|
||||
*/
|
||||
switch (o) {
|
||||
<int, String>{0: _} /*space=<int, String>{0: String}*/ => 0,
|
||||
<int, bool>{0: _} /*space=<int, bool>{0: bool}*/ => 1,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,138 +9,91 @@ class Class<Typedef> {
|
|||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
Typedef(:var hashCode) /*cfe.space=(Typedef & Object)(hashCode: int)*//*analyzer.space=Typedef & Object(hashCode: int)*/=> hashCode,
|
||||
Typedef(:var runtimeType) /*cfe.
|
||||
error=unreachable,
|
||||
space=(Typedef & Object)(runtimeType: Type)
|
||||
*//*analyzer.
|
||||
error=unreachable,
|
||||
space=Typedef & Object(runtimeType: Type)
|
||||
*/=> runtimeType,
|
||||
Typedef(:var toString) /*cfe.
|
||||
error=unreachable,
|
||||
space=(Typedef & Object)(toString: String Function())
|
||||
*//*analyzer.
|
||||
error=unreachable,
|
||||
space=Typedef & Object(toString: String Function())
|
||||
*/=> toString(),
|
||||
Typedef(:var noSuchMethod) /*cfe.
|
||||
error=unreachable,
|
||||
space=(Typedef & Object)(noSuchMethod: dynamic Function(Invocation))
|
||||
*//*analyzer.
|
||||
error=unreachable,
|
||||
space=Typedef & Object(noSuchMethod: dynamic Function(Invocation))
|
||||
*/=> noSuchMethod,
|
||||
Typedef(:var hashCode) /*space=Object?(hashCode: int)*/=> hashCode,
|
||||
Typedef(:var runtimeType) /*space=Object?(runtimeType: Type)*/=> runtimeType,
|
||||
Typedef(:var toString) /*space=Object?(toString: String Function())*/=> toString(),
|
||||
Typedef(:var noSuchMethod) /*space=Object?(noSuchMethod: dynamic Function(Invocation))*/=> noSuchMethod,
|
||||
_ /*space=()*/=> null,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustiveHashCode(Typedef o) {
|
||||
return /*cfe.
|
||||
fields={hashCode:int},
|
||||
type=(Typedef & Object)
|
||||
*//*analyzer.
|
||||
fields={hashCode:int},
|
||||
type=Typedef & Object
|
||||
return /*
|
||||
error=non-exhaustive:Object(hashCode: Object()),
|
||||
fields={hashCode:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
Typedef(:int hashCode) /*cfe.space=(Typedef & Object)(hashCode: int)*//*analyzer.space=Typedef & Object(hashCode: int)*/=> hashCode,
|
||||
Typedef(:int hashCode) /*space=Object?(hashCode: int)*/=> hashCode,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustiveRuntimeType(Typedef o) {
|
||||
return /*cfe.
|
||||
fields={runtimeType:Type},
|
||||
type=(Typedef & Object)
|
||||
*//*analyzer.
|
||||
fields={runtimeType:Type},
|
||||
type=Typedef & Object
|
||||
return /*
|
||||
error=non-exhaustive:Object(runtimeType: Object()),
|
||||
fields={runtimeType:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
Typedef(:Type runtimeType) /*cfe.space=(Typedef & Object)(runtimeType: Type)*//*analyzer.space=Typedef & Object(runtimeType: Type)*/=> runtimeType,
|
||||
Typedef(:Type runtimeType) /*space=Object?(runtimeType: Type)*/=> runtimeType,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustiveToString(Typedef o) {
|
||||
return /*cfe.
|
||||
fields={toString:String Function()},
|
||||
type=(Typedef & Object)
|
||||
*//*analyzer.
|
||||
fields={toString:String Function()},
|
||||
type=Typedef & Object
|
||||
return /*
|
||||
error=non-exhaustive:Object(toString: Object()),
|
||||
fields={toString:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
Typedef(:String Function() toString) /*cfe.space=(Typedef & Object)(toString: String Function())*//*analyzer.space=Typedef & Object(toString: String Function())*/=> toString,
|
||||
Typedef(:String Function() toString) /*space=Object?(toString: String Function())*/=> toString,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustiveNoSuchMethod(Typedef o) {
|
||||
return /*cfe.
|
||||
fields={noSuchMethod:dynamic Function(Invocation)},
|
||||
type=(Typedef & Object)
|
||||
*//*analyzer.
|
||||
fields={noSuchMethod:dynamic Function(Invocation)},
|
||||
type=Typedef & Object
|
||||
return /*
|
||||
error=non-exhaustive:Object(noSuchMethod: Object()),
|
||||
fields={noSuchMethod:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
Typedef(:dynamic Function(Invocation) noSuchMethod) /*cfe.space=(Typedef & Object)(noSuchMethod: dynamic Function(Invocation))*//*analyzer.space=Typedef & Object(noSuchMethod: dynamic Function(Invocation))*/=> noSuchMethod,
|
||||
Typedef(:dynamic Function(Invocation) noSuchMethod) /*space=Object?(noSuchMethod: dynamic Function(Invocation))*/=> noSuchMethod,
|
||||
};
|
||||
}
|
||||
|
||||
nonExhaustiveRestrictedValue(Typedef o) {
|
||||
return /*cfe.
|
||||
error=non-exhaustive:(Typedef & Object) _ && Object(hashCode: int()),
|
||||
fields={hashCode:int},
|
||||
type=(Typedef & Object)
|
||||
*//*analyzer.
|
||||
error=non-exhaustive:Typedef & Object(hashCode: int()),
|
||||
fields={hashCode:int},
|
||||
type=Typedef & Object
|
||||
return /*
|
||||
error=non-exhaustive:Object(hashCode: Object()),
|
||||
fields={hashCode:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
Typedef(hashCode: 5) /*cfe.space=(Typedef & Object)(hashCode: 5)*//*analyzer.space=Typedef & Object(hashCode: 5)*/=> 5,
|
||||
Typedef(hashCode: 5) /*space=Object?(hashCode: 5)*/=> 5,
|
||||
};
|
||||
}
|
||||
|
||||
nonExhaustiveRestrictedType(Typedef o) {
|
||||
return /*cfe.
|
||||
error=non-exhaustive:(Typedef & Object) _ && Object(noSuchMethod: dynamic Function(Invocation) _),
|
||||
fields={noSuchMethod:dynamic Function(Invocation)},
|
||||
type=(Typedef & Object)
|
||||
*//*analyzer.
|
||||
error=non-exhaustive:Typedef & Object(noSuchMethod: dynamic Function(Invocation) _),
|
||||
fields={noSuchMethod:dynamic Function(Invocation)},
|
||||
type=Typedef & Object
|
||||
return /*
|
||||
error=non-exhaustive:Object(noSuchMethod: Object()),
|
||||
fields={noSuchMethod:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
Typedef(:int Function(Invocation) noSuchMethod) /*cfe.space=(Typedef & Object)(noSuchMethod: int Function(Invocation))*//*analyzer.space=Typedef & Object(noSuchMethod: int Function(Invocation))*/=> noSuchMethod,
|
||||
Typedef(:int Function(Invocation) noSuchMethod) /*space=Object?(noSuchMethod: int Function(Invocation))*/=> noSuchMethod,
|
||||
};
|
||||
}
|
||||
|
||||
unreachableMethod(Typedef o) {
|
||||
return /*cfe.
|
||||
fields={hashCode:int,noSuchMethod:dynamic Function(Invocation),runtimeType:Type,toString:String Function()},
|
||||
type=(Typedef & Object)
|
||||
*//*analyzer.
|
||||
fields={hashCode:int,noSuchMethod:dynamic Function(Invocation),runtimeType:Type,toString:String Function()},
|
||||
type=Typedef & Object
|
||||
return /*
|
||||
error=non-exhaustive:Object(hashCode: Object(), noSuchMethod: Object(), runtimeType: Object(), toString: Object()),
|
||||
fields={hashCode:-,noSuchMethod:-,runtimeType:-,toString:-},
|
||||
subtypes={Object,Null},
|
||||
type=Object?
|
||||
*/switch (o) {
|
||||
Typedef(:var hashCode) /*cfe.space=(Typedef & Object)(hashCode: int)*//*analyzer.space=Typedef & Object(hashCode: int)*/=> hashCode,
|
||||
Typedef(:var runtimeType) /*cfe.
|
||||
error=unreachable,
|
||||
space=(Typedef & Object)(runtimeType: Type)
|
||||
*//*analyzer.
|
||||
error=unreachable,
|
||||
space=Typedef & Object(runtimeType: Type)
|
||||
*/=> runtimeType,
|
||||
Typedef(:var toString) /*cfe.
|
||||
error=unreachable,
|
||||
space=(Typedef & Object)(toString: String Function())
|
||||
*//*analyzer.
|
||||
error=unreachable,
|
||||
space=Typedef & Object(toString: String Function())
|
||||
*/=> toString(),
|
||||
Typedef(:var noSuchMethod) /*cfe.
|
||||
error=unreachable,
|
||||
space=(Typedef & Object)(noSuchMethod: dynamic Function(Invocation))
|
||||
*//*analyzer.
|
||||
error=unreachable,
|
||||
space=Typedef & Object(noSuchMethod: dynamic Function(Invocation))
|
||||
*/=> noSuchMethod,
|
||||
Typedef(:var hashCode) /*space=Object?(hashCode: int)*/=> hashCode,
|
||||
Typedef(:var runtimeType) /*space=Object?(runtimeType: Type)*/=> runtimeType,
|
||||
Typedef(:var toString) /*space=Object?(toString: String Function())*/=> toString(),
|
||||
Typedef(:var noSuchMethod) /*space=Object?(noSuchMethod: dynamic Function(Invocation))*/=> noSuchMethod,
|
||||
};
|
||||
}
|
||||
}
|
|
@ -421,6 +421,12 @@ class _TypeOperations implements TypeOperations<_Type> {
|
|||
bool hasSimpleName(_Type type) {
|
||||
return type is _InterfaceType;
|
||||
}
|
||||
|
||||
@override
|
||||
_Type? getTypeVariableBound(_Type type) {
|
||||
// TODO(johnniwinther): Support type variable bounds in testing.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class _EnumOperations
|
||||
|
|
|
@ -232,6 +232,14 @@ class AnalyzerTypeOperations implements TypeOperations<DartType> {
|
|||
return _typeSystem.promoteToNonNull(type);
|
||||
}
|
||||
|
||||
@override
|
||||
DartType? getTypeVariableBound(DartType type) {
|
||||
if (type is TypeParameterType) {
|
||||
return type.bound;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
bool hasSimpleName(DartType type) {
|
||||
return type is InterfaceType ||
|
||||
|
@ -370,13 +378,14 @@ class PatternConverter with SpaceCreator<DartPattern, DartType> {
|
|||
|
||||
@override
|
||||
StaticType createListType(
|
||||
DartType type, ListTypeIdentity<DartType> identity) {
|
||||
return cache.getListStaticType(type, identity);
|
||||
DartType type, ListTypeRestriction<DartType> restriction) {
|
||||
return cache.getListStaticType(type, restriction);
|
||||
}
|
||||
|
||||
@override
|
||||
StaticType createMapType(DartType type, MapTypeIdentity<DartType> identity) {
|
||||
return cache.getMapStaticType(type, identity);
|
||||
StaticType createMapType(
|
||||
DartType type, MapTypeRestriction<DartType> restriction) {
|
||||
return cache.getMapStaticType(type, restriction);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -462,12 +471,10 @@ class PatternConverter with SpaceCreator<DartPattern, DartType> {
|
|||
} else if (pattern is RelationalPattern) {
|
||||
return createRelationalSpace(path);
|
||||
} else if (pattern is ListPattern) {
|
||||
DartType? elementType;
|
||||
var typeArguments = pattern.typeArguments;
|
||||
if (typeArguments != null && typeArguments.arguments.length == 1) {
|
||||
elementType = typeArguments.arguments[0].typeOrThrow;
|
||||
}
|
||||
elementType ??= cache.typeSystem.typeProvider.dynamicType;
|
||||
InterfaceType type = pattern.requiredType as InterfaceType;
|
||||
assert(type.element == cache.typeSystem.typeProvider.listElement &&
|
||||
type.typeArguments.length == 1);
|
||||
DartType elementType = type.typeArguments[0];
|
||||
List<DartPattern> headElements = [];
|
||||
DartPattern? restElement;
|
||||
List<DartPattern> tailElements = [];
|
||||
|
@ -483,7 +490,7 @@ class PatternConverter with SpaceCreator<DartPattern, DartType> {
|
|||
}
|
||||
}
|
||||
return createListSpace(path,
|
||||
type: cache.typeSystem.typeProvider.listType(elementType),
|
||||
type: type,
|
||||
elementType: elementType,
|
||||
headElements: headElements,
|
||||
tailElements: tailElements,
|
||||
|
@ -491,15 +498,11 @@ class PatternConverter with SpaceCreator<DartPattern, DartType> {
|
|||
hasRest: hasRest,
|
||||
hasExplicitTypeArgument: pattern.typeArguments != null);
|
||||
} else if (pattern is MapPattern) {
|
||||
DartType? keyType;
|
||||
DartType? valueType;
|
||||
var typeArguments = pattern.typeArguments;
|
||||
if (typeArguments != null && typeArguments.arguments.length == 2) {
|
||||
keyType = typeArguments.arguments[0].typeOrThrow;
|
||||
valueType = typeArguments.arguments[1].typeOrThrow;
|
||||
}
|
||||
keyType ??= cache.typeSystem.typeProvider.dynamicType;
|
||||
valueType ??= cache.typeSystem.typeProvider.dynamicType;
|
||||
InterfaceType type = pattern.requiredType as InterfaceType;
|
||||
assert(type.element == cache.typeSystem.typeProvider.mapElement &&
|
||||
type.typeArguments.length == 2);
|
||||
DartType keyType = type.typeArguments[0];
|
||||
DartType valueType = type.typeArguments[1];
|
||||
bool hasRest = false;
|
||||
Map<MapKey, DartPattern> entries = {};
|
||||
for (MapPatternElement entry in pattern.elements) {
|
||||
|
|
|
@ -355,7 +355,7 @@ void f<T extends bool>(T x) {
|
|||
}
|
||||
|
||||
test_alwaysExhaustive_typeVariable_bound_bool_true_false() async {
|
||||
await assertErrorsInCode(r'''
|
||||
await assertNoErrorsInCode(r'''
|
||||
void f<T extends bool>(T x) {
|
||||
switch (x) {
|
||||
case true:
|
||||
|
@ -363,9 +363,7 @@ void f<T extends bool>(T x) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
''', [
|
||||
error(CompileTimeErrorCode.NON_EXHAUSTIVE_SWITCH, 32, 6),
|
||||
]);
|
||||
''');
|
||||
}
|
||||
|
||||
test_alwaysExhaustive_typeVariable_promoted_bool_true() async {
|
||||
|
@ -383,8 +381,6 @@ void f<T>(T x) {
|
|||
]);
|
||||
}
|
||||
|
||||
/// TODO(scheglov) Fix it.
|
||||
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/51819')
|
||||
test_alwaysExhaustive_typeVariable_promoted_bool_true_false() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
void f<T>(T x) {
|
||||
|
|
|
@ -233,6 +233,16 @@ class CfeTypeOperations implements TypeOperations<DartType> {
|
|||
// TODO(johnniwinther): What about intersection types?
|
||||
type is TypeParameterType;
|
||||
}
|
||||
|
||||
@override
|
||||
DartType? getTypeVariableBound(DartType type) {
|
||||
if (type is TypeParameterType) {
|
||||
return type.bound;
|
||||
} else if (type is IntersectionType) {
|
||||
return type.right;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class CfeEnumOperations
|
||||
|
@ -384,8 +394,11 @@ class CfeSealedClassOperations
|
|||
|
||||
class CfeExhaustivenessCache
|
||||
extends ExhaustivenessCache<DartType, Class, Class, Field, Constant> {
|
||||
final TypeEnvironment typeEnvironment;
|
||||
|
||||
CfeExhaustivenessCache(ConstantEvaluator constantEvaluator)
|
||||
: super(
|
||||
: typeEnvironment = constantEvaluator.typeEnvironment,
|
||||
super(
|
||||
new CfeTypeOperations(constantEvaluator.typeEnvironment),
|
||||
new CfeEnumOperations(constantEvaluator),
|
||||
new CfeSealedClassOperations(constantEvaluator.typeEnvironment));
|
||||
|
@ -458,7 +471,10 @@ class PatternConverter with SpaceCreator<Pattern, DartType> {
|
|||
} else if (pattern is RelationalPattern) {
|
||||
return createRelationalSpace(path);
|
||||
} else if (pattern is ListPattern) {
|
||||
DartType elementType = pattern.typeArgument ?? const DynamicType();
|
||||
InterfaceType type = pattern.requiredType as InterfaceType;
|
||||
assert(type.classNode == cache.typeEnvironment.coreTypes.listClass &&
|
||||
type.typeArguments.length == 1);
|
||||
DartType elementType = type.typeArguments[0];
|
||||
bool hasRest = false;
|
||||
List<Pattern> headPatterns = [];
|
||||
Pattern? restPattern;
|
||||
|
@ -474,7 +490,7 @@ class PatternConverter with SpaceCreator<Pattern, DartType> {
|
|||
}
|
||||
}
|
||||
return createListSpace(path,
|
||||
type: pattern.lookupType!,
|
||||
type: pattern.requiredType!,
|
||||
elementType: elementType,
|
||||
headElements: headPatterns,
|
||||
restElement: restPattern,
|
||||
|
@ -482,8 +498,11 @@ class PatternConverter with SpaceCreator<Pattern, DartType> {
|
|||
hasRest: hasRest,
|
||||
hasExplicitTypeArgument: pattern.typeArgument != null);
|
||||
} else if (pattern is MapPattern) {
|
||||
DartType keyType = pattern.keyType ?? const DynamicType();
|
||||
DartType valueType = pattern.valueType ?? const DynamicType();
|
||||
InterfaceType type = pattern.requiredType as InterfaceType;
|
||||
assert(type.classNode == cache.typeEnvironment.coreTypes.mapClass &&
|
||||
type.typeArguments.length == 2);
|
||||
DartType keyType = type.typeArguments[0];
|
||||
DartType valueType = type.typeArguments[1];
|
||||
bool hasRest = false;
|
||||
Map<MapKey, Pattern> entries = {};
|
||||
for (MapPatternEntry entry in pattern.entries) {
|
||||
|
@ -560,13 +579,14 @@ class PatternConverter with SpaceCreator<Pattern, DartType> {
|
|||
|
||||
@override
|
||||
StaticType createListType(
|
||||
DartType type, ListTypeIdentity<DartType> identity) {
|
||||
return cache.getListStaticType(type, identity);
|
||||
DartType type, ListTypeRestriction<DartType> restriction) {
|
||||
return cache.getListStaticType(type, restriction);
|
||||
}
|
||||
|
||||
@override
|
||||
StaticType createMapType(DartType type, MapTypeIdentity<DartType> identity) {
|
||||
return cache.getMapStaticType(type, identity);
|
||||
StaticType createMapType(
|
||||
DartType type, MapTypeRestriction<DartType> restriction) {
|
||||
return cache.getMapStaticType(type, restriction);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -605,7 +625,6 @@ class ExhaustiveDartTypeVisitor implements DartTypeVisitor1<bool, CoreTypes> {
|
|||
|
||||
@override
|
||||
bool visitFutureOrType(FutureOrType type, CoreTypes coreTypes) {
|
||||
// TODO(johnniwinther): Why? This doesn't work if the value is a Future.
|
||||
return type.typeArgument.accept1(this, coreTypes);
|
||||
}
|
||||
|
||||
|
@ -629,8 +648,7 @@ class ExhaustiveDartTypeVisitor implements DartTypeVisitor1<bool, CoreTypes> {
|
|||
|
||||
@override
|
||||
bool visitIntersectionType(IntersectionType type, CoreTypes coreTypes) {
|
||||
// TODO(johnniwinther): Why don't we use the bound?
|
||||
return false;
|
||||
return type.right.accept1(this, coreTypes);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -665,8 +683,7 @@ class ExhaustiveDartTypeVisitor implements DartTypeVisitor1<bool, CoreTypes> {
|
|||
|
||||
@override
|
||||
bool visitTypeParameterType(TypeParameterType type, CoreTypes coreTypes) {
|
||||
// TODO(johnniwinther): Why don't we use the bound?
|
||||
return false;
|
||||
return type.bound.accept1(this, coreTypes);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -508,6 +508,8 @@ pays
|
|||
pc
|
||||
periodic
|
||||
periodically
|
||||
perm
|
||||
perms
|
||||
person
|
||||
phrase
|
||||
pink
|
||||
|
@ -651,6 +653,7 @@ stupid
|
|||
subcommand
|
||||
subdir
|
||||
subfolder
|
||||
subs
|
||||
subtool
|
||||
subtools
|
||||
successes
|
||||
|
|
128
pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart
Normal file
128
pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart
Normal file
|
@ -0,0 +1,128 @@
|
|||
// Copyright (c) 2023, 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.
|
||||
|
||||
exhaustiveBoundedTypeVariableByValue<T extends bool>(T x1, T x2) {
|
||||
switch (x1) /* Ok */ {
|
||||
case true:
|
||||
case false:
|
||||
break;
|
||||
}
|
||||
return switch (x2) /* Ok */ {
|
||||
true => 0,
|
||||
false => 1,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustiveBoundedTypeVariableByType<T extends bool>(T x1, T x2) {
|
||||
switch (x1) /* Ok */ {
|
||||
case T():
|
||||
break;
|
||||
}
|
||||
return switch (x2) /* Ok */ {
|
||||
T() => 0,
|
||||
};
|
||||
}
|
||||
|
||||
nonExhaustiveBoundedTypeVariable<T extends bool>(T x1, T x2) {
|
||||
switch (x1) /* Error */ {
|
||||
case true:
|
||||
break;
|
||||
}
|
||||
return switch (x2) /* Error */ {
|
||||
true => 0,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustiveBoundedTypeVariableByBound<T extends bool>(T x1, T x2) {
|
||||
switch (x1) /* Ok */ {
|
||||
case bool():
|
||||
break;
|
||||
}
|
||||
return switch (x2) /* Ok */ {
|
||||
bool() => 0,
|
||||
};
|
||||
}
|
||||
|
||||
nonExhaustiveBoundedTypeVariableByOtherType<T extends bool, S extends bool>(
|
||||
T x1, T x2) {
|
||||
switch (x1) /* Error */ {
|
||||
case S():
|
||||
break;
|
||||
}
|
||||
return switch (x2) /* Error */ {
|
||||
S() => 0,
|
||||
};
|
||||
}
|
||||
|
||||
exhaustivePromotedTypeVariableByValue<T>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
switch (x1) /* Ok */ {
|
||||
case true:
|
||||
case false:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = switch (x2) /* Ok */ {
|
||||
true => 0,
|
||||
false => 1,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exhaustivePromotedTypeVariableByType<T>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
switch (x1) /* Ok */ {
|
||||
case T():
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = switch (x2) /* Ok */ {
|
||||
T() => 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
nonExhaustivePromotedTypeVariable<T>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
switch (x1) /* Error */ {
|
||||
case true:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = switch (x2) /* Error */ {
|
||||
true => 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exhaustivePromotedTypeVariableByBound1<T>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
switch (x1) /* Ok */ {
|
||||
case bool():
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = switch (x2) /* Ok */ {
|
||||
bool() => 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
nonExhaustivePromotedTypeVariableByOtherType<T, S extends bool>(T x1, T x2) {
|
||||
if (x1 is bool) {
|
||||
switch (x1) /* Error */ {
|
||||
case S():
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x2 is bool) {
|
||||
var a = switch (x2) /* Error */ {
|
||||
S() => 0,
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,330 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:28:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:32:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:49:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:53:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:90:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:96:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:118:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:124:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method exhaustiveBoundedTypeVariableByValue<T extends core::bool>(self::exhaustiveBoundedTypeVariableByValue::T x1, self::exhaustiveBoundedTypeVariableByValue::T x2) → dynamic {
|
||||
#L1:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t1;
|
||||
#L3:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L4:
|
||||
case #C1:
|
||||
{
|
||||
#t1 = 0;
|
||||
break #L3;
|
||||
}
|
||||
#L5:
|
||||
case #C2:
|
||||
{
|
||||
#t1 = 1;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByType<T extends core::bool>(self::exhaustiveBoundedTypeVariableByType::T x1, self::exhaustiveBoundedTypeVariableByType::T x2) → dynamic {
|
||||
#L6:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t2;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #1#0 = x2;
|
||||
#L7:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t2 = 0;
|
||||
break #L7;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t2;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariable<T extends core::bool>(self::nonExhaustiveBoundedTypeVariable::T x1, self::nonExhaustiveBoundedTypeVariable::T x2) → dynamic {
|
||||
#L8:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L9:
|
||||
case #C1:
|
||||
{
|
||||
break #L8;
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t3;
|
||||
#L10:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L11:
|
||||
case #C1:
|
||||
{
|
||||
#t3 = 0;
|
||||
break #L10;
|
||||
}
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByBound<T extends core::bool>(self::exhaustiveBoundedTypeVariableByBound::T x1, self::exhaustiveBoundedTypeVariableByBound::T x2) → dynamic {
|
||||
#L12:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L12;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t4;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #1#0 = x2;
|
||||
#L13:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t4 = 0;
|
||||
break #L13;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t4;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariableByOtherType<T extends core::bool, S extends core::bool>(self::nonExhaustiveBoundedTypeVariableByOtherType::T x1, self::nonExhaustiveBoundedTypeVariableByOtherType::T x2) → dynamic {
|
||||
#L14:
|
||||
{
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #0#0 = x1;
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L14;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t5;
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #1#0 = x2;
|
||||
#L15:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
#t5 = 0;
|
||||
break #L15;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t5;
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByValue<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByValue::T% x1, self::exhaustivePromotedTypeVariableByValue::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L16:
|
||||
switch(x1{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L17:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L16;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t6;
|
||||
#L18:
|
||||
switch(x2{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L19:
|
||||
case #C1:
|
||||
{
|
||||
#t6 = 0;
|
||||
break #L18;
|
||||
}
|
||||
#L20:
|
||||
case #C2:
|
||||
{
|
||||
#t6 = 1;
|
||||
break #L18;
|
||||
}
|
||||
}
|
||||
} =>#t6;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByType<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByType::T% x1, self::exhaustivePromotedTypeVariableByType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L21:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L21;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t7;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L22:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t7 = 0;
|
||||
break #L22;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t7;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariable<T extends core::Object? = dynamic>(self::nonExhaustivePromotedTypeVariable::T% x1, self::nonExhaustivePromotedTypeVariable::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L23:
|
||||
switch(x1{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L24:
|
||||
case #C1:
|
||||
{
|
||||
break #L23;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t8;
|
||||
#L25:
|
||||
switch(x2{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L26:
|
||||
case #C1:
|
||||
{
|
||||
#t8 = 0;
|
||||
break #L25;
|
||||
}
|
||||
}
|
||||
} =>#t8;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByBound1<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByBound1::T% x1, self::exhaustivePromotedTypeVariableByBound1::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L27:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L27;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t9;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L28:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t9 = 0;
|
||||
break #L28;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t9;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariableByOtherType<T extends core::Object? = dynamic, S extends core::bool>(self::nonExhaustivePromotedTypeVariableByOtherType::T% x1, self::nonExhaustivePromotedTypeVariableByOtherType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L29:
|
||||
{
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L29;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t10;
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L30:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
#t10 = 0;
|
||||
break #L30;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t10;
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = true
|
||||
#C2 = false
|
||||
}
|
|
@ -0,0 +1,330 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:28:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:32:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:49:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:53:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:90:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:96:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:118:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:124:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method exhaustiveBoundedTypeVariableByValue<T extends core::bool>(self::exhaustiveBoundedTypeVariableByValue::T x1, self::exhaustiveBoundedTypeVariableByValue::T x2) → dynamic {
|
||||
#L1:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t1;
|
||||
#L3:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L4:
|
||||
case #C1:
|
||||
{
|
||||
#t1 = 0;
|
||||
break #L3;
|
||||
}
|
||||
#L5:
|
||||
case #C2:
|
||||
{
|
||||
#t1 = 1;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByType<T extends core::bool>(self::exhaustiveBoundedTypeVariableByType::T x1, self::exhaustiveBoundedTypeVariableByType::T x2) → dynamic {
|
||||
#L6:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t2;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #1#0 = x2;
|
||||
#L7:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t2 = 0;
|
||||
break #L7;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t2;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariable<T extends core::bool>(self::nonExhaustiveBoundedTypeVariable::T x1, self::nonExhaustiveBoundedTypeVariable::T x2) → dynamic {
|
||||
#L8:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L9:
|
||||
case #C1:
|
||||
{
|
||||
break #L8;
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t3;
|
||||
#L10:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L11:
|
||||
case #C1:
|
||||
{
|
||||
#t3 = 0;
|
||||
break #L10;
|
||||
}
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByBound<T extends core::bool>(self::exhaustiveBoundedTypeVariableByBound::T x1, self::exhaustiveBoundedTypeVariableByBound::T x2) → dynamic {
|
||||
#L12:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L12;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t4;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #1#0 = x2;
|
||||
#L13:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t4 = 0;
|
||||
break #L13;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t4;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariableByOtherType<T extends core::bool, S extends core::bool>(self::nonExhaustiveBoundedTypeVariableByOtherType::T x1, self::nonExhaustiveBoundedTypeVariableByOtherType::T x2) → dynamic {
|
||||
#L14:
|
||||
{
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #0#0 = x1;
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L14;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return block {
|
||||
core::int #t5;
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #1#0 = x2;
|
||||
#L15:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
#t5 = 0;
|
||||
break #L15;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t5;
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByValue<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByValue::T% x1, self::exhaustivePromotedTypeVariableByValue::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L16:
|
||||
switch(x1{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L17:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L16;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t6;
|
||||
#L18:
|
||||
switch(x2{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L19:
|
||||
case #C1:
|
||||
{
|
||||
#t6 = 0;
|
||||
break #L18;
|
||||
}
|
||||
#L20:
|
||||
case #C2:
|
||||
{
|
||||
#t6 = 1;
|
||||
break #L18;
|
||||
}
|
||||
}
|
||||
} =>#t6;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByType<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByType::T% x1, self::exhaustivePromotedTypeVariableByType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L21:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L21;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t7;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L22:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t7 = 0;
|
||||
break #L22;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t7;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariable<T extends core::Object? = dynamic>(self::nonExhaustivePromotedTypeVariable::T% x1, self::nonExhaustivePromotedTypeVariable::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L23:
|
||||
switch(x1{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L24:
|
||||
case #C1:
|
||||
{
|
||||
break #L23;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t8;
|
||||
#L25:
|
||||
switch(x2{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L26:
|
||||
case #C1:
|
||||
{
|
||||
#t8 = 0;
|
||||
break #L25;
|
||||
}
|
||||
}
|
||||
} =>#t8;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByBound1<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByBound1::T% x1, self::exhaustivePromotedTypeVariableByBound1::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L27:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L27;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t9;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L28:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t9 = 0;
|
||||
break #L28;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t9;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariableByOtherType<T extends core::Object? = dynamic, S extends core::bool>(self::nonExhaustivePromotedTypeVariableByOtherType::T% x1, self::nonExhaustivePromotedTypeVariableByOtherType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L29:
|
||||
{
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L29;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t10;
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L30:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
#t10 = 0;
|
||||
break #L30;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t10;
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = true
|
||||
#C2 = false
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
exhaustiveBoundedTypeVariableByValue<T extends bool>(T x1, T x2) {}
|
||||
exhaustiveBoundedTypeVariableByType<T extends bool>(T x1, T x2) {}
|
||||
nonExhaustiveBoundedTypeVariable<T extends bool>(T x1, T x2) {}
|
||||
exhaustiveBoundedTypeVariableByBound<T extends bool>(T x1, T x2) {}
|
||||
nonExhaustiveBoundedTypeVariableByOtherType<T extends bool, S extends bool>(
|
||||
T x1, T x2) {}
|
||||
exhaustivePromotedTypeVariableByValue<T>(T x1, T x2) {}
|
||||
exhaustivePromotedTypeVariableByType<T>(T x1, T x2) {}
|
||||
nonExhaustivePromotedTypeVariable<T>(T x1, T x2) {}
|
||||
exhaustivePromotedTypeVariableByBound1<T>(T x1, T x2) {}
|
||||
nonExhaustivePromotedTypeVariableByOtherType<T, S extends bool>(T x1, T x2) {}
|
|
@ -0,0 +1,11 @@
|
|||
exhaustiveBoundedTypeVariableByBound<T extends bool>(T x1, T x2) {}
|
||||
exhaustiveBoundedTypeVariableByType<T extends bool>(T x1, T x2) {}
|
||||
exhaustiveBoundedTypeVariableByValue<T extends bool>(T x1, T x2) {}
|
||||
exhaustivePromotedTypeVariableByBound1<T>(T x1, T x2) {}
|
||||
exhaustivePromotedTypeVariableByType<T>(T x1, T x2) {}
|
||||
exhaustivePromotedTypeVariableByValue<T>(T x1, T x2) {}
|
||||
nonExhaustiveBoundedTypeVariable<T extends bool>(T x1, T x2) {}
|
||||
nonExhaustiveBoundedTypeVariableByOtherType<T extends bool, S extends bool>(
|
||||
T x1, T x2) {}
|
||||
nonExhaustivePromotedTypeVariable<T>(T x1, T x2) {}
|
||||
nonExhaustivePromotedTypeVariableByOtherType<T, S extends bool>(T x1, T x2) {}
|
|
@ -0,0 +1,367 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:28:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:32:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:49:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:53:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:90:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:96:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:118:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:124:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method exhaustiveBoundedTypeVariableByValue<T extends core::bool>(self::exhaustiveBoundedTypeVariableByValue::T x1, self::exhaustiveBoundedTypeVariableByValue::T x2) → dynamic {
|
||||
#L1:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L1;
|
||||
}
|
||||
#L3:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t1;
|
||||
#L4:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L5:
|
||||
case #C1:
|
||||
{
|
||||
#t1 = 0;
|
||||
break #L4;
|
||||
}
|
||||
#L6:
|
||||
case #C2:
|
||||
{
|
||||
#t1 = 1;
|
||||
break #L4;
|
||||
}
|
||||
#L7:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByType<T extends core::bool>(self::exhaustiveBoundedTypeVariableByType::T x1, self::exhaustiveBoundedTypeVariableByType::T x2) → dynamic {
|
||||
#L8:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L8;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t2;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #1#0 = x2;
|
||||
#L9:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t2 = 0;
|
||||
break #L9;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t2;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariable<T extends core::bool>(self::nonExhaustiveBoundedTypeVariable::T x1, self::nonExhaustiveBoundedTypeVariable::T x2) → dynamic {
|
||||
#L10:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L11:
|
||||
case #C1:
|
||||
{
|
||||
break #L10;
|
||||
}
|
||||
#L12:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t3;
|
||||
#L13:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L14:
|
||||
case #C1:
|
||||
{
|
||||
#t3 = 0;
|
||||
break #L13;
|
||||
}
|
||||
#L15:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByBound<T extends core::bool>(self::exhaustiveBoundedTypeVariableByBound::T x1, self::exhaustiveBoundedTypeVariableByBound::T x2) → dynamic {
|
||||
#L16:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L16;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t4;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #1#0 = x2;
|
||||
#L17:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t4 = 0;
|
||||
break #L17;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t4;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariableByOtherType<T extends core::bool, S extends core::bool>(self::nonExhaustiveBoundedTypeVariableByOtherType::T x1, self::nonExhaustiveBoundedTypeVariableByOtherType::T x2) → dynamic {
|
||||
#L18:
|
||||
{
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #0#0 = x1;
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L18;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t5;
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #1#0 = x2;
|
||||
#L19:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
#t5 = 0;
|
||||
break #L19;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t5;
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByValue<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByValue::T% x1, self::exhaustivePromotedTypeVariableByValue::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L20:
|
||||
switch(x1{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L21:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L20;
|
||||
}
|
||||
#L22:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t6;
|
||||
#L23:
|
||||
switch(x2{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L24:
|
||||
case #C1:
|
||||
{
|
||||
#t6 = 0;
|
||||
break #L23;
|
||||
}
|
||||
#L25:
|
||||
case #C2:
|
||||
{
|
||||
#t6 = 1;
|
||||
break #L23;
|
||||
}
|
||||
#L26:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t6;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByType<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByType::T% x1, self::exhaustivePromotedTypeVariableByType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L27:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L27;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t7;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L28:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t7 = 0;
|
||||
break #L28;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t7;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariable<T extends core::Object? = dynamic>(self::nonExhaustivePromotedTypeVariable::T% x1, self::nonExhaustivePromotedTypeVariable::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L29:
|
||||
switch(x1{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L30:
|
||||
case #C1:
|
||||
{
|
||||
break #L29;
|
||||
}
|
||||
#L31:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t8;
|
||||
#L32:
|
||||
switch(x2{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L33:
|
||||
case #C1:
|
||||
{
|
||||
#t8 = 0;
|
||||
break #L32;
|
||||
}
|
||||
#L34:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t8;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByBound1<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByBound1::T% x1, self::exhaustivePromotedTypeVariableByBound1::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L35:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L35;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t9;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L36:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t9 = 0;
|
||||
break #L36;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t9;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariableByOtherType<T extends core::Object? = dynamic, S extends core::bool>(self::nonExhaustivePromotedTypeVariableByOtherType::T% x1, self::nonExhaustivePromotedTypeVariableByOtherType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L37:
|
||||
{
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L37;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t10;
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L38:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
#t10 = 0;
|
||||
break #L38;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t10;
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = true
|
||||
#C2 = false
|
||||
}
|
|
@ -0,0 +1,367 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:28:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:32:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:49:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:53:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:90:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:96:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:118:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:124:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method exhaustiveBoundedTypeVariableByValue<T extends core::bool>(self::exhaustiveBoundedTypeVariableByValue::T x1, self::exhaustiveBoundedTypeVariableByValue::T x2) → dynamic {
|
||||
#L1:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L1;
|
||||
}
|
||||
#L3:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t1;
|
||||
#L4:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L5:
|
||||
case #C1:
|
||||
{
|
||||
#t1 = 0;
|
||||
break #L4;
|
||||
}
|
||||
#L6:
|
||||
case #C2:
|
||||
{
|
||||
#t1 = 1;
|
||||
break #L4;
|
||||
}
|
||||
#L7:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByType<T extends core::bool>(self::exhaustiveBoundedTypeVariableByType::T x1, self::exhaustiveBoundedTypeVariableByType::T x2) → dynamic {
|
||||
#L8:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L8;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t2;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #1#0 = x2;
|
||||
#L9:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t2 = 0;
|
||||
break #L9;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t2;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariable<T extends core::bool>(self::nonExhaustiveBoundedTypeVariable::T x1, self::nonExhaustiveBoundedTypeVariable::T x2) → dynamic {
|
||||
#L10:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L11:
|
||||
case #C1:
|
||||
{
|
||||
break #L10;
|
||||
}
|
||||
#L12:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t3;
|
||||
#L13:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L14:
|
||||
case #C1:
|
||||
{
|
||||
#t3 = 0;
|
||||
break #L13;
|
||||
}
|
||||
#L15:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByBound<T extends core::bool>(self::exhaustiveBoundedTypeVariableByBound::T x1, self::exhaustiveBoundedTypeVariableByBound::T x2) → dynamic {
|
||||
#L16:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L16;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t4;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #1#0 = x2;
|
||||
#L17:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t4 = 0;
|
||||
break #L17;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t4;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariableByOtherType<T extends core::bool, S extends core::bool>(self::nonExhaustiveBoundedTypeVariableByOtherType::T x1, self::nonExhaustiveBoundedTypeVariableByOtherType::T x2) → dynamic {
|
||||
#L18:
|
||||
{
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #0#0 = x1;
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L18;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t5;
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #1#0 = x2;
|
||||
#L19:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
#t5 = 0;
|
||||
break #L19;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t5;
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByValue<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByValue::T% x1, self::exhaustivePromotedTypeVariableByValue::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L20:
|
||||
switch(x1{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L21:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L20;
|
||||
}
|
||||
#L22:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t6;
|
||||
#L23:
|
||||
switch(x2{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L24:
|
||||
case #C1:
|
||||
{
|
||||
#t6 = 0;
|
||||
break #L23;
|
||||
}
|
||||
#L25:
|
||||
case #C2:
|
||||
{
|
||||
#t6 = 1;
|
||||
break #L23;
|
||||
}
|
||||
#L26:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t6;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByType<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByType::T% x1, self::exhaustivePromotedTypeVariableByType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L27:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L27;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t7;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L28:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t7 = 0;
|
||||
break #L28;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t7;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariable<T extends core::Object? = dynamic>(self::nonExhaustivePromotedTypeVariable::T% x1, self::nonExhaustivePromotedTypeVariable::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L29:
|
||||
switch(x1{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L30:
|
||||
case #C1:
|
||||
{
|
||||
break #L29;
|
||||
}
|
||||
#L31:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t8;
|
||||
#L32:
|
||||
switch(x2{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L33:
|
||||
case #C1:
|
||||
{
|
||||
#t8 = 0;
|
||||
break #L32;
|
||||
}
|
||||
#L34:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t8;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByBound1<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByBound1::T% x1, self::exhaustivePromotedTypeVariableByBound1::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L35:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L35;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t9;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L36:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t9 = 0;
|
||||
break #L36;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t9;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariableByOtherType<T extends core::Object? = dynamic, S extends core::bool>(self::nonExhaustivePromotedTypeVariableByOtherType::T% x1, self::nonExhaustivePromotedTypeVariableByOtherType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L37:
|
||||
{
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L37;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t10;
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L38:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
#t10 = 0;
|
||||
break #L38;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t10;
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = true
|
||||
#C2 = false
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method exhaustiveBoundedTypeVariableByValue<T extends core::bool>(self::exhaustiveBoundedTypeVariableByValue::T x1, self::exhaustiveBoundedTypeVariableByValue::T x2) → dynamic
|
||||
;
|
||||
static method exhaustiveBoundedTypeVariableByType<T extends core::bool>(self::exhaustiveBoundedTypeVariableByType::T x1, self::exhaustiveBoundedTypeVariableByType::T x2) → dynamic
|
||||
;
|
||||
static method nonExhaustiveBoundedTypeVariable<T extends core::bool>(self::nonExhaustiveBoundedTypeVariable::T x1, self::nonExhaustiveBoundedTypeVariable::T x2) → dynamic
|
||||
;
|
||||
static method exhaustiveBoundedTypeVariableByBound<T extends core::bool>(self::exhaustiveBoundedTypeVariableByBound::T x1, self::exhaustiveBoundedTypeVariableByBound::T x2) → dynamic
|
||||
;
|
||||
static method nonExhaustiveBoundedTypeVariableByOtherType<T extends core::bool, S extends core::bool>(self::nonExhaustiveBoundedTypeVariableByOtherType::T x1, self::nonExhaustiveBoundedTypeVariableByOtherType::T x2) → dynamic
|
||||
;
|
||||
static method exhaustivePromotedTypeVariableByValue<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByValue::T% x1, self::exhaustivePromotedTypeVariableByValue::T% x2) → dynamic
|
||||
;
|
||||
static method exhaustivePromotedTypeVariableByType<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByType::T% x1, self::exhaustivePromotedTypeVariableByType::T% x2) → dynamic
|
||||
;
|
||||
static method nonExhaustivePromotedTypeVariable<T extends core::Object? = dynamic>(self::nonExhaustivePromotedTypeVariable::T% x1, self::nonExhaustivePromotedTypeVariable::T% x2) → dynamic
|
||||
;
|
||||
static method exhaustivePromotedTypeVariableByBound1<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByBound1::T% x1, self::exhaustivePromotedTypeVariableByBound1::T% x2) → dynamic
|
||||
;
|
||||
static method nonExhaustivePromotedTypeVariableByOtherType<T extends core::Object? = dynamic, S extends core::bool>(self::nonExhaustivePromotedTypeVariableByOtherType::T% x1, self::nonExhaustivePromotedTypeVariableByOtherType::T% x2) → dynamic
|
||||
;
|
|
@ -0,0 +1,367 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:28:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:32:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:49:11: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:53:18: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// return switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:90:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:96:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'false'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:118:13: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// switch (x1) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/patterns/exhaustiveness/intersect.dart:124:21: Error: The type 'T' is not exhaustively matched by the switch cases.
|
||||
// Try adding a default case or cases that match 'true'.
|
||||
// var a = switch (x2) /* Error */ {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method exhaustiveBoundedTypeVariableByValue<T extends core::bool>(self::exhaustiveBoundedTypeVariableByValue::T x1, self::exhaustiveBoundedTypeVariableByValue::T x2) → dynamic {
|
||||
#L1:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L2:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L1;
|
||||
}
|
||||
#L3:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t1;
|
||||
#L4:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L5:
|
||||
case #C1:
|
||||
{
|
||||
#t1 = 0;
|
||||
break #L4;
|
||||
}
|
||||
#L6:
|
||||
case #C2:
|
||||
{
|
||||
#t1 = 1;
|
||||
break #L4;
|
||||
}
|
||||
#L7:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByType<T extends core::bool>(self::exhaustiveBoundedTypeVariableByType::T x1, self::exhaustiveBoundedTypeVariableByType::T x2) → dynamic {
|
||||
#L8:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L8;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t2;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByType::T #1#0 = x2;
|
||||
#L9:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t2 = 0;
|
||||
break #L9;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t2;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariable<T extends core::bool>(self::nonExhaustiveBoundedTypeVariable::T x1, self::nonExhaustiveBoundedTypeVariable::T x2) → dynamic {
|
||||
#L10:
|
||||
switch(x1) /*isExplicitlyExhaustive*/ {
|
||||
#L11:
|
||||
case #C1:
|
||||
{
|
||||
break #L10;
|
||||
}
|
||||
#L12:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t3;
|
||||
#L13:
|
||||
switch(x2) /*isExplicitlyExhaustive*/ {
|
||||
#L14:
|
||||
case #C1:
|
||||
{
|
||||
#t3 = 0;
|
||||
break #L13;
|
||||
}
|
||||
#L15:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
static method exhaustiveBoundedTypeVariableByBound<T extends core::bool>(self::exhaustiveBoundedTypeVariableByBound::T x1, self::exhaustiveBoundedTypeVariableByBound::T x2) → dynamic {
|
||||
#L16:
|
||||
{
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #0#0 = x1;
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L16;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t4;
|
||||
final synthesized self::exhaustiveBoundedTypeVariableByBound::T #1#0 = x2;
|
||||
#L17:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t4 = 0;
|
||||
break #L17;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t4;
|
||||
}
|
||||
static method nonExhaustiveBoundedTypeVariableByOtherType<T extends core::bool, S extends core::bool>(self::nonExhaustiveBoundedTypeVariableByOtherType::T x1, self::nonExhaustiveBoundedTypeVariableByOtherType::T x2) → dynamic {
|
||||
#L18:
|
||||
{
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #0#0 = x1;
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L18;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
return block {
|
||||
core::int #t5;
|
||||
final synthesized self::nonExhaustiveBoundedTypeVariableByOtherType::T #1#0 = x2;
|
||||
#L19:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustiveBoundedTypeVariableByOtherType::S) {
|
||||
#t5 = 0;
|
||||
break #L19;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t5;
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByValue<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByValue::T% x1, self::exhaustivePromotedTypeVariableByValue::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L20:
|
||||
switch(x1{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L21:
|
||||
case #C1:
|
||||
case #C2:
|
||||
{
|
||||
break #L20;
|
||||
}
|
||||
#L22:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t6;
|
||||
#L23:
|
||||
switch(x2{self::exhaustivePromotedTypeVariableByValue::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L24:
|
||||
case #C1:
|
||||
{
|
||||
#t6 = 0;
|
||||
break #L23;
|
||||
}
|
||||
#L25:
|
||||
case #C2:
|
||||
{
|
||||
#t6 = 1;
|
||||
break #L23;
|
||||
}
|
||||
#L26:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t6;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByType<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByType::T% x1, self::exhaustivePromotedTypeVariableByType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L27:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L27;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t7;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L28:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t7 = 0;
|
||||
break #L28;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t7;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariable<T extends core::Object? = dynamic>(self::nonExhaustivePromotedTypeVariable::T% x1, self::nonExhaustivePromotedTypeVariable::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L29:
|
||||
switch(x1{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L30:
|
||||
case #C1:
|
||||
{
|
||||
break #L29;
|
||||
}
|
||||
#L31:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t8;
|
||||
#L32:
|
||||
switch(x2{self::nonExhaustivePromotedTypeVariable::T% & core::bool /* '%' & '!' = '!' */}) /*isExplicitlyExhaustive*/ {
|
||||
#L33:
|
||||
case #C1:
|
||||
{
|
||||
#t8 = 0;
|
||||
break #L32;
|
||||
}
|
||||
#L34:
|
||||
default:
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t8;
|
||||
}
|
||||
}
|
||||
static method exhaustivePromotedTypeVariableByBound1<T extends core::Object? = dynamic>(self::exhaustivePromotedTypeVariableByBound1::T% x1, self::exhaustivePromotedTypeVariableByBound1::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L35:
|
||||
{
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(true) {
|
||||
{
|
||||
break #L35;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t9;
|
||||
final synthesized self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::exhaustivePromotedTypeVariableByBound1::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L36:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t9 = 0;
|
||||
break #L36;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t9;
|
||||
}
|
||||
}
|
||||
static method nonExhaustivePromotedTypeVariableByOtherType<T extends core::Object? = dynamic, S extends core::bool>(self::nonExhaustivePromotedTypeVariableByOtherType::T% x1, self::nonExhaustivePromotedTypeVariableByOtherType::T% x2) → dynamic {
|
||||
if(x1 is{ForNonNullableByDefault} core::bool) {
|
||||
#L37:
|
||||
{
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #0#0 = x1{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
{
|
||||
if(#0#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
{
|
||||
break #L37;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch statement with a non-nullable type.");
|
||||
}
|
||||
}
|
||||
if(x2 is{ForNonNullableByDefault} core::bool) {
|
||||
core::int a = block {
|
||||
core::int #t10;
|
||||
final synthesized self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */ #1#0 = x2{self::nonExhaustivePromotedTypeVariableByOtherType::T% & core::bool /* '%' & '!' = '!' */};
|
||||
#L38:
|
||||
{
|
||||
{
|
||||
if(#1#0 is{ForNonNullableByDefault} self::nonExhaustivePromotedTypeVariableByOtherType::S) {
|
||||
#t10 = 0;
|
||||
break #L38;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t10;
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = true
|
||||
#C2 = false
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (c) 2023, 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.
|
||||
|
||||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
|
||||
(switch (list) {
|
||||
[...] => 1,
|
||||
});
|
||||
|
||||
(switch (list) {
|
||||
[] => 1,
|
||||
[_, ...] => 2,
|
||||
});
|
||||
|
||||
(switch (list) {
|
||||
[] => 1,
|
||||
[_] => 2,
|
||||
[_, ..., _] => 3,
|
||||
});
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
block {
|
||||
core::int #t1;
|
||||
final synthesized core::List<core::int> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t1 = 1;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
block {
|
||||
core::int #t2;
|
||||
final synthesized core::List<core::int> #1#0 = list;
|
||||
late final synthesized core::int #1#1 = #1#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#1#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = 1;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#1#1.{core::num::>=}(#C2){(core::num) → core::bool}) {
|
||||
#t2 = 2;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t2;
|
||||
block {
|
||||
core::int #t3;
|
||||
final synthesized core::List<core::int> #2#0 = list;
|
||||
late final synthesized core::int #2#1 = #2#0.{core::List::length}{core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#2#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t3 = 1;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t3 = 2;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool}) {
|
||||
#t3 = 3;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
#C3 = 2
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
block {
|
||||
core::int #t1;
|
||||
final synthesized core::List<core::int> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t1 = 1;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
block {
|
||||
core::int #t2;
|
||||
final synthesized core::List<core::int> #1#0 = list;
|
||||
function ##1#1#initializer() → core::int
|
||||
return #1#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #1#1 = ##1#1#initializer(){() → core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#1#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = 1;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#1#1.{core::num::>=}(#C2){(core::num) → core::bool}) {
|
||||
#t2 = 2;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t2;
|
||||
block {
|
||||
core::int #t3;
|
||||
final synthesized core::List<core::int> #2#0 = list;
|
||||
function ##2#1#initializer() → core::int
|
||||
return #2#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #2#1 = ##2#1#initializer(){() → core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#2#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t3 = 1;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t3 = 2;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool}) {
|
||||
#t3 = 3;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
#C3 = 2
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
void main() {}
|
|
@ -0,0 +1 @@
|
|||
void main() {}
|
|
@ -0,0 +1,76 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
block {
|
||||
core::int #t1;
|
||||
final synthesized core::List<core::int> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t1 = 1;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
block {
|
||||
core::int #t2;
|
||||
final synthesized core::List<core::int> #1#0 = list;
|
||||
late final synthesized core::int #1#1 = #1#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#1#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = 1;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#1#1.{core::num::>=}(#C2){(core::num) → core::bool}) {
|
||||
#t2 = 2;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t2;
|
||||
block {
|
||||
core::int #t3;
|
||||
final synthesized core::List<core::int> #2#0 = list;
|
||||
late final synthesized core::int #2#1 = #2#0.{core::List::length}{core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#2#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t3 = 1;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t3 = 2;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool}) {
|
||||
#t3 = 3;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
#C3 = 2
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
block {
|
||||
core::int #t1;
|
||||
final synthesized core::List<core::int> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t1 = 1;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
block {
|
||||
core::int #t2;
|
||||
final synthesized core::List<core::int> #1#0 = list;
|
||||
late final synthesized core::int #1#1 = #1#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#1#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = 1;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#1#1.{core::num::>=}(#C2){(core::num) → core::bool}) {
|
||||
#t2 = 2;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t2;
|
||||
block {
|
||||
core::int #t3;
|
||||
final synthesized core::List<core::int> #2#0 = list;
|
||||
late final synthesized core::int #2#1 = #2#0.{core::List::length}{core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#2#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t3 = 1;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t3 = 2;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool}) {
|
||||
#t3 = 3;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
#C3 = 2
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
|
||||
static method main() → void
|
||||
;
|
|
@ -0,0 +1,80 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
block {
|
||||
core::int #t1;
|
||||
final synthesized core::List<core::int> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(true) {
|
||||
#t1 = 1;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
block {
|
||||
core::int #t2;
|
||||
final synthesized core::List<core::int> #1#0 = list;
|
||||
function ##1#1#initializer() → core::int
|
||||
return #1#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #1#1 = ##1#1#initializer(){() → core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#1#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = 1;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#1#1.{core::num::>=}(#C2){(core::num) → core::bool}) {
|
||||
#t2 = 2;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t2;
|
||||
block {
|
||||
core::int #t3;
|
||||
final synthesized core::List<core::int> #2#0 = list;
|
||||
function ##2#1#initializer() → core::int
|
||||
return #2#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #2#1 = ##2#1#initializer(){() → core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#2#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t3 = 1;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t3 = 2;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool}) {
|
||||
#t3 = 3;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t3;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
#C3 = 2
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
print(subs(list));
|
||||
print(perms(list));
|
||||
print(equals(list, list));
|
||||
}
|
||||
|
||||
List<List<A>> subs<A>(List<A> list) => switch (list) {
|
||||
[] => [],
|
||||
[var x, ...var xs] => [
|
||||
for (var ys in subs(xs)) ...[
|
||||
[x] + ys,
|
||||
ys
|
||||
],
|
||||
[x]
|
||||
],
|
||||
};
|
||||
|
||||
List<List<A>> perms<A>(List<A> list) => switch (list) {
|
||||
[] || [_] => [list],
|
||||
[var x, ...var xs] => [
|
||||
for (var i = 0; i < list.length; i++)
|
||||
for (var perm in perms(xs)) [...perm.take(i), x, ...perm.skip(i)]
|
||||
],
|
||||
};
|
||||
|
||||
bool equals<A>(List<A> a, List<A> b) => switch ((a, b)) {
|
||||
([], []) => true,
|
||||
([_, ...], []) => false,
|
||||
([], [_, ...]) => false,
|
||||
([var l, ...var ls], [var r, ...var rs]) => l == r && equals(ls, rs),
|
||||
};
|
|
@ -0,0 +1,119 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <core::List<self::subs::A%>>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t4.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t4.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = <core::List<self::perms::A%>>[list];
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final dynamic #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = <core::List<self::perms::A%>>[];
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
|
||||
for (core::List<self::perms::A%> perm in self::perms<self::perms::A%>(xs))
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#2 = #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#4 = #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#6 = #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#7 = #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final dynamic #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final dynamic #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::subs::A% #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final core::List<self::subs::A%> #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
{
|
||||
synthesized core::Iterator<core::List<self::subs::A%>> :sync-for-iterator = self::subs<self::subs::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::subs::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::subs::A%> ys = :sync-for-iterator.{core::Iterator::current}{core::List<self::subs::A%>};
|
||||
#t4.{core::List::addAll}{Invariant}(core::_GrowableList::_literal2<core::List<self::subs::A%>>(core::_GrowableList::_literal1<self::subs::A%>(x).{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys)){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
}
|
||||
}
|
||||
#t4.{core::List::add}{Invariant}(core::_GrowableList::_literal1<self::subs::A%>(x)){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = core::_GrowableList::_literal1<core::List<self::perms::A%>>(list);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::perms::A% #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final core::List<self::perms::A%> #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = core::_GrowableList::•<core::List<self::perms::A%>>(0);
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
synthesized core::Iterator<core::List<self::perms::A%>> :sync-for-iterator = self::perms<self::perms::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::perms::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::perms::A%> perm = :sync-for-iterator.{core::Iterator::current}{core::List<self::perms::A%>};
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
}
|
||||
}
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
function ##0#1#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = ##0#1#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#2#initializer() → core::int
|
||||
return #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#2 = ##0#2#initializer(){() → core::int};
|
||||
function ##0#4#initializer() → core::bool
|
||||
return #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#4 = ##0#4#initializer(){() → core::bool};
|
||||
function ##0#5#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = ##0#5#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#6#initializer() → core::int
|
||||
return #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#6 = ##0#6#initializer(){() → core::int};
|
||||
function ##0#7#initializer() → core::bool
|
||||
return #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#7 = ##0#7#initializer(){() → core::bool};
|
||||
function ##0#9#initializer() → core::bool
|
||||
return #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = ##0#9#initializer(){() → core::bool};
|
||||
function ##0#11#initializer() → core::bool
|
||||
return #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = ##0#11#initializer(){() → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final self::equals::A% #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final self::equals::A% #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
void main() {}
|
||||
List<List<A>> subs<A>(List<A> list) => switch (list) { };
|
||||
List<List<A>> perms<A>(List<A> list) => switch (list) { };
|
||||
bool equals<A>(List<A> a, List<A> b) => switch ((a, b)) { };
|
|
@ -0,0 +1,16 @@
|
|||
List<List<A>> subs<A>(List<A> list) =>
|
||||
switch (list) {}
|
||||
void main() {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
||||
List<List<A>> perms<A>(List<A> list) =>
|
||||
switch (list) {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
||||
bool equals<A>(List<A> a, List<A> b) =>
|
||||
switch ((a, b)) {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
|
@ -0,0 +1,123 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <core::List<self::subs::A%>>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t4.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t4.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = <core::List<self::perms::A%>>[list];
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final dynamic #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = <core::List<self::perms::A%>>[];
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
|
||||
for (core::List<self::perms::A%> perm in self::perms<self::perms::A%>(xs))
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#2 = #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#4 = #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#6 = #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#7 = #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final dynamic #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final dynamic #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <core::List<self::subs::A%>>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t4.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t4.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = <core::List<self::perms::A%>>[list];
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final dynamic #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = <core::List<self::perms::A%>>[];
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
|
||||
for (core::List<self::perms::A%> perm in self::perms<self::perms::A%>(xs))
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#2 = #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#4 = #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#6 = #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#7 = #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final dynamic #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final dynamic #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void
|
||||
;
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
;
|
|
@ -0,0 +1,152 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::subs::A% #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final core::List<self::subs::A%> #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
{
|
||||
synthesized core::Iterator<core::List<self::subs::A%>> :sync-for-iterator = self::subs<self::subs::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::subs::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::subs::A%> ys = :sync-for-iterator.{core::Iterator::current}{core::List<self::subs::A%>};
|
||||
#t4.{core::List::addAll}{Invariant}(core::_GrowableList::_literal2<core::List<self::subs::A%>>(core::_GrowableList::_literal1<self::subs::A%>(x).{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys)){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
}
|
||||
}
|
||||
#t4.{core::List::add}{Invariant}(core::_GrowableList::_literal1<self::subs::A%>(x)){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = core::_GrowableList::_literal1<core::List<self::perms::A%>>(list);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::perms::A% #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final core::List<self::perms::A%> #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = core::_GrowableList::•<core::List<self::perms::A%>>(0);
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
synthesized core::Iterator<core::List<self::perms::A%>> :sync-for-iterator = self::perms<self::perms::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::perms::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::perms::A%> perm = :sync-for-iterator.{core::Iterator::current}{core::List<self::perms::A%>};
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
}
|
||||
}
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
function ##0#1#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = ##0#1#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#2#initializer() → core::int
|
||||
return #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#2 = ##0#2#initializer(){() → core::int};
|
||||
function ##0#4#initializer() → core::bool
|
||||
return #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#4 = ##0#4#initializer(){() → core::bool};
|
||||
function ##0#5#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = ##0#5#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#6#initializer() → core::int
|
||||
return #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#6 = ##0#6#initializer(){() → core::int};
|
||||
function ##0#7#initializer() → core::bool
|
||||
return #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#7 = ##0#7#initializer(){() → core::bool};
|
||||
function ##0#9#initializer() → core::bool
|
||||
return #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = ##0#9#initializer(){() → core::bool};
|
||||
function ##0#11#initializer() → core::bool
|
||||
return #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = ##0#11#initializer(){() → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final self::equals::A% #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final self::equals::A% #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
print(f(list));
|
||||
print(subs(list));
|
||||
print(perms(list));
|
||||
print(equals(list, list));
|
||||
}
|
||||
|
||||
List<A> f<A>(List<A> list) => switch (list) {
|
||||
[] => [],
|
||||
[...] => [],
|
||||
};
|
||||
|
||||
List<List<A>> subs<A>(List<A> list) => switch (list) {
|
||||
[] => [],
|
||||
[var x, ...var xs] => [
|
||||
for (var ys in subs(xs)) ...[
|
||||
[x] + ys,
|
||||
ys
|
||||
],
|
||||
[x]
|
||||
],
|
||||
};
|
||||
|
||||
List<List<A>> perms<A>(List<A> list) => switch (list) {
|
||||
[] || [_] => [list],
|
||||
[var x, ...var xs] => [
|
||||
for (var i = 0; i < list.length; i++)
|
||||
for (var perm in perms(xs)) [...perm.take(i), x, ...perm.skip(i)]
|
||||
],
|
||||
};
|
||||
|
||||
bool equals<A>(List<A> a, List<A> b) => switch ((a, b)) {
|
||||
([], []) => true,
|
||||
([_, ...], []) => false,
|
||||
([], [_, ...]) => false,
|
||||
([var l, ...var ls], [var r, ...var rs]) => l == r && equals(ls, rs),
|
||||
};
|
|
@ -0,0 +1,140 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::f<core::int>(list));
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method f<A extends core::Object? = dynamic>(core::List<self::f::A%> list) → core::List<self::f::A%>
|
||||
return block {
|
||||
core::List<self::f::A%> #t1;
|
||||
final synthesized core::List<self::f::A%> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <self::f::A%>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(true) {
|
||||
#t1 = <self::f::A%>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t2;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = <core::List<self::subs::A%>>[];
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t3 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t4 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t2 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t5 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t5.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t5.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t5;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t2;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t6;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t6 = <core::List<self::perms::A%>>[list];
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t7 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final dynamic #t8 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t6 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t9 = <core::List<self::perms::A%>>[];
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
|
||||
for (core::List<self::perms::A%> perm in self::perms<self::perms::A%>(xs))
|
||||
#t9.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t10 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t10.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t10.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t10){(core::List<self::perms::A%>) → void};
|
||||
} =>#t9;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t6;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t11;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#2 = #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#4 = #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#6 = #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#7 = #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
#L4:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t11 = true;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final dynamic #t12 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t13 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final dynamic #t14 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t15 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t11 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t11;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
core::print(self::f<core::int>(list));
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method f<A extends core::Object? = dynamic>(core::List<self::f::A%> list) → core::List<self::f::A%>
|
||||
return block {
|
||||
core::List<self::f::A%> #t1;
|
||||
final synthesized core::List<self::f::A%> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = core::_GrowableList::•<self::f::A%>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(true) {
|
||||
#t1 = core::_GrowableList::•<self::f::A%>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t2;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::subs::A% #t3 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final core::List<self::subs::A%> #t4 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t2 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t5 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
{
|
||||
synthesized core::Iterator<core::List<self::subs::A%>> :sync-for-iterator = self::subs<self::subs::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::subs::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::subs::A%> ys = :sync-for-iterator.{core::Iterator::current}{core::List<self::subs::A%>};
|
||||
#t5.{core::List::addAll}{Invariant}(core::_GrowableList::_literal2<core::List<self::subs::A%>>(core::_GrowableList::_literal1<self::subs::A%>(x).{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys)){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
}
|
||||
}
|
||||
#t5.{core::List::add}{Invariant}(core::_GrowableList::_literal1<self::subs::A%>(x)){(core::List<self::subs::A%>) → void};
|
||||
} =>#t5;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t2;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t6;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t6 = core::_GrowableList::_literal1<core::List<self::perms::A%>>(list);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::perms::A% #t7 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final core::List<self::perms::A%> #t8 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t6 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t9 = core::_GrowableList::•<core::List<self::perms::A%>>(0);
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
synthesized core::Iterator<core::List<self::perms::A%>> :sync-for-iterator = self::perms<self::perms::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::perms::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::perms::A%> perm = :sync-for-iterator.{core::Iterator::current}{core::List<self::perms::A%>};
|
||||
#t9.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t10 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t10.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t10.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t10){(core::List<self::perms::A%>) → void};
|
||||
}
|
||||
}
|
||||
} =>#t9;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t6;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t11;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
function ##0#1#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = ##0#1#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#2#initializer() → core::int
|
||||
return #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#2 = ##0#2#initializer(){() → core::int};
|
||||
function ##0#4#initializer() → core::bool
|
||||
return #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#4 = ##0#4#initializer(){() → core::bool};
|
||||
function ##0#5#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = ##0#5#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#6#initializer() → core::int
|
||||
return #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#6 = ##0#6#initializer(){() → core::int};
|
||||
function ##0#7#initializer() → core::bool
|
||||
return #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#7 = ##0#7#initializer(){() → core::bool};
|
||||
function ##0#9#initializer() → core::bool
|
||||
return #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = ##0#9#initializer(){() → core::bool};
|
||||
function ##0#11#initializer() → core::bool
|
||||
return #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = ##0#11#initializer(){() → core::bool};
|
||||
#L4:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t11 = true;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final self::equals::A% #t12 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t13 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final self::equals::A% #t14 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t15 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t11 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t11;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
void main() {}
|
||||
List<A> f<A>(List<A> list) => switch (list) { };
|
||||
List<List<A>> subs<A>(List<A> list) => switch (list) { };
|
||||
List<List<A>> perms<A>(List<A> list) => switch (list) { };
|
||||
bool equals<A>(List<A> a, List<A> b) => switch ((a, b)) { };
|
|
@ -0,0 +1,21 @@
|
|||
List<A> f<A>(List<A> list) =>
|
||||
switch (list) {}
|
||||
void main() {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
||||
List<List<A>> subs<A>(List<A> list) =>
|
||||
switch (list) {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
||||
List<List<A>> perms<A>(List<A> list) =>
|
||||
switch (list) {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
||||
bool equals<A>(List<A> a, List<A> b) =>
|
||||
switch ((a, b)) {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
|
@ -0,0 +1,145 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::f<core::int>(list));
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method f<A extends core::Object? = dynamic>(core::List<self::f::A%> list) → core::List<self::f::A%>
|
||||
return block {
|
||||
core::List<self::f::A%> #t1;
|
||||
final synthesized core::List<self::f::A%> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <self::f::A%>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(true) {
|
||||
#t1 = <self::f::A%>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t2;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = <core::List<self::subs::A%>>[];
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t3 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t4 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t2 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t5 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t5.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t5.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t5;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t2;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t6;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t6 = <core::List<self::perms::A%>>[list];
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t7 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final dynamic #t8 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t6 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t9 = <core::List<self::perms::A%>>[];
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
|
||||
for (core::List<self::perms::A%> perm in self::perms<self::perms::A%>(xs))
|
||||
#t9.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t10 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t10.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t10.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t10){(core::List<self::perms::A%>) → void};
|
||||
} =>#t9;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t6;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t11;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#2 = #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#4 = #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#6 = #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#7 = #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
#L4:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t11 = true;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final dynamic #t12 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t13 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final dynamic #t14 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t15 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t11 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t11;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::f<core::int>(list));
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method f<A extends core::Object? = dynamic>(core::List<self::f::A%> list) → core::List<self::f::A%>
|
||||
return block {
|
||||
core::List<self::f::A%> #t1;
|
||||
final synthesized core::List<self::f::A%> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <self::f::A%>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(true) {
|
||||
#t1 = <self::f::A%>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t2;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = <core::List<self::subs::A%>>[];
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t3 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t4 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t2 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t5 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t5.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t5.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t5;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t2;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t6;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t6 = <core::List<self::perms::A%>>[list];
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t7 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final dynamic #t8 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t6 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t9 = <core::List<self::perms::A%>>[];
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
|
||||
for (core::List<self::perms::A%> perm in self::perms<self::perms::A%>(xs))
|
||||
#t9.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t10 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t10.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t10.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t10){(core::List<self::perms::A%>) → void};
|
||||
} =>#t9;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t6;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t11;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#2 = #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#4 = #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#6 = #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#7 = #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
#L4:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t11 = true;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final dynamic #t12 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t13 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final dynamic #t14 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t15 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t11 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t11;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void
|
||||
;
|
||||
static method f<A extends core::Object? = dynamic>(core::List<self::f::A%> list) → core::List<self::f::A%>
|
||||
;
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
;
|
|
@ -0,0 +1,174 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
core::print(self::f<core::int>(list));
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method f<A extends core::Object? = dynamic>(core::List<self::f::A%> list) → core::List<self::f::A%>
|
||||
return block {
|
||||
core::List<self::f::A%> #t1;
|
||||
final synthesized core::List<self::f::A%> #0#0 = list;
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = core::_GrowableList::•<self::f::A%>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(true) {
|
||||
#t1 = core::_GrowableList::•<self::f::A%>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t2;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t2 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::subs::A% #t3 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final core::List<self::subs::A%> #t4 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t2 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t5 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
{
|
||||
synthesized core::Iterator<core::List<self::subs::A%>> :sync-for-iterator = self::subs<self::subs::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::subs::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::subs::A%> ys = :sync-for-iterator.{core::Iterator::current}{core::List<self::subs::A%>};
|
||||
#t5.{core::List::addAll}{Invariant}(core::_GrowableList::_literal2<core::List<self::subs::A%>>(core::_GrowableList::_literal1<self::subs::A%>(x).{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys)){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
}
|
||||
}
|
||||
#t5.{core::List::add}{Invariant}(core::_GrowableList::_literal1<self::subs::A%>(x)){(core::List<self::subs::A%>) → void};
|
||||
} =>#t5;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t2;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t6;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t6 = core::_GrowableList::_literal1<core::List<self::perms::A%>>(list);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::perms::A% #t7 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final core::List<self::perms::A%> #t8 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t6 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t9 = core::_GrowableList::•<core::List<self::perms::A%>>(0);
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
synthesized core::Iterator<core::List<self::perms::A%>> :sync-for-iterator = self::perms<self::perms::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::perms::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::perms::A%> perm = :sync-for-iterator.{core::Iterator::current}{core::List<self::perms::A%>};
|
||||
#t9.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t10 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t10.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t10.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t10){(core::List<self::perms::A%>) → void};
|
||||
}
|
||||
}
|
||||
} =>#t9;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t6;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t11;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
function ##0#1#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = ##0#1#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#2#initializer() → core::int
|
||||
return #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#2 = ##0#2#initializer(){() → core::int};
|
||||
function ##0#4#initializer() → core::bool
|
||||
return #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#4 = ##0#4#initializer(){() → core::bool};
|
||||
function ##0#5#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = ##0#5#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#6#initializer() → core::int
|
||||
return #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#6 = ##0#6#initializer(){() → core::int};
|
||||
function ##0#7#initializer() → core::bool
|
||||
return #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#7 = ##0#7#initializer(){() → core::bool};
|
||||
function ##0#9#initializer() → core::bool
|
||||
return #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = ##0#9#initializer(){() → core::bool};
|
||||
function ##0#11#initializer() → core::bool
|
||||
return #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = ##0#11#initializer(){() → core::bool};
|
||||
#L4:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t11 = true;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t11 = false;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final self::equals::A% #t12 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t13 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final self::equals::A% #t14 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t15 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t11 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t11;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
print(subs(list));
|
||||
}
|
||||
|
||||
List<List<A>> subs<A>(List<A> list) => switch (list) {
|
||||
[] => [],
|
||||
[var x, ...var xs] => [
|
||||
for (var ys in subs(xs)) ...[
|
||||
[x] + ys,
|
||||
ys
|
||||
],
|
||||
[x]
|
||||
],
|
||||
};
|
|
@ -0,0 +1,41 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::subs<core::int>(list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <core::List<self::subs::A%>>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t4.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t4.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
core::print(self::subs<core::int>(list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::subs::A% #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final core::List<self::subs::A%> #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
{
|
||||
synthesized core::Iterator<core::List<self::subs::A%>> :sync-for-iterator = self::subs<self::subs::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::subs::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::subs::A%> ys = :sync-for-iterator.{core::Iterator::current}{core::List<self::subs::A%>};
|
||||
#t4.{core::List::addAll}{Invariant}(core::_GrowableList::_literal2<core::List<self::subs::A%>>(core::_GrowableList::_literal1<self::subs::A%>(x).{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys)){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
}
|
||||
}
|
||||
#t4.{core::List::add}{Invariant}(core::_GrowableList::_literal1<self::subs::A%>(x)){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
void main() {}
|
||||
List<List<A>> subs<A>(List<A> list) => switch (list) { };
|
|
@ -0,0 +1,6 @@
|
|||
List<List<A>> subs<A>(List<A> list) =>
|
||||
switch (list) {}
|
||||
void main() {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
|
@ -0,0 +1,43 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::subs<core::int>(list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <core::List<self::subs::A%>>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t4.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t4.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::subs<core::int>(list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <core::List<self::subs::A%>>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t4.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t4.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void
|
||||
;
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
;
|
|
@ -0,0 +1,50 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
core::print(self::subs<core::int>(list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::subs::A% #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final core::List<self::subs::A%> #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
{
|
||||
synthesized core::Iterator<core::List<self::subs::A%>> :sync-for-iterator = self::subs<self::subs::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::subs::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::subs::A%> ys = :sync-for-iterator.{core::Iterator::current}{core::List<self::subs::A%>};
|
||||
#t4.{core::List::addAll}{Invariant}(core::_GrowableList::_literal2<core::List<self::subs::A%>>(core::_GrowableList::_literal1<self::subs::A%>(x).{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys)){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
}
|
||||
}
|
||||
#t4.{core::List::add}{Invariant}(core::_GrowableList::_literal1<self::subs::A%>(x)){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
void main() {
|
||||
List<int> list = [1, 2, 3];
|
||||
print(subs(list));
|
||||
print(perms(list));
|
||||
print(equals(list, list));
|
||||
}
|
||||
|
||||
List<List<A>> subs<A>(List<A> list) => switch (list) {
|
||||
<A>[] => [],
|
||||
<A>[var x, ...var xs] => [
|
||||
for (var ys in subs(xs)) ...[
|
||||
[x] + ys,
|
||||
ys
|
||||
],
|
||||
[x]
|
||||
],
|
||||
};
|
||||
|
||||
List<List<A>> perms<A>(List<A> list) => switch (list) {
|
||||
<A>[] || <A>[_] => [list],
|
||||
<A>[var x, ...var xs] => [
|
||||
for (var i = 0; i < list.length; i++)
|
||||
for (var perm in perms(xs)) [...perm.take(i), x, ...perm.skip(i)]
|
||||
],
|
||||
};
|
||||
|
||||
bool equals<A>(List<A> a, List<A> b) => switch ((a, b)) {
|
||||
(<A>[], <A>[]) => true,
|
||||
(<A>[_, ...], <A>[]) => false,
|
||||
(<A>[], <A>[_, ...]) => false,
|
||||
(<A>[var l, ...var ls], <A>[var r, ...var rs]) =>
|
||||
l == r && equals(ls, rs),
|
||||
};
|
|
@ -0,0 +1,119 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <core::List<self::subs::A%>>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t4.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t4.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = <core::List<self::perms::A%>>[list];
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final dynamic #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = <core::List<self::perms::A%>>[];
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
|
||||
for (core::List<self::perms::A%> perm in self::perms<self::perms::A%>(xs))
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#2 = #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#4 = #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#6 = #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#7 = #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final dynamic #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final dynamic #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::subs::A% #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final core::List<self::subs::A%> #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
{
|
||||
synthesized core::Iterator<core::List<self::subs::A%>> :sync-for-iterator = self::subs<self::subs::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::subs::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::subs::A%> ys = :sync-for-iterator.{core::Iterator::current}{core::List<self::subs::A%>};
|
||||
#t4.{core::List::addAll}{Invariant}(core::_GrowableList::_literal2<core::List<self::subs::A%>>(core::_GrowableList::_literal1<self::subs::A%>(x).{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys)){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
}
|
||||
}
|
||||
#t4.{core::List::add}{Invariant}(core::_GrowableList::_literal1<self::subs::A%>(x)){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = core::_GrowableList::_literal1<core::List<self::perms::A%>>(list);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::perms::A% #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final core::List<self::perms::A%> #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = core::_GrowableList::•<core::List<self::perms::A%>>(0);
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
synthesized core::Iterator<core::List<self::perms::A%>> :sync-for-iterator = self::perms<self::perms::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::perms::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::perms::A%> perm = :sync-for-iterator.{core::Iterator::current}{core::List<self::perms::A%>};
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
}
|
||||
}
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
function ##0#1#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = ##0#1#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#2#initializer() → core::int
|
||||
return #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#2 = ##0#2#initializer(){() → core::int};
|
||||
function ##0#4#initializer() → core::bool
|
||||
return #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#4 = ##0#4#initializer(){() → core::bool};
|
||||
function ##0#5#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = ##0#5#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#6#initializer() → core::int
|
||||
return #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#6 = ##0#6#initializer(){() → core::int};
|
||||
function ##0#7#initializer() → core::bool
|
||||
return #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#7 = ##0#7#initializer(){() → core::bool};
|
||||
function ##0#9#initializer() → core::bool
|
||||
return #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = ##0#9#initializer(){() → core::bool};
|
||||
function ##0#11#initializer() → core::bool
|
||||
return #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = ##0#11#initializer(){() → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final self::equals::A% #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final self::equals::A% #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
void main() {}
|
||||
List<List<A>> subs<A>(List<A> list) => switch (list) { };
|
||||
List<List<A>> perms<A>(List<A> list) => switch (list) { };
|
||||
bool equals<A>(List<A> a, List<A> b) => switch ((a, b)) { };
|
|
@ -0,0 +1,16 @@
|
|||
List<List<A>> subs<A>(List<A> list) =>
|
||||
switch (list) {}
|
||||
void main() {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
||||
List<List<A>> perms<A>(List<A> list) =>
|
||||
switch (list) {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
||||
bool equals<A>(List<A> a, List<A> b) =>
|
||||
switch ((a, b)) {}
|
||||
---- unknown chunk starts ----
|
||||
;
|
||||
---- unknown chunk ends ----
|
|
@ -0,0 +1,123 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <core::List<self::subs::A%>>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t4.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t4.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = <core::List<self::perms::A%>>[list];
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final dynamic #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = <core::List<self::perms::A%>>[];
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
|
||||
for (core::List<self::perms::A%> perm in self::perms<self::perms::A%>(xs))
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#2 = #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#4 = #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#6 = #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#7 = #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final dynamic #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final dynamic #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = <core::int>[1, 2, 3];
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = <core::List<self::subs::A%>>[];
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final dynamic #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = <core::List<self::subs::A%>>[];
|
||||
for (core::List<self::subs::A%> ys in self::subs<self::subs::A%>(xs))
|
||||
#t4.{core::List::addAll}{Invariant}(<core::List<self::subs::A%>>[<self::subs::A%>[x].{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys]){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
#t4.{core::List::add}{Invariant}(<self::subs::A%>[x]){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
late final synthesized core::int #0#1 = #0#0.{core::List::length}{core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = <core::List<self::perms::A%>>[list];
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final dynamic #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final dynamic #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = <core::List<self::perms::A%>>[];
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
|
||||
for (core::List<self::perms::A%> perm in self::perms<self::perms::A%>(xs))
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#2 = #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#4 = #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::int #0#6 = #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::bool #0#7 = #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final dynamic #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final dynamic #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final dynamic #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void
|
||||
;
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
;
|
|
@ -0,0 +1,152 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:_internal" as _in;
|
||||
|
||||
static method main() → void {
|
||||
core::List<core::int> list = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
core::print(self::subs<core::int>(list));
|
||||
core::print(self::perms<core::int>(list));
|
||||
core::print(self::equals<core::int>(list, list));
|
||||
}
|
||||
static method subs<A extends core::Object? = dynamic>(core::List<self::subs::A%> list) → core::List<core::List<self::subs::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::subs::A%>> #t1;
|
||||
final synthesized core::List<self::subs::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L1:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool}) {
|
||||
#t1 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::subs::A% x;
|
||||
core::List<self::subs::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::subs::A% #t2 = x = #0#0.{core::List::[]}(0){(core::int) → self::subs::A%} in true) && (let final core::List<self::subs::A%> #t3 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::subs::A%>} in true)) {
|
||||
#t1 = block {
|
||||
final core::List<core::List<self::subs::A%>> #t4 = core::_GrowableList::•<core::List<self::subs::A%>>(0);
|
||||
{
|
||||
synthesized core::Iterator<core::List<self::subs::A%>> :sync-for-iterator = self::subs<self::subs::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::subs::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::subs::A%> ys = :sync-for-iterator.{core::Iterator::current}{core::List<self::subs::A%>};
|
||||
#t4.{core::List::addAll}{Invariant}(core::_GrowableList::_literal2<core::List<self::subs::A%>>(core::_GrowableList::_literal1<self::subs::A%>(x).{core::List::+}(ys){(core::List<self::subs::A%>) → core::List<self::subs::A%>}, ys)){(core::Iterable<core::List<self::subs::A%>>) → void};
|
||||
}
|
||||
}
|
||||
#t4.{core::List::add}{Invariant}(core::_GrowableList::_literal1<self::subs::A%>(x)){(core::List<self::subs::A%>) → void};
|
||||
} =>#t4;
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t1;
|
||||
static method perms<A extends core::Object? = dynamic>(core::List<self::perms::A%> list) → core::List<core::List<self::perms::A%>>
|
||||
return block {
|
||||
core::List<core::List<self::perms::A%>> #t5;
|
||||
final synthesized core::List<self::perms::A%> #0#0 = list;
|
||||
function ##0#1#initializer() → core::int
|
||||
return #0#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#1 = ##0#1#initializer(){() → core::int};
|
||||
#L2:
|
||||
{
|
||||
{
|
||||
if(#0#1.{core::num::<=}(#C1){(core::num) → core::bool} || #0#1 =={core::num::==}{(core::Object) → core::bool} #C2) {
|
||||
#t5 = core::_GrowableList::_literal1<core::List<self::perms::A%>>(list);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::perms::A% x;
|
||||
core::List<self::perms::A%> xs;
|
||||
if(#0#1.{core::num::>=}(#C2){(core::num) → core::bool} && (let final self::perms::A% #t6 = x = #0#0.{core::List::[]}(0){(core::int) → self::perms::A%} in true) && (let final core::List<self::perms::A%> #t7 = xs = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::perms::A%>} in true)) {
|
||||
#t5 = block {
|
||||
final core::List<core::List<self::perms::A%>> #t8 = core::_GrowableList::•<core::List<self::perms::A%>>(0);
|
||||
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
synthesized core::Iterator<core::List<self::perms::A%>> :sync-for-iterator = self::perms<self::perms::A%>(xs).{core::Iterable::iterator}{core::Iterator<core::List<self::perms::A%>>};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
|
||||
core::List<self::perms::A%> perm = :sync-for-iterator.{core::Iterator::current}{core::List<self::perms::A%>};
|
||||
#t8.{core::List::add}{Invariant}( block {
|
||||
final core::List<self::perms::A%> #t9 = core::List::of<self::perms::A%>(perm.{core::Iterable::take}(i){(core::int) → core::Iterable<self::perms::A%>});
|
||||
#t9.{core::List::add}{Invariant}(x){(self::perms::A%) → void};
|
||||
#t9.{core::List::addAll}{Invariant}(perm.{core::Iterable::skip}(i){(core::int) → core::Iterable<self::perms::A%>}){(core::Iterable<self::perms::A%>) → void};
|
||||
} =>#t9){(core::List<self::perms::A%>) → void};
|
||||
}
|
||||
}
|
||||
} =>#t8;
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t5;
|
||||
static method equals<A extends core::Object? = dynamic>(core::List<self::equals::A%> a, core::List<self::equals::A%> b) → core::bool
|
||||
return block {
|
||||
core::bool #t10;
|
||||
final synthesized(core::List<self::equals::A%>, core::List<self::equals::A%>) #0#0 = (a, b);
|
||||
function ##0#1#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$1{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#1 = ##0#1#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#2#initializer() → core::int
|
||||
return #0#1.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#2 = ##0#2#initializer(){() → core::int};
|
||||
function ##0#4#initializer() → core::bool
|
||||
return #0#2.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#4 = ##0#4#initializer(){() → core::bool};
|
||||
function ##0#5#initializer() → core::List<self::equals::A%>
|
||||
return #0#0.$2{core::List<self::equals::A%>};
|
||||
late final synthesized core::List<self::equals::A%> #0#5 = ##0#5#initializer(){() → core::List<self::equals::A%>};
|
||||
function ##0#6#initializer() → core::int
|
||||
return #0#5.{core::List::length}{core::int};
|
||||
late final synthesized core::int #0#6 = ##0#6#initializer(){() → core::int};
|
||||
function ##0#7#initializer() → core::bool
|
||||
return #0#6.{core::num::<=}(#C1){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#7 = ##0#7#initializer(){() → core::bool};
|
||||
function ##0#9#initializer() → core::bool
|
||||
return #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#9 = ##0#9#initializer(){() → core::bool};
|
||||
function ##0#11#initializer() → core::bool
|
||||
return #0#6.{core::num::>=}(#C2){(core::num) → core::bool};
|
||||
late final synthesized core::bool #0#11 = ##0#11#initializer(){() → core::bool};
|
||||
#L3:
|
||||
{
|
||||
{
|
||||
if(#0#4 && #0#7) {
|
||||
#t10 = true;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#9 && #0#7) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(#0#4 && #0#11) {
|
||||
#t10 = false;
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
{
|
||||
self::equals::A% l;
|
||||
core::List<self::equals::A%> ls;
|
||||
self::equals::A% r;
|
||||
core::List<self::equals::A%> rs;
|
||||
if(#0#9 && (let final self::equals::A% #t11 = l = #0#1.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t12 = ls = #0#1.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true) && (#0#11 && (let final self::equals::A% #t13 = r = #0#5.{core::List::[]}(0){(core::int) → self::equals::A%} in true) && (let final core::List<self::equals::A%> #t14 = rs = #0#5.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<self::equals::A%>} in true))) {
|
||||
#t10 = l =={core::Object::==}{(core::Object) → core::bool} r && self::equals<self::equals::A%>(ls, rs);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
|
||||
}
|
||||
} =>#t10;
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = 1
|
||||
}
|
Loading…
Reference in a new issue