c191551fac
TEST=Covered by existing tests. Change-Id: Ied8be1874164e68e0a3a48e1b2f9a33310071381 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183009 Commit-Queue: Dmitry Stefantsov <dmitryas@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
57 lines
2.3 KiB
Plaintext
57 lines
2.3 KiB
Plaintext
library /*isNonNullableByDefault*/;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/nnbd/call.dart:12:4: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
// Try calling using ?.call instead.
|
|
// f();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/call.dart:13:5: Error: Method 'call' cannot be called on 'void Function()?' because it is potentially null.
|
|
// Try calling using ?. instead.
|
|
// f.call();
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/call.dart:15:10: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
// Try calling using ?.call instead.
|
|
// c.field();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/call.dart:16:11: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
// Try calling using ?.call instead.
|
|
// c.getter();
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
class Class extends core::Object {
|
|
field () →? void field = null;
|
|
synthetic constructor •() → self::Class
|
|
: super core::Object::•()
|
|
;
|
|
get getter() → () →? void
|
|
return null;
|
|
}
|
|
static method error() → dynamic {
|
|
() →? void f;
|
|
let final Never #t1 = invalid-expression "pkg/front_end/testcases/nnbd/call.dart:12:4: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
Try calling using ?.call instead.
|
|
f();
|
|
^" in f.call();
|
|
let final Never #t2 = invalid-expression "pkg/front_end/testcases/nnbd/call.dart:13:5: Error: Method 'call' cannot be called on 'void Function()?' because it is potentially null.
|
|
Try calling using ?. instead.
|
|
f.call();
|
|
^^^^" in f.call();
|
|
self::Class c = new self::Class::•();
|
|
let final Never #t3 = invalid-expression "pkg/front_end/testcases/nnbd/call.dart:15:10: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
Try calling using ?.call instead.
|
|
c.field();
|
|
^" in c.{self::Class::field}.call();
|
|
let final Never #t4 = invalid-expression "pkg/front_end/testcases/nnbd/call.dart:16:11: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
Try calling using ?.call instead.
|
|
c.getter();
|
|
^" in c.{self::Class::getter}.call();
|
|
}
|
|
static method main() → dynamic {}
|