blob: 767b275c7c5282632ad3eac9f1f4188b5ae72b1c [file] [log] [blame]
// Copyright (c) 2021, 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.
/// @assertion A type T is assignable to a type S if T is dynamic, or if T is a
/// subtype of S.
///
/// @description Checks that a type T is assignable to a type S if T is dynamic,
/// or if T is a subtype of S. Test type aliases
///
/// @author sgrekhov@unipro.ru
// Requirements=nnbd-weak
import '../../../Utils/expect.dart';
class A {}
class C extends A {}
typedef AAlias = A;
typedef CAlias = C;
main() {
dynamic d = "Lily was here";
AAlias a1 = new A();
AAlias a2 = new C();
Expect.throws(() {
AAlias a3 = d;
});
AAlias? a4 = new A();
AAlias? a5 = new C();
Expect.throws(() {
AAlias? a6 = d;
});
}