blob: c787b65e08560134a11f13a3d99a1cf0461c7e6a [file] [log] [blame]
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/constants.dart:45:7: Error: Property 'length' cannot be accessed on 'String?' because it is potentially null.
// Try accessing using ?. instead.
// s.length; // This will be an invalid expression in strong mode.
// ^^^^^^
//
import self as self;
import "dart:core" as core;
import "constants_lib.dart" as con;
import "org-dartlang-testcase:///constants_lib.dart" as lib;
typedef F1<invariant T extends core::Object? = dynamic> = (T%) T%;
typedef F2 = <T extends core::Object? = dynamic>(T%) T%;
static const field core::Type objectTypeLiteral = #C1;
static const field (core::int) core::int partialInstantiation = #C3;
static const field con::Class<core::int> instance = #C5;
static const field core::Type functionTypeLiteral = #C6;
static const field core::Type genericFunctionTypeLiteral = #C7;
static const field core::List<core::int> listLiteral = #C8;
static const field core::Set<core::int> setLiteral = #C12;
static const field core::Map<core::int, core::String> mapLiteral = #C15;
static const field core::List<core::int> listConcatenation = #C8;
static const field core::Set<core::int> setConcatenation = #C12;
static const field core::Map<core::int, core::String> mapConcatenation = #C15;
static const field core::bool objectTypeLiteralIdentical = #C16;
static const field core::bool partialInstantiationIdentical = #C16;
static const field core::bool instanceIdentical = #C16;
static const field core::bool functionTypeLiteralIdentical = #C16;
static const field core::bool genericFunctionTypeLiteralIdentical = #C16;
static const field core::bool listLiteralIdentical = #C16;
static const field core::bool setLiteralIdentical = #C16;
static const field core::bool mapLiteralIdentical = #C16;
static const field core::bool listConcatenationIdentical = #C16;
static const field core::bool setConcatenationIdentical = #C16;
static const field core::bool mapConcatenationIdentical = #C16;
static final field core::bool inStrongMode = self::_inStrongMode();
static method _inStrongMode() core::bool {
(core::String?) core::Null? f = (core::String? s) core::Null? {
let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/constants.dart:45:7: Error: Property 'length' cannot be accessed on 'String?' because it is potentially null.
Try accessing using ?. instead.
s.length; // This will be an invalid expression in strong mode.
^^^^^^" in s.{core::String::length};
};
try {
f.call("foo");
}
on dynamic catch(final dynamic e) {
core::print("Running in strong mode.");
return true;
}
core::print("Running in weak mode.");
return false;
}
static method main() → dynamic {
self::test(#C1, #C17);
self::test(#C3, #C18);
self::test(#C5, #C19);
self::test(#C6, #C20);
self::test(#C7, #C21);
self::test(#C8, #C22);
self::test(#C12, #C24);
self::test(#C15, #C25);
self::test(#C8, #C22);
self::test(#C12, #C24);
self::test(#C15, #C25);
self::test(true, #C16);
self::test(true, #C16);
self::test(true, #C16);
self::test(true, #C16);
self::test(true, #C16);
self::test(true, #C16);
self::test(true, #C16);
self::test(true, #C16);
self::test(true, #C16);
self::test(true, #C16);
self::test(true, #C16);
}
static method test(dynamic expected, dynamic actual) → dynamic {
core::print("test(${expected}, ${actual})");
if(self::inStrongMode) {
if(core::identical(expected, actual)) {
throw "Unexpected identical for ${expected} and ${actual}";
}
}
else {
if(!core::identical(expected, actual)) {
throw "Expected ${expected}, actual ${actual}";
}
}
}
library;
import self as con;
import "dart:core" as core;
typedef F1<invariant T extends core::Object* = dynamic> = (T*) →* T*;
typedef F2 = <T extends core::Object* = dynamic>(T*) →* T*;
class Class<T extends core::Object* = dynamic> extends core::Object {
final field con::Class::T* field;
const constructor •(con::Class::T* field) → con::Class<con::Class::T*>*
: con::Class::field = field, super core::Object::•()
;
}
static const field core::Type* objectTypeLiteral = #C17;
static const field (core::Object*, core::Object*) →* core::bool* c2 = #C26;
static const field (core::int*) →* core::int* partialInstantiation = #C18;
static const field con::Class<core::int*>* instance = #C19;
static const field core::Type* functionTypeLiteral = #C20;
static const field core::Type* genericFunctionTypeLiteral = #C21;
static const field core::List<core::int*>* listLiteral = #C22;
static const field core::Set<core::int*>* setLiteral = #C24;
static const field core::Map<core::int*, core::String*>* mapLiteral = #C25;
static const field core::List<core::int*>* listConcatenation = #C22;
static const field core::Set<core::int*>* setConcatenation = #C24;
static const field core::Map<core::int*, core::String*>* mapConcatenation = #C25;
static method id<T extends core::Object* = dynamic>(con::id::T* t) → con::id::T*
return t;
constants {
#C1 = TypeLiteralConstant(dart.core::Object)
#C2 = tearoff con::id
#C3 = partial-instantiation con::id <core::int>
#C4 = 0
#C5 = con::Class<core::int> {field:#C4}
#C6 = TypeLiteralConstant((dynamic) → dynamic)
#C7 = TypeLiteralConstant(<T extends dart.core::Object? = dynamic>(T%) → T%)
#C8 = <core::int>[#C4]
#C9 = null
#C10 = <dynamic>[#C4, #C9]
#C11 = core::_ImmutableMap<core::int, core::Null?> {_kvPairs:#C10}
#C12 = col::_UnmodifiableSet<core::int> {_map:#C11}
#C13 = "foo"
#C14 = <dynamic>[#C4, #C13]
#C15 = core::_ImmutableMap<core::int, core::String> {_kvPairs:#C14}
#C16 = false
#C17 = TypeLiteralConstant(dart.core::Object*)
#C18 = partial-instantiation con::id <core::int*>
#C19 = con::Class<core::int*> {field:#C4}
#C20 = TypeLiteralConstant((dynamic) →* dynamic)
#C21 = TypeLiteralConstant(<T extends dart.core::Object* = dynamic>(T*) →* T*)
#C22 = <core::int*>[#C4]
#C23 = core::_ImmutableMap<core::int*, core::Null?> {_kvPairs:#C10}
#C24 = col::_UnmodifiableSet<core::int*> {_map:#C23}
#C25 = core::_ImmutableMap<core::int*, core::String*> {_kvPairs:#C14}
#C26 = tearoff core::identical
}