85cb56dd20
This changes the pattern matching lowering to avoid using late final variables (or lowerings thereof) and instead inline the initializer where used. This avoids generating closures that are hard for backends to reason about and optimize. Closes #52805 Closes #53804 Change-Id: Ia887446dd4d4475d05cf852c812bfe4b851de261 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338860 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
468 lines
35 KiB
Plaintext
468 lines
35 KiB
Plaintext
library;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:26:12: Error: Method invocation is not a constant expression.
|
|
// case super(): // Error
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:43:13: Error: Only negation of a numeric literal is supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case -value: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:45:13: Error: Only negation of a numeric literal is supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case -local: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:48:13: Error: Only negation of a numeric literal is supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case -prefix.value: // Error
|
|
// ^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:48:20: Error: Only negation of a numeric literal is supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case -prefix.value: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:50:14: Error: The binary operator + is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case 1 + 2: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:51:14: Error: The binary operator * is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case 1 * 2: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:52:20: Error: Expected ':' before this.
|
|
// case void fun() {}: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:52:24: Error: Expected ';' after this.
|
|
// case void fun() {}: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:52:25: Error: Expected an identifier, but got ':'.
|
|
// Try inserting an identifier before ':'.
|
|
// case void fun() {}: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:52:25: Error: Unexpected token ':'.
|
|
// case void fun() {}: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:53:12: Error: `assert` can't be used as an expression.
|
|
// case assert(false): // Error
|
|
// ^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:54:20: Error: Not a constant expression.
|
|
// case switch (o) { _ => true }: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:56:12: Error: The unary operator ! is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case !false: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:57:12: Error: The unary operator ~ is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case ~0: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:58:14: Error: Not a constant expression.
|
|
// case ++variable: // Error
|
|
// ^^^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:59:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const 0: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:60:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const 0x0: // Error
|
|
// ^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:61:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const 0.5: // Error
|
|
// ^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:62:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const true: // Error
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:63:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const null: // Error
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:64:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const -0: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:65:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const 'foo': // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:66:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const #a: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:67:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const value: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:68:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const local: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:69:25: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const prefix.value: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:70:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const -prefix.value: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:71:31: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const prefix.Class.named: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:72:18: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const 1 + 2: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:73:23: Error: A function expression can't have a name.
|
|
// case const void fun() {}: // Error
|
|
// ^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:74:18: Error: `assert` can't be used as an expression.
|
|
// case const assert(false): // Error
|
|
// ^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:75:26: Error: Not a constant expression.
|
|
// case const switch (o) { _ => true }: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:77:18: Error: The unary operator ! is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case const !false: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:78:18: Error: The unary operator ~ is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case const ~0: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:79:20: Error: Not a constant expression.
|
|
// case const ++variable: // Error
|
|
// ^^^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:92:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const Class(): // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:93:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const Class(0): // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:94:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const GenericClass(): // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:95:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const GenericClass(a: 0): // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:96:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const GenericClass<int>(): // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:97:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const GenericClass<int>(a: 0): // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:98:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const []: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:99:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const <int>[]: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:100:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const {}: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:101:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const <int, String>{}: // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:102:18: Error: New expression is not a constant expression.
|
|
// case const new Class(): // Error
|
|
// ^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:103:12: Error: New expression is not a constant expression.
|
|
// case new Class(): // Error
|
|
// ^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:104:18: Error: The empty record literal is not supported as a constant pattern.
|
|
// case const (): // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:105:18: Error: Duplicate 'const' keyword in constant expression.
|
|
// Try removing one of the 'const' keywords.
|
|
// case const const (): // Error
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:111:24: Error: This expression is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case GenericClass<int>: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:112:31: Error: This expression is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case prefix.GenericClass<int>: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:113:24: Error: This expression is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case GenericClass<int>.new: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:114:31: Error: This expression is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case prefix.GenericClass<int>.new: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:115:30: Error: This expression is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case const GenericClass<int>: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:116:37: Error: This expression is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case const prefix.GenericClass<int>: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:24:12: Error: Not a constant expression.
|
|
// case this: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:25:12: Error: Not a constant expression.
|
|
// case this(): // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:54:12: Error: Not a constant expression.
|
|
// case switch (o) { _ => true }: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:55:12: Error: Not a constant expression.
|
|
// case await 0: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:73:18: Error: Not a constant expression.
|
|
// case const void fun() {}: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:75:18: Error: Not a constant expression.
|
|
// case const switch (o) { _ => true }: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:76:18: Error: Not a constant expression.
|
|
// case const await 0: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:102:22: Error: New expression is not a constant expression.
|
|
// case const new Class(): // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns.dart:103:16: Error: New expression is not a constant expression.
|
|
// case new Class(): // Error
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
import "org-dartlang-testcase:///const_patterns.dart" as prefix;
|
|
|
|
class Class extends core::Object /*hasConstConstructor*/ {
|
|
const constructor •([dynamic a = #C1]) → self::Class
|
|
: super core::Object::•()
|
|
;
|
|
const constructor named() → self::Class
|
|
: super core::Object::•()
|
|
;
|
|
method call() → dynamic {}
|
|
method test(dynamic o) → dynamic async /* futureValueType= dynamic */ {
|
|
dynamic variable = 0;
|
|
#L1:
|
|
{
|
|
final synthesized dynamic #2#0 = o;
|
|
synthesized core::bool #2#2;
|
|
synthesized core::bool #2#2#isSet = false;
|
|
synthesized core::bool #2#4;
|
|
synthesized core::bool #2#4#isSet = false;
|
|
final const synthesized self::Class #2#5 = invalid-expression "Not a constant expression.";
|
|
final const synthesized dynamic #2#7 = invalid-expression "Not a constant expression.";
|
|
final const synthesized invalid-type #2#9 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:26:12: Error: Method invocation is not a constant expression.
|
|
case super(): // Error
|
|
^^^^";
|
|
synthesized core::bool #2#12;
|
|
synthesized core::bool #2#12#isSet = false;
|
|
synthesized core::bool #2#14;
|
|
synthesized core::bool #2#14#isSet = false;
|
|
synthesized core::bool #2#20;
|
|
synthesized core::bool #2#20#isSet = false;
|
|
synthesized core::bool #2#24;
|
|
synthesized core::bool #2#24#isSet = false;
|
|
synthesized core::bool #2#27;
|
|
synthesized core::bool #2#27#isSet = false;
|
|
synthesized core::bool #2#31;
|
|
synthesized core::bool #2#31#isSet = false;
|
|
synthesized core::bool #2#35;
|
|
synthesized core::bool #2#35#isSet = false;
|
|
synthesized core::bool #2#37;
|
|
synthesized core::bool #2#37#isSet = false;
|
|
final const synthesized invalid-type #2#40 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:53:12: Error: `assert` can't be used as an expression.
|
|
case assert(false): // Error
|
|
^^^^^^";
|
|
final const synthesized core::bool #2#42 = invalid-expression "Not a constant expression.";
|
|
final const synthesized core::int #2#44 = invalid-expression "Not a constant expression.";
|
|
synthesized core::bool #2#47;
|
|
synthesized core::bool #2#47#isSet = false;
|
|
final const synthesized invalid-type #2#48 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:58:14: Error: Not a constant expression.
|
|
case ++variable: // Error
|
|
^^^^^^^^";
|
|
final const synthesized invalid-type #2#54 = invalid-expression "Not a constant expression.";
|
|
final const synthesized invalid-type #2#56 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:74:18: Error: `assert` can't be used as an expression.
|
|
case const assert(false): // Error
|
|
^^^^^^";
|
|
final const synthesized core::bool #2#58 = invalid-expression "Not a constant expression.";
|
|
final const synthesized core::int #2#60 = invalid-expression "Not a constant expression.";
|
|
final const synthesized invalid-type #2#62 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:79:20: Error: Not a constant expression.
|
|
case const ++variable: // Error
|
|
^^^^^^^^";
|
|
synthesized core::bool #2#65;
|
|
synthesized core::bool #2#65#isSet = false;
|
|
synthesized core::bool #2#67;
|
|
synthesized core::bool #2#67#isSet = false;
|
|
synthesized core::bool #2#69;
|
|
synthesized core::bool #2#69#isSet = false;
|
|
synthesized core::bool #2#71;
|
|
synthesized core::bool #2#71#isSet = false;
|
|
synthesized core::bool #2#73;
|
|
synthesized core::bool #2#73#isSet = false;
|
|
synthesized core::bool #2#75;
|
|
synthesized core::bool #2#75#isSet = false;
|
|
synthesized core::bool #2#77;
|
|
synthesized core::bool #2#77#isSet = false;
|
|
final const synthesized self::Class #2#78 = invalid-expression "New expression is not a constant expression.";
|
|
final const synthesized self::Class #2#80 = invalid-expression "New expression is not a constant expression.";
|
|
synthesized core::bool #2#83;
|
|
synthesized core::bool #2#83#isSet = false;
|
|
synthesized core::bool #2#87;
|
|
synthesized core::bool #2#87#isSet = false;
|
|
synthesized core::bool #2#89;
|
|
synthesized core::bool #2#89#isSet = false;
|
|
{
|
|
hoisted void fun;
|
|
if((#2#2#isSet ?{core::bool} #2#2{core::bool} : let final dynamic #t1 = #2#2#isSet = true in #2#2 = #C2 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#4#isSet ?{core::bool} #2#4{core::bool} : let final dynamic #t2 = #2#4#isSet = true in #2#4 = #2#0 == null) || invalid-expression "Not a constant expression." =={core::Object::==}{(core::Object) → core::bool} #2#0 || invalid-expression "Not a constant expression." =={core::Object::==}{(core::Object) → core::bool} #2#0 || invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:26:12: Error: Method invocation is not a constant expression.
|
|
case super(): // Error
|
|
^^^^" =={core::Object::==}{(core::Object) → core::bool} #2#0 || (#2#12#isSet ?{core::bool} #2#12{core::bool} : let final dynamic #t3 = #2#12#isSet = true in #2#12 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#14#isSet ?{core::bool} #2#14{core::bool} : let final dynamic #t4 = #2#14#isSet = true in #2#14 = #C4 =={core::num::==}{(core::Object) → core::bool} #2#0) || #C5 =={core::num::==}{(core::Object) → core::bool} #2#0 || #C6 =={core::num::==}{(core::Object) → core::bool} #2#0 || (#2#20#isSet ?{core::bool} #2#20{core::bool} : let final dynamic #t5 = #2#20#isSet = true in #2#20 = #C7 =={core::String::==}{(core::Object) → core::bool} #2#0) || #C8 =={core::String::==}{(core::Object) → core::bool} #2#0 || (#2#12#isSet ?{core::bool} #2#12{core::bool} : let final dynamic #t6 = #2#12#isSet = true in #2#12 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0) || (let final dynamic #t7 = #2#0! in #2#24#isSet ?{core::bool} #2#24{core::bool} : let final dynamic #t8 = #2#24#isSet = true in #2#24 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0!) || !(#2#0 == null) && (#2#12#isSet ?{core::bool} #2#12{core::bool} : let final dynamic #t9 = #2#12#isSet = true in #2#12 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0) || (let final dynamic #t10 = #2#0! in !(#2#0! == null) && (#2#24#isSet ?{core::bool} #2#24{core::bool} : let final dynamic #t11 = #2#24#isSet = true in #2#24 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0!)) || !(#2#0 == null) && (let final dynamic #t12 = #2#0! in #2#24#isSet ?{core::bool} #2#24{core::bool} : let final dynamic #t13 = #2#24#isSet = true in #2#24 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0!) || (let final dynamic #t14 = #2#0! in #2#27#isSet ?{core::bool} #2#27{core::bool} : let final dynamic #t15 = #2#27#isSet = true in #2#27 = #C4 =={core::num::==}{(core::Object) → core::bool} #2#0!) || !(#2#0 == null) && (#2#14#isSet ?{core::bool} #2#14{core::bool} : let final dynamic #t16 = #2#14#isSet = true in #2#14 = #C4 =={core::num::==}{(core::Object) → core::bool} #2#0) || !(#2#0 == null) && (let final dynamic #t17 = #2#0! in #2#27#isSet ?{core::bool} #2#27{core::bool} : let final dynamic #t18 = #2#27#isSet = true in #2#27 = #C4 =={core::num::==}{(core::Object) → core::bool} #2#0!) || (let final dynamic #t19 = #2#0! in !(#2#0! == null) && (#2#27#isSet ?{core::bool} #2#27{core::bool} : let final dynamic #t20 = #2#27#isSet = true in #2#27 = #C4 =={core::num::==}{(core::Object) → core::bool} #2#0!)) || (let final dynamic #t21 = #2#0 as core::int in #C3 =={core::num::==}{(core::Object) → core::bool} #2#0 as core::int) || (#2#14#isSet ?{core::bool} #2#14{core::bool} : let final dynamic #t22 = #2#14#isSet = true in #2#14 = #C4 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#31#isSet ?{core::bool} #2#31{core::bool} : let final dynamic #t23 = #2#31#isSet = true in #2#31 = #C9 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#31#isSet ?{core::bool} #2#31{core::bool} : let final dynamic #t24 = #2#31#isSet = true in #2#31 = #C9 =={core::Object::==}{(core::Object) → core::bool} #2#0) || #C10 =={core::Object::==}{(core::Object) → core::bool} #2#0 || (#2#12#isSet ?{core::bool} #2#12{core::bool} : let final dynamic #t25 = #2#12#isSet = true in #2#12 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#14#isSet ?{core::bool} #2#14{core::bool} : let final dynamic #t26 = #2#14#isSet = true in #2#14 = #C4 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#35#isSet ?{core::bool} #2#35{core::bool} : let final dynamic #t27 = #2#35#isSet = true in #2#35 = #C11 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#37#isSet ?{core::bool} #2#37{core::bool} : let final dynamic #t28 = #2#37#isSet = true in #2#37 = #C12 =={core::num::==}{(core::Object) → core::bool} #2#0) || #C13 =={core::num::==}{(core::Object) → core::bool} #2#0 || #2#0{core::int} is void && (let final dynamic #t29 = fun = #2#0{core::int} in true)) {
|
|
{
|
|
() → Null {};
|
|
invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:52:25: Error: This couldn't be parsed.
|
|
case void fun() {}: // Error
|
|
^";
|
|
break #L1;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
if(invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:53:12: Error: `assert` can't be used as an expression.
|
|
case assert(false): // Error
|
|
^^^^^^" =={core::Object::==}{(core::Object) → core::bool} #2#0 || invalid-expression "Not a constant expression." =={core::Object::==}{(core::Object) → core::bool} #2#0 || invalid-expression "Not a constant expression." =={core::num::==}{(core::Object) → core::bool} #2#0 || (#2#2#isSet ?{core::bool} #2#2{core::bool} : let final dynamic #t30 = #2#2#isSet = true in #2#2 = #C2 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#47#isSet ?{core::bool} #2#47{core::bool} : let final dynamic #t31 = #2#47#isSet = true in #2#47 = #C14 =={core::num::==}{(core::Object) → core::bool} #2#0) || invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:58:14: Error: Not a constant expression.
|
|
case ++variable: // Error
|
|
^^^^^^^^" =={core::Object::==}{(core::Object) → core::bool} #2#0 || (#2#31#isSet ?{core::bool} #2#31{core::bool} : let final dynamic #t32 = #2#31#isSet = true in #2#31 = #C9 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#31#isSet ?{core::bool} #2#31{core::bool} : let final dynamic #t33 = #2#31#isSet = true in #2#31 = #C9 =={core::Object::==}{(core::Object) → core::bool} #2#0) || #C15 =={core::num::==}{(core::Object) → core::bool} #2#0 || (#2#2#isSet ?{core::bool} #2#2{core::bool} : let final dynamic #t34 = #2#2#isSet = true in #2#2 = #C2 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#4#isSet ?{core::bool} #2#4{core::bool} : let final dynamic #t35 = #2#4#isSet = true in #2#4 = #2#0 == null) || (#2#31#isSet ?{core::bool} #2#31{core::bool} : let final dynamic #t36 = #2#31#isSet = true in #2#31 = #C9 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#20#isSet ?{core::bool} #2#20{core::bool} : let final dynamic #t37 = #2#20#isSet = true in #2#20 = #C7 =={core::String::==}{(core::Object) → core::bool} #2#0) || #C16 =={core::Symbol::==}{(core::Object) → core::bool} #2#0 || (#2#12#isSet ?{core::bool} #2#12{core::bool} : let final dynamic #t38 = #2#12#isSet = true in #2#12 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#31#isSet ?{core::bool} #2#31{core::bool} : let final dynamic #t39 = #2#31#isSet = true in #2#31 = #C9 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#12#isSet ?{core::bool} #2#12{core::bool} : let final dynamic #t40 = #2#12#isSet = true in #2#12 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#14#isSet ?{core::bool} #2#14{core::bool} : let final dynamic #t41 = #2#14#isSet = true in #2#14 = #C4 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#35#isSet ?{core::bool} #2#35{core::bool} : let final dynamic #t42 = #2#35#isSet = true in #2#35 = #C11 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#37#isSet ?{core::bool} #2#37{core::bool} : let final dynamic #t43 = #2#37#isSet = true in #2#37 = #C12 =={core::num::==}{(core::Object) → core::bool} #2#0) || invalid-expression "Not a constant expression." =={core::Object::==}{(core::Object) → core::bool} #2#0 || invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:74:18: Error: `assert` can't be used as an expression.
|
|
case const assert(false): // Error
|
|
^^^^^^" =={core::Object::==}{(core::Object) → core::bool} #2#0 || invalid-expression "Not a constant expression." =={core::Object::==}{(core::Object) → core::bool} #2#0 || invalid-expression "Not a constant expression." =={core::num::==}{(core::Object) → core::bool} #2#0 || (#2#2#isSet ?{core::bool} #2#2{core::bool} : let final dynamic #t44 = #2#2#isSet = true in #2#2 = #C2 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#47#isSet ?{core::bool} #2#47{core::bool} : let final dynamic #t45 = #2#47#isSet = true in #2#47 = #C14 =={core::num::==}{(core::Object) → core::bool} #2#0) || invalid-expression "pkg/front_end/testcases/patterns/const_patterns.dart:79:20: Error: Not a constant expression.
|
|
case const ++variable: // Error
|
|
^^^^^^^^" =={core::Object::==}{(core::Object) → core::bool} #2#0 || (#2#65#isSet ?{core::bool} #2#65{core::bool} : let final dynamic #t46 = #2#65#isSet = true in #2#65 = #C17 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#65#isSet ?{core::bool} #2#65{core::bool} : let final dynamic #t47 = #2#65#isSet = true in #2#65 = #C17 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#67#isSet ?{core::bool} #2#67{core::bool} : let final dynamic #t48 = #2#67#isSet = true in #2#67 = #C18 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#67#isSet ?{core::bool} #2#67{core::bool} : let final dynamic #t49 = #2#67#isSet = true in #2#67 = #C18 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#69#isSet ?{core::bool} #2#69{core::bool} : let final dynamic #t50 = #2#69#isSet = true in #2#69 = #C19 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#69#isSet ?{core::bool} #2#69{core::bool} : let final dynamic #t51 = #2#69#isSet = true in #2#69 = #C19 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#69#isSet ?{core::bool} #2#69{core::bool} : let final dynamic #t52 = #2#69#isSet = true in #2#69 = #C19 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#69#isSet ?{core::bool} #2#69{core::bool} : let final dynamic #t53 = #2#69#isSet = true in #2#69 = #C19 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#71#isSet ?{core::bool} #2#71{core::bool} : let final dynamic #t54 = #2#71#isSet = true in #2#71 = #C20 =={core::List::==}{(core::Object) → core::bool} #2#0) || (#2#73#isSet ?{core::bool} #2#73{core::bool} : let final dynamic #t55 = #2#73#isSet = true in #2#73 = #C21 =={core::List::==}{(core::Object) → core::bool} #2#0) || (#2#75#isSet ?{core::bool} #2#75{core::bool} : let final dynamic #t56 = #2#75#isSet = true in #2#75 = #C22 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#77#isSet ?{core::bool} #2#77{core::bool} : let final dynamic #t57 = #2#77#isSet = true in #2#77 = #C23 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#65#isSet ?{core::bool} #2#65{core::bool} : let final dynamic #t58 = #2#65#isSet = true in #2#65 = #C17 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#65#isSet ?{core::bool} #2#65{core::bool} : let final dynamic #t59 = #2#65#isSet = true in #2#65 = #C17 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#67#isSet ?{core::bool} #2#67{core::bool} : let final dynamic #t60 = #2#67#isSet = true in #2#67 = #C18 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#67#isSet ?{core::bool} #2#67{core::bool} : let final dynamic #t61 = #2#67#isSet = true in #2#67 = #C18 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#69#isSet ?{core::bool} #2#69{core::bool} : let final dynamic #t62 = #2#69#isSet = true in #2#69 = #C19 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#69#isSet ?{core::bool} #2#69{core::bool} : let final dynamic #t63 = #2#69#isSet = true in #2#69 = #C19 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#71#isSet ?{core::bool} #2#71{core::bool} : let final dynamic #t64 = #2#71#isSet = true in #2#71 = #C20 =={core::List::==}{(core::Object) → core::bool} #2#0) || (#2#73#isSet ?{core::bool} #2#73{core::bool} : let final dynamic #t65 = #2#73#isSet = true in #2#73 = #C21 =={core::List::==}{(core::Object) → core::bool} #2#0) || (#2#75#isSet ?{core::bool} #2#75{core::bool} : let final dynamic #t66 = #2#75#isSet = true in #2#75 = #C22 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#77#isSet ?{core::bool} #2#77{core::bool} : let final dynamic #t67 = #2#77#isSet = true in #2#77 = #C23 =={core::Object::==}{(core::Object) → core::bool} #2#0) || invalid-expression "New expression is not a constant expression." =={core::Object::==}{(core::Object) → core::bool} #2#0 || invalid-expression "New expression is not a constant expression." =={core::Object::==}{(core::Object) → core::bool} #2#0 || (#2#83#isSet ?{core::bool} #2#83{core::bool} : let final dynamic #t68 = #2#83#isSet = true in #2#83 = #C24 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#83#isSet ?{core::bool} #2#83{core::bool} : let final dynamic #t69 = #2#83#isSet = true in #2#83 = #C24 =={core::Object::==}{(core::Object) → core::bool} #2#0) || #C25 =={core::num::==}{(core::Object) → core::bool} #2#0 || (#2#47#isSet ?{core::bool} #2#47{core::bool} : let final dynamic #t70 = #2#47#isSet = true in #2#47 = #C14 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#12#isSet ?{core::bool} #2#12{core::bool} : let final dynamic #t71 = #2#12#isSet = true in #2#12 = #C3 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#14#isSet ?{core::bool} #2#14{core::bool} : let final dynamic #t72 = #2#14#isSet = true in #2#14 = #C4 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#37#isSet ?{core::bool} #2#37{core::bool} : let final dynamic #t73 = #2#37#isSet = true in #2#37 = #C12 =={core::num::==}{(core::Object) → core::bool} #2#0) || (#2#87#isSet ?{core::bool} #2#87{core::bool} : let final dynamic #t74 = #2#87#isSet = true in #2#87 = #C26 =={core::Type::==}{(core::Object) → core::bool} #2#0) || (#2#87#isSet ?{core::bool} #2#87{core::bool} : let final dynamic #t75 = #2#87#isSet = true in #2#87 = #C26 =={core::Type::==}{(core::Object) → core::bool} #2#0) || (#2#89#isSet ?{core::bool} #2#89{core::bool} : let final dynamic #t76 = #2#89#isSet = true in #2#89 = #C28 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#89#isSet ?{core::bool} #2#89{core::bool} : let final dynamic #t77 = #2#89#isSet = true in #2#89 = #C28 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#87#isSet ?{core::bool} #2#87{core::bool} : let final dynamic #t78 = #2#87#isSet = true in #2#87 = #C26 =={core::Type::==}{(core::Object) → core::bool} #2#0) || (#2#87#isSet ?{core::bool} #2#87{core::bool} : let final dynamic #t79 = #2#87#isSet = true in #2#87 = #C26 =={core::Type::==}{(core::Object) → core::bool} #2#0) || (#2#87#isSet ?{core::bool} #2#87{core::bool} : let final dynamic #t80 = #2#87#isSet = true in #2#87 = #C26 =={core::Type::==}{(core::Object) → core::bool} #2#0) || (#2#87#isSet ?{core::bool} #2#87{core::bool} : let final dynamic #t81 = #2#87#isSet = true in #2#87 = #C26 =={core::Type::==}{(core::Object) → core::bool} #2#0) || (#2#89#isSet ?{core::bool} #2#89{core::bool} : let final dynamic #t82 = #2#89#isSet = true in #2#89 = #C28 =={core::Object::==}{(core::Object) → core::bool} #2#0) || (#2#89#isSet ?{core::bool} #2#89{core::bool} : let final dynamic #t83 = #2#89#isSet = true in #2#89 = #C28 =={core::Object::==}{(core::Object) → core::bool} #2#0)) {
|
|
{
|
|
core::print(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
class GenericClass<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
|
|
const constructor •({dynamic a = #C1}) → self::GenericClass<self::GenericClass::T%>
|
|
: super core::Object::•()
|
|
;
|
|
}
|
|
static const field core::int value = #C3;
|
|
static method func() → void {}
|
|
|
|
constants {
|
|
#C1 = null
|
|
#C2 = true
|
|
#C3 = 42
|
|
#C4 = -42
|
|
#C5 = 42.5
|
|
#C6 = -42.5
|
|
#C7 = "foo"
|
|
#C8 = "foobar"
|
|
#C9 = 0
|
|
#C10 = static-tearoff self::func
|
|
#C11 = constructor-tearoff self::Class::named
|
|
#C12 = 3
|
|
#C13 = 2
|
|
#C14 = -1
|
|
#C15 = 0.5
|
|
#C16 = #a
|
|
#C17 = self::Class {}
|
|
#C18 = self::GenericClass<dynamic> {}
|
|
#C19 = self::GenericClass<core::int*> {}
|
|
#C20 = <dynamic>[]
|
|
#C21 = <core::int*>[]
|
|
#C22 = <dynamic, dynamic>{}
|
|
#C23 = <core::int*, core::String*>{}
|
|
#C24 = ()
|
|
#C25 = 1
|
|
#C26 = TypeLiteralConstant(self::GenericClass<core::int*>*)
|
|
#C27 = constructor-tearoff self::GenericClass::•
|
|
#C28 = instantiation #C27 <core::int*>
|
|
}
|
|
|
|
|
|
Constructor coverage from constants:
|
|
org-dartlang-testcase:///const_patterns.dart:
|
|
- Class. (from org-dartlang-testcase:///const_patterns.dart:12:9)
|
|
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
|
|
- GenericClass. (from org-dartlang-testcase:///const_patterns.dart:127:9)
|