Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Side by Side Diff: pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.expect

Issue 2923733004: Properly flatten FutureOr types when inferring the type of an async method. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 library test;
2 import self as self;
3 import "dart:core" as core;
4 import "dart:async" as asy;
5
6 class MyFuture<T extends core::Object> extends core::Object implements asy::Futu re<self::MyFuture::T> {
7 constructor •() → void
8 : super core::Object::•() {}
9 constructor value(self::MyFuture::T x) → void
10 : super core::Object::•() {}
11 abstract method noSuchMethod(dynamic invocation) → dynamic;
12 method then<S extends core::Object>((self::MyFuture::T) → asy::FutureOr<self:: MyFuture::then::S> f, {core::Function onError = null}) → self::MyFuture<self::My Future::then::S>
13 return null;
14 }
15 static method test() → void {
16 asy::Future<core::bool> f;
17 asy::Future<core::int> t1 = f.{asy::Future::then}<core::int>((core::bool x) → asy::Future<core::int> /* originally async */ {
18 final asy::Completer<asy::FutureOr<core::int>> :completer = asy::Completer:: sync<asy::FutureOr<core::int>>();
19 asy::FutureOr<core::int> :return_value;
20 dynamic :async_op_then;
21 dynamic :async_op_error;
22 dynamic :await_jump_var = 0;
23 dynamic :await_ctx_var;
24 dynamic :saved_try_context_var0;
25 dynamic :async_temporary_0;
26 function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trac e]) → dynamic yielding
27 try {
28 #L1:
29 {
30 if(x) {
31 :async_temporary_0 = 2;
32 }
33 else {
34 asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op _then, :async_op_error, :async_op);
35 [yield] null;
36 :async_temporary_0 = :result;
37 }
38 :return_value = :async_temporary_0;
39 break #L1;
40 }
41 :completer.complete(:return_value);
42 return;
43 }
44 on dynamic catch(dynamic :exception, dynamic :stack_trace) {
45 :completer.completeError(:exception, :stack_trace);
46 }
47 :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
48 :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
49 asy::Future::microtask<dynamic>(:async_op);
50 return :completer.future;
51 });
52 asy::Future<core::int> t2 = f.{asy::Future::then}<core::int>((core::bool x) → asy::Future<core::int> /* originally async */ {
53 final asy::Completer<asy::FutureOr<core::int>> :completer = asy::Completer:: sync<asy::FutureOr<core::int>>();
54 asy::FutureOr<core::int> :return_value;
55 dynamic :async_op_then;
56 dynamic :async_op_error;
57 dynamic :await_jump_var = 0;
58 dynamic :await_ctx_var;
59 dynamic :saved_try_context_var0;
60 function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trac e]) → dynamic yielding
61 try {
62 #L2:
63 {
64 asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op);
65 [yield] null;
66 :return_value = :result ? 2 : new self::MyFuture::value<core::int>(3);
67 break #L2;
68 }
69 :completer.complete(:return_value);
70 return;
71 }
72 on dynamic catch(dynamic :exception, dynamic :stack_trace) {
73 :completer.completeError(:exception, :stack_trace);
74 }
75 :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
76 :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
77 asy::Future::microtask<dynamic>(:async_op);
78 return :completer.future;
79 });
80 asy::Future<core::int> t5 = f.{asy::Future::then}<core::int>((core::bool x) → core::Object => x ? 2 : new self::MyFuture::value<core::int>(3));
81 asy::Future<core::int> t6 = f.{asy::Future::then}<core::int>((core::bool x) → asy::FutureOr<core::int> {
82 return x ? 2 : new self::MyFuture::value<core::int>(3);
83 });
84 }
85 static method main() → dynamic {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698