[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:
Johnni Winther 2020-06-16 08:10:24 +00:00 committed by commit-bot@chromium.org
parent 967deb8db4
commit f369194255
8 changed files with 113 additions and 0 deletions

View 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() {}

View file

@ -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
;

View file

@ -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 {}

View file

@ -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 {}

View file

@ -0,0 +1,5 @@
extension Extension ;
on Never (){ }
implicitAccess(Never never) { }
explicitAccess(Never never) { }
main() { }

View file

@ -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 {}

View file

@ -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 {}

View file

@ -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