94c165d189
Closes #51045 Closes #51565 Closes #51566 Closes #51688 Closes #51800 Change-Id: I4a679ef9cf496a22f4fdc2047a2dc4753e796e2b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290320 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
351 lines
18 KiB
Plaintext
351 lines
18 KiB
Plaintext
library /*isNonNullableByDefault*/;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:19:12: 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_binary.dart:20:12: 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_binary.dart:21:12: 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_binary.dart:22:12: 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_binary.dart:23:12: 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_binary.dart:24:12: 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_binary.dart:25:12: 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_binary.dart:26:12: 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_binary.dart:27:12: 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_binary.dart:28:12: 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_binary.dart:29:12: 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_binary.dart:30:12: 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_binary.dart:31:12: 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_binary.dart:32:12: 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_binary.dart:33:12: 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_binary.dart:34:12: 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_binary.dart:35:12: 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_binary.dart:36:12: 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_binary.dart:37:12: Error: The binary operator + is not supported as a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )'.
|
|
// case 1 + 2 + 3: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:40:16: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const 1 as int: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:41:16: 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_binary.dart:42:16: 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_binary.dart:43:16: 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_binary.dart:44:16: 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_binary.dart:45:16: 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_binary.dart:46:16: 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_binary.dart:47:16: 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_binary.dart:48:16: 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_binary.dart:49:16: 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_binary.dart:50:16: 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_binary.dart:51:16: 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_binary.dart:52:16: 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_binary.dart:53:16: 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_binary.dart:54:16: 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_binary.dart:55:16: 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_binary.dart:56:16: 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_binary.dart:57:16: 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_binary.dart:58:16: 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_binary.dart:59:16: 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 + 3: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:60:23: Error: The expression can't be prefixed by 'const' to form a constant pattern.
|
|
// Try wrapping the expression in 'const ( ... )' instead.
|
|
// case const Object() == 2: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:81:12: Error: Expected ':' before this.
|
|
// case 1 ?? 2: // Error
|
|
// ^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:81:12: Error: Expected an identifier, but got '??'.
|
|
// Try inserting an identifier before '??'.
|
|
// case 1 ?? 2: // Error
|
|
// ^^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:81:15: Error: Expected ';' after this.
|
|
// case 1 ?? 2: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:81:16: Error: Expected an identifier, but got ':'.
|
|
// Try inserting an identifier before ':'.
|
|
// case 1 ?? 2: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:81:16: Error: Unexpected token ':'.
|
|
// case 1 ?? 2: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:82:10: Error: Not a constant expression.
|
|
// case o++: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:83:10: Error: Not a constant expression.
|
|
// case o--: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:84:12: Error: Not a constant expression.
|
|
// case ++o: // Error
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/patterns/const_patterns_binary.dart:85:12: Error: Not a constant expression.
|
|
// case --o: // Error
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
import "org-dartlang-testcase:///const_patterns_binary.dart" as prefix;
|
|
|
|
class Class extends core::Object {
|
|
static const field core::int value = #C1;
|
|
synthetic constructor •() → self::Class
|
|
: super core::Object::•()
|
|
;
|
|
}
|
|
static const field core::int value = #C2;
|
|
static method method<T extends core::Object? = dynamic>(dynamic o) → dynamic {
|
|
#L1:
|
|
{
|
|
final synthesized dynamic #0#0 = o;
|
|
function ##0#2#initializer() → core::bool
|
|
return #C2 =={core::num::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#2 = ##0#2#initializer(){() → core::bool};
|
|
function ##0#4#initializer() → core::bool
|
|
return #C1 =={core::num::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#4 = ##0#4#initializer(){() → core::bool};
|
|
function ##0#6#initializer() → core::bool
|
|
return #C2 =={core::num::==}{(core::Object) → core::bool} #0#0 as{ForNonNullableByDefault} self::method::T%;
|
|
late final synthesized core::bool #0#6 = ##0#6#initializer(){() → core::bool};
|
|
function ##0#10#initializer() → core::bool
|
|
return #C3 =={core::num::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#10 = ##0#10#initializer(){() → core::bool};
|
|
function ##0#12#initializer() → core::bool
|
|
return #C4 =={core::num::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#12 = ##0#12#initializer(){() → core::bool};
|
|
function ##0#14#initializer() → core::bool
|
|
return #C5 =={core::num::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#14 = ##0#14#initializer(){() → core::bool};
|
|
function ##0#16#initializer() → core::bool
|
|
return #C6 =={core::num::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#16 = ##0#16#initializer(){() → core::bool};
|
|
function ##0#18#initializer() → core::bool
|
|
return #C7 =={core::Object::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#18 = ##0#18#initializer(){() → core::bool};
|
|
function ##0#20#initializer() → core::bool
|
|
return #C8 =={core::Object::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#20 = ##0#20#initializer(){() → core::bool};
|
|
function ##0#22#initializer() → core::bool
|
|
return #C9 =={core::num::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#22 = ##0#22#initializer(){() → core::bool};
|
|
function ##0#24#initializer() → core::bool
|
|
return #C10 =={core::num::==}{(core::Object) → core::bool} #0#0;
|
|
late final synthesized core::bool #0#24 = ##0#24#initializer(){() → core::bool};
|
|
final const synthesized invalid-type #0#31 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:82:10: Error: Not a constant expression.
|
|
case o++: // Error
|
|
^";
|
|
final const synthesized invalid-type #0#33 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:83:10: Error: Not a constant expression.
|
|
case o--: // Error
|
|
^";
|
|
final const synthesized invalid-type #0#35 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:84:12: Error: Not a constant expression.
|
|
case ++o: // Error
|
|
^";
|
|
final const synthesized invalid-type #0#37 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:85:12: Error: Not a constant expression.
|
|
case --o: // Error
|
|
^";
|
|
{
|
|
if(#0#2 || #0#4 || #0#2 && #0#4 || (let final self::method::T% #t1 = #0#0 as{ForNonNullableByDefault} self::method::T% in #0#6) || #C11 =={core::Object::==}{(core::Object) → core::bool} #0#0 || #0#10 || #0#12 || #0#4 || #0#14 || #0#16 || #0#2 || #0#18 || #0#20 || #0#10 || #0#16 || #0#10 || #0#20 || #0#20 || #0#18 || #0#18 || #0#22 || #0#16 || #0#16 || #0#24 || (let final self::method::T% #t2 = #0#0 as{ForNonNullableByDefault} self::method::T% in #0#6) || (let final self::method::T% #t3 = #0#0 as{ForNonNullableByDefault} self::method::T% in #C1 =={core::num::==}{(core::Object) → core::bool} #0#0 as{ForNonNullableByDefault} self::method::T%) || (let final core::int #t4 = #0#0 as{ForNonNullableByDefault} core::int in #C2 =={core::num::==}{(core::Object) → core::bool} #0#0 as{ForNonNullableByDefault} core::int) || #0#10 || #0#12 || #0#4 || #0#14 || #0#16 || #0#2 || #0#18 || #0#20 || #0#10 || #0#16 || #0#10 || #0#20 || #0#20 || #0#18 || #0#18 || #0#22 || #0#16 || #0#16 || #0#24 || #0#18 || (let final core::List<self::method::T%> #t5 = #0#0 as{ForNonNullableByDefault} core::List<self::method::T%> in #C12 =={core::List::==}{(core::Object) → core::bool} #0#0 as{ForNonNullableByDefault} core::List<self::method::T%>) || #0#10 || #0#12 || #0#4 || #0#14 || #0#16 || #0#2 || #0#18 || #0#20 || #0#10 || #0#16 || #0#10 || #0#20 || #0#20 || #0#18 || #0#18 || #0#22 || #0#16 || #0#16 || #0#24 || #0#2) {
|
|
{
|
|
let final invalid-type #t6 = invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:81:12: Error: This couldn't be parsed.
|
|
case 1 ?? 2: // Error
|
|
^" in #t6 == null ?{invalid-type} 2 : #t6;
|
|
invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:81:16: Error: This couldn't be parsed.
|
|
case 1 ?? 2: // Error
|
|
^";
|
|
break #L1;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
if(invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:82:10: Error: Not a constant expression.
|
|
case o++: // Error
|
|
^" =={core::Object::==}{(core::Object) → core::bool} #0#0 || invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:83:10: Error: Not a constant expression.
|
|
case o--: // Error
|
|
^" =={core::Object::==}{(core::Object) → core::bool} #0#0 || invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:84:12: Error: Not a constant expression.
|
|
case ++o: // Error
|
|
^" =={core::Object::==}{(core::Object) → core::bool} #0#0 || invalid-expression "pkg/front_end/testcases/patterns/const_patterns_binary.dart:85:12: Error: Not a constant expression.
|
|
case --o: // Error
|
|
^" =={core::Object::==}{(core::Object) → core::bool} #0#0) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
constants {
|
|
#C1 = 2
|
|
#C2 = 1
|
|
#C3 = 3
|
|
#C4 = -1
|
|
#C5 = 0.5
|
|
#C6 = 0
|
|
#C7 = false
|
|
#C8 = true
|
|
#C9 = 4
|
|
#C10 = 6
|
|
#C11 = core::Object {}
|
|
#C12 = <core::int*>[]
|
|
}
|
|
|
|
|
|
Constructor coverage from constants:
|
|
org-dartlang-testcase:///const_patterns_binary.dart:
|
|
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
|