Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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 the representation type of an
/// extension type declaration is a bottom type.
///
/// @description Check that it is a compile-time error if the representation
/// type of an extension type declaration is a bottom type.
/// @author sgrekhov22@gmail.com

typedef NeverAlias = Never;

extension type ET1(Never _) {}
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

extension type ET2(NeverAlias _) {}
// ^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
print(ET1);
print(ET2);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 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 Note that it is still possible for the instantiated
/// representation type of a given extension type to be a bottom type. For
/// example, assuming extension type `E<X>(X x) {}, E<Never>` would be an
/// extension type whose instantiated representation type is `Never`.
///
/// @description Check that it is not an error to have an instantiated
/// representation type to be a bottom type.
/// @author sgrekhov22@gmail.com

import '../../Utils/static_type_helper.dart';

typedef NeverAlias = Never;

extension type ET<X>(X _) {}

main() {
ET<Never>? et1;
et1.expectStaticType<Exactly<ET<Never>?>>();
ET<NeverAlias>? et2;
et2.expectStaticType<Exactly<ET<Never>?>>();
}