| library; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/patterns/pattern_schema_affects_inferred_expression_type.dart:12:11: Error: Variable patterns in declaration context can't specify 'var' or 'final' keyword. |
| // Try removing the keyword. |
| // var <A>[var x] = foo((a) => a.foo); |
| // ^^^ |
| // |
| // pkg/front_end/testcases/patterns/pattern_schema_affects_inferred_expression_type.dart:16:8: Error: Variable patterns in declaration context can't specify 'var' or 'final' keyword. |
| // Try removing the keyword. |
| // var [var x, ...y] = foo((e) => e); |
| // ^^^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| class A extends core::Object { |
| synthetic constructor •() → self::A |
| : super core::Object::•() |
| ; |
| get foo() → core::int |
| return 0; |
| } |
| static method foo<T extends core::Object? = dynamic>((self::foo::T%) → void f) → core::List<self::foo::T%> |
| return throw 0; |
| static method test1() → dynamic { |
| hoisted has-declared-initializer self::A x; |
| { |
| final synthesized core::List<self::A> #0#0 = self::foo<self::A>((self::A a) → void => a.{self::A::foo}{core::int}); |
| if(!(#0#0.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C1 && (let final self::A #t1 = x = #0#0.{core::List::[]}(0){(core::int) → self::A} in true))) |
| throw{for-error-handling} new core::StateError::•("Pattern matching error"); |
| } |
| } |
| static method test2() → dynamic { |
| hoisted has-declared-initializer core::Object? x; |
| hoisted has-declared-initializer core::List<core::Object?> y; |
| { |
| final synthesized core::List<core::Object?> #0#0 = self::foo<core::Object?>((core::Object? e) → void => e); |
| if(!(#0#0.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && (let final core::Object? #t2 = x = #0#0.{core::List::[]}(0){(core::int) → core::Object?} in true) && (let final core::List<core::Object?> #t3 = y = #0#0.{core::List::sublist}(1){(core::int, [core::int?]) → core::List<core::Object?>} in true))) |
| throw{for-error-handling} new core::StateError::•("Pattern matching error"); |
| } |
| } |
| |
| constants { |
| #C1 = 1 |
| } |