Skip to content

Commit 84d71cd

Browse files
committed
[cfe] Add regression test for 41108
Closes #41108 Change-Id: I6b2f7fb5624901c298e4d4cccb691cfdc52f4e19 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155322 Reviewed-by: Dmitry Stefantsov <[email protected]>
1 parent 19ee726 commit 84d71cd

8 files changed

+170
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
test() async {
6+
List y = await l(); // should be a List?
7+
}
8+
9+
Future<List>? l() => null;
10+
11+
main() {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
library /*isNonNullableByDefault*/;
2+
import self as self;
3+
import "dart:async" as asy;
4+
import "dart:core" as core;
5+
6+
static method test() → dynamic async
7+
;
8+
static method l() → asy::Future<core::List<dynamic>>?
9+
;
10+
static method main() → dynamic
11+
;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
library /*isNonNullableByDefault*/;
2+
//
3+
// Problems in library:
4+
//
5+
// pkg/front_end/testcases/nnbd/issue41108.dart:6:12: Error: A value of type 'List<dynamic>?' can't be assigned to a variable of type 'List<dynamic>'.
6+
// - 'List' is from 'dart:core'.
7+
// List y = await l(); // should be a List?
8+
// ^
9+
//
10+
import self as self;
11+
import "dart:core" as core;
12+
import "dart:async" as asy;
13+
14+
static method test() → dynamic async {
15+
core::List<dynamic> y = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41108.dart:6:12: Error: A value of type 'List<dynamic>?' can't be assigned to a variable of type 'List<dynamic>'.
16+
- 'List' is from 'dart:core'.
17+
List y = await l(); // should be a List?
18+
^" in await self::l() as{TypeError,ForNonNullableByDefault} core::List<dynamic>;
19+
}
20+
static method l() → asy::Future<core::List<dynamic>>?
21+
return null;
22+
static method main() → dynamic {}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
library /*isNonNullableByDefault*/;
2+
//
3+
// Problems in library:
4+
//
5+
// pkg/front_end/testcases/nnbd/issue41108.dart:6:12: Error: A value of type 'List<dynamic>?' can't be assigned to a variable of type 'List<dynamic>'.
6+
// - 'List' is from 'dart:core'.
7+
// List y = await l(); // should be a List?
8+
// ^
9+
//
10+
import self as self;
11+
import "dart:async" as asy;
12+
import "dart:core" as core;
13+
import "dart:_internal" as _in;
14+
15+
static method test() → dynamic /* originally async */ {
16+
final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
17+
FutureOr<dynamic>? :return_value;
18+
dynamic :async_stack_trace;
19+
(dynamic) → dynamic :async_op_then;
20+
(core::Object, core::StackTrace) → dynamic :async_op_error;
21+
core::int :await_jump_var = 0;
22+
dynamic :await_ctx_var;
23+
dynamic :saved_try_context_var0;
24+
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
25+
try {
26+
#L1:
27+
{
28+
final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41108.dart:6:12: Error: A value of type 'List<dynamic>?' can't be assigned to a variable of type 'List<dynamic>'.
29+
- 'List' is from 'dart:core'.
30+
List y = await l(); // should be a List?
31+
^";
32+
[yield] let dynamic #t2 = asy::_awaitHelper(self::l(), :async_op_then, :async_op_error, :async_op) in null;
33+
core::List<dynamic> y = let core::List<dynamic>? #t3 = _in::unsafeCast<core::List<dynamic>?>(:result) in #t3.==(null) ?{core::List<dynamic>} #t3 as{TypeError,ForNonNullableByDefault} core::List<dynamic> : #t3{core::List<dynamic>};
34+
}
35+
asy::_completeOnAsyncReturn(:async_completer, :return_value);
36+
return;
37+
}
38+
on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
39+
:async_completer.{asy::Completer::completeError}(exception, stack_trace);
40+
}
41+
:async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
42+
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
43+
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
44+
:async_completer.{asy::_AsyncAwaitCompleter::start}(:async_op);
45+
return :async_completer.{asy::Completer::future};
46+
}
47+
static method l() → asy::Future<core::List<dynamic>>?
48+
return null;
49+
static method main() → dynamic {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test() async {}
2+
Future<List>? l() => null;
3+
main() {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Future<List>? l() => null;
2+
main() {}
3+
test() async {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
library /*isNonNullableByDefault*/;
2+
//
3+
// Problems in library:
4+
//
5+
// pkg/front_end/testcases/nnbd/issue41108.dart:6:12: Error: A value of type 'List<dynamic>?' can't be assigned to a variable of type 'List<dynamic>'.
6+
// - 'List' is from 'dart:core'.
7+
// List y = await l(); // should be a List?
8+
// ^
9+
//
10+
import self as self;
11+
import "dart:core" as core;
12+
import "dart:async" as asy;
13+
14+
static method test() → dynamic async {
15+
core::List<dynamic> y = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41108.dart:6:12: Error: A value of type 'List<dynamic>?' can't be assigned to a variable of type 'List<dynamic>'.
16+
- 'List' is from 'dart:core'.
17+
List y = await l(); // should be a List?
18+
^" in await self::l() as{TypeError,ForNonNullableByDefault} core::List<dynamic>;
19+
}
20+
static method l() → asy::Future<core::List<dynamic>>?
21+
return null;
22+
static method main() → dynamic {}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
library /*isNonNullableByDefault*/;
2+
//
3+
// Problems in library:
4+
//
5+
// pkg/front_end/testcases/nnbd/issue41108.dart:6:12: Error: A value of type 'List<dynamic>?' can't be assigned to a variable of type 'List<dynamic>'.
6+
// - 'List' is from 'dart:core'.
7+
// List y = await l(); // should be a List?
8+
// ^
9+
//
10+
import self as self;
11+
import "dart:async" as asy;
12+
import "dart:core" as core;
13+
import "dart:_internal" as _in;
14+
15+
static method test() → dynamic /* originally async */ {
16+
final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
17+
FutureOr<dynamic>? :return_value;
18+
dynamic :async_stack_trace;
19+
(dynamic) → dynamic :async_op_then;
20+
(core::Object, core::StackTrace) → dynamic :async_op_error;
21+
core::int :await_jump_var = 0;
22+
dynamic :await_ctx_var;
23+
dynamic :saved_try_context_var0;
24+
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
25+
try {
26+
#L1:
27+
{
28+
final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41108.dart:6:12: Error: A value of type 'List<dynamic>?' can't be assigned to a variable of type 'List<dynamic>'.
29+
- 'List' is from 'dart:core'.
30+
List y = await l(); // should be a List?
31+
^";
32+
[yield] let dynamic #t2 = asy::_awaitHelper(self::l(), :async_op_then, :async_op_error, :async_op) in null;
33+
core::List<dynamic> y = _in::unsafeCast<core::List<dynamic>?>(:result);
34+
}
35+
asy::_completeOnAsyncReturn(:async_completer, :return_value);
36+
return;
37+
}
38+
on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
39+
:async_completer.{asy::Completer::completeError}(exception, stack_trace);
40+
}
41+
:async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
42+
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
43+
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
44+
:async_completer.{asy::_AsyncAwaitCompleter::start}(:async_op);
45+
return :async_completer.{asy::Completer::future};
46+
}
47+
static method l() → asy::Future<core::List<dynamic>>?
48+
return null;
49+
static method main() → dynamic {}

0 commit comments

Comments
 (0)