mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:17:55 +00:00
f0625ac010
Change-Id: Ia032182ae94e9215c22fe1627dc93495946d4074 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151640 Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Joshua Litt <joshualitt@google.com>
38 lines
1.3 KiB
Dart
38 lines
1.3 KiB
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// Requirements=nnbd
|
|
|
|
import 'dart:_runtime' show legacy, nullable, typeRep, legacyTypeRep;
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
class A {}
|
|
|
|
void main() {
|
|
// A?? == A?
|
|
Expect.identical(nullable(typeRep<A?>()), typeRep<A?>());
|
|
// A?* == A?
|
|
Expect.identical(legacy(typeRep<A?>()), typeRep<A?>());
|
|
// A*? == A?
|
|
Expect.identical(nullable(legacyTypeRep<A>()), typeRep<A?>());
|
|
// A** == A*
|
|
Expect.identical(legacy(legacyTypeRep<A>()), legacyTypeRep<A>());
|
|
|
|
// The tests below need explicit wrapping in nullable and legacy to ensure
|
|
// they appear at runtime and the runtime library normalizes them correctly.
|
|
// Null? == Null
|
|
Expect.identical(nullable(typeRep<Null>()), typeRep<Null>());
|
|
// Never? == Null
|
|
Expect.identical(nullable(typeRep<Never>()), typeRep<Null>());
|
|
// dynamic? == dynamic
|
|
Expect.identical(nullable(typeRep<dynamic>()), typeRep<dynamic>());
|
|
// void? == void
|
|
Expect.identical(nullable(typeRep<void>()), typeRep<void>());
|
|
// dynamic* == dynamic
|
|
Expect.identical(legacy(typeRep<dynamic>()), typeRep<dynamic>());
|
|
// void* == void
|
|
Expect.identical(legacy(typeRep<void>()), typeRep<void>());
|
|
}
|