| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/extensions/issue40713_2.dart:22:8: Error: 'safeFirst' isn't a function or method and can't be invoked. |
| // list.safeFirst(); |
| // ^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/extensions/issue40713_2.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}{core::bool} ?{self::SafeAccess|get#safeFirst::T%} #this.{core::Iterable::first}{self::SafeAccess|get#safeFirst::T%} : throw ""; |
| } |
| static method main() → dynamic {} |
| static method test() → void { |
| final core::List<dynamic> list = core::_GrowableList::•<dynamic>(0); |
| self::SafeAccess|get#safeFirst<dynamic>(list){dynamic}.call(); |
| final core::List<(core::int) → void> list2 = core::_GrowableList::•<(core::int) → void>(0); |
| self::SafeAccess|get#safeFirst<(core::int) → void>(list2)(0){(core::int) → void}; |
| } |
| static method errors() → void { |
| final core::List<core::Object> list = core::_GrowableList::•<core::Object>(0); |
| invalid-expression "pkg/front_end/testcases/extensions/issue40713_2.dart:22:8: Error: 'safeFirst' isn't a function or method and can't be invoked. |
| list.safeFirst(); |
| ^^^^^^^^^" in self::SafeAccess|get#safeFirst<core::Object>(list){<unresolved>}.call(); |
| final core::List<(core::int) → void> list2 = core::_GrowableList::•<(core::int) → void>(0); |
| invalid-expression "pkg/front_end/testcases/extensions/issue40713_2.dart:24:18: Error: Too few positional arguments: 1 required, 0 given. |
| list2.safeFirst(); |
| ^" in self::SafeAccess|get#safeFirst<(core::int) → void>(list2){<inapplicable>}.(); |
| } |