36641368bb
This changes ast-to-text to mark legacy libraries instead of non-nullable-by-default libraries. TEST=existing Change-Id: Ib01147e4ef48c2c5b2ffc6b23547998344dfdf2e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307121 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>
110 lines
2.5 KiB
Plaintext
110 lines
2.5 KiB
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
class Const<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
|
|
final field self::Const::T% value;
|
|
const constructor •(self::Const::T% value) → self::Const<self::Const::T%>
|
|
: self::Const::value = value, super core::Object::•()
|
|
;
|
|
}
|
|
static method main() → dynamic {
|
|
self::test(42, false);
|
|
self::test(<core::int>[42], false);
|
|
self::test(<core::num>[42], false);
|
|
self::test(<core::int, core::String>{42: "foo"}, false);
|
|
self::test(<core::num, core::Object>{42: "foo"}, false);
|
|
self::test(new self::Const::•<core::int>(42), false);
|
|
self::test(new self::Const::•<core::num>(42), false);
|
|
self::test(#C2, true);
|
|
self::test(#C3, true);
|
|
self::test(#C4, true);
|
|
self::test(#C5, true);
|
|
self::test(#C7, true);
|
|
self::test(#C8, true);
|
|
self::test(#C9, true);
|
|
self::test(#C10, true);
|
|
}
|
|
static method test(dynamic value, core::bool expected) → void {
|
|
core::bool matched;
|
|
#L1:
|
|
switch(value) /* dynamic */ {
|
|
#L2:
|
|
case #C2:
|
|
{
|
|
matched = true;
|
|
break #L1;
|
|
}
|
|
#L3:
|
|
case #C3:
|
|
{
|
|
matched = true;
|
|
break #L1;
|
|
}
|
|
#L4:
|
|
case #C4:
|
|
{
|
|
matched = true;
|
|
break #L1;
|
|
}
|
|
#L5:
|
|
case #C5:
|
|
{
|
|
matched = true;
|
|
break #L1;
|
|
}
|
|
#L6:
|
|
case #C7:
|
|
{
|
|
matched = true;
|
|
break #L1;
|
|
}
|
|
#L7:
|
|
case #C8:
|
|
{
|
|
matched = true;
|
|
break #L1;
|
|
}
|
|
#L8:
|
|
case #C9:
|
|
{
|
|
matched = true;
|
|
break #L1;
|
|
}
|
|
#L9:
|
|
case #C10:
|
|
{
|
|
matched = true;
|
|
break #L1;
|
|
}
|
|
#L10:
|
|
default:
|
|
{
|
|
matched = false;
|
|
break #L1;
|
|
}
|
|
}
|
|
if(!(matched =={core::Object::==}{(core::Object) → core::bool} expected)) {
|
|
core::print("FAIL: ${value} ${matched ?{core::String} "matched" : "didn't match"}");
|
|
}
|
|
}
|
|
|
|
constants {
|
|
#C1 = 42
|
|
#C2 = <core::int*>[#C1]
|
|
#C3 = <core::num*>[#C1]
|
|
#C4 = <core::int*>{#C1}
|
|
#C5 = <core::num*>{#C1}
|
|
#C6 = "foo"
|
|
#C7 = <core::int*, core::String*>{#C1:#C6}
|
|
#C8 = <core::num*, core::Object*>{#C1:#C6}
|
|
#C9 = self::Const<core::int*> {value:#C1}
|
|
#C10 = self::Const<core::num*> {value:#C1}
|
|
}
|
|
|
|
|
|
Constructor coverage from constants:
|
|
org-dartlang-testcase:///constant_pattern_in_switch.dart:
|
|
- Const. (from org-dartlang-testcase:///constant_pattern_in_switch.dart:8:9)
|
|
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart)
|