| library test; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/inference/future_then_upwards_3.dart:21:49: Error: A value of type 'Future<double>' can't be assigned to a variable of type 'Future<int>'. |
| // - 'Future' is from 'dart:async'. |
| // Try changing the type of the left hand side, or casting the right hand side to 'Future<int>'. |
| // Future<int> f2 = /*error:INVALID_ASSIGNMENT*/ f; |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| import "dart:async" as asy; |
| |
| class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> { |
| constructor •() → self::MyFuture<self::MyFuture::T> |
| : super core::Object::•() {} |
| constructor value(self::MyFuture::T x) → self::MyFuture<self::MyFuture::T> |
| : super core::Object::•() {} |
| method noSuchMethod(core::Invocation invocation) → dynamic |
| return null; |
| method then<S extends core::Object = dynamic>((self::MyFuture::T) → asy::FutureOr<self::MyFuture::then::S> f, {core::Function onError = null}) → self::MyFuture<self::MyFuture::then::S> |
| return null; |
| no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T> |
| return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#catchError, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[onError]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#test: test}))) as{TypeError} asy::Future<self::MyFuture::T>; |
| no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T> |
| return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#whenComplete, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[action]), core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Future<self::MyFuture::T>; |
| no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T> |
| return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#timeout, 0, const <core::Type>[], core::List::unmodifiable<dynamic>(<dynamic>[timeLimit]), core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#onTimeout: onTimeout}))) as{TypeError} asy::Future<self::MyFuture::T>; |
| no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T> |
| return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#asStream, 0, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{}))) as{TypeError} asy::Stream<self::MyFuture::T>; |
| } |
| static method test() → void { |
| asy::Future<core::double> f = self::foo().{asy::Future::then}<core::double>((dynamic _) → core::double => 2.3); |
| asy::Future<core::int> f2 = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/inference/future_then_upwards_3.dart:21:49: Error: A value of type 'Future<double>' can't be assigned to a variable of type 'Future<int>'. |
| - 'Future' is from 'dart:async'. |
| Try changing the type of the left hand side, or casting the right hand side to 'Future<int>'. |
| Future<int> f2 = /*error:INVALID_ASSIGNMENT*/ f; |
| ^" in f as{TypeError} asy::Future<core::int>; |
| asy::Future<core::num> f3 = self::foo().{asy::Future::then}<core::double>((dynamic _) → core::double => 2.3) as asy::Future<core::double>; |
| } |
| static method foo() → asy::Future<dynamic> |
| return asy::Future::value<core::int>(1); |
| static method main() → dynamic {} |