forked from dart-lang/co19
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes dart-lang#2491. Add test that an extension type cannot implemen…
…t type `Never`
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
LanguageFeatures/Extension-types/static_analysis_extension_types_A10_t16.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2024, 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 compile-time error occurs if an extension type has a | ||
/// non-extension superinterface whose transitive alias expansion is a type | ||
/// variable, a deferred type, any top type (including dynamic and void), the | ||
/// type Null, any function type, the type Function, any record type, the type | ||
/// Record, or any type of the form T? or FutureOr<T> for any type T. | ||
/// | ||
/// @description Checks that it is a compile-time error if an extension type has | ||
/// a non-extension superinterface whose transitive alias expansion is a type | ||
/// `Never` | ||
/// @author sgrekhov22@gmail.com | ||
// SharedOptions=--enable-experiment=inline-class | ||
|
||
typedef NeverAlias = Never; | ||
|
||
extension type NeverET1(Object? _) implements Never {} | ||
// ^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
extension type NeverET2(Object? _) implements NeverAlias {} | ||
// ^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(NeverET1); | ||
print(NeverET2); | ||
} |