mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:11:19 +00:00
[cfe] Add test for issue 52941
Change-Id: I5f40ab64923e6b1612e41fd96e3b92d52e2f79b1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314720 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
1861faef4a
commit
2172993731
47
pkg/front_end/testcases/patterns/issue52941.dart
Normal file
47
pkg/front_end/testcases/patterns/issue52941.dart
Normal file
|
@ -0,0 +1,47 @@
|
|||
// 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() {
|
||||
switch ([1, 2, 3]) {
|
||||
case [6, ...var rest]:
|
||||
expect(null, rest);
|
||||
case [...var all]:
|
||||
expect([1, 2, 3], all);
|
||||
}
|
||||
switch ([1, 2, 3]) {
|
||||
case [...var all]:
|
||||
expect([1, 2, 3], all);
|
||||
case [6, ...var rest]:
|
||||
expect(null, rest);
|
||||
}
|
||||
switch ([1, 2, 3]) {
|
||||
case [6, 7, ...var rest]:
|
||||
expect(null, rest);
|
||||
case [_, ...var all]:
|
||||
expect([2, 3], all);
|
||||
}
|
||||
switch ([1, 2, 3]) {
|
||||
case [_, ...var all]:
|
||||
expect([2, 3], all);
|
||||
case [6, 7, ...var rest]:
|
||||
expect(null, rest);
|
||||
}
|
||||
}
|
||||
|
||||
expect(List? expected, List actual) {
|
||||
if (expected == null) {
|
||||
if (actual != null) {
|
||||
throw 'Unexpected $actual';
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (expected.length != actual.length) {
|
||||
throw 'Expected $expected, actual $actual';
|
||||
}
|
||||
for (int i = 0; i < expected.length; i++) {
|
||||
if (expected[i] != actual[i]) {
|
||||
throw 'Expected $expected, actual $actual';
|
||||
}
|
||||
}
|
||||
}
|
115
pkg/front_end/testcases/patterns/issue52941.dart.strong.expect
Normal file
115
pkg/front_end/testcases/patterns/issue52941.dart.strong.expect
Normal file
|
@ -0,0 +1,115 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
#L1:
|
||||
{
|
||||
final synthesized core::List<core::int> #0#0 = <core::int>[1, 2, 3];
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #0#0.{core::List::[]}(0){(core::int) → core::int} && (let final dynamic #t1 = rest = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final dynamic #t2 = all = #0#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(<dynamic>[1, 2, 3], all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L2:
|
||||
{
|
||||
final synthesized core::List<core::int> #1#0 = <core::int>[1, 2, 3];
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final dynamic #t3 = all = #1#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(<dynamic>[1, 2, 3], all);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#1#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #1#0.{core::List::[]}(0){(core::int) → core::int} && (let final dynamic #t4 = rest = #1#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L3:
|
||||
{
|
||||
final synthesized core::List<core::int> #2#0 = <core::int>[1, 2, 3];
|
||||
late final synthesized core::int #2#1 = #2#0.{core::List::length}{core::int};
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(1){(core::int) → core::int} && (let final dynamic #t5 = rest = #2#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#2#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final dynamic #t6 = all = #2#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(<dynamic>[2, 3], all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L4:
|
||||
{
|
||||
final synthesized core::List<core::int> #3#0 = <core::int>[1, 2, 3];
|
||||
late final synthesized core::int #3#1 = #3#0.{core::List::length}{core::int};
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#3#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final dynamic #t7 = all = #3#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(<dynamic>[2, 3], all);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#3#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(1){(core::int) → core::int} && (let final dynamic #t8 = rest = #3#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static method expect(core::List<dynamic>? expected, core::List<dynamic> actual) → dynamic {
|
||||
if(expected == null) {
|
||||
if(!(actual == null)) {
|
||||
throw "Unexpected ${actual}";
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!(expected{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} actual.{core::List::length}{core::int})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
for (core::int i = 0; i.{core::num::<}(expected{core::List<dynamic>}.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
if(!(expected{core::List<dynamic>}.{core::List::[]}(i){(core::int) → dynamic} =={core::Object::==}{(core::Object) → core::bool} actual.{core::List::[]}(i){(core::int) → dynamic})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 1
|
||||
#C2 = 6
|
||||
#C3 = 2
|
||||
#C4 = 7
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
#L1:
|
||||
{
|
||||
final synthesized core::List<core::int> #0#0 = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #0#0.{core::List::[]}(0){(core::int) → core::int} && (let final core::List<core::int> #t1 = rest = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final core::List<core::int> #t2 = all = #0#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(core::_GrowableList::_literal3<dynamic>(1, 2, 3), all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L2:
|
||||
{
|
||||
final synthesized core::List<core::int> #1#0 = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final core::List<core::int> #t3 = all = #1#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(core::_GrowableList::_literal3<dynamic>(1, 2, 3), all);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#1#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #1#0.{core::List::[]}(0){(core::int) → core::int} && (let final core::List<core::int> #t4 = rest = #1#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L3:
|
||||
{
|
||||
final synthesized core::List<core::int> #2#0 = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
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};
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(1){(core::int) → core::int} && (let final core::List<core::int> #t5 = rest = #2#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#2#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final core::List<core::int> #t6 = all = #2#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(core::_GrowableList::_literal2<dynamic>(2, 3), all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L4:
|
||||
{
|
||||
final synthesized core::List<core::int> #3#0 = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
function ##3#1#initializer() → core::int
|
||||
return #3#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #3#1 = ##3#1#initializer(){() → core::int};
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#3#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final core::List<core::int> #t7 = all = #3#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(core::_GrowableList::_literal2<dynamic>(2, 3), all);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#3#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(1){(core::int) → core::int} && (let final core::List<core::int> #t8 = rest = #3#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static method expect(core::List<dynamic>? expected, core::List<dynamic> actual) → dynamic {
|
||||
if(expected == null) {
|
||||
if(!(actual == null)) {
|
||||
throw "Unexpected ${actual}";
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!(expected{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} actual.{core::List::length}{core::int})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
for (core::int i = 0; i.{core::num::<}(expected{core::List<dynamic>}.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
if(!(expected{core::List<dynamic>}.{core::List::[]}(i){(core::int) → dynamic} =={core::Object::==}{(core::Object) → core::bool} actual.{core::List::[]}(i){(core::int) → dynamic})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 1
|
||||
#C2 = 6
|
||||
#C3 = 2
|
||||
#C4 = 7
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
void main() {}
|
||||
expect(List? expected, List actual) {}
|
|
@ -0,0 +1,2 @@
|
|||
expect(List? expected, List actual) {}
|
||||
void main() {}
|
115
pkg/front_end/testcases/patterns/issue52941.dart.weak.expect
Normal file
115
pkg/front_end/testcases/patterns/issue52941.dart.weak.expect
Normal file
|
@ -0,0 +1,115 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
#L1:
|
||||
{
|
||||
final synthesized core::List<core::int> #0#0 = <core::int>[1, 2, 3];
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #0#0.{core::List::[]}(0){(core::int) → core::int} && (let final dynamic #t1 = rest = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final dynamic #t2 = all = #0#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(<dynamic>[1, 2, 3], all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L2:
|
||||
{
|
||||
final synthesized core::List<core::int> #1#0 = <core::int>[1, 2, 3];
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final dynamic #t3 = all = #1#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(<dynamic>[1, 2, 3], all);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#1#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #1#0.{core::List::[]}(0){(core::int) → core::int} && (let final dynamic #t4 = rest = #1#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L3:
|
||||
{
|
||||
final synthesized core::List<core::int> #2#0 = <core::int>[1, 2, 3];
|
||||
late final synthesized core::int #2#1 = #2#0.{core::List::length}{core::int};
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(1){(core::int) → core::int} && (let final dynamic #t5 = rest = #2#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#2#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final dynamic #t6 = all = #2#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(<dynamic>[2, 3], all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L4:
|
||||
{
|
||||
final synthesized core::List<core::int> #3#0 = <core::int>[1, 2, 3];
|
||||
late final synthesized core::int #3#1 = #3#0.{core::List::length}{core::int};
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#3#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final dynamic #t7 = all = #3#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(<dynamic>[2, 3], all);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#3#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(1){(core::int) → core::int} && (let final dynamic #t8 = rest = #3#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static method expect(core::List<dynamic>? expected, core::List<dynamic> actual) → dynamic {
|
||||
if(expected == null) {
|
||||
if(!(actual == null)) {
|
||||
throw "Unexpected ${actual}";
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!(expected{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} actual.{core::List::length}{core::int})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
for (core::int i = 0; i.{core::num::<}(expected{core::List<dynamic>}.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
if(!(expected{core::List<dynamic>}.{core::List::[]}(i){(core::int) → dynamic} =={core::Object::==}{(core::Object) → core::bool} actual.{core::List::[]}(i){(core::int) → dynamic})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 1
|
||||
#C2 = 6
|
||||
#C3 = 2
|
||||
#C4 = 7
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
#L1:
|
||||
{
|
||||
final synthesized core::List<core::int> #0#0 = <core::int>[1, 2, 3];
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #0#0.{core::List::[]}(0){(core::int) → core::int} && (let final dynamic #t1 = rest = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final dynamic #t2 = all = #0#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(<dynamic>[1, 2, 3], all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L2:
|
||||
{
|
||||
final synthesized core::List<core::int> #1#0 = <core::int>[1, 2, 3];
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final dynamic #t3 = all = #1#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(<dynamic>[1, 2, 3], all);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#1#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #1#0.{core::List::[]}(0){(core::int) → core::int} && (let final dynamic #t4 = rest = #1#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L3:
|
||||
{
|
||||
final synthesized core::List<core::int> #2#0 = <core::int>[1, 2, 3];
|
||||
late final synthesized core::int #2#1 = #2#0.{core::List::length}{core::int};
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(1){(core::int) → core::int} && (let final dynamic #t5 = rest = #2#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#2#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final dynamic #t6 = all = #2#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(<dynamic>[2, 3], all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L4:
|
||||
{
|
||||
final synthesized core::List<core::int> #3#0 = <core::int>[1, 2, 3];
|
||||
late final synthesized core::int #3#1 = #3#0.{core::List::length}{core::int};
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#3#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final dynamic #t7 = all = #3#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(<dynamic>[2, 3], all);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#3#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(1){(core::int) → core::int} && (let final dynamic #t8 = rest = #3#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static method expect(core::List<dynamic>? expected, core::List<dynamic> actual) → dynamic {
|
||||
if(expected == null) {
|
||||
if(!(actual == null)) {
|
||||
throw "Unexpected ${actual}";
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!(expected{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} actual.{core::List::length}{core::int})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
for (core::int i = 0; i.{core::num::<}(expected{core::List<dynamic>}.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
if(!(expected{core::List<dynamic>}.{core::List::[]}(i){(core::int) → dynamic} =={core::Object::==}{(core::Object) → core::bool} actual.{core::List::[]}(i){(core::int) → dynamic})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 1
|
||||
#C2 = 6
|
||||
#C3 = 2
|
||||
#C4 = 7
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void
|
||||
;
|
||||
static method expect(core::List<dynamic>? expected, core::List<dynamic> actual) → dynamic
|
||||
;
|
|
@ -0,0 +1,119 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → void {
|
||||
#L1:
|
||||
{
|
||||
final synthesized core::List<core::int> #0#0 = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#0#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #0#0.{core::List::[]}(0){(core::int) → core::int} && (let final core::List<core::int> #t1 = rest = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L1;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final core::List<core::int> #t2 = all = #0#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(core::_GrowableList::_literal3<dynamic>(1, 2, 3), all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L2:
|
||||
{
|
||||
final synthesized core::List<core::int> #1#0 = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(let final core::List<core::int> #t3 = all = #1#0.{core::List::sublist}(0){(core::int, [core::int?]) → core::List<core::int>} in true) {
|
||||
{
|
||||
self::expect(core::_GrowableList::_literal3<dynamic>(1, 2, 3), all);
|
||||
break #L2;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#1#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #1#0.{core::List::[]}(0){(core::int) → core::int} && (let final core::List<core::int> #t4 = rest = #1#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L3:
|
||||
{
|
||||
final synthesized core::List<core::int> #2#0 = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
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};
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#2#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #2#0.{core::List::[]}(1){(core::int) → core::int} && (let final core::List<core::int> #t5 = rest = #2#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
break #L3;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#2#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final core::List<core::int> #t6 = all = #2#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(core::_GrowableList::_literal2<dynamic>(2, 3), all);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#L4:
|
||||
{
|
||||
final synthesized core::List<core::int> #3#0 = core::_GrowableList::_literal3<core::int>(1, 2, 3);
|
||||
function ##3#1#initializer() → core::int
|
||||
return #3#0.{core::List::length}{core::int};
|
||||
late final synthesized core::int #3#1 = ##3#1#initializer(){() → core::int};
|
||||
{
|
||||
hoisted core::List<core::int> all;
|
||||
if(#3#1.{core::num::>=}(#C1){(core::num) → core::bool} && (let final core::List<core::int> #t7 = all = #3#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(core::_GrowableList::_literal2<dynamic>(2, 3), all);
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
hoisted core::List<core::int> rest;
|
||||
if(#3#1.{core::num::>=}(#C3){(core::num) → core::bool} && #C2 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(0){(core::int) → core::int} && #C4 =={core::num::==}{(core::Object) → core::bool} #3#0.{core::List::[]}(1){(core::int) → core::int} && (let final core::List<core::int> #t8 = rest = #3#0.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<core::int>} in true)) {
|
||||
{
|
||||
self::expect(null, rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static method expect(core::List<dynamic>? expected, core::List<dynamic> actual) → dynamic {
|
||||
if(expected == null) {
|
||||
if(!(actual == null)) {
|
||||
throw "Unexpected ${actual}";
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!(expected{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} actual.{core::List::length}{core::int})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
for (core::int i = 0; i.{core::num::<}(expected{core::List<dynamic>}.{core::List::length}{core::int}){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int}) {
|
||||
if(!(expected{core::List<dynamic>}.{core::List::[]}(i){(core::int) → dynamic} =={core::Object::==}{(core::Object) → core::bool} actual.{core::List::[]}(i){(core::int) → dynamic})) {
|
||||
throw "Expected ${expected{core::List<dynamic>}}, actual ${actual}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 1
|
||||
#C2 = 6
|
||||
#C3 = 2
|
||||
#C4 = 7
|
||||
}
|
Loading…
Reference in a new issue