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>
39 lines
1.8 KiB
Plaintext
39 lines
1.8 KiB
Plaintext
library;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/extensions/issue40713.dart:22:8: Error: 'safeFirst' isn't a function or method and can't be invoked.
|
|
// list.safeFirst();
|
|
// ^^^^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/extensions/issue40713.dart:24:18: Error: Too few positional arguments: 1 required, 0 given.
|
|
// list2.safeFirst();
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
extension SafeAccess<T extends core::Object* = dynamic> on core::Iterable<T*>* {
|
|
get safeFirst = self::SafeAccess|get#safeFirst;
|
|
}
|
|
static method SafeAccess|get#safeFirst<T extends core::Object* = dynamic>(lowered final core::Iterable<self::SafeAccess|get#safeFirst::T*>* #this) → self::SafeAccess|get#safeFirst::T* {
|
|
return #this.{core::Iterable::isNotEmpty} ?{self::SafeAccess|get#safeFirst::T*} #this.{core::Iterable::first} : null;
|
|
}
|
|
static method main() → dynamic {}
|
|
static method test() → void {
|
|
final core::List<dynamic>* list = <dynamic>[];
|
|
self::SafeAccess|get#safeFirst<dynamic>(list).call();
|
|
final core::List<(core::int*) →* void>* list2 = <(core::int*) →* void>[];
|
|
self::SafeAccess|get#safeFirst<(core::int*) →* void>(list2).call(0);
|
|
}
|
|
static method errors() → void {
|
|
final core::List<core::Object*>* list = <core::Object*>[];
|
|
invalid-expression "pkg/front_end/testcases/extensions/issue40713.dart:22:8: Error: 'safeFirst' isn't a function or method and can't be invoked.
|
|
list.safeFirst();
|
|
^^^^^^^^^";
|
|
final core::List<(core::int*) →* void>* list2 = <(core::int*) →* void>[];
|
|
let final Never* #t1 = invalid-expression "pkg/front_end/testcases/extensions/issue40713.dart:24:18: Error: Too few positional arguments: 1 required, 0 given.
|
|
list2.safeFirst();
|
|
^" in self::SafeAccess|get#safeFirst<(core::int*) →* void>(list2).call();
|
|
}
|