mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
[cfe] Add test for extension on Never
Closes #42180 Change-Id: I690d3419d94bfc593f77f0cea75274cb20182ba2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151229 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
967deb8db4
commit
f369194255
8 changed files with 113 additions and 0 deletions
18
pkg/front_end/testcases/nnbd/extension_never.dart
Normal file
18
pkg/front_end/testcases/nnbd/extension_never.dart
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
extension Extension on Never {
|
||||
extensionMethod() {}
|
||||
}
|
||||
|
||||
implicitAccess(Never never) {
|
||||
never.extensionMethod();
|
||||
never.missingMethod();
|
||||
}
|
||||
|
||||
explicitAccess(Never never) {
|
||||
Extension(never).extensionMethod();
|
||||
}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,17 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
|
||||
extension Extension on Never {
|
||||
method extensionMethod = self::Extension|extensionMethod;
|
||||
tearoff extensionMethod = self::Extension|get#extensionMethod;
|
||||
}
|
||||
static method Extension|extensionMethod(final Never #this) → dynamic
|
||||
;
|
||||
static method Extension|get#extensionMethod(final Never #this) → () → dynamic
|
||||
return () → dynamic => self::Extension|extensionMethod(#this);
|
||||
static method implicitAccess(Never never) → dynamic
|
||||
;
|
||||
static method explicitAccess(Never never) → dynamic
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,18 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
|
||||
extension Extension on Never {
|
||||
method extensionMethod = self::Extension|extensionMethod;
|
||||
tearoff extensionMethod = self::Extension|get#extensionMethod;
|
||||
}
|
||||
static method Extension|extensionMethod(final Never #this) → dynamic {}
|
||||
static method Extension|get#extensionMethod(final Never #this) → () → dynamic
|
||||
return () → dynamic => self::Extension|extensionMethod(#this);
|
||||
static method implicitAccess(Never never) → dynamic {
|
||||
never.extensionMethod();
|
||||
never.missingMethod();
|
||||
}
|
||||
static method explicitAccess(Never never) → dynamic {
|
||||
self::Extension|extensionMethod(never);
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,18 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
|
||||
extension Extension on Never {
|
||||
method extensionMethod = self::Extension|extensionMethod;
|
||||
tearoff extensionMethod = self::Extension|get#extensionMethod;
|
||||
}
|
||||
static method Extension|extensionMethod(final Never #this) → dynamic {}
|
||||
static method Extension|get#extensionMethod(final Never #this) → () → dynamic
|
||||
return () → dynamic => self::Extension|extensionMethod(#this);
|
||||
static method implicitAccess(Never never) → dynamic {
|
||||
never.extensionMethod();
|
||||
never.missingMethod();
|
||||
}
|
||||
static method explicitAccess(Never never) → dynamic {
|
||||
self::Extension|extensionMethod(never);
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,5 @@
|
|||
extension Extension ;
|
||||
on Never (){ }
|
||||
implicitAccess(Never never) { }
|
||||
explicitAccess(Never never) { }
|
||||
main() { }
|
|
@ -0,0 +1,18 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
|
||||
extension Extension on Never {
|
||||
method extensionMethod = self::Extension|extensionMethod;
|
||||
tearoff extensionMethod = self::Extension|get#extensionMethod;
|
||||
}
|
||||
static method Extension|extensionMethod(final Never #this) → dynamic {}
|
||||
static method Extension|get#extensionMethod(final Never #this) → () → dynamic
|
||||
return () → dynamic => self::Extension|extensionMethod(#this);
|
||||
static method implicitAccess(Never never) → dynamic {
|
||||
never.extensionMethod();
|
||||
never.missingMethod();
|
||||
}
|
||||
static method explicitAccess(Never never) → dynamic {
|
||||
self::Extension|extensionMethod(never);
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,18 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
|
||||
extension Extension on Never {
|
||||
method extensionMethod = self::Extension|extensionMethod;
|
||||
tearoff extensionMethod = self::Extension|get#extensionMethod;
|
||||
}
|
||||
static method Extension|extensionMethod(final Never #this) → dynamic {}
|
||||
static method Extension|get#extensionMethod(final Never #this) → () → dynamic
|
||||
return () → dynamic => self::Extension|extensionMethod(#this);
|
||||
static method implicitAccess(Never never) → dynamic {
|
||||
never.extensionMethod();
|
||||
never.missingMethod();
|
||||
}
|
||||
static method explicitAccess(Never never) → dynamic {
|
||||
self::Extension|extensionMethod(never);
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -156,6 +156,7 @@ late_lowering/override_getter_setter: FormatterCrash
|
|||
late_lowering/override: FormatterCrash
|
||||
late_lowering/uninitialized_non_nullable_late_fields: FormatterCrash
|
||||
nnbd/covariant_late_field: FormatterCrash
|
||||
nnbd/extension_never: FormatterCrash
|
||||
nnbd/forbidden_supers: FormatterCrash
|
||||
nnbd/infer_if_null: FormatterCrash
|
||||
nnbd/inheritance_from_opt_in: FormatterCrash
|
||||
|
|
Loading…
Reference in a new issue