Version 2.12.0-259.8.beta
* Cherry-pick bc5952d8e8aaeb83adfe3aad2aeb1c6be22fef7e to beta
* Cherry-pick f5743e6c66d8cf4460bc1e09454d1130827f46b3 to beta
* Cherry-pick e0cd4b37cfc8a1fbc205fa1fd89c082c439db4ad to beta
* Cherry-pick 27deca1457ad6b79eb3d22f16ab45b30b754e2eb to beta
* Cherry-pick 0c3696d76a4431e90216fb28453ad4fe693aa83d to beta
* Cherry-pick 53f5179b45911fd1f937239f91e55ec8badd7975 to beta
* Cherry-pick refs/changes/00/182200/1 to beta
diff --git a/pkg/_js_interop_checks/lib/js_interop_checks.dart b/pkg/_js_interop_checks/lib/js_interop_checks.dart
index e3f0978..b936c44 100644
--- a/pkg/_js_interop_checks/lib/js_interop_checks.dart
+++ b/pkg/_js_interop_checks/lib/js_interop_checks.dart
@@ -30,6 +30,9 @@
bool _classHasAnonymousAnnotation = false;
bool _libraryHasJSAnnotation = false;
bool _libraryIsGlobalNamespace = false;
+ // TODO(srujzs): This currently disables this check always. This check should
+ // instead only be disabled up until a given language version.
+ bool _disableJSNativeClassConflict = true;
JsInteropChecks(
this._coreTypes, this._diagnosticsReporter, this._nativeClasses);
@@ -83,7 +86,8 @@
cls.location.file);
}
}
- if (_classHasJSAnnotation &&
+ if (!_disableJSNativeClassConflict &&
+ _classHasJSAnnotation &&
!_classHasAnonymousAnnotation &&
_libraryIsGlobalNamespace) {
var jsClass = getJSName(cls);
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart
index 32d0b8e..3c49589 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart
@@ -60,7 +60,7 @@
var arguments = argumentList.arguments;
var argumentCount = arguments.length;
var templateContext = TemplateContext(argumentList.parent, fix.utils);
- var newNamed = <AddParameter>[];
+
var indexToNewArgumentMap = <int, AddParameter>{};
var argumentsToInsert = <int>[];
var argumentsToDelete = <int>[];
@@ -69,16 +69,14 @@
if (modification is AddParameter) {
var index = modification.index;
indexToNewArgumentMap[index] = modification;
- if (modification.isPositional) {
+ if (modification.isPositional || modification.isRequired) {
argumentsToInsert.add(index);
- } else if (modification.isRequired) {
- newNamed.add(modification);
} else {
var requiredIfCondition =
modification.argumentValue?.requiredIfCondition;
if (requiredIfCondition != null &&
requiredIfCondition.evaluateIn(templateContext)) {
- newNamed.add(modification);
+ argumentsToInsert.add(index);
}
}
} else if (modification is RemoveParameter) {
@@ -94,7 +92,6 @@
}
}
argumentsToInsert.sort();
- newNamed.sort((first, second) => first.name.compareTo(second.name));
/// Write to the [builder] the argument associated with a single
/// [parameter].
@@ -185,39 +182,21 @@
var insertionRange = insertionRanges[nextInsertionRange];
var lower = insertionRange.lower;
var upper = insertionRange.upper;
- while (upper >= lower && !indexToNewArgumentMap[upper].isRequired) {
+ var parameter = indexToNewArgumentMap[upper];
+ while (upper >= lower &&
+ (parameter.isPositional && !parameter.isRequired)) {
upper--;
}
if (upper >= lower) {
builder.addInsertion(offset, (builder) {
- writeInsertionRange(builder, _IndexRange(lower, upper), true);
+ writeInsertionRange(builder, _IndexRange(lower, upper),
+ nextRemaining > 0 || insertionCount > 0);
});
}
nextInsertionRange++;
}
}
//
- // Insert arguments for required named parameters.
- //
- if (newNamed.isNotEmpty) {
- int offset;
- var needsInitialComma = false;
- if (remainingArguments.isEmpty && argumentsToInsert.isEmpty) {
- offset = argumentList.rightParenthesis.offset;
- } else {
- offset = arguments[arguments.length - 1].end;
- needsInitialComma = true;
- }
- builder.addInsertion(offset, (builder) {
- for (var i = 0; i < newNamed.length; i++) {
- if (i > 0 || needsInitialComma) {
- builder.write(', ');
- }
- writeArgument(builder, newNamed[i]);
- }
- });
- }
- //
// The remaining deletion ranges are now ready to be removed.
//
for (var subRange in deletionRanges) {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
index 389b739..9570680 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
@@ -428,8 +428,12 @@
// Add parameters for fields, local, and method parameters.
for (var parameter in _parameters) {
builder.write(' ');
- builder.write('@');
- builder.writeReference(accessorRequired);
+ if (_isNonNullable) {
+ builder.write('required');
+ } else {
+ builder.write('@');
+ builder.writeReference(accessorRequired);
+ }
builder.write(' ');
if (parameter.constructorName != parameter.name) {
builder.writeType(parameter.type);
diff --git a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
index 2338885..82eca0f 100644
--- a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
+++ b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
@@ -12,6 +12,7 @@
show RefactoringProblemSeverity, SourceChange, SourceEdit;
import 'package:test/test.dart';
+import '../../abstract_context.dart';
import '../../abstract_single_unit.dart';
int findIdentifierLength(String search) {
@@ -29,7 +30,8 @@
}
/// The base class for all [Refactoring] tests.
-abstract class RefactoringTest extends AbstractSingleUnitTest {
+abstract class RefactoringTest extends AbstractSingleUnitTest
+ with WithNonFunctionTypeAliasesMixin {
SearchEngine searchEngine;
SourceChange refactoringChange;
diff --git a/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart b/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart
index aa6c028..17c7103 100644
--- a/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart
@@ -56,7 +56,7 @@
class D extends A {
int get test => 4;
}
-main(A a, B b, C c, D d) {
+void f(A a, B b, C c, D d) {
var va = a.test;
var vb = b.test;
var vc = c.test;
@@ -79,7 +79,7 @@
class D extends A {
int test() => 4;
}
-main(A a, B b, C c, D d) {
+void f(A a, B b, C c, D d) {
var va = a.test();
var vb = b.test();
var vc = c.test();
@@ -99,7 +99,7 @@
class B extends A {
int get test => 2;
}
-main(A a, B b) {
+void f(A a, B b) {
a.test;
b.test;
}
@@ -112,7 +112,7 @@
class B extends A {
int test() => 2;
}
-main(A a, B b) {
+void f(A a, B b) {
a.test();
b.test();
}
diff --git a/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart b/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart
index 95e8ed2..7afbb5d 100644
--- a/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart
@@ -55,7 +55,7 @@
class D extends A {
int test() => 4;
}
-main(A a, B b, C c, D d) {
+void f(A a, B b, C c, D d) {
var va = a.test();
var vb = b.test();
var vc = c.test();
@@ -78,7 +78,7 @@
class D extends A {
int get test => 4;
}
-main(A a, B b, C c, D d) {
+void f(A a, B b, C c, D d) {
var va = a.test;
var vb = b.test;
var vc = c.test;
@@ -98,7 +98,7 @@
class B extends A {
int test() => 2;
}
-main(A a, B b) {
+void f(A a, B b) {
a.test();
b.test();
}
@@ -111,7 +111,7 @@
class B extends A {
int get test => 2;
}
-main(A a, B b) {
+void f(A a, B b) {
a.test;
b.test;
}
diff --git a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
index 4ffad65..4d5d5bf 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
@@ -245,7 +245,7 @@
await indexTestUnit('''
main() {
int a = 1 + 2;
- Res b = null;
+ Res? b = null;
}
class Res {}
@@ -698,7 +698,7 @@
Future<void> test_guessNames_singleExpression() async {
await indexTestUnit('''
class TreeItem {}
-TreeItem getSelectedItem() => null;
+TreeItem? getSelectedItem() => null;
process(my) {}
main() {
process(getSelectedItem()); // marker
@@ -760,21 +760,21 @@
Future<void> test_occurrences_differentName_samePrefix() async {
await indexTestUnit('''
-void main(A a) {
+void f(A a) {
if (a.foo != 1) {
} else if (a.foo2 != 2) {
}
}
class A {
- int foo;
- int foo2;
+ int? foo;
+ int? foo2;
}
''');
_createRefactoringWithSuffix('a.foo', ' != 1');
// apply refactoring
await _assertSuccessfulRefactoring('''
-void main(A a) {
+void f(A a) {
var res = a.foo;
if (res != 1) {
} else if (a.foo2 != 2) {
@@ -782,8 +782,8 @@
}
class A {
- int foo;
- int foo2;
+ int? foo;
+ int? foo2;
}
''');
}
@@ -1068,7 +1068,7 @@
Future<void> test_singleExpression_inExpressionBody_ofFunction() async {
await indexTestUnit('''
foo(Point p) => p.x * p.x + p.y * p.y;
-class Point {int x; int y;}
+class Point {int x = 0; int y = 0;}
''');
_createRefactoringForString('p.x');
// apply refactoring
@@ -1077,7 +1077,7 @@
var res = p.x;
return res * res + p.y * p.y;
}
-class Point {int x; int y;}
+class Point {int x = 0; int y = 0;}
''');
_assertSingleLinkedEditGroup(
length: 3, offsets: [21, 41, 47], names: ['x', 'i']);
@@ -1088,7 +1088,7 @@
class A {
foo(Point p) => p.x * p.x + p.y * p.y;
}
-class Point {int x; int y;}
+class Point {int x = 0; int y = 0;}
''');
_createRefactoringForString('p.x');
// apply refactoring
@@ -1099,7 +1099,7 @@
return res * res + p.y * p.y;
}
}
-class Point {int x; int y;}
+class Point {int x = 0; int y = 0;}
''');
_assertSingleLinkedEditGroup(
length: 3, offsets: [35, 57, 63], names: ['x', 'i']);
@@ -1107,7 +1107,7 @@
Future<void> test_singleExpression_inIfElseIf() async {
await indexTestUnit('''
-main(int p) {
+void f(int p) {
if (p == 1) {
print(1);
} else if (p == 2) {
@@ -1118,7 +1118,7 @@
_createRefactoringForString('2');
// apply refactoring
return _assertSuccessfulRefactoring('''
-main(int p) {
+void f(int p) {
var res = 2;
if (p == 1) {
print(1);
diff --git a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
index ff277f5..2396564 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
@@ -318,8 +318,8 @@
class A {
var fff;
}
-main() {
- A a;
+
+void f(A a) {
a.fff = 1;
}
''');
@@ -471,7 +471,7 @@
Future<void> test_bad_statements_exit_notAllExecutionFlows() async {
await indexTestUnit('''
-main(int p) {
+void f(int p) {
// start
if (p == 0) {
return;
@@ -704,7 +704,7 @@
Future<void> test_canExtractGetter_false_hasParameters() async {
await indexTestUnit('''
-main(int p) {
+void f(int p) {
int a = p + 1;
}
''');
@@ -718,7 +718,7 @@
Future<void> test_canExtractGetter_false_returnNotUsed_assignment() async {
await indexTestUnit('''
var topVar = 0;
-f(int p) {
+void f(int p) {
topVar = 5;
}
''');
@@ -897,7 +897,7 @@
Future<void> test_closure_atArgumentName() async {
await indexTestUnit('''
-void process({int fff(int x)}) {}
+void process({int fff(int x)?}) {}
class C {
main() {
process(fff: (int x) => x * 2);
@@ -907,7 +907,7 @@
_createRefactoring(findOffset('ff: (int x)'), 0);
// apply refactoring
return _assertSuccessfulRefactoring('''
-void process({int fff(int x)}) {}
+void process({int fff(int x)?}) {}
class C {
main() {
process(fff: res);
@@ -960,7 +960,7 @@
Future<void> test_closure_bad_referencesParameter() async {
await indexTestUnit('''
process(f(x)) {}
-main(int k) {
+void f(int k) {
process((x) => x * k);
}
''');
@@ -1114,7 +1114,7 @@
Future<void> test_names_singleExpression() async {
await indexTestUnit('''
class TreeItem {}
-TreeItem getSelectedItem() => null;
+TreeItem getSelectedItem() => throw 0;
process(my) {}
main() {
process(getSelectedItem()); // marker
@@ -1203,7 +1203,7 @@
Future<void> test_returnType_statements_nullMix() async {
await indexTestUnit('''
-main(bool p) {
+f(bool p) {
// start
if (p) {
return 42;
@@ -1291,7 +1291,7 @@
Future<void> test_singleExpression_coveringExpression() async {
await indexTestUnit('''
-main(int n) {
+void f(int n) {
var v = new FooBar(n);
}
@@ -1301,7 +1301,7 @@
''');
_createRefactoringForStringOffset('Bar(n);');
return _assertSuccessfulRefactoring('''
-main(int n) {
+void f(int n) {
var v = res(n);
}
@@ -1535,7 +1535,7 @@
Future<void> test_singleExpression_parameter_functionTypeAlias() async {
await indexTestUnit('''
typedef R Foo<S, R>(S s);
-void main(Foo<String, int> foo, String s) {
+void f(Foo<String, int> foo, String s) {
int a = foo(s);
}
''');
@@ -1543,7 +1543,7 @@
// apply refactoring
return _assertSuccessfulRefactoring('''
typedef R Foo<S, R>(S s);
-void main(Foo<String, int> foo, String s) {
+void f(Foo<String, int> foo, String s) {
int a = res(foo, s);
}
@@ -2298,7 +2298,7 @@
Future<void> test_statements_exit_throws() async {
await indexTestUnit('''
-main(int p) {
+void f(int p) {
// start
if (p == 0) {
return;
@@ -2376,7 +2376,7 @@
Future<void> test_statements_hasAwait_forEach() async {
await indexTestUnit('''
import 'dart:async';
-Stream<int> getValueStream() => null;
+Stream<int> getValueStream() => throw 0;
main() async {
// start
int sum = 0;
@@ -2391,7 +2391,7 @@
// apply refactoring
return _assertSuccessfulRefactoring('''
import 'dart:async';
-Stream<int> getValueStream() => null;
+Stream<int> getValueStream() => throw 0;
main() async {
// start
int sum = await res();
@@ -2672,7 +2672,7 @@
Future<void> test_statements_return_multiple_ifElse() async {
await indexTestUnit('''
-num main(bool b) {
+num f(bool b) {
// start
if (b) {
return 1;
@@ -2685,7 +2685,7 @@
_createRefactoringForStartEndComments();
// apply refactoring
return _assertSuccessfulRefactoring('''
-num main(bool b) {
+num f(bool b) {
// start
return res(b);
// end
@@ -2703,7 +2703,7 @@
Future<void> test_statements_return_multiple_ifThen() async {
await indexTestUnit('''
-num main(bool b) {
+num f(bool b) {
// start
if (b) {
return 1;
@@ -2715,7 +2715,7 @@
_createRefactoringForStartEndComments();
// apply refactoring
return _assertSuccessfulRefactoring('''
-num main(bool b) {
+num f(bool b) {
// start
return res(b);
// end
@@ -2761,7 +2761,7 @@
Future<void> test_statements_return_multiple_interfaceFunction() async {
await indexTestUnit('''
-main(bool b) {
+f(bool b) {
// start
if (b) {
return 1;
@@ -2773,7 +2773,7 @@
_createRefactoringForStartEndComments();
// apply refactoring
return _assertSuccessfulRefactoring('''
-main(bool b) {
+f(bool b) {
// start
return res(b);
// end
@@ -2791,7 +2791,7 @@
Future<void>
test_statements_return_multiple_sameElementDifferentTypeArgs() async {
await indexTestUnit('''
-main(bool b) {
+f(bool b) {
// start
if (b) {
print(true);
@@ -2806,7 +2806,7 @@
_createRefactoringForStartEndComments();
// apply refactoring
return _assertSuccessfulRefactoring('''
-main(bool b) {
+f(bool b) {
// start
return res(b);
// end
diff --git a/pkg/analysis_server/test/services/refactoring/extract_widget_test.dart b/pkg/analysis_server/test/services/refactoring/extract_widget_test.dart
index be25023..23d0d92 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_widget_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_widget_test.dart
@@ -133,7 +133,7 @@
class Test extends StatelessWidget {
const Test({
- Key key,
+ Key? key,
}) : super(key: key);
@override
@@ -184,7 +184,7 @@
class Test extends StatelessWidget {
const Test({
- Key key,
+ Key? key,
}) : super(key: key);
@override
@@ -220,7 +220,7 @@
class Test extends StatelessWidget {
const Test({
- Key key,
+ Key? key,
}) : super(key: key);
@override
@@ -253,7 +253,7 @@
class Test extends StatelessWidget {
const Test({
- Key key,
+ Key? key,
}) : super(key: key);
@override
@@ -307,7 +307,7 @@
class Test extends StatelessWidget {
const Test({
- Key key,
+ Key? key,
}) : super(key: key);
@override
@@ -410,8 +410,8 @@
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.c,
+ Key? key,
+ required this.c,
}) : super(key: key);
final C c;
@@ -462,7 +462,7 @@
class Test extends StatelessWidget {
const Test({
- Key key,
+ Key? key,
}) : super(key: key);
@override
@@ -482,7 +482,7 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String foo;
+ String foo = '';
@override
Widget build(BuildContext context) {
@@ -510,7 +510,7 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String foo;
+ String foo = '';
@override
Widget build(BuildContext context) {
@@ -526,10 +526,10 @@
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.foo,
- @required this.p1,
- @required this.p2,
+ Key? key,
+ required this.foo,
+ required this.p1,
+ required this.p2,
}) : super(key: key);
final String foo;
@@ -548,12 +548,14 @@
''');
}
- Future<void> test_method_parameters_named() async {
+ Future<void> test_method_parameters_namedRequired() async {
await indexTestUnit(r'''
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String foo;
+ final String foo;
+
+ MyWidget(this.foo);
@override
Widget build(BuildContext context) {
@@ -566,7 +568,7 @@
);
}
- Widget createColumn({String p1, int p2}) {
+ Widget createColumn({required String p1, required int p2}) {
var a = new Text('$foo $p1');
var b = new Text('$p2');
return new Column(
@@ -575,13 +577,15 @@
}
}
''');
- _createRefactoringForStringOffset('createColumn({String');
+ _createRefactoringForStringOffset('createColumn({');
await _assertSuccessfulRefactoring(r'''
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String foo;
+ final String foo;
+
+ MyWidget(this.foo);
@override
Widget build(BuildContext context) {
@@ -597,10 +601,10 @@
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.foo,
- @required this.p1,
- @required this.p2,
+ Key? key,
+ required this.foo,
+ required this.p1,
+ required this.p2,
}) : super(key: key);
final String foo;
@@ -624,7 +628,9 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String field;
+ final String field;
+
+ MyWidget(this.field);
@override
Widget build(BuildContext context) {
@@ -638,7 +644,9 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String field;
+ final String field;
+
+ MyWidget(this.field);
@override
Widget build(BuildContext context) {
@@ -648,8 +656,8 @@
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.field,
+ Key? key,
+ required this.field,
}) : super(key: key);
final String field;
@@ -667,7 +675,7 @@
import 'package:flutter/material.dart';
class C {
- String field;
+ String field = '';
}
class MyWidget extends StatelessWidget {
@@ -685,7 +693,7 @@
import 'package:flutter/material.dart';
class C {
- String field;
+ String field = '';
}
class MyWidget extends StatelessWidget {
@@ -699,8 +707,8 @@
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.c,
+ Key? key,
+ required this.c,
}) : super(key: key);
final C c;
@@ -717,7 +725,7 @@
await indexTestUnit(r'''
import 'package:flutter/material.dart';
-String field;
+String field = '';
class MyWidget extends StatelessWidget {
@override
@@ -731,7 +739,7 @@
await _assertSuccessfulRefactoring('''
import 'package:flutter/material.dart';
-String field;
+String field = '';
class MyWidget extends StatelessWidget {
@override
@@ -742,7 +750,7 @@
class Test extends StatelessWidget {
const Test({
- Key key,
+ Key? key,
}) : super(key: key);
@override
@@ -759,6 +767,8 @@
class MyWidget extends StatelessWidget {
String field;
+
+ MyWidget(this.field);
@override
Widget build(BuildContext context) {
@@ -782,7 +792,7 @@
import 'package:flutter/material.dart';
abstract class MySuperWidget extends StatelessWidget {
- String field;
+ String field = '';
}
class MyWidget extends MySuperWidget {
@@ -808,7 +818,7 @@
import 'package:flutter/material.dart';
class C {
- String field;
+ String field = '';
}
class MyWidget extends StatelessWidget {
@@ -831,7 +841,7 @@
import 'package:flutter/material.dart';
class C {
- String field;
+ String field = '';
}
class MyWidget extends StatelessWidget {
@@ -845,8 +855,8 @@
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.c,
+ Key? key,
+ required this.c,
}) : super(key: key);
final C c;
@@ -871,7 +881,7 @@
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- String key;
+ String key = '';
return new Text('$key $key');
}
}
@@ -889,7 +899,7 @@
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- String local;
+ String local = '';
return new Text('$local $local');
}
}
@@ -902,15 +912,15 @@
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- String local;
+ String local = '';
return Test(local: local);
}
}
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.local,
+ Key? key,
+ required this.local,
}) : super(key: key);
final String local;
@@ -951,7 +961,9 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String _field;
+ final String _field;
+
+ MyWidget(this._field);
@override
Widget build(BuildContext context) {
@@ -965,7 +977,9 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String _field;
+ final String _field;
+
+ MyWidget(this._field);
@override
Widget build(BuildContext context) {
@@ -975,8 +989,8 @@
class Test extends StatelessWidget {
const Test({
- Key key,
- @required String field,
+ Key? key,
+ required String field,
}) : _field = field, super(key: key);
final String _field;
@@ -994,8 +1008,10 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- int field;
- String _field;
+ final int field;
+ final String _field;
+
+ MyWidget(this.field, this._field);
@override
Widget build(BuildContext context) {
@@ -1009,8 +1025,10 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- int field;
- String _field;
+ final int field;
+ final String _field;
+
+ MyWidget(this.field, this._field);
@override
Widget build(BuildContext context) {
@@ -1020,9 +1038,9 @@
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.field,
- @required String field2,
+ Key? key,
+ required this.field,
+ required String field2,
}) : _field = field2, super(key: key);
final int field;
@@ -1041,11 +1059,13 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String field;
+ final String field;
+
+ MyWidget(this.field);
@override
Widget build(BuildContext context) {
- String local;
+ String local = '';
return new Column(
children: <Widget>[
new Text(field),
@@ -1061,20 +1081,22 @@
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
- String field;
+ final String field;
+
+ MyWidget(this.field);
@override
Widget build(BuildContext context) {
- String local;
+ String local = '';
return Test(field: field, local: local);
}
}
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.field,
- @required this.local,
+ Key? key,
+ required this.field,
+ required this.local,
}) : super(key: key);
final String field;
@@ -1141,9 +1163,9 @@
class Test extends StatelessWidget {
const Test({
- Key key,
- @required this.index,
- @required this.a,
+ Key? key,
+ required this.index,
+ required this.a,
}) : super(key: key);
final int index;
diff --git a/pkg/analysis_server/test/services/refactoring/inline_local_test.dart b/pkg/analysis_server/test/services/refactoring/inline_local_test.dart
index e60b02b..6409980 100644
--- a/pkg/analysis_server/test/services/refactoring/inline_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/inline_local_test.dart
@@ -50,7 +50,7 @@
Future<void> test_bad_selectionParameter() async {
await indexTestUnit(r'''
-main(int test) {
+void f(int test) {
}
''');
_createRefactoring('test) {');
@@ -157,7 +157,7 @@
Future<void> test_OK_inSwitchCase() async {
await indexTestUnit('''
-main(int p) {
+void f(int p) {
switch (p) {
case 0:
int test = 42;
@@ -169,7 +169,7 @@
_createRefactoring('test =');
// validate change
return assertSuccessfulRefactoring('''
-main(int p) {
+void f(int p) {
switch (p) {
case 0:
print(42);
diff --git a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
index 04f61a5..0f5d160 100644
--- a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
@@ -203,10 +203,10 @@
Future<void> test_bad_propertyAccessor_synthetic() async {
await indexTestUnit(r'''
class A {
- int fff;
+ int fff = 0;
}
-main(A a) {
+void f(A a) {
print(a.fff);
}
''');
@@ -252,12 +252,12 @@
Future<void> test_cascadeInCascade() async {
await indexTestUnit(r'''
class Inner {
- String a;
- String b;
+ String a = '';
+ String b = '';
}
class Outer {
- Inner inner;
+ Inner inner = Inner();
}
void main() {
@@ -273,12 +273,12 @@
// validate change
return _assertSuccessfulRefactoring(r'''
class Inner {
- String a;
- String b;
+ String a = '';
+ String b = '';
}
class Outer {
- Inner inner;
+ Inner inner = Inner();
}
void main() {
@@ -923,10 +923,10 @@
Future<void> test_getter_classMember_instance() async {
await indexTestUnit(r'''
class A {
- int f;
+ int f = 0;
int get result => f + 1;
}
-main(A a) {
+void f(A a) {
print(a.result);
}
''');
@@ -934,9 +934,9 @@
// validate change
return _assertSuccessfulRefactoring(r'''
class A {
- int f;
+ int f = 0;
}
-main(A a) {
+void f(A a) {
print(a.f + 1);
}
''');
@@ -1063,7 +1063,7 @@
abstract class A {
test();
}
-main(A a) {
+void f(A a) {
print(a.test());
}
''');
@@ -1182,7 +1182,7 @@
}
mb() {}
}
-main(B b) {
+void f(B b) {
b.test();
}
''');
@@ -1199,7 +1199,7 @@
}
mb() {}
}
-main(B b) {
+void f(B b) {
b.ma();
b.mb();
}
@@ -1219,7 +1219,7 @@
B.mb();
}
}
-main(B b) {
+void f(B b) {
b.test();
}
''');
@@ -1237,7 +1237,7 @@
B.mb();
}
}
-main(B b) {
+void f(B b) {
B.mb();
A.ma();
B.mb();
@@ -1559,12 +1559,12 @@
Future<void> test_setter_classMember_instance() async {
await indexTestUnit(r'''
class A {
- int f;
+ int f = 0;
void set result(x) {
f = x + 1;
}
}
-main(A a) {
+void f(A a) {
a.result = 5;
}
''');
@@ -1572,9 +1572,9 @@
// validate change
return _assertSuccessfulRefactoring(r'''
class A {
- int f;
+ int f = 0;
}
-main(A a) {
+void f(A a) {
a.f = 5 + 1;
}
''');
@@ -1725,7 +1725,7 @@
test(bool a, bool b) {
return a || b;
}
-main(bool p, bool p2, bool p3) {
+void f(bool p, bool p2, bool p3) {
var res1 = p && test(p2, p3);
var res2 = p || test(p2, p3);
}
@@ -1733,7 +1733,7 @@
_createRefactoring('test(bool a, bool b)');
// validate change
return _assertSuccessfulRefactoring(r'''
-main(bool p, bool p2, bool p3) {
+void f(bool p, bool p2, bool p3) {
var res1 = p && (p2 || p3);
var res2 = p || p2 || p3;
}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
index 97731a6..24223d8 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
@@ -107,7 +107,7 @@
Future<void> test_checkFinalConditions_OK_noShadow() async {
await indexTestUnit('''
class A {
- int newName;
+ int newName = 0;
}
class B {
test() {}
@@ -128,7 +128,7 @@
Future<void> test_checkFinalConditions_OK_noShadow_nullVisibleRange() async {
await indexTestUnit('''
class A {
- int foo;
+ int foo = 0;
A(this.foo);
}
@@ -161,7 +161,7 @@
library my.lib;
import 'test.dart';
-main(A a) {
+void f(A a) {
a.test();
}
''');
@@ -184,7 +184,7 @@
await indexUnit('/home/test/lib/lib.dart', '''
import 'test.dart';
-main(A a) {
+void f(A a) {
print(a.foo);
}
''');
@@ -342,7 +342,7 @@
Future<void> test_checkFinalConditions_shadowsSuper_FieldElement() async {
await indexTestUnit('''
class A {
- int newName; // marker
+ int newName = 0; // marker
}
class B extends A {
test() {}
@@ -359,7 +359,7 @@
var status = await refactoring.checkFinalConditions();
assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
expectedMessage: "Renamed method will shadow field 'A.newName'.",
- expectedContextSearch: 'newName; // marker');
+ expectedContextSearch: 'newName = 0; // marker');
}
Future<void> test_checkFinalConditions_shadowsSuper_MethodElement() async {
@@ -435,10 +435,10 @@
Future<void> test_checkNewName_FieldElement() async {
await indexTestUnit('''
class A {
- int test;
+ int test = 0;
}
''');
- createRenameRefactoringAtString('test;');
+ createRenameRefactoringAtString('test = 0;');
// null
refactoring.newName = null;
assertRefactoringStatus(
@@ -480,7 +480,7 @@
Future<void> test_createChange_FieldElement() async {
await indexTestUnit('''
class A {
- int test; // marker
+ int test = 0; // marker
main() {
print(test);
test = 1;
@@ -507,7 +507,7 @@
}
''');
// configure refactoring
- createRenameRefactoringAtString('test; // marker');
+ createRenameRefactoringAtString('test = 0; // marker');
expect(refactoring.refactoringName, 'Rename Field');
expect(refactoring.elementKindName, 'field');
expect(refactoring.oldName, 'test');
@@ -515,7 +515,7 @@
// validate change
return assertSuccessfulRefactoring('''
class A {
- int newName; // marker
+ int newName = 0; // marker
main() {
print(newName);
newName = 1;
@@ -618,13 +618,13 @@
await indexTestUnit('''
typedef F(a);
class A {
- F test;
+ final F test;
+ A(this.test);
main() {
test(1);
}
}
-main() {
- A a = new A();
+void f(A a) {
a.test(2);
}
''');
@@ -637,13 +637,13 @@
return assertSuccessfulRefactoring('''
typedef F(a);
class A {
- F newName;
+ final F newName;
+ A(this.newName);
main() {
newName(1);
}
}
-main() {
- A a = new A();
+void f(A a) {
a.newName(2);
}
''');
@@ -850,7 +850,7 @@
void test() {}
}
-main(A a, B b) {
+void f(A a, B b) {
a.test();
b.test();
}
@@ -865,7 +865,7 @@
void newName() {}
}
-main(A a, B b) {
+void f(A a, B b) {
a.newName();
b.newName();
}
@@ -896,7 +896,7 @@
void test() {}
}
-main(A a) {
+void f(A a) {
a.test();
}
''');
@@ -912,7 +912,7 @@
void newName() {}
}
-main(A a) {
+void f(A a) {
a.newName();
}
''');
@@ -1035,8 +1035,9 @@
await indexTestUnit('''
class A<Test> {
Test field;
- List<Test> items;
- Test method(Test p) => null;
+ List<Test> items = [];
+ A(this.field);
+ Test method(Test p) => field;
}
''');
// configure refactoring
@@ -1049,8 +1050,9 @@
return assertSuccessfulRefactoring('''
class A<NewName> {
NewName field;
- List<NewName> items;
- NewName method(NewName p) => null;
+ List<NewName> items = [];
+ A(this.field);
+ NewName method(NewName p) => field;
}
''');
}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_extension_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_extension_member_test.dart
index ddff7c5..8490802 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_extension_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_extension_member_test.dart
@@ -312,9 +312,9 @@
Future<void> test_createChange_named_TypeParameterElement() async {
await indexTestUnit('''
extension E<Test> on int {
- Test get g1 => null;
- List<Test> get g2 => null;
- Test m(Test p) => null;
+ Test get g1 => throw 0;
+ List<Test> get g2 => throw 0;
+ Test m(Test p) => throw 0;
}
''');
// configure refactoring
@@ -326,9 +326,9 @@
// validate change
return assertSuccessfulRefactoring('''
extension E<NewName> on int {
- NewName get g1 => null;
- List<NewName> get g2 => null;
- NewName m(NewName p) => null;
+ NewName get g1 => throw 0;
+ List<NewName> get g2 => throw 0;
+ NewName m(NewName p) => throw 0;
}
''');
}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
index e13ea89..0e6b663 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
@@ -420,7 +420,7 @@
Future<void> test_createChange_parameter_named() async {
await indexTestUnit('''
-myFunction({int test}) {
+myFunction({required int test}) {
test = 1;
test += 2;
print(test);
@@ -436,7 +436,7 @@
refactoring.newName = 'newName';
// validate change
return assertSuccessfulRefactoring('''
-myFunction({int newName}) {
+myFunction({required int newName}) {
newName = 1;
newName += 2;
print(newName);
@@ -490,7 +490,7 @@
test_createChange_parameter_named_ofConstructor_genericClass() async {
await indexTestUnit('''
class A<T> {
- A({T test});
+ A({required T test});
}
main() {
@@ -505,7 +505,7 @@
// validate change
return assertSuccessfulRefactoring('''
class A<T> {
- A({T newName});
+ A({required T newName});
}
main() {
@@ -517,10 +517,10 @@
Future<void> test_createChange_parameter_named_ofMethod_genericClass() async {
await indexTestUnit('''
class A<T> {
- void foo({T test}) {}
+ void foo({required T test}) {}
}
-main(A<int> a) {
+void f(A<int> a) {
a.foo(test: 0);
}
''');
@@ -532,10 +532,10 @@
// validate change
return assertSuccessfulRefactoring('''
class A<T> {
- void foo({T newName}) {}
+ void foo({required T newName}) {}
}
-main(A<int> a) {
+void f(A<int> a) {
a.foo(newName: 0);
}
''');
@@ -545,12 +545,12 @@
await indexUnit('/home/test/lib/test2.dart', '''
library test2;
class A {
- void foo({int test}) {
+ void foo({int? test}) {
print(test);
}
}
class B extends A {
- void foo({int test}) {
+ void foo({int? test}) {
print(test);
}
}
@@ -563,7 +563,7 @@
new C().foo(test: 30);
}
class C extends A {
- void foo({int test}) {
+ void foo({int? test}) {
print(test);
}
}
@@ -581,7 +581,7 @@
new C().foo(newName: 30);
}
class C extends A {
- void foo({int newName}) {
+ void foo({int? newName}) {
print(newName);
}
}
@@ -589,12 +589,12 @@
assertFileChangeResult('/home/test/lib/test2.dart', '''
library test2;
class A {
- void foo({int newName}) {
+ void foo({int? newName}) {
print(newName);
}
}
class B extends A {
- void foo({int newName}) {
+ void foo({int? newName}) {
print(newName);
}
}
@@ -603,7 +603,7 @@
Future<void> test_createChange_parameter_optionalPositional() async {
await indexTestUnit('''
-myFunction([int test]) {
+myFunction([int? test]) {
test = 1;
test += 2;
print(test);
@@ -619,7 +619,7 @@
refactoring.newName = 'newName';
// validate change
return assertSuccessfulRefactoring('''
-myFunction([int newName]) {
+myFunction([int? newName]) {
newName = 1;
newName += 2;
print(newName);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/flutter_use_case_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/flutter_use_case_test.dart
index f6359cd..ee6c688 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/flutter_use_case_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/flutter_use_case_test.dart
@@ -2526,6 +2526,152 @@
''');
}
+ Future<void> test_widgets_Stack_overflow_clip() async {
+ setPackageContent('''
+class Stack {
+ const Stack({
+ @deprecated Overflow overflow: Overflow.clip,
+ Clip clipBehavior: Clip.hardEdge,
+ List<Widget> children: const <Widget>[]});
+}
+class Overflow {
+ static const Overflow clip = Overflow();
+ static const Overflow visible = Overflow();
+ const Overflow();
+}
+class Clip {
+ static const Clip hardEdge = Clip();
+ static const Clip none = Clip();
+ const Clip();
+}
+class Widget {}
+''');
+ addPackageDataFile('''
+version: 1
+transforms:
+ - title: "Migrate to 'clipBehavior'"
+ date: 2020-09-22
+ element:
+ uris: ['$importUri']
+ constructor: ''
+ inClass: 'Stack'
+ oneOf:
+ - if: "overflow == 'Overflow.clip'"
+ changes:
+ - kind: 'addParameter'
+ index: 0
+ name: 'clipBehavior'
+ style: optional_named
+ argumentValue:
+ expression: 'Clip.hardEdge'
+ requiredIf: "overflow == 'Overflow.clip'"
+ - kind: 'removeParameter'
+ name: 'overflow'
+ - if: "overflow == 'Overflow.visible'"
+ changes:
+ - kind: 'addParameter'
+ index: 0
+ name: 'clipBehavior'
+ style: optional_named
+ argumentValue:
+ expression: 'Clip.none'
+ requiredIf: "overflow == 'Overflow.visible'"
+ - kind: 'removeParameter'
+ name: 'overflow'
+ variables:
+ overflow:
+ kind: 'fragment'
+ value: 'arguments[overflow]'
+''');
+ await resolveTestCode('''
+import '$importUri';
+
+void f() {
+ const Stack(overflow: Overflow.clip, children: []);
+}
+''');
+ await assertHasFix('''
+import '$importUri';
+
+void f() {
+ const Stack(clipBehavior: Clip.hardEdge, children: []);
+}
+''');
+ }
+
+ Future<void> test_widgets_Stack_overflow_visible() async {
+ setPackageContent('''
+class Stack {
+ const Stack({
+ @deprecated Overflow overflow: Overflow.clip,
+ Clip clipBehavior: Clip.hardEdge,
+ List<Widget> children: const <Widget>[]});
+}
+class Overflow {
+ static const Overflow clip = Overflow();
+ static const Overflow visible = Overflow();
+ const Overflow();
+}
+class Clip {
+ static const Clip hardEdge = Clip();
+ static const Clip none = Clip();
+ const Clip();
+}
+class Widget {}
+''');
+ addPackageDataFile('''
+version: 1
+transforms:
+ - title: "Migrate to 'clipBehavior'"
+ date: 2020-09-22
+ element:
+ uris: ['$importUri']
+ constructor: ''
+ inClass: 'Stack'
+ oneOf:
+ - if: "overflow == 'Overflow.clip'"
+ changes:
+ - kind: 'addParameter'
+ index: 0
+ name: 'clipBehavior'
+ style: optional_named
+ argumentValue:
+ expression: 'Clip.hardEdge'
+ requiredIf: "overflow == 'Overflow.clip'"
+ - kind: 'removeParameter'
+ name: 'overflow'
+ - if: "overflow == 'Overflow.visible'"
+ changes:
+ - kind: 'addParameter'
+ index: 0
+ name: 'clipBehavior'
+ style: optional_named
+ argumentValue:
+ expression: 'Clip.none'
+ requiredIf: "overflow == 'Overflow.visible'"
+ - kind: 'removeParameter'
+ name: 'overflow'
+ variables:
+ overflow:
+ kind: 'fragment'
+ value: 'arguments[overflow]'
+''');
+ await resolveTestCode('''
+import '$importUri';
+
+void f() {
+ const Stack(overflow: Overflow.visible, children: []);
+}
+''');
+ await assertHasFix('''
+import '$importUri';
+
+void f() {
+ const Stack(clipBehavior: Clip.none, children: []);
+}
+''');
+ }
+
Future<void>
test_widgets_StatefulElement_inheritFromElement_deprecated() async {
setPackageContent('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart
index d67d30e..77e7e1f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart
@@ -101,7 +101,7 @@
import '$importUri';
void f(C c) {
- c.m2(b: 1, a: 0);
+ c.m2(a: 0, b: 1);
}
''');
}
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index 8a32c10..7693984 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -775,7 +775,7 @@
}
void _validateRefIndexed(IndexExpression node) {
- DartType targetType = node.target?.staticType;
+ DartType targetType = node.realTarget?.staticType;
if (!_isValidFfiNativeType(targetType, false, true)) {
final AstNode errorNode = node;
_errorReporter.reportErrorForNode(
@@ -795,7 +795,7 @@
}
void _validateRefPropertyAccess(PropertyAccess node) {
- DartType targetType = node.target?.staticType;
+ DartType targetType = node.realTarget?.staticType;
if (!_isValidFfiNativeType(targetType, false, true)) {
final AstNode errorNode = node;
_errorReporter.reportErrorForNode(
diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
index 36be56b..16f0bcd 100644
--- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
+++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
@@ -661,6 +661,8 @@
}
class Pointer<T extends NativeType> extends NativeType {
+ external factory Pointer.fromAddress(int ptr);
+
static Pointer<NativeFunction<T>> fromFunction<T extends Function>(
@DartRepresentationOf("T") Function f,
[Object exceptionalReturn]) {}
@@ -685,6 +687,12 @@
class DartRepresentationOf {
const DartRepresentationOf(String nativeType);
}
+
+extension StructPointer<T extends Struct> on Pointer<T> {
+ external T get ref;
+
+ external T operator [](int index);
+}
''',
)
]);
diff --git a/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart b/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart
index eee33d4..f783c71 100644
--- a/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart
@@ -9,11 +9,53 @@
main() {
defineReflectiveSuite(() {
+ defineReflectiveTests(NonConstantTypeArgumentNoWarningTest);
+ defineReflectiveTests(NonConstantTypeArgumentNoWarningTest2);
defineReflectiveTests(NonConstantTypeArgumentTest);
+ defineReflectiveTests(NonConstantTypeArgumentWarningTest);
});
}
@reflectiveTest
+class NonConstantTypeArgumentNoWarningTest extends PubPackageResolutionTest {
+ test_asFunction_R() async {
+ await assertNoErrorsInCode(r'''
+import 'dart:ffi';
+
+class MyStruct extends Struct {
+ @Uint8()
+ int myField;
+}
+
+void main(){
+ final pointer = Pointer<MyStruct>.fromAddress(0);
+ pointer.ref.myField = 1;
+}
+''');
+ }
+}
+
+@reflectiveTest
+class NonConstantTypeArgumentNoWarningTest2 extends PubPackageResolutionTest {
+ test_asFunction_R() async {
+ await assertNoErrorsInCode(r'''
+import 'dart:ffi';
+
+class MyStruct extends Struct {
+ @Uint8()
+ int myField;
+}
+
+void main(){
+ final pointer = Pointer<MyStruct>.fromAddress(0)
+ ..ref.myField = 1;
+ print(pointer);
+}
+''');
+ }
+}
+
+@reflectiveTest
class NonConstantTypeArgumentTest extends PubPackageResolutionTest {
test_asFunction_R() async {
await assertErrorsInCode(r'''
@@ -29,3 +71,15 @@
]);
}
}
+
+@reflectiveTest
+class NonConstantTypeArgumentWarningTest extends PubPackageResolutionTest {
+ test_asFunction_R() async {
+ await assertErrorsInCode(r'''
+import 'dart:ffi';
+
+T genericRef<T extends Struct>(Pointer<T> p) =>
+ p.ref;
+''', [error(FfiCode.NON_CONSTANT_TYPE_ARGUMENT_WARNING, 72, 5)]);
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart b/pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart
index 7073a39..85129db 100644
--- a/pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart
@@ -75,7 +75,9 @@
test_Pointer() async {
await assertErrorsInCode(r'''
import 'dart:ffi';
-class C extends Pointer {}
+class C extends Pointer {
+ external factory C();
+}
''', [
error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 7),
]);
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index db638dc..1fee87e 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -3316,10 +3316,15 @@
// In the body of an `async`, `await` is generated simply as `yield`.
var gen = emitGeneratorFn((_) => []);
// Return type of an async body is `Future<flatten(T)>`, where T is the
- // declared return type.
- var returnType = _types.flatten(function
+ // declared return type, unless T is Object. In that case the Object refers
+ // to a return type of `Future<Object?>`.
+ // TODO(nshahan) Use the Future type value when available on a FunctionNode.
+ var declaredReturnType = function
.computeThisFunctionType(_currentLibrary.nonNullable)
- .returnType);
+ .returnType;
+ var returnType = _coreTypes.isObject(declaredReturnType)
+ ? _coreTypes.objectNullableRawType
+ : _types.flatten(declaredReturnType);
return js.call('#.async(#, #)',
[emitLibraryName(_coreTypes.asyncLibrary), _emitType(returnType), gen]);
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/closure_context.dart b/pkg/front_end/lib/src/fasta/type_inference/closure_context.dart
index 4029c5c..78dc0c5 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/closure_context.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/closure_context.dart
@@ -546,75 +546,30 @@
statement.expression.fileOffset,
noLength)
..parent = statement;
- } else {
- DartType futureOrType =
- inferrer.computeGreatestClosure2(_returnContext);
- if (flattenedExpressionType is! VoidType &&
- !inferrer.typeSchemaEnvironment
- .performNullabilityAwareSubtypeCheck(
- flattenedExpressionType, futureValueType)
- .isSubtypeWhenUsingNullabilities()) {
- // It is a compile-time error if s is `return e;`, flatten(S) is not
- // void, S is not assignable to T_v, and flatten(S) is not a subtype
- // of T_v.
- statement.expression = inferrer.ensureAssignable(
- futureValueType, expressionType, statement.expression,
- fileOffset: statement.expression.fileOffset,
- runtimeCheckedType: futureOrType,
- declaredContextType: returnType,
- isVoidAllowed: false,
- errorTemplate: templateInvalidReturnAsync,
- nullabilityErrorTemplate: templateInvalidReturnAsyncNullability,
- nullabilityPartErrorTemplate:
- templateInvalidReturnAsyncPartNullability,
- nullabilityNullErrorTemplate:
- templateInvalidReturnAsyncNullabilityNull,
- nullabilityNullTypeErrorTemplate:
- templateInvalidReturnAsyncNullabilityNullType)
- ..parent = statement;
- }
- // For `return e`:
- // When `f` is an asynchronous non-generator with future value type
- // T_v, evaluation proceeds as follows:
- //
- // The expression `e` is evaluated to an object `o`.
- // If the run-time type of `o` is a subtype of `Future<T_v>`,
- // let `v` be a fresh variable bound to `o` and
- // evaluate `await v` to an object `r`;
- // otherwise let `r` be `o`.
- // A dynamic error occurs unless the dynamic type of `r`
- // is a subtype of the actual value of T_v.
- // Then the return statement `s` completes returning `r`.
- DartType futureType = new InterfaceType(
- inferrer.coreTypes.futureClass,
- Nullability.nonNullable,
- [futureValueType]);
- VariableDeclaration variable;
- Expression isOperand;
- Expression awaitOperand;
- Expression resultExpression;
- if (isPureExpression(statement.expression)) {
- isOperand = clonePureExpression(statement.expression);
- awaitOperand = clonePureExpression(statement.expression);
- resultExpression = statement.expression;
- } else {
- variable = createVariable(statement.expression, expressionType);
- isOperand = createVariableGet(variable);
- awaitOperand = createVariableGet(variable);
- resultExpression = createVariableGet(variable);
- }
- Expression replacement = new ConditionalExpression(
- new IsExpression(isOperand, futureType)
- ..fileOffset = statement.fileOffset,
- new AwaitExpression(awaitOperand)
- ..fileOffset = statement.fileOffset,
- resultExpression,
- futureOrType)
- ..fileOffset = statement.fileOffset;
- if (variable != null) {
- replacement = createLet(variable, replacement);
- }
- statement.expression = replacement..parent = statement;
+ } else if (flattenedExpressionType is! VoidType &&
+ !inferrer.typeSchemaEnvironment
+ .performNullabilityAwareSubtypeCheck(
+ flattenedExpressionType, futureValueType)
+ .isSubtypeWhenUsingNullabilities()) {
+ // It is a compile-time error if s is `return e;`, flatten(S) is not
+ // void, S is not assignable to T_v, and flatten(S) is not a subtype
+ // of T_v.
+ statement.expression = inferrer.ensureAssignable(
+ futureValueType, expressionType, statement.expression,
+ fileOffset: statement.expression.fileOffset,
+ runtimeCheckedType:
+ inferrer.computeGreatestClosure2(_returnContext),
+ declaredContextType: returnType,
+ isVoidAllowed: false,
+ errorTemplate: templateInvalidReturnAsync,
+ nullabilityErrorTemplate: templateInvalidReturnAsyncNullability,
+ nullabilityPartErrorTemplate:
+ templateInvalidReturnAsyncPartNullability,
+ nullabilityNullErrorTemplate:
+ templateInvalidReturnAsyncNullabilityNull,
+ nullabilityNullTypeErrorTemplate:
+ templateInvalidReturnAsyncNullabilityNullType)
+ ..parent = statement;
}
}
} else {
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 4dd7287..0b50fbb 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -2514,13 +2514,16 @@
// `void` if `B’` contains no `yield` expressions. Otherwise, let `M` be
// the least upper bound of the types of the `return` expressions in `B’`,
// or `void` if `B’` contains no `return` expressions.
+ DartType inferredReturnType;
if (needToSetReturnType) {
- DartType inferredReturnType = closureContext.inferReturnType(this,
+ inferredReturnType = closureContext.inferReturnType(this,
hasImplicitReturn: flowAnalysis.isReachable);
+ }
- // Then the result of inference is `<T0, ..., Tn>(R0 x0, ..., Rn xn) B`
- // with type `<T0, ..., Tn>(R0, ..., Rn) -> M'` (with some of the `Ri` and
- // `xi` denoted as optional or named parameters, if appropriate).
+ // Then the result of inference is `<T0, ..., Tn>(R0 x0, ..., Rn xn) B` with
+ // type `<T0, ..., Tn>(R0, ..., Rn) -> M’` (with some of the `Ri` and `xi`
+ // denoted as optional or named parameters, if appropriate).
+ if (needToSetReturnType) {
instrumentation?.record(uriForInstrumentation, fileOffset, 'returnType',
new InstrumentationValueForType(inferredReturnType));
function.returnType = inferredReturnType;
diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt
index e422e9d..572493d 100644
--- a/pkg/front_end/test/spell_checking_list_code.txt
+++ b/pkg/front_end/test/spell_checking_list_code.txt
@@ -868,7 +868,6 @@
printf
println
proc
-proceeds
producers
product
progresses
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index d3bc3e1a..55be1a1 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -737,7 +737,6 @@
unassignment
unawaited
unbreak
-uncaught
unconverted
uncover
uncovers
diff --git a/pkg/front_end/test/text_representation/data/expressions.dart b/pkg/front_end/test/text_representation/data/expressions.dart
index 4d70d21..bf8c23c 100644
--- a/pkg/front_end/test/text_representation/data/expressions.dart
+++ b/pkg/front_end/test/text_representation/data/expressions.dart
@@ -382,9 +382,7 @@
exprMap() => {0: "foo", 1: "bar"};
/*member: exprAwait:await o*/
-exprAwait(o) async {
- await o;
-}
+exprAwait(o) async => await o;
/*member: exprLoadLibrary:prefix.loadLibrary()*/
exprLoadLibrary() => prefix.loadLibrary();
diff --git a/pkg/front_end/test/text_representation/text_representation_test.dart b/pkg/front_end/test/text_representation/text_representation_test.dart
index d9019d0..f804385 100644
--- a/pkg/front_end/test/text_representation/text_representation_test.dart
+++ b/pkg/front_end/test/text_representation/text_representation_test.dart
@@ -156,16 +156,14 @@
@override
String computeMemberValue(Id id, Member node) {
+ if (node.name.text == 'stmtVariableDeclarationMulti') {
+ print(node);
+ }
if (node.name.text.startsWith(expressionMarker)) {
if (node is Procedure) {
Statement body = node.function.body;
if (body is ReturnStatement) {
return body.expression.toText(strategy);
- } else if (body is Block &&
- body.statements.isNotEmpty &&
- body.statements.first is ExpressionStatement) {
- ExpressionStatement statement = body.statements.first;
- return statement.expression.toText(strategy);
}
} else if (node is Field && node.initializer != null) {
return node.initializer.toText(strategy);
diff --git a/pkg/front_end/testcases/late_lowering/later.dart.strong.expect b/pkg/front_end/testcases/late_lowering/later.dart.strong.expect
index 74694bf..0b84933 100644
--- a/pkg/front_end/testcases/late_lowering/later.dart.strong.expect
+++ b/pkg/front_end/testcases/late_lowering/later.dart.strong.expect
@@ -134,28 +134,28 @@
await for (core::String s in asy::Stream::fromIterable<core::String>(<core::String>["hest"])) {
core::print(s);
}
- return let final core::String #t8 = "hest" in #t8 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t8 : #t8;
+ return "hest";
}
static method fisk() → dynamic async {
lowered core::String? #s1;
function #s1#get() → core::String
- return let final core::String? #t9 = #s1 in #t9.==(null) ?{core::String} #s1 = invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:40:20: Error: `await` expressions are not supported in late local initializers.
+ return let final core::String? #t8 = #s1 in #t8.==(null) ?{core::String} #s1 = invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:40:20: Error: `await` expressions are not supported in late local initializers.
late String s1 = await hest(); // Error.
- ^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} core::String : #t9{core::String};
- function #s1#set(core::String #t10) → dynamic
- return #s1 = #t10;
+ ^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} core::String : #t8{core::String};
+ function #s1#set(core::String #t9) → dynamic
+ return #s1 = #t9;
lowered core::String? #s2;
function #s2#get() → core::String
- return let final core::String? #t11 = #s2 in #t11.==(null) ?{core::String} #s2 = "${#C1}${invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:41:30: Error: `await` expressions are not supported in late local initializers.
+ return let final core::String? #t10 = #s2 in #t10.==(null) ?{core::String} #s2 = "${#C1}${invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:41:30: Error: `await` expressions are not supported in late local initializers.
late String s2 = '\${fisk}\${await hest()}\${fisk}'; // Error.
- ^^^^^"}${#C1}" : #t11{core::String};
- function #s2#set(core::String #t12) → dynamic
- return #s2 = #t12;
+ ^^^^^"}${#C1}" : #t10{core::String};
+ function #s2#set(core::String #t11) → dynamic
+ return #s2 = #t11;
lowered core::Function? #f;
function #f#get() → core::Function
- return let final core::Function? #t13 = #f in #t13.==(null) ?{core::Function} #f = () → asy::Future<dynamic> async => let final dynamic #t14 = await self::hest() in #t14 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t14 : #t14 : #t13{core::Function};
- function #f#set(core::Function #t15) → dynamic
- return #f = #t15;
+ return let final core::Function? #t12 = #f in #t12.==(null) ?{core::Function} #f = () → asy::Future<dynamic> async => await self::hest() : #t12{core::Function};
+ function #f#set(core::Function #t13) → dynamic
+ return #f = #t13;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/late_lowering/later.dart.strong.transformed.expect b/pkg/front_end/testcases/late_lowering/later.dart.strong.transformed.expect
index 09236c4..12f0ed3 100644
--- a/pkg/front_end/testcases/late_lowering/later.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/late_lowering/later.dart.strong.transformed.expect
@@ -148,8 +148,6 @@
dynamic :saved_try_context_var1;
dynamic :exception0;
dynamic :stack_trace0;
- FutureOr<dynamic>:async_temporary_0;
- FutureOr<dynamic>:async_temporary_1;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
@@ -177,15 +175,7 @@
:result;
}
}
- final core::String #t11 = "hest";
- if(#t11 is asy::Future<dynamic>) {
- [yield] let dynamic #t12 = asy::_awaitHelper(#t11, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_1 = _in::unsafeCast<core::String>(:result);
- }
- else {
- :async_temporary_1 = #t11;
- }
- :return_value = :async_temporary_1;
+ :return_value = "hest";
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -214,21 +204,21 @@
{
lowered core::String? #s1;
function #s1#get() → core::String
- return let final core::String? #t13 = #s1 in #t13.==(null) ?{core::String} #s1 = invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:40:20: Error: `await` expressions are not supported in late local initializers.
+ return let final core::String? #t11 = #s1 in #t11.==(null) ?{core::String} #s1 = invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:40:20: Error: `await` expressions are not supported in late local initializers.
late String s1 = await hest(); // Error.
- ^^^^^" : #t13{core::String};
- function #s1#set(core::String #t14) → dynamic
- return #s1 = #t14;
+ ^^^^^" : #t11{core::String};
+ function #s1#set(core::String #t12) → dynamic
+ return #s1 = #t12;
lowered core::String? #s2;
function #s2#get() → core::String
- return let final core::String? #t15 = #s2 in #t15.==(null) ?{core::String} #s2 = "${#C1}${invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:41:30: Error: `await` expressions are not supported in late local initializers.
+ return let final core::String? #t13 = #s2 in #t13.==(null) ?{core::String} #s2 = "${#C1}${invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:41:30: Error: `await` expressions are not supported in late local initializers.
late String s2 = '\${fisk}\${await hest()}\${fisk}'; // Error.
- ^^^^^"}${#C1}" : #t15{core::String};
- function #s2#set(core::String #t16) → dynamic
- return #s2 = #t16;
+ ^^^^^"}${#C1}" : #t13{core::String};
+ function #s2#set(core::String #t14) → dynamic
+ return #s2 = #t14;
lowered core::Function? #f;
function #f#get() → core::Function
- return let final core::Function? #t17 = #f in #t17.==(null) ?{core::Function} #f = () → asy::Future<dynamic> /* originally async */ {
+ return let final core::Function? #t15 = #f in #t15.==(null) ?{core::Function} #f = () → asy::Future<dynamic> /* originally async */ {
final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
core::bool* :is_sync = false;
FutureOr<dynamic>? :return_value;
@@ -237,21 +227,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
- [yield] let dynamic #t18 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null;
- final dynamic #t19 = :result;
- if(#t19 is asy::Future<dynamic>) {
- [yield] let dynamic #t20 = asy::_awaitHelper(#t19, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = :result;
- }
- else {
- :async_temporary_0 = #t19;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t16 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result;
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -265,9 +246,9 @@
:async_op.call();
:is_sync = true;
return :async_future;
- } : #t17{core::Function};
- function #f#set(core::Function #t21) → dynamic
- return #f = #t21;
+ } : #t15{core::Function};
+ function #f#set(core::Function #t17) → dynamic
+ return #f = #t17;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
return;
@@ -289,4 +270,4 @@
Extra constant evaluation status:
Evaluated: VariableGet @ org-dartlang-testcase:///later.dart:46:18 -> IntConstant(42)
-Extra constant evaluation: evaluated: 234, effectively constant: 1
+Extra constant evaluation: evaluated: 207, effectively constant: 1
diff --git a/pkg/front_end/testcases/late_lowering/later.dart.weak.expect b/pkg/front_end/testcases/late_lowering/later.dart.weak.expect
index 0d0243b..7123dd80 100644
--- a/pkg/front_end/testcases/late_lowering/later.dart.weak.expect
+++ b/pkg/front_end/testcases/late_lowering/later.dart.weak.expect
@@ -154,7 +154,7 @@
await for (core::String s in asy::Stream::fromIterable<core::String>(<core::String>["hest"])) {
core::print(s);
}
- return let final core::String #t8 = "hest" in #t8 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t8 : #t8;
+ return "hest";
}
static method fisk() → dynamic async {
lowered core::String? #s1;
@@ -168,9 +168,9 @@
}
return #s1{core::String};
}
- function #s1#set(core::String #t9) → dynamic {
+ function #s1#set(core::String #t8) → dynamic {
#s1#isSet = true;
- return #s1 = #t9;
+ return #s1 = #t8;
}
lowered core::String? #s2;
lowered core::bool #s2#isSet = false;
@@ -183,22 +183,22 @@
}
return #s2{core::String};
}
- function #s2#set(core::String #t10) → dynamic {
+ function #s2#set(core::String #t9) → dynamic {
#s2#isSet = true;
- return #s2 = #t10;
+ return #s2 = #t9;
}
lowered core::Function? #f;
lowered core::bool #f#isSet = false;
function #f#get() → core::Function {
if(!#f#isSet) {
- #f = () → asy::Future<dynamic> async => let final dynamic #t11 = await self::hest() in #t11 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t11 : #t11;
+ #f = () → asy::Future<dynamic> async => await self::hest();
#f#isSet = true;
}
return #f{core::Function};
}
- function #f#set(core::Function #t12) → dynamic {
+ function #f#set(core::Function #t10) → dynamic {
#f#isSet = true;
- return #f = #t12;
+ return #f = #t10;
}
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/late_lowering/later.dart.weak.transformed.expect b/pkg/front_end/testcases/late_lowering/later.dart.weak.transformed.expect
index 7fe5b1b..3bcf2b7 100644
--- a/pkg/front_end/testcases/late_lowering/later.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/late_lowering/later.dart.weak.transformed.expect
@@ -168,8 +168,6 @@
dynamic :saved_try_context_var1;
dynamic :exception0;
dynamic :stack_trace0;
- FutureOr<dynamic>:async_temporary_0;
- FutureOr<dynamic>:async_temporary_1;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
@@ -197,15 +195,7 @@
:result;
}
}
- final core::String #t11 = "hest";
- if(#t11 is asy::Future<dynamic>) {
- [yield] let dynamic #t12 = asy::_awaitHelper(#t11, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_1 = _in::unsafeCast<core::String>(:result);
- }
- else {
- :async_temporary_1 = #t11;
- }
- :return_value = :async_temporary_1;
+ :return_value = "hest";
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -243,9 +233,9 @@
}
return #s1{core::String};
}
- function #s1#set(core::String #t13) → dynamic {
+ function #s1#set(core::String #t11) → dynamic {
#s1#isSet = true;
- return #s1 = #t13;
+ return #s1 = #t11;
}
lowered core::String? #s2;
lowered core::bool #s2#isSet = false;
@@ -258,9 +248,9 @@
}
return #s2{core::String};
}
- function #s2#set(core::String #t14) → dynamic {
+ function #s2#set(core::String #t12) → dynamic {
#s2#isSet = true;
- return #s2 = #t14;
+ return #s2 = #t12;
}
lowered core::Function? #f;
lowered core::bool #f#isSet = false;
@@ -275,21 +265,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
- [yield] let dynamic #t15 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null;
- final dynamic #t16 = :result;
- if(#t16 is asy::Future<dynamic>) {
- [yield] let dynamic #t17 = asy::_awaitHelper(#t16, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = :result;
- }
- else {
- :async_temporary_0 = #t16;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t13 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result;
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -308,9 +289,9 @@
}
return #f{core::Function};
}
- function #f#set(core::Function #t18) → dynamic {
+ function #f#set(core::Function #t14) → dynamic {
#f#isSet = true;
- return #f = #t18;
+ return #f = #t14;
}
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.strong.expect b/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.strong.expect
index 6769397..0e66be9 100644
--- a/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.strong.expect
@@ -263,35 +263,35 @@
}
function local() → FutureOr<self::A> async {
if(true) {
- return let final self::B? #t6 = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
+ return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
- ^" in x as{TypeError,ForNonNullableByDefault} self::A in #t6 is asy::Future<self::A> ?{FutureOr<self::A>} await #t6 : #t6;
+ ^" in x as{TypeError,ForNonNullableByDefault} self::A;
}
else {
- return let final asy::Future<self::B?> #t8 = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
+ return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
- 'Future' is from 'dart:async'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return new Future<B?>.value(x); // Error.
- ^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A in #t8 is asy::Future<self::A> ?{FutureOr<self::A>} await #t8 : #t8;
+ ^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A;
}
}
- return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
^" in x as{TypeError,ForNonNullableByDefault} self::A;
}
static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, core::Map<core::List<self::B?>, core::List<self::B?>> m) → core::List<self::A> {
- self::barContext(let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ self::barContext(let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
barContext(x); // Error.
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>);
- core::List<self::A> y = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ core::List<self::A> y = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
@@ -314,16 +314,16 @@
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
<List<A>, List<A>>{...m}; // Error.
^"};
- for (final core::List<self::B?> #t13 in l) {
- core::List<self::A> y = let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ for (final core::List<self::B?> #t11 in l) {
+ core::List<self::A> y = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
Try changing the type of the variable.
for (List<A> y in l) {} // Error.
- ^" in #t13 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
+ ^" in #t11 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
}
- return let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ return let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
@@ -331,52 +331,52 @@
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>;
}
static method baz(self::C c) → void {
- self::bazContext(let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
+ self::bazContext(let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
bazContext(c);
- ^" in (let final self::C #t17 = c in #t17.==(null) ?{() → core::num?} null : #t17.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
+ ^" in (let final self::C #t15 = c in #t15.==(null) ?{() → core::num?} null : #t15.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
}
static method boz(Null x) → self::A {
- self::fooContext(let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
+ self::fooContext(let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
fooContext(x); // Error.
^" in x as{TypeError,ForNonNullableByDefault} self::A);
- self::fooContext(let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
+ self::fooContext(let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
fooContext(null); // Error.
^" in null as{TypeError,ForNonNullableByDefault} self::A);
- self::A a1 = let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
+ self::A a1 = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
A a1 = x; // Error.
^" in x as{TypeError,ForNonNullableByDefault} self::A;
- self::A a2 = let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
+ self::A a2 = let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
A a2 = null; // Error.
^" in null as{TypeError,ForNonNullableByDefault} self::A;
if(true) {
- return let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
+ return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
^" in x as{TypeError,ForNonNullableByDefault} self::A;
}
else {
- return let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
+ return let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return null; // Error.
^" in null as{TypeError,ForNonNullableByDefault} self::A;
}
function local() → FutureOr<self::A> async {
if(true) {
- return let final Null #t24 = let final<BottomType> #t25 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
+ return let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return null; // Error.
- ^" in null as{TypeError,ForNonNullableByDefault} self::A in #t24 is asy::Future<self::A> ?{FutureOr<self::A>} await #t24 : #t24;
+ ^" in null as{TypeError,ForNonNullableByDefault} self::A;
}
else {
- return let final asy::Future<Null> #t26 = let final<BottomType> #t27 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
+ return let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
- 'Future' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return new Future<Null>.value(null); // Error.
- ^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A in #t26 is asy::Future<self::A> ?{FutureOr<self::A>} await #t26 : #t26;
+ ^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A;
}
}
}
diff --git a/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.strong.transformed.expect
index c855781..bdd60d8 100644
--- a/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.strong.transformed.expect
@@ -180,7 +180,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
import "dart:async";
@@ -281,45 +280,25 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<self::A>:async_temporary_0;
- FutureOr<self::A>:async_temporary_1;
- FutureOr<self::A>:async_temporary_2;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
if(true) {
- final self::B? #t10 = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
+ :return_value = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
- ^" in let self::B? #t12 = x in #t12.==(null) ?{self::A} #t12 as{TypeError,ForNonNullableByDefault} self::A : #t12{self::A};
- if(#t10 is asy::Future<self::A>) {
- [yield] let dynamic #t13 = asy::_awaitHelper(#t10, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<self::B?>(:result);
- }
- else {
- :async_temporary_0 = #t10;
- }
- :return_value = :async_temporary_0;
+ ^" in let self::B? #t11 = x in #t11.==(null) ?{self::A} #t11 as{TypeError,ForNonNullableByDefault} self::A : #t11{self::A};
break #L4;
}
else {
- final asy::Future<self::B?> #t14 = let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
+ :return_value = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
- 'Future' is from 'dart:async'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return new Future<B?>.value(x); // Error.
^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A;
- if(#t14 is asy::Future<self::A>) {
- [yield] let dynamic #t16 = asy::_awaitHelper(#t14, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<self::B?>(:result);
- }
- else {
- :async_temporary_2 = #t14;
- }
- :return_value = :async_temporary_2;
break #L4;
}
}
@@ -335,20 +314,20 @@
:is_sync = true;
return :async_future;
}
- return let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
+ return let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
- ^" in let self::B? #t18 = x in #t18.==(null) ?{self::A} #t18 as{TypeError,ForNonNullableByDefault} self::A : #t18{self::A};
+ ^" in let self::B? #t14 = x in #t14.==(null) ?{self::A} #t14 as{TypeError,ForNonNullableByDefault} self::A : #t14{self::A};
}
static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, core::Map<core::List<self::B?>, core::List<self::B?>> m) → core::List<self::A> {
- self::barContext(let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ self::barContext(let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
barContext(x); // Error.
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>);
- core::List<self::A> y = let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ core::List<self::A> y = let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
@@ -374,19 +353,19 @@
{
core::Iterator<core::List<self::B?>> :sync-for-iterator = l.{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
- final core::List<self::B?> #t21 = :sync-for-iterator.{core::Iterator::current};
+ final core::List<self::B?> #t17 = :sync-for-iterator.{core::Iterator::current};
{
- core::List<self::A> y = let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ core::List<self::A> y = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
Try changing the type of the variable.
for (List<A> y in l) {} // Error.
- ^" in #t21 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
+ ^" in #t17 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
}
}
}
- return let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ return let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
@@ -394,38 +373,38 @@
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>;
}
static method baz(self::C c) → void {
- self::bazContext(let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
+ self::bazContext(let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
bazContext(c);
- ^" in (let final self::C #t25 = c in #t25.==(null) ?{() → core::num?} null : #t25.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
+ ^" in (let final self::C #t21 = c in #t21.==(null) ?{() → core::num?} null : #t21.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
}
static method boz(Null x) → self::A {
- self::fooContext(let final<BottomType> #t26 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
+ self::fooContext(let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
fooContext(x); // Error.
- ^" in let Null #t27 = x in #t27.==(null) ?{self::A} #t27 as{TypeError,ForNonNullableByDefault} self::A : #t27{self::A});
- self::fooContext(let final<BottomType> #t28 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
+ ^" in let Null #t23 = x in #t23.==(null) ?{self::A} #t23 as{TypeError,ForNonNullableByDefault} self::A : #t23{self::A});
+ self::fooContext(let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
fooContext(null); // Error.
- ^" in let Null #t29 = null in #t29.==(null) ?{self::A} #t29 as{TypeError,ForNonNullableByDefault} self::A : #t29{self::A});
- self::A a1 = let final<BottomType> #t30 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
+ ^" in let Null #t25 = null in #t25.==(null) ?{self::A} #t25 as{TypeError,ForNonNullableByDefault} self::A : #t25{self::A});
+ self::A a1 = let final<BottomType> #t26 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
A a1 = x; // Error.
- ^" in let Null #t31 = x in #t31.==(null) ?{self::A} #t31 as{TypeError,ForNonNullableByDefault} self::A : #t31{self::A};
- self::A a2 = let final<BottomType> #t32 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
+ ^" in let Null #t27 = x in #t27.==(null) ?{self::A} #t27 as{TypeError,ForNonNullableByDefault} self::A : #t27{self::A};
+ self::A a2 = let final<BottomType> #t28 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
A a2 = null; // Error.
- ^" in let Null #t33 = null in #t33.==(null) ?{self::A} #t33 as{TypeError,ForNonNullableByDefault} self::A : #t33{self::A};
+ ^" in let Null #t29 = null in #t29.==(null) ?{self::A} #t29 as{TypeError,ForNonNullableByDefault} self::A : #t29{self::A};
if(true) {
- return let final<BottomType> #t34 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
+ return let final<BottomType> #t30 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
- ^" in let Null #t35 = x in #t35.==(null) ?{self::A} #t35 as{TypeError,ForNonNullableByDefault} self::A : #t35{self::A};
+ ^" in let Null #t31 = x in #t31.==(null) ?{self::A} #t31 as{TypeError,ForNonNullableByDefault} self::A : #t31{self::A};
}
else {
- return let final<BottomType> #t36 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
+ return let final<BottomType> #t32 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return null; // Error.
- ^" in let Null #t37 = null in #t37.==(null) ?{self::A} #t37 as{TypeError,ForNonNullableByDefault} self::A : #t37{self::A};
+ ^" in let Null #t33 = null in #t33.==(null) ?{self::A} #t33 as{TypeError,ForNonNullableByDefault} self::A : #t33{self::A};
}
function local() → FutureOr<self::A> /* originally async */ {
final asy::_Future<self::A> :async_future = new asy::_Future::•<self::A>();
@@ -435,43 +414,23 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<self::A>:async_temporary_0;
- FutureOr<self::A>:async_temporary_1;
- FutureOr<self::A>:async_temporary_2;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L5:
{
if(true) {
- final Null #t38 = let final<BottomType> #t39 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
+ :return_value = let final<BottomType> #t34 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return null; // Error.
- ^" in let Null #t40 = null in #t40.==(null) ?{self::A} #t40 as{TypeError,ForNonNullableByDefault} self::A : #t40{self::A};
- if(#t38 is asy::Future<self::A>) {
- [yield] let dynamic #t41 = asy::_awaitHelper(#t38, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_0 = #t38;
- }
- :return_value = :async_temporary_0;
+ ^" in let Null #t35 = null in #t35.==(null) ?{self::A} #t35 as{TypeError,ForNonNullableByDefault} self::A : #t35{self::A};
break #L5;
}
else {
- final asy::Future<Null> #t42 = let final<BottomType> #t43 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
+ :return_value = let final<BottomType> #t36 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
- 'Future' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return new Future<Null>.value(null); // Error.
^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A;
- if(#t42 is asy::Future<self::A>) {
- [yield] let dynamic #t44 = asy::_awaitHelper(#t42, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_2 = #t42;
- }
- :return_value = :async_temporary_2;
break #L5;
}
}
@@ -507,7 +466,7 @@
Evaluated: MethodInvocation @ org-dartlang-testcase:///assignability_error_messages.dart:77:14 -> BoolConstant(true)
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:77:14 -> NullConstant(null)
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:77:14 -> NullConstant(null)
-Extra constant evaluation: evaluated: 266, effectively constant: 12
+Extra constant evaluation: evaluated: 210, effectively constant: 12
Constructor coverage from constants:
diff --git a/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.weak.expect b/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.weak.expect
index 6769397..0e66be9 100644
--- a/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.weak.expect
@@ -263,35 +263,35 @@
}
function local() → FutureOr<self::A> async {
if(true) {
- return let final self::B? #t6 = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
+ return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
- ^" in x as{TypeError,ForNonNullableByDefault} self::A in #t6 is asy::Future<self::A> ?{FutureOr<self::A>} await #t6 : #t6;
+ ^" in x as{TypeError,ForNonNullableByDefault} self::A;
}
else {
- return let final asy::Future<self::B?> #t8 = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
+ return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
- 'Future' is from 'dart:async'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return new Future<B?>.value(x); // Error.
- ^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A in #t8 is asy::Future<self::A> ?{FutureOr<self::A>} await #t8 : #t8;
+ ^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A;
}
}
- return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
^" in x as{TypeError,ForNonNullableByDefault} self::A;
}
static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, core::Map<core::List<self::B?>, core::List<self::B?>> m) → core::List<self::A> {
- self::barContext(let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ self::barContext(let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
barContext(x); // Error.
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>);
- core::List<self::A> y = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ core::List<self::A> y = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
@@ -314,16 +314,16 @@
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
<List<A>, List<A>>{...m}; // Error.
^"};
- for (final core::List<self::B?> #t13 in l) {
- core::List<self::A> y = let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ for (final core::List<self::B?> #t11 in l) {
+ core::List<self::A> y = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
Try changing the type of the variable.
for (List<A> y in l) {} // Error.
- ^" in #t13 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
+ ^" in #t11 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
}
- return let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ return let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
@@ -331,52 +331,52 @@
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>;
}
static method baz(self::C c) → void {
- self::bazContext(let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
+ self::bazContext(let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
bazContext(c);
- ^" in (let final self::C #t17 = c in #t17.==(null) ?{() → core::num?} null : #t17.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
+ ^" in (let final self::C #t15 = c in #t15.==(null) ?{() → core::num?} null : #t15.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
}
static method boz(Null x) → self::A {
- self::fooContext(let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
+ self::fooContext(let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
fooContext(x); // Error.
^" in x as{TypeError,ForNonNullableByDefault} self::A);
- self::fooContext(let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
+ self::fooContext(let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
fooContext(null); // Error.
^" in null as{TypeError,ForNonNullableByDefault} self::A);
- self::A a1 = let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
+ self::A a1 = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
A a1 = x; // Error.
^" in x as{TypeError,ForNonNullableByDefault} self::A;
- self::A a2 = let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
+ self::A a2 = let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
A a2 = null; // Error.
^" in null as{TypeError,ForNonNullableByDefault} self::A;
if(true) {
- return let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
+ return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
^" in x as{TypeError,ForNonNullableByDefault} self::A;
}
else {
- return let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
+ return let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return null; // Error.
^" in null as{TypeError,ForNonNullableByDefault} self::A;
}
function local() → FutureOr<self::A> async {
if(true) {
- return let final Null #t24 = let final<BottomType> #t25 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
+ return let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return null; // Error.
- ^" in null as{TypeError,ForNonNullableByDefault} self::A in #t24 is asy::Future<self::A> ?{FutureOr<self::A>} await #t24 : #t24;
+ ^" in null as{TypeError,ForNonNullableByDefault} self::A;
}
else {
- return let final asy::Future<Null> #t26 = let final<BottomType> #t27 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
+ return let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
- 'Future' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return new Future<Null>.value(null); // Error.
- ^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A in #t26 is asy::Future<self::A> ?{FutureOr<self::A>} await #t26 : #t26;
+ ^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A;
}
}
}
diff --git a/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.weak.transformed.expect
index 242b2b4..4ba3fa1 100644
--- a/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/assignability_error_messages.dart.weak.transformed.expect
@@ -180,7 +180,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
import "dart:async";
@@ -281,45 +280,25 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<self::A>:async_temporary_0;
- FutureOr<self::A>:async_temporary_1;
- FutureOr<self::A>:async_temporary_2;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
if(true) {
- final self::B? #t6 = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
+ :return_value = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
^" in x;
- if(#t6 is asy::Future<self::A>) {
- [yield] let dynamic #t8 = asy::_awaitHelper(#t6, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<self::B?>(:result);
- }
- else {
- :async_temporary_0 = #t6;
- }
- :return_value = :async_temporary_0;
break #L4;
}
else {
- final asy::Future<self::B?> #t9 = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
+ :return_value = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
- 'Future' is from 'dart:async'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return new Future<B?>.value(x); // Error.
^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A;
- if(#t9 is asy::Future<self::A>) {
- [yield] let dynamic #t11 = asy::_awaitHelper(#t9, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<self::B?>(:result);
- }
- else {
- :async_temporary_2 = #t9;
- }
- :return_value = :async_temporary_2;
break #L4;
}
}
@@ -335,20 +314,20 @@
:is_sync = true;
return :async_future;
}
- return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
^" in x;
}
static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, core::Map<core::List<self::B?>, core::List<self::B?>> m) → core::List<self::A> {
- self::barContext(let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ self::barContext(let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
barContext(x); // Error.
^" in x);
- core::List<self::A> y = let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ core::List<self::A> y = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
@@ -374,19 +353,19 @@
{
core::Iterator<core::List<self::B?>> :sync-for-iterator = l.{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
- final core::List<self::B?> #t15 = :sync-for-iterator.{core::Iterator::current};
+ final core::List<self::B?> #t11 = :sync-for-iterator.{core::Iterator::current};
{
- core::List<self::A> y = let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ core::List<self::A> y = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
Try changing the type of the variable.
for (List<A> y in l) {} // Error.
- ^" in #t15;
+ ^" in #t11;
}
}
}
- return let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
+ return let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
- 'List' is from 'dart:core'.
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
@@ -394,35 +373,35 @@
^" in x;
}
static method baz(self::C c) → void {
- self::bazContext(let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
+ self::bazContext(let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
bazContext(c);
- ^" in let final self::C #t19 = c in #t19.==(null) ?{() → core::num?} null : #t19.{self::C::call});
+ ^" in let final self::C #t15 = c in #t15.==(null) ?{() → core::num?} null : #t15.{self::C::call});
}
static method boz(Null x) → self::A {
- self::fooContext(let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
+ self::fooContext(let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
fooContext(x); // Error.
^" in x);
- self::fooContext(let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
+ self::fooContext(let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
fooContext(null); // Error.
^" in null);
- self::A a1 = let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
+ self::A a1 = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
A a1 = x; // Error.
^" in x;
- self::A a2 = let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
+ self::A a2 = let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
A a2 = null; // Error.
^" in null;
if(true) {
- return let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
+ return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return x; // Error.
^" in x;
}
else {
- return let final<BottomType> #t25 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
+ return let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return null; // Error.
^" in null;
@@ -435,43 +414,23 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<self::A>:async_temporary_0;
- FutureOr<self::A>:async_temporary_1;
- FutureOr<self::A>:async_temporary_2;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L5:
{
if(true) {
- final Null #t26 = let final<BottomType> #t27 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
+ :return_value = let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return null; // Error.
^" in null;
- if(#t26 is asy::Future<self::A>) {
- [yield] let dynamic #t28 = asy::_awaitHelper(#t26, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_0 = #t26;
- }
- :return_value = :async_temporary_0;
break #L5;
}
else {
- final asy::Future<Null> #t29 = let final<BottomType> #t30 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
+ :return_value = let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
- 'Future' is from 'dart:async'.
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
return new Future<Null>.value(null); // Error.
^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A;
- if(#t29 is asy::Future<self::A>) {
- [yield] let dynamic #t31 = asy::_awaitHelper(#t29, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_2 = #t29;
- }
- :return_value = :async_temporary_2;
break #L5;
}
}
diff --git a/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.strong.expect b/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.strong.expect
index bda20dd..f39bdfbd 100644
--- a/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.strong.expect
@@ -21,7 +21,7 @@
else {
throw core::Exception::•("Invalid response type");
}
- return let final self::TestMixin::T% #t1 = result in #t1 is asy::Future<self::TestMixin::T%> ?{FutureOr<self::TestMixin::T%>} await #t1 : #t1;
+ return result;
}
}
class PagingResponse<T extends core::Object? = dynamic> extends core::Object {
diff --git a/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.strong.transformed.expect
index e23e8dd..76b3473 100644
--- a/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.strong.transformed.expect
@@ -14,7 +14,6 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<self::TestMixin::T%>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
@@ -36,15 +35,7 @@
else {
throw core::Exception::•("Invalid response type");
}
- final self::TestMixin::T% #t2 = result;
- if(#t2 is asy::Future<self::TestMixin::T%>) {
- [yield] let dynamic #t3 = asy::_awaitHelper(#t2, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<self::TestMixin::T%>(:result);
- }
- else {
- :async_temporary_0 = #t2;
- }
- :return_value = :async_temporary_0;
+ :return_value = result;
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -91,12 +82,11 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L2:
{
- [yield] let dynamic #t4 = asy::_awaitHelper(fetch, :async_op_then, :async_op_error, :async_op) in null;
+ [yield] let dynamic #t2 = asy::_awaitHelper(fetch, :async_op_then, :async_op_error, :async_op) in null;
final self::Response<core::String> response = _in::unsafeCast<self::Response<core::String>>(:result);
core::String result;
if(response is{ForNonNullableByDefault} self::Response<dynamic>) {
@@ -113,15 +103,7 @@
else {
throw core::Exception::•("Invalid response type");
}
- final core::String #t5 = result;
- if(#t5 is asy::Future<core::String>) {
- [yield] let dynamic #t6 = asy::_awaitHelper(#t5, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::String>(:result);
- }
- else {
- :async_temporary_0 = #t5;
- }
- :return_value = :async_temporary_0;
+ :return_value = result;
break #L2;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -159,12 +141,11 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L3:
{
- [yield] let dynamic #t7 = asy::_awaitHelper(fetch, :async_op_then, :async_op_error, :async_op) in null;
+ [yield] let dynamic #t3 = asy::_awaitHelper(fetch, :async_op_then, :async_op_error, :async_op) in null;
final self::PagingResponse<core::String> response = _in::unsafeCast<self::PagingResponse<core::String>>(:result);
core::String result;
if(response is{ForNonNullableByDefault} self::Response<dynamic>) {
@@ -181,15 +162,7 @@
else {
throw core::Exception::•("Invalid response type");
}
- final core::String #t8 = result;
- if(#t8 is asy::Future<core::String>) {
- [yield] let dynamic #t9 = asy::_awaitHelper(#t8, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::String>(:result);
- }
- else {
- :async_temporary_0 = #t8;
- }
- :return_value = :async_temporary_0;
+ :return_value = result;
break #L3;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.weak.expect b/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.weak.expect
index bda20dd..f39bdfbd 100644
--- a/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.weak.expect
@@ -21,7 +21,7 @@
else {
throw core::Exception::•("Invalid response type");
}
- return let final self::TestMixin::T% #t1 = result in #t1 is asy::Future<self::TestMixin::T%> ?{FutureOr<self::TestMixin::T%>} await #t1 : #t1;
+ return result;
}
}
class PagingResponse<T extends core::Object? = dynamic> extends core::Object {
diff --git a/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.weak.transformed.expect
index e23e8dd..76b3473 100644
--- a/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/flutter_issue64155.dart.weak.transformed.expect
@@ -14,7 +14,6 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<self::TestMixin::T%>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
@@ -36,15 +35,7 @@
else {
throw core::Exception::•("Invalid response type");
}
- final self::TestMixin::T% #t2 = result;
- if(#t2 is asy::Future<self::TestMixin::T%>) {
- [yield] let dynamic #t3 = asy::_awaitHelper(#t2, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<self::TestMixin::T%>(:result);
- }
- else {
- :async_temporary_0 = #t2;
- }
- :return_value = :async_temporary_0;
+ :return_value = result;
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -91,12 +82,11 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L2:
{
- [yield] let dynamic #t4 = asy::_awaitHelper(fetch, :async_op_then, :async_op_error, :async_op) in null;
+ [yield] let dynamic #t2 = asy::_awaitHelper(fetch, :async_op_then, :async_op_error, :async_op) in null;
final self::Response<core::String> response = _in::unsafeCast<self::Response<core::String>>(:result);
core::String result;
if(response is{ForNonNullableByDefault} self::Response<dynamic>) {
@@ -113,15 +103,7 @@
else {
throw core::Exception::•("Invalid response type");
}
- final core::String #t5 = result;
- if(#t5 is asy::Future<core::String>) {
- [yield] let dynamic #t6 = asy::_awaitHelper(#t5, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::String>(:result);
- }
- else {
- :async_temporary_0 = #t5;
- }
- :return_value = :async_temporary_0;
+ :return_value = result;
break #L2;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -159,12 +141,11 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L3:
{
- [yield] let dynamic #t7 = asy::_awaitHelper(fetch, :async_op_then, :async_op_error, :async_op) in null;
+ [yield] let dynamic #t3 = asy::_awaitHelper(fetch, :async_op_then, :async_op_error, :async_op) in null;
final self::PagingResponse<core::String> response = _in::unsafeCast<self::PagingResponse<core::String>>(:result);
core::String result;
if(response is{ForNonNullableByDefault} self::Response<dynamic>) {
@@ -181,15 +162,7 @@
else {
throw core::Exception::•("Invalid response type");
}
- final core::String #t8 = result;
- if(#t8 is asy::Future<core::String>) {
- [yield] let dynamic #t9 = asy::_awaitHelper(#t8, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::String>(:result);
- }
- else {
- :async_temporary_0 = #t8;
- }
- :return_value = :async_temporary_0;
+ :return_value = result;
break #L3;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/issue41156.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue41156.dart.strong.expect
index ca6b488..11217a1 100644
--- a/pkg/front_end/testcases/nnbd/issue41156.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/issue41156.dart.strong.expect
@@ -55,19 +55,19 @@
(core::int) → core::String x6 = (core::int v) → Never {
return self::throwing();
};
- (core::int) → asy::Future<core::String> y1 = (core::int v) → asy::Future<Never> async => let final Never #t1 = throw v in #t1 is asy::Future<Never> ?{FutureOr<core::String>} await #t1 : #t1;
+ (core::int) → asy::Future<core::String> y1 = (core::int v) → asy::Future<Never> async => throw v;
(core::int) → asy::Future<core::String> y2 = (core::int v) → asy::Future<Never> async {
throw v;
};
(core::int) → asy::Future<core::String> y3 = (core::int v) → asy::Future<Never> async {
- return let final Never #t2 = throw v in #t2 is asy::Future<Never> ?{FutureOr<core::String>} await #t2 : #t2;
+ return throw v;
};
- (core::int) → asy::Future<core::String> y4 = (core::int v) → asy::Future<Never> async => let final Never #t3 = self::throwing() in #t3 is asy::Future<Never> ?{FutureOr<core::String>} await #t3 : #t3;
+ (core::int) → asy::Future<core::String> y4 = (core::int v) → asy::Future<Never> async => self::throwing();
(core::int) → asy::Future<core::String> y5 = (core::int v) → asy::Future<Never> async {
self::throwing();
};
(core::int) → asy::Future<core::String> y6 = (core::int v) → asy::Future<Never> async {
- return let final Never #t4 = self::throwing() in #t4 is asy::Future<Never> ?{FutureOr<core::String>} await #t4 : #t4;
+ return self::throwing();
};
}
static method errors() → void async {
@@ -77,7 +77,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:39:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:39:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x2 = (int v) /* error */ {
^" in null;
};
@@ -87,7 +87,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:44:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:44:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x3 = (int v) /* error */ {
^" in null;
};
@@ -97,7 +97,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:49:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:49:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x5 = (int v) /* error */ {
^" in null;
};
@@ -107,7 +107,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:54:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:54:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x6 = (int v) /* error */ {
^" in null;
};
@@ -117,17 +117,17 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:59:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:59:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y2 = (int v) async /* error */ {
^" in null;
};
(core::int) → asy::Future<core::String> y3 = (core::int v) → asy::Future<core::String> async {
try {
- return let final Never #t10 = throw v in #t10 is asy::Future<core::String> ?{FutureOr<core::String>} await #t10 : #t10;
+ return throw v;
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:64:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:64:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y3 = (int v) async /* error */ {
^" in null;
};
@@ -137,17 +137,17 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:69:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:69:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y5 = (int v) async /* error */ {
^" in null;
};
(core::int) → asy::Future<core::String> y6 = (core::int v) → asy::Future<core::String> async {
try {
- return let final Never #t13 = self::throwing() in #t13 is asy::Future<core::String> ?{FutureOr<core::String>} await #t13 : #t13;
+ return self::throwing();
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:74:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:74:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y6 = (int v) async /* error */ {
^" in null;
};
diff --git a/pkg/front_end/testcases/nnbd/issue41156.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue41156.dart.strong.transformed.expect
index 515ceec..3e9bef1 100644
--- a/pkg/front_end/testcases/nnbd/issue41156.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue41156.dart.strong.transformed.expect
@@ -37,7 +37,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
static method throwing() → Never
return throw "";
@@ -64,21 +63,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
{
- final Never #t1 = throw v;
- if(#t1 is asy::Future<Never>) {
- [yield] let dynamic #t2 = asy::_awaitHelper(#t1, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t1;
- }
- :return_value = :async_temporary_0;
+ :return_value = throw v;
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -127,21 +116,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L3:
{
- final Never #t3 = throw v;
- if(#t3 is asy::Future<Never>) {
- [yield] let dynamic #t4 = asy::_awaitHelper(#t3, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t3;
- }
- :return_value = :async_temporary_0;
+ :return_value = throw v;
break #L3;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -164,21 +143,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
- final Never #t5 = self::throwing();
- if(#t5 is asy::Future<Never>) {
- [yield] let dynamic #t6 = asy::_awaitHelper(#t5, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t5;
- }
- :return_value = :async_temporary_0;
+ :return_value = self::throwing();
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -227,21 +196,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L6:
{
- final Never #t7 = self::throwing();
- if(#t7 is asy::Future<Never>) {
- [yield] let dynamic #t8 = asy::_awaitHelper(#t7, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t7;
- }
- :return_value = :async_temporary_0;
+ :return_value = self::throwing();
break #L6;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -275,7 +234,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:39:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:39:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x2 = (int v) /* error */ {
^" in null;
};
@@ -285,7 +244,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:44:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:44:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x3 = (int v) /* error */ {
^" in null;
};
@@ -295,7 +254,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:49:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:49:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x5 = (int v) /* error */ {
^" in null;
};
@@ -305,7 +264,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:54:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:54:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x6 = (int v) /* error */ {
^" in null;
};
@@ -326,7 +285,7 @@
}
on core::Object catch(final core::Object _) {
}
- :return_value = let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:59:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ :return_value = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:59:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y2 = (int v) async /* error */ {
^" in null;
break #L8;
@@ -351,28 +310,17 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L9:
{
try {
- final Never #t14 = throw v;
- if(#t14 is asy::Future<core::String>) {
- [yield] let dynamic #t15 = asy::_awaitHelper(#t14, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t14;
- }
- :return_value = :async_temporary_0;
+ :return_value = throw v;
break #L9;
}
on core::Object catch(final core::Object _) {
}
- :return_value = let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:64:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ :return_value = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:64:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y3 = (int v) async /* error */ {
^" in null;
break #L9;
@@ -406,7 +354,7 @@
}
on core::Object catch(final core::Object _) {
}
- :return_value = let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:69:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ :return_value = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:69:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y5 = (int v) async /* error */ {
^" in null;
break #L10;
@@ -431,28 +379,17 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L11:
{
try {
- final Never #t18 = self::throwing();
- if(#t18 is asy::Future<core::String>) {
- [yield] let dynamic #t19 = asy::_awaitHelper(#t18, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t18;
- }
- :return_value = :async_temporary_0;
+ :return_value = self::throwing();
break #L11;
}
on core::Object catch(final core::Object _) {
}
- :return_value = let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:74:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ :return_value = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:74:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y6 = (int v) async /* error */ {
^" in null;
break #L11;
diff --git a/pkg/front_end/testcases/nnbd/issue41156.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue41156.dart.weak.expect
index 344471e..3ced126 100644
--- a/pkg/front_end/testcases/nnbd/issue41156.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/issue41156.dart.weak.expect
@@ -56,19 +56,19 @@
(core::int) → core::String x6 = (core::int v) → Never {
return let final Never #t3 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
};
- (core::int) → asy::Future<core::String> y1 = (core::int v) → asy::Future<Never> async => let final Never #t4 = throw v in #t4 is asy::Future<Never> ?{FutureOr<core::String>} await #t4 : #t4;
+ (core::int) → asy::Future<core::String> y1 = (core::int v) → asy::Future<Never> async => throw v;
(core::int) → asy::Future<core::String> y2 = (core::int v) → asy::Future<Never> async {
throw v;
};
(core::int) → asy::Future<core::String> y3 = (core::int v) → asy::Future<Never> async {
- return let final Never #t5 = throw v in #t5 is asy::Future<Never> ?{FutureOr<core::String>} await #t5 : #t5;
+ return throw v;
};
- (core::int) → asy::Future<core::String> y4 = (core::int v) → asy::Future<Never> async => let final Never #t6 = let final Never #t7 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.") in #t6 is asy::Future<Never> ?{FutureOr<core::String>} await #t6 : #t6;
+ (core::int) → asy::Future<core::String> y4 = (core::int v) → asy::Future<Never> async => let final Never #t4 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
(core::int) → asy::Future<core::String> y5 = (core::int v) → asy::Future<Never> async {
- let final Never #t8 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
+ let final Never #t5 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
};
(core::int) → asy::Future<core::String> y6 = (core::int v) → asy::Future<Never> async {
- return let final Never #t9 = let final Never #t10 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.") in #t9 is asy::Future<Never> ?{FutureOr<core::String>} await #t9 : #t9;
+ return let final Never #t6 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
};
}
static method errors() → void async {
@@ -78,7 +78,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:39:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:39:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x2 = (int v) /* error */ {
^" in null;
};
@@ -88,27 +88,27 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:44:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:44:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x3 = (int v) /* error */ {
^" in null;
};
(core::int) → core::String x5 = (core::int v) → core::String {
try {
- let final Never #t13 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
+ let final Never #t9 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:49:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:49:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x5 = (int v) /* error */ {
^" in null;
};
(core::int) → core::String x6 = (core::int v) → core::String {
try {
- return let final Never #t15 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
+ return let final Never #t11 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:54:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:54:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x6 = (int v) /* error */ {
^" in null;
};
@@ -118,37 +118,37 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:59:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:59:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y2 = (int v) async /* error */ {
^" in null;
};
(core::int) → asy::Future<core::String> y3 = (core::int v) → asy::Future<core::String> async {
try {
- return let final Never #t18 = throw v in #t18 is asy::Future<core::String> ?{FutureOr<core::String>} await #t18 : #t18;
+ return throw v;
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:64:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:64:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y3 = (int v) async /* error */ {
^" in null;
};
(core::int) → asy::Future<core::String> y5 = (core::int v) → asy::Future<core::String> async {
try {
- let final Never #t20 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
+ let final Never #t15 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:69:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:69:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y5 = (int v) async /* error */ {
^" in null;
};
(core::int) → asy::Future<core::String> y6 = (core::int v) → asy::Future<core::String> async {
try {
- return let final Never #t22 = let final Never #t23 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.") in #t22 is asy::Future<core::String> ?{FutureOr<core::String>} await #t22 : #t22;
+ return let final Never #t17 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:74:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:74:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y6 = (int v) async /* error */ {
^" in null;
};
diff --git a/pkg/front_end/testcases/nnbd/issue41156.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue41156.dart.weak.transformed.expect
index 5ebb180..e3ff8f7 100644
--- a/pkg/front_end/testcases/nnbd/issue41156.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue41156.dart.weak.transformed.expect
@@ -64,21 +64,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
{
- final Never #t4 = throw v;
- if(#t4 is asy::Future<Never>) {
- [yield] let dynamic #t5 = asy::_awaitHelper(#t4, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t4;
- }
- :return_value = :async_temporary_0;
+ :return_value = throw v;
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -127,21 +117,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L3:
{
- final Never #t6 = throw v;
- if(#t6 is asy::Future<Never>) {
- [yield] let dynamic #t7 = asy::_awaitHelper(#t6, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t6;
- }
- :return_value = :async_temporary_0;
+ :return_value = throw v;
break #L3;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -164,21 +144,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
- final Never #t8 = let final Never #t9 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
- if(#t8 is asy::Future<Never>) {
- [yield] let dynamic #t10 = asy::_awaitHelper(#t8, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t8;
- }
- :return_value = :async_temporary_0;
+ :return_value = let final Never #t4 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -205,7 +175,7 @@
try {
#L5:
{
- let final Never #t11 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
+ let final Never #t5 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
return;
@@ -227,21 +197,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L6:
{
- final Never #t12 = let final Never #t13 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
- if(#t12 is asy::Future<Never>) {
- [yield] let dynamic #t14 = asy::_awaitHelper(#t12, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t12;
- }
- :return_value = :async_temporary_0;
+ :return_value = let final Never #t6 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
break #L6;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -275,7 +235,7 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:39:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:39:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x2 = (int v) /* error */ {
^" in null;
};
@@ -285,27 +245,27 @@
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:44:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:44:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x3 = (int v) /* error */ {
^" in null;
};
(core::int) → core::String x5 = (core::int v) → core::String {
try {
- let final Never #t17 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
+ let final Never #t9 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:49:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:49:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x5 = (int v) /* error */ {
^" in null;
};
(core::int) → core::String x6 = (core::int v) → core::String {
try {
- return let final Never #t19 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
+ return let final Never #t11 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
}
on core::Object catch(final core::Object _) {
}
- return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:54:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:54:29: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String Function(int) x6 = (int v) /* error */ {
^" in null;
};
@@ -326,7 +286,7 @@
}
on core::Object catch(final core::Object _) {
}
- :return_value = let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:59:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ :return_value = let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:59:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y2 = (int v) async /* error */ {
^" in null;
break #L8;
@@ -351,28 +311,17 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L9:
{
try {
- final Never #t22 = throw v;
- if(#t22 is asy::Future<core::String>) {
- [yield] let dynamic #t23 = asy::_awaitHelper(#t22, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t22;
- }
- :return_value = :async_temporary_0;
+ :return_value = throw v;
break #L9;
}
on core::Object catch(final core::Object _) {
}
- :return_value = let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:64:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ :return_value = let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:64:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y3 = (int v) async /* error */ {
^" in null;
break #L9;
@@ -402,11 +351,11 @@
#L10:
{
try {
- let final Never #t25 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
+ let final Never #t15 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
}
on core::Object catch(final core::Object _) {
}
- :return_value = let final<BottomType> #t26 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:69:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ :return_value = let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:69:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y5 = (int v) async /* error */ {
^" in null;
break #L10;
@@ -431,28 +380,17 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- FutureOr<core::String>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L11:
{
try {
- final Never #t27 = let final Never #t28 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
- if(#t27 is asy::Future<core::String>) {
- [yield] let dynamic #t29 = asy::_awaitHelper(#t27, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Never>(:result);
- }
- else {
- :async_temporary_0 = #t27;
- }
- :return_value = :async_temporary_0;
+ :return_value = let final Never #t17 = self::throwing() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
break #L11;
}
on core::Object catch(final core::Object _) {
}
- :return_value = let final<BottomType> #t30 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:74:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ :return_value = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/issue41156.dart:74:37: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
Future<String> Function(int) y6 = (int v) async /* error */ {
^" in null;
break #L11;
diff --git a/pkg/front_end/testcases/nnbd/issue41437a.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue41437a.dart.strong.expect
index d7881ae..fbcd99e 100644
--- a/pkg/front_end/testcases/nnbd/issue41437a.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/issue41437a.dart.strong.expect
@@ -34,61 +34,61 @@
static method getNull() → dynamic
return null;
static method getFutureNull() → asy::Future<dynamic> async {
- return let final Null #t1 = null in #t1 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t1 : #t1;
+ return null;
}
static method getFutureBool() → asy::Future<core::bool> async {
- return let final core::bool #t2 = true in #t2 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t2 : #t2;
+ return true;
}
static method test1() → asy::Future<core::bool> async
- return let final dynamic #t3 = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool> in #t3 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t3 : #t3;
+ return await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
static method test2() → asy::Future<core::bool>
return self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<core::bool>;
static method test3() → core::bool
return self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} core::bool;
static method test4() → asy::Future<core::bool> async
- return let final dynamic #t4 = await self::getFutureNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool> in #t4 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t4 : #t4;
+ return await self::getFutureNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
static method test5() → asy::Future<core::bool>
- return let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:18:25: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
+ return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:18:25: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> test5() => getFutureNull(); // error
^" in self::getFutureNull() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
static method test6() → asy::Future<core::bool>
return self::getFutureBool();
static method test7() → asy::Future<core::bool> async
- return let final asy::Future<core::bool> #t6 = self::getFutureBool() in #t6 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t6 : #t6;
+ return self::getFutureBool();
static method test() → dynamic async {
function test1() → asy::Future<core::bool> async
- return let final dynamic #t7 = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool> in #t7 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t7 : #t7;
+ return await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
function test2() → asy::Future<core::bool>
return self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<core::bool>;
function test3() → core::bool
return self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} core::bool;
function test4() → asy::Future<core::bool> async
- return let final dynamic #t8 = await self::getFutureNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool> in #t8 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t8 : #t8;
+ return await self::getFutureNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
function test5() → asy::Future<core::bool>
- return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:27:27: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
+ return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:27:27: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> test5() => getFutureNull(); // error
^" in self::getFutureNull() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
function test6() → asy::Future<core::bool>
return self::getFutureBool();
function test7() → asy::Future<core::bool> async
- return let final asy::Future<core::bool> #t10 = self::getFutureBool() in #t10 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t10 : #t10;
- asy::Future<core::bool> var1 = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:31:52: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ return self::getFutureBool();
+ asy::Future<core::bool> var1 = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:31:52: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var1 = (() async => await getNull())(); // error
- ^" in (() → asy::Future<dynamic> async => let final dynamic #t12 = await self::getNull() in #t12 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t12 : #t12).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
+ ^" in (() → asy::Future<dynamic> async => await self::getNull()).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
asy::Future<core::bool> var2 = (() → dynamic => self::getNull()).call() as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<core::bool>;
core::bool var3 = (() → dynamic => self::getNull()).call() as{TypeError,ForDynamic,ForNonNullableByDefault} core::bool;
- asy::Future<core::bool> var4 = let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:34:58: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ asy::Future<core::bool> var4 = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:34:58: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var4 = (() async => await getFutureNull())(); // error
- ^" in (() → asy::Future<dynamic> async => let final dynamic #t14 = await self::getFutureNull() in #t14 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t14 : #t14).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
- asy::Future<core::bool> var5 = let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:35:46: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ ^" in (() → asy::Future<dynamic> async => await self::getFutureNull()).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
+ asy::Future<core::bool> var5 = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:35:46: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var5 = (() => getFutureNull())(); // error
^" in (() → asy::Future<dynamic> => self::getFutureNull()).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
asy::Future<core::bool> var6 = (() → asy::Future<core::bool> => self::getFutureBool()).call();
- asy::Future<core::bool> var7 = (() → asy::Future<core::bool> async => let final asy::Future<core::bool> #t16 = self::getFutureBool() in #t16 is asy::Future<core::bool> ?{FutureOr<dynamic>} await #t16 : #t16).call();
+ asy::Future<core::bool> var7 = (() → asy::Future<core::bool> async => self::getFutureBool()).call();
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue41437a.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue41437a.dart.strong.transformed.expect
index 2b35c4f..b4ab7d2 100644
--- a/pkg/front_end/testcases/nnbd/issue41437a.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue41437a.dart.strong.transformed.expect
@@ -30,7 +30,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method getNull() → dynamic
return null;
@@ -42,21 +41,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
{
- final Null #t1 = null;
- if(#t1 is asy::Future<dynamic>) {
- [yield] let dynamic #t2 = asy::_awaitHelper(#t1, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_0 = #t1;
- }
- :return_value = :async_temporary_0;
+ :return_value = null;
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -79,21 +68,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L2:
{
- final core::bool #t3 = true;
- if(#t3 is asy::Future<core::bool>) {
- [yield] let dynamic #t4 = asy::_awaitHelper(#t3, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t3;
- }
- :return_value = :async_temporary_0;
+ :return_value = true;
break #L2;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -117,21 +96,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L3:
{
- [yield] let dynamic #t5 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::bool>#t6 = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
- if(#t6 is asy::Future<core::bool>) {
- [yield] let dynamic #t7 = asy::_awaitHelper(#t6, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t6;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t1 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
break #L3;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -159,21 +129,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
- [yield] let dynamic #t8 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::bool>#t9 = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
- if(#t9 is asy::Future<core::bool>) {
- [yield] let dynamic #t10 = asy::_awaitHelper(#t9, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t9;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t2 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -189,7 +150,7 @@
return :async_future;
}
static method test5() → asy::Future<core::bool>
- return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:18:25: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
+ return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:18:25: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> test5() => getFutureNull(); // error
^" in self::getFutureNull() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
@@ -203,21 +164,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L5:
{
- final asy::Future<core::bool> #t12 = self::getFutureBool();
- if(#t12 is asy::Future<core::bool>) {
- [yield] let dynamic #t13 = asy::_awaitHelper(#t12, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t12;
- }
- :return_value = :async_temporary_0;
+ :return_value = self::getFutureBool();
break #L5;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -253,21 +204,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L7:
{
- [yield] let dynamic #t14 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::bool>#t15 = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
- if(#t15 is asy::Future<core::bool>) {
- [yield] let dynamic #t16 = asy::_awaitHelper(#t15, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t15;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t4 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
break #L7;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -295,21 +237,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L8:
{
- [yield] let dynamic #t17 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::bool>#t18 = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
- if(#t18 is asy::Future<core::bool>) {
- [yield] let dynamic #t19 = asy::_awaitHelper(#t18, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t18;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t5 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
break #L8;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -325,7 +258,7 @@
return :async_future;
}
function test5() → asy::Future<core::bool>
- return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:27:27: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
+ return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:27:27: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> test5() => getFutureNull(); // error
^" in self::getFutureNull() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
@@ -339,21 +272,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L9:
{
- final asy::Future<core::bool> #t21 = self::getFutureBool();
- if(#t21 is asy::Future<core::bool>) {
- [yield] let dynamic #t22 = asy::_awaitHelper(#t21, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t21;
- }
- :return_value = :async_temporary_0;
+ :return_value = self::getFutureBool();
break #L9;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -368,7 +291,7 @@
:is_sync = true;
return :async_future;
}
- asy::Future<core::bool> var1 = let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:31:52: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ asy::Future<core::bool> var1 = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:31:52: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var1 = (() async => await getNull())(); // error
^" in (() → asy::Future<dynamic> /* originally async */ {
@@ -380,21 +303,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L10:
{
- [yield] let dynamic #t24 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
- final dynamic #t25 = :result;
- if(#t25 is asy::Future<dynamic>) {
- [yield] let dynamic #t26 = asy::_awaitHelper(#t25, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = :result;
- }
- else {
- :async_temporary_0 = #t25;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t8 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result;
break #L10;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -411,7 +325,7 @@
}).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
asy::Future<core::bool> var2 = (() → dynamic => self::getNull()).call() as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<core::bool>;
core::bool var3 = (() → dynamic => self::getNull()).call() as{TypeError,ForDynamic,ForNonNullableByDefault} core::bool;
- asy::Future<core::bool> var4 = let final<BottomType> #t27 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:34:58: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ asy::Future<core::bool> var4 = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:34:58: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var4 = (() async => await getFutureNull())(); // error
^" in (() → asy::Future<dynamic> /* originally async */ {
@@ -423,21 +337,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L11:
{
- [yield] let dynamic #t28 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
- final dynamic #t29 = :result;
- if(#t29 is asy::Future<dynamic>) {
- [yield] let dynamic #t30 = asy::_awaitHelper(#t29, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = :result;
- }
- else {
- :async_temporary_0 = #t29;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t10 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result;
break #L11;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -452,7 +357,7 @@
:is_sync = true;
return :async_future;
}).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
- asy::Future<core::bool> var5 = let final<BottomType> #t31 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:35:46: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ asy::Future<core::bool> var5 = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:35:46: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var5 = (() => getFutureNull())(); // error
^" in (() → asy::Future<dynamic> => self::getFutureNull()).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
@@ -465,21 +370,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L12:
{
- final asy::Future<core::bool> #t32 = self::getFutureBool();
- if(#t32 is asy::Future<core::bool>) {
- [yield] let dynamic #t33 = asy::_awaitHelper(#t32, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t32;
- }
- :return_value = :async_temporary_0;
+ :return_value = self::getFutureBool();
break #L12;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/issue41437a.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue41437a.dart.weak.expect
index d7881ae..fbcd99e 100644
--- a/pkg/front_end/testcases/nnbd/issue41437a.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/issue41437a.dart.weak.expect
@@ -34,61 +34,61 @@
static method getNull() → dynamic
return null;
static method getFutureNull() → asy::Future<dynamic> async {
- return let final Null #t1 = null in #t1 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t1 : #t1;
+ return null;
}
static method getFutureBool() → asy::Future<core::bool> async {
- return let final core::bool #t2 = true in #t2 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t2 : #t2;
+ return true;
}
static method test1() → asy::Future<core::bool> async
- return let final dynamic #t3 = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool> in #t3 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t3 : #t3;
+ return await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
static method test2() → asy::Future<core::bool>
return self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<core::bool>;
static method test3() → core::bool
return self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} core::bool;
static method test4() → asy::Future<core::bool> async
- return let final dynamic #t4 = await self::getFutureNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool> in #t4 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t4 : #t4;
+ return await self::getFutureNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
static method test5() → asy::Future<core::bool>
- return let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:18:25: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
+ return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:18:25: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> test5() => getFutureNull(); // error
^" in self::getFutureNull() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
static method test6() → asy::Future<core::bool>
return self::getFutureBool();
static method test7() → asy::Future<core::bool> async
- return let final asy::Future<core::bool> #t6 = self::getFutureBool() in #t6 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t6 : #t6;
+ return self::getFutureBool();
static method test() → dynamic async {
function test1() → asy::Future<core::bool> async
- return let final dynamic #t7 = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool> in #t7 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t7 : #t7;
+ return await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
function test2() → asy::Future<core::bool>
return self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<core::bool>;
function test3() → core::bool
return self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} core::bool;
function test4() → asy::Future<core::bool> async
- return let final dynamic #t8 = await self::getFutureNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool> in #t8 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t8 : #t8;
+ return await self::getFutureNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
function test5() → asy::Future<core::bool>
- return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:27:27: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
+ return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:27:27: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> test5() => getFutureNull(); // error
^" in self::getFutureNull() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
function test6() → asy::Future<core::bool>
return self::getFutureBool();
function test7() → asy::Future<core::bool> async
- return let final asy::Future<core::bool> #t10 = self::getFutureBool() in #t10 is asy::Future<core::bool> ?{FutureOr<core::bool>} await #t10 : #t10;
- asy::Future<core::bool> var1 = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:31:52: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ return self::getFutureBool();
+ asy::Future<core::bool> var1 = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:31:52: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var1 = (() async => await getNull())(); // error
- ^" in (() → asy::Future<dynamic> async => let final dynamic #t12 = await self::getNull() in #t12 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t12 : #t12).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
+ ^" in (() → asy::Future<dynamic> async => await self::getNull()).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
asy::Future<core::bool> var2 = (() → dynamic => self::getNull()).call() as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<core::bool>;
core::bool var3 = (() → dynamic => self::getNull()).call() as{TypeError,ForDynamic,ForNonNullableByDefault} core::bool;
- asy::Future<core::bool> var4 = let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:34:58: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ asy::Future<core::bool> var4 = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:34:58: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var4 = (() async => await getFutureNull())(); // error
- ^" in (() → asy::Future<dynamic> async => let final dynamic #t14 = await self::getFutureNull() in #t14 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t14 : #t14).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
- asy::Future<core::bool> var5 = let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:35:46: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ ^" in (() → asy::Future<dynamic> async => await self::getFutureNull()).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
+ asy::Future<core::bool> var5 = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:35:46: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var5 = (() => getFutureNull())(); // error
^" in (() → asy::Future<dynamic> => self::getFutureNull()).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
asy::Future<core::bool> var6 = (() → asy::Future<core::bool> => self::getFutureBool()).call();
- asy::Future<core::bool> var7 = (() → asy::Future<core::bool> async => let final asy::Future<core::bool> #t16 = self::getFutureBool() in #t16 is asy::Future<core::bool> ?{FutureOr<dynamic>} await #t16 : #t16).call();
+ asy::Future<core::bool> var7 = (() → asy::Future<core::bool> async => self::getFutureBool()).call();
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue41437a.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue41437a.dart.weak.transformed.expect
index 2b35c4f..b4ab7d2 100644
--- a/pkg/front_end/testcases/nnbd/issue41437a.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue41437a.dart.weak.transformed.expect
@@ -30,7 +30,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method getNull() → dynamic
return null;
@@ -42,21 +41,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
{
- final Null #t1 = null;
- if(#t1 is asy::Future<dynamic>) {
- [yield] let dynamic #t2 = asy::_awaitHelper(#t1, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_0 = #t1;
- }
- :return_value = :async_temporary_0;
+ :return_value = null;
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -79,21 +68,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L2:
{
- final core::bool #t3 = true;
- if(#t3 is asy::Future<core::bool>) {
- [yield] let dynamic #t4 = asy::_awaitHelper(#t3, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t3;
- }
- :return_value = :async_temporary_0;
+ :return_value = true;
break #L2;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -117,21 +96,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L3:
{
- [yield] let dynamic #t5 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::bool>#t6 = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
- if(#t6 is asy::Future<core::bool>) {
- [yield] let dynamic #t7 = asy::_awaitHelper(#t6, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t6;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t1 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
break #L3;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -159,21 +129,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
- [yield] let dynamic #t8 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::bool>#t9 = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
- if(#t9 is asy::Future<core::bool>) {
- [yield] let dynamic #t10 = asy::_awaitHelper(#t9, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t9;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t2 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -189,7 +150,7 @@
return :async_future;
}
static method test5() → asy::Future<core::bool>
- return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:18:25: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
+ return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:18:25: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> test5() => getFutureNull(); // error
^" in self::getFutureNull() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
@@ -203,21 +164,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L5:
{
- final asy::Future<core::bool> #t12 = self::getFutureBool();
- if(#t12 is asy::Future<core::bool>) {
- [yield] let dynamic #t13 = asy::_awaitHelper(#t12, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t12;
- }
- :return_value = :async_temporary_0;
+ :return_value = self::getFutureBool();
break #L5;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -253,21 +204,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L7:
{
- [yield] let dynamic #t14 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::bool>#t15 = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
- if(#t15 is asy::Future<core::bool>) {
- [yield] let dynamic #t16 = asy::_awaitHelper(#t15, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t15;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t4 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
break #L7;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -295,21 +237,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L8:
{
- [yield] let dynamic #t17 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::bool>#t18 = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
- if(#t18 is asy::Future<core::bool>) {
- [yield] let dynamic #t19 = asy::_awaitHelper(#t18, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t18;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t5 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::bool>;
break #L8;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -325,7 +258,7 @@
return :async_future;
}
function test5() → asy::Future<core::bool>
- return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:27:27: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
+ return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:27:27: Error: A value of type 'Future<dynamic>' can't be returned from a function with return type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> test5() => getFutureNull(); // error
^" in self::getFutureNull() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
@@ -339,21 +272,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::bool>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L9:
{
- final asy::Future<core::bool> #t21 = self::getFutureBool();
- if(#t21 is asy::Future<core::bool>) {
- [yield] let dynamic #t22 = asy::_awaitHelper(#t21, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t21;
- }
- :return_value = :async_temporary_0;
+ :return_value = self::getFutureBool();
break #L9;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -368,7 +291,7 @@
:is_sync = true;
return :async_future;
}
- asy::Future<core::bool> var1 = let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:31:52: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ asy::Future<core::bool> var1 = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:31:52: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var1 = (() async => await getNull())(); // error
^" in (() → asy::Future<dynamic> /* originally async */ {
@@ -380,21 +303,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L10:
{
- [yield] let dynamic #t24 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
- final dynamic #t25 = :result;
- if(#t25 is asy::Future<dynamic>) {
- [yield] let dynamic #t26 = asy::_awaitHelper(#t25, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = :result;
- }
- else {
- :async_temporary_0 = #t25;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t8 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result;
break #L10;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -411,7 +325,7 @@
}).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
asy::Future<core::bool> var2 = (() → dynamic => self::getNull()).call() as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<core::bool>;
core::bool var3 = (() → dynamic => self::getNull()).call() as{TypeError,ForDynamic,ForNonNullableByDefault} core::bool;
- asy::Future<core::bool> var4 = let final<BottomType> #t27 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:34:58: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ asy::Future<core::bool> var4 = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:34:58: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var4 = (() async => await getFutureNull())(); // error
^" in (() → asy::Future<dynamic> /* originally async */ {
@@ -423,21 +337,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L11:
{
- [yield] let dynamic #t28 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
- final dynamic #t29 = :result;
- if(#t29 is asy::Future<dynamic>) {
- [yield] let dynamic #t30 = asy::_awaitHelper(#t29, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = :result;
- }
- else {
- :async_temporary_0 = #t29;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t10 = asy::_awaitHelper(self::getFutureNull(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result;
break #L11;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -452,7 +357,7 @@
:is_sync = true;
return :async_future;
}).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
- asy::Future<core::bool> var5 = let final<BottomType> #t31 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:35:46: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
+ asy::Future<core::bool> var5 = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/issue41437a.dart:35:46: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'Future<bool>'.
- 'Future' is from 'dart:async'.
Future<bool> var5 = (() => getFutureNull())(); // error
^" in (() → asy::Future<dynamic> => self::getFutureNull()).call() as{TypeError,ForNonNullableByDefault} asy::Future<core::bool>;
@@ -465,21 +370,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L12:
{
- final asy::Future<core::bool> #t32 = self::getFutureBool();
- if(#t32 is asy::Future<core::bool>) {
- [yield] let dynamic #t33 = asy::_awaitHelper(#t32, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::bool>(:result);
- }
- else {
- :async_temporary_0 = #t32;
- }
- :return_value = :async_temporary_0;
+ :return_value = self::getFutureBool();
break #L12;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/issue41697.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue41697.dart.strong.expect
index 58eebef..f0b15fb 100644
--- a/pkg/front_end/testcases/nnbd/issue41697.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/issue41697.dart.strong.expect
@@ -34,23 +34,23 @@
return s.{core::num::+}(1);
};
<S extends FutureOr<core::num> = FutureOr<core::num>>(S, FutureOr<core::num>) → asy::Future<core::num> f2 = c.{self::C::field2} = <S extends FutureOr<core::num> = FutureOr<core::num>>(S s, FutureOr<core::num>t) → asy::Future<core::num> async {
- return let final core::num #t1 = (await t).{core::num::+}(1) in #t1 is asy::Future<core::num> ?{FutureOr<dynamic>} await #t1 : #t1;
+ return (await t).{core::num::+}(1);
};
}
static method test2(self::C<core::num?> c) → dynamic {
<S extends core::num? = core::num?>(S%) → core::num f1 = c.{self::C::field1} = <S extends core::num? = core::num?>(S% s) → core::num {
- return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:33:14: Error: Operator '+' cannot be called on 'S' because it is potentially null.
+ return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:33:14: Error: Operator '+' cannot be called on 'S' because it is potentially null.
return s + 1; // error
^" in s.{core::num::+}(1);
};
<S extends FutureOr<core::num?> = FutureOr<core::num?>>(S%, FutureOr<core::num?>) → asy::Future<core::num> f2 = c.{self::C::field2} = <S extends FutureOr<core::num?> = FutureOr<core::num?>>(S% s, FutureOr<core::num?>t) → asy::Future<core::num> async {
- return let final core::num #t3 = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:36:22: Error: Operator '+' cannot be called on 'num?' because it is potentially null.
+ return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:36:22: Error: Operator '+' cannot be called on 'num?' because it is potentially null.
return (await t) + 1; // error
- ^" in (await t).{core::num::+}(1) in #t3 is asy::Future<core::num> ?{FutureOr<dynamic>} await #t3 : #t3;
+ ^" in (await t).{core::num::+}(1);
};
}
static method test3<S extends core::num? = core::num?>(self::test3::S% s) → dynamic
- return let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:40:33: Error: Operator '+' cannot be called on 'S' because it is potentially null.
+ return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:40:33: Error: Operator '+' cannot be called on 'S' because it is potentially null.
test3<S extends num?>(S s) => s + 1; // error
^" in s.{core::num::+}(1);
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue41697.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue41697.dart.strong.transformed.expect
index b08be8f..b287a57 100644
--- a/pkg/front_end/testcases/nnbd/issue41697.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue41697.dart.strong.transformed.expect
@@ -43,21 +43,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
{
[yield] let dynamic #t1 = asy::_awaitHelper(t, :async_op_then, :async_op_error, :async_op) in null;
- final core::num #t2 = _in::unsafeCast<core::num>(:result).{core::num::+}(1);
- if(#t2 is asy::Future<core::num>) {
- [yield] let dynamic #t3 = asy::_awaitHelper(#t2, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::num>(:result);
- }
- else {
- :async_temporary_0 = #t2;
- }
- :return_value = :async_temporary_0;
+ :return_value = _in::unsafeCast<core::num>(:result).{core::num::+}(1);
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -75,7 +66,7 @@
}
static method test2(self::C<core::num?> c) → dynamic {
<S extends core::num? = core::num?>(S%) → core::num f1 = c.{self::C::field1} = <S extends core::num? = core::num?>(S% s) → core::num {
- return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:33:14: Error: Operator '+' cannot be called on 'S' because it is potentially null.
+ return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:33:14: Error: Operator '+' cannot be called on 'S' because it is potentially null.
return s + 1; // error
^" in s.{core::num::+}(1);
};
@@ -88,24 +79,15 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L2:
{
- final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:36:22: Error: Operator '+' cannot be called on 'num?' because it is potentially null.
+ final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:36:22: Error: Operator '+' cannot be called on 'num?' because it is potentially null.
return (await t) + 1; // error
^";
- [yield] let dynamic #t6 = asy::_awaitHelper(t, :async_op_then, :async_op_error, :async_op) in null;
- final core::num #t7 = _in::unsafeCast<core::num?>(:result).{core::num::+}(1);
- if(#t7 is asy::Future<core::num>) {
- [yield] let dynamic #t8 = asy::_awaitHelper(#t7, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::num>(:result);
- }
- else {
- :async_temporary_0 = #t7;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t4 = asy::_awaitHelper(t, :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = _in::unsafeCast<core::num?>(:result).{core::num::+}(1);
break #L2;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -122,7 +104,7 @@
};
}
static method test3<S extends core::num? = core::num?>(self::test3::S% s) → dynamic
- return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:40:33: Error: Operator '+' cannot be called on 'S' because it is potentially null.
+ return let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:40:33: Error: Operator '+' cannot be called on 'S' because it is potentially null.
test3<S extends num?>(S s) => s + 1; // error
^" in s.{core::num::+}(1);
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue41697.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue41697.dart.weak.expect
index 58eebef..f0b15fb 100644
--- a/pkg/front_end/testcases/nnbd/issue41697.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/issue41697.dart.weak.expect
@@ -34,23 +34,23 @@
return s.{core::num::+}(1);
};
<S extends FutureOr<core::num> = FutureOr<core::num>>(S, FutureOr<core::num>) → asy::Future<core::num> f2 = c.{self::C::field2} = <S extends FutureOr<core::num> = FutureOr<core::num>>(S s, FutureOr<core::num>t) → asy::Future<core::num> async {
- return let final core::num #t1 = (await t).{core::num::+}(1) in #t1 is asy::Future<core::num> ?{FutureOr<dynamic>} await #t1 : #t1;
+ return (await t).{core::num::+}(1);
};
}
static method test2(self::C<core::num?> c) → dynamic {
<S extends core::num? = core::num?>(S%) → core::num f1 = c.{self::C::field1} = <S extends core::num? = core::num?>(S% s) → core::num {
- return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:33:14: Error: Operator '+' cannot be called on 'S' because it is potentially null.
+ return let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:33:14: Error: Operator '+' cannot be called on 'S' because it is potentially null.
return s + 1; // error
^" in s.{core::num::+}(1);
};
<S extends FutureOr<core::num?> = FutureOr<core::num?>>(S%, FutureOr<core::num?>) → asy::Future<core::num> f2 = c.{self::C::field2} = <S extends FutureOr<core::num?> = FutureOr<core::num?>>(S% s, FutureOr<core::num?>t) → asy::Future<core::num> async {
- return let final core::num #t3 = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:36:22: Error: Operator '+' cannot be called on 'num?' because it is potentially null.
+ return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:36:22: Error: Operator '+' cannot be called on 'num?' because it is potentially null.
return (await t) + 1; // error
- ^" in (await t).{core::num::+}(1) in #t3 is asy::Future<core::num> ?{FutureOr<dynamic>} await #t3 : #t3;
+ ^" in (await t).{core::num::+}(1);
};
}
static method test3<S extends core::num? = core::num?>(self::test3::S% s) → dynamic
- return let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:40:33: Error: Operator '+' cannot be called on 'S' because it is potentially null.
+ return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:40:33: Error: Operator '+' cannot be called on 'S' because it is potentially null.
test3<S extends num?>(S s) => s + 1; // error
^" in s.{core::num::+}(1);
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue41697.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue41697.dart.weak.transformed.expect
index b08be8f..b287a57 100644
--- a/pkg/front_end/testcases/nnbd/issue41697.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue41697.dart.weak.transformed.expect
@@ -43,21 +43,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
{
[yield] let dynamic #t1 = asy::_awaitHelper(t, :async_op_then, :async_op_error, :async_op) in null;
- final core::num #t2 = _in::unsafeCast<core::num>(:result).{core::num::+}(1);
- if(#t2 is asy::Future<core::num>) {
- [yield] let dynamic #t3 = asy::_awaitHelper(#t2, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::num>(:result);
- }
- else {
- :async_temporary_0 = #t2;
- }
- :return_value = :async_temporary_0;
+ :return_value = _in::unsafeCast<core::num>(:result).{core::num::+}(1);
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -75,7 +66,7 @@
}
static method test2(self::C<core::num?> c) → dynamic {
<S extends core::num? = core::num?>(S%) → core::num f1 = c.{self::C::field1} = <S extends core::num? = core::num?>(S% s) → core::num {
- return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:33:14: Error: Operator '+' cannot be called on 'S' because it is potentially null.
+ return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:33:14: Error: Operator '+' cannot be called on 'S' because it is potentially null.
return s + 1; // error
^" in s.{core::num::+}(1);
};
@@ -88,24 +79,15 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L2:
{
- final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:36:22: Error: Operator '+' cannot be called on 'num?' because it is potentially null.
+ final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:36:22: Error: Operator '+' cannot be called on 'num?' because it is potentially null.
return (await t) + 1; // error
^";
- [yield] let dynamic #t6 = asy::_awaitHelper(t, :async_op_then, :async_op_error, :async_op) in null;
- final core::num #t7 = _in::unsafeCast<core::num?>(:result).{core::num::+}(1);
- if(#t7 is asy::Future<core::num>) {
- [yield] let dynamic #t8 = asy::_awaitHelper(#t7, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::num>(:result);
- }
- else {
- :async_temporary_0 = #t7;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t4 = asy::_awaitHelper(t, :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = _in::unsafeCast<core::num?>(:result).{core::num::+}(1);
break #L2;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -122,7 +104,7 @@
};
}
static method test3<S extends core::num? = core::num?>(self::test3::S% s) → dynamic
- return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:40:33: Error: Operator '+' cannot be called on 'S' because it is potentially null.
+ return let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue41697.dart:40:33: Error: Operator '+' cannot be called on 'S' because it is potentially null.
test3<S extends num?>(S s) => s + 1; // error
^" in s.{core::num::+}(1);
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue42540.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue42540.dart.strong.expect
index c1d787d..aaf931d 100644
--- a/pkg/front_end/testcases/nnbd/issue42540.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/issue42540.dart.strong.expect
@@ -7,6 +7,6 @@
return null;
static method fn() → asy::Future<core::Object> async {
core::Object o = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} core::Object;
- return let final dynamic #t1 = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::Object> in #t1 is asy::Future<core::Object> ?{FutureOr<core::Object>} await #t1 : #t1;
+ return await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::Object>;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue42540.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue42540.dart.strong.transformed.expect
index b5edde0..4e127a6 100644
--- a/pkg/front_end/testcases/nnbd/issue42540.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue42540.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method getNull() → dynamic
return null;
@@ -15,7 +14,6 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::Object>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
@@ -23,15 +21,7 @@
[yield] let dynamic #t1 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
core::Object o = let dynamic #t2 = :result in #t2.==(null) ?{core::Object} #t2 as{TypeError,ForDynamic,ForNonNullableByDefault} core::Object : #t2{core::Object};
[yield] let dynamic #t3 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::Object>#t4 = let dynamic #t5 = :result in #t5.==(null) ?{FutureOr<core::Object>} #t5 as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::Object> : #t5{FutureOr<core::Object>};
- if(#t4 is asy::Future<core::Object>) {
- [yield] let dynamic #t6 = asy::_awaitHelper(#t4, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::Object>(:result);
- }
- else {
- :async_temporary_0 = #t4;
- }
- :return_value = :async_temporary_0;
+ :return_value = let dynamic #t4 = :result in #t4.==(null) ?{FutureOr<core::Object>} #t4 as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::Object> : #t4{FutureOr<core::Object>};
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/issue42540.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue42540.dart.weak.expect
index c1d787d..aaf931d 100644
--- a/pkg/front_end/testcases/nnbd/issue42540.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/issue42540.dart.weak.expect
@@ -7,6 +7,6 @@
return null;
static method fn() → asy::Future<core::Object> async {
core::Object o = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} core::Object;
- return let final dynamic #t1 = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::Object> in #t1 is asy::Future<core::Object> ?{FutureOr<core::Object>} await #t1 : #t1;
+ return await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::Object>;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue42540.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue42540.dart.weak.transformed.expect
index 36497a3..e61b30d 100644
--- a/pkg/front_end/testcases/nnbd/issue42540.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue42540.dart.weak.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method getNull() → dynamic
return null;
@@ -15,7 +14,6 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<core::Object>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
@@ -23,15 +21,7 @@
[yield] let dynamic #t1 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
core::Object o = :result;
[yield] let dynamic #t2 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null;
- final FutureOr<core::Object>#t3 = :result;
- if(#t3 is asy::Future<core::Object>) {
- [yield] let dynamic #t4 = asy::_awaitHelper(#t3, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::Object>(:result);
- }
- else {
- :async_temporary_0 = #t3;
- }
- :return_value = :async_temporary_0;
+ :return_value = :result;
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/issue42546.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue42546.dart.strong.expect
index e446f7c..e5372a7 100644
--- a/pkg/front_end/testcases/nnbd/issue42546.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/issue42546.dart.strong.expect
@@ -42,11 +42,11 @@
- 'Future' is from 'dart:async'.
- 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
- ^" in (() → asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> async => let final self::Divergent<core::int> #t2 = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42546.dart:14:58: Error: A value of type 'Divergent<int>' can't be returned from an async function with return type 'Future<Divergent<Divergent<Divergent<int>>>>'.
+ ^" in (() → asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> async => let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue42546.dart:14:58: Error: A value of type 'Divergent<int>' can't be returned from an async function with return type 'Future<Divergent<Divergent<Divergent<int>>>>'.
- 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
- 'Future' is from 'dart:async'.
Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
- ^" in new self::Divergent::•<core::int>() as{TypeError,ForNonNullableByDefault} self::Divergent<self::Divergent<self::Divergent<core::int>>> in #t2 is asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> ?{FutureOr<dynamic>} await #t2 : #t2).call() as{TypeError,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<core::int>>>;
+ ^" in new self::Divergent::•<core::int>() as{TypeError,ForNonNullableByDefault} self::Divergent<self::Divergent<self::Divergent<core::int>>>).call() as{TypeError,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<core::int>>>;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue42546.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue42546.dart.strong.transformed.expect
deleted file mode 100644
index 5ae2bec..0000000
--- a/pkg/front_end/testcases/nnbd/issue42546.dart.strong.transformed.expect
+++ /dev/null
@@ -1,126 +0,0 @@
-library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/nnbd/issue42546.dart:14:58: Error: A value of type 'Divergent<int>' can't be returned from an async function with return type 'Future<Divergent<Divergent<Divergent<int>>>>'.
-// - 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
-// - 'Future' is from 'dart:async'.
-// Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
-// ^
-//
-// pkg/front_end/testcases/nnbd/issue42546.dart:14:75: Error: A value of type 'Future<Divergent<Divergent<Divergent<int>>>>' can't be assigned to a variable of type 'Future<Divergent<Divergent<int>>>'.
-// - 'Future' is from 'dart:async'.
-// - 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
-// Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
-// ^
-//
-import self as self;
-import "dart:core" as core;
-import "dart:async" as asy;
-import "dart:_internal" as _in;
-
-import "dart:async";
-
-class Divergent<T extends core::Object? = dynamic> extends core::Object implements asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>> {
- synthetic constructor •() → self::Divergent<self::Divergent::T%>
- : super core::Object::•()
- ;
- method noSuchMethod(core::Invocation invocation) → dynamic
- return super.{core::Object::noSuchMethod}(invocation);
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) →? core::bool test = #C1}) → asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C2, 0, #C3, core::List::unmodifiable<dynamic>(core::_GrowableList::_literal1<dynamic>(onError)), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C4: test}))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → FutureOr<void>action) → asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 0, #C3, core::List::unmodifiable<dynamic>(core::_GrowableList::_literal1<dynamic>(action)), core::Map::unmodifiable<core::Symbol*, dynamic>(#C7))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () →? FutureOr<self::Divergent<self::Divergent<self::Divergent::T%>>>onTimeout = #C1}) → asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 0, #C3, core::List::unmodifiable<dynamic>(core::_GrowableList::_literal1<dynamic>(timeLimit)), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C9: onTimeout}))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ then<R extends core::Object? = dynamic>((self::Divergent<self::Divergent<self::Divergent::T%>>) → FutureOr<self::Divergent::then::R%>onValue, {core::Function? onError = #C1}) → asy::Future<self::Divergent::then::R%>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 0, core::List::unmodifiable<core::Type*>(core::_GrowableList::_literal1<core::Type*>(self::Divergent::then::R%)), core::List::unmodifiable<dynamic>(core::_GrowableList::_literal1<dynamic>(onValue)), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C11: onError}))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<self::Divergent::then::R%>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::Divergent<self::Divergent<self::Divergent::T%>>>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C12, 0, #C3, #C6, core::Map::unmodifiable<core::Symbol*, dynamic>(#C7))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Stream<self::Divergent<self::Divergent<self::Divergent::T%>>>;
-}
-static method test() → dynamic /* originally async */ {
- final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
- core::bool* :is_sync = false;
- FutureOr<dynamic>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L1:
- {
- asy::Future<self::Divergent<self::Divergent<core::int>>> x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue42546.dart:14:75: Error: A value of type 'Future<Divergent<Divergent<Divergent<int>>>>' can't be assigned to a variable of type 'Future<Divergent<Divergent<int>>>'.
- - 'Future' is from 'dart:async'.
- - 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
- Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
- ^" in (() → asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> /* originally async */ {
- final asy::_Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> :async_future = new asy::_Future::•<self::Divergent<self::Divergent<self::Divergent<core::int>>>>();
- core::bool* :is_sync = false;
- FutureOr<self::Divergent<self::Divergent<self::Divergent<core::int>>>>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L2:
- {
- final self::Divergent<core::int> #t2 = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42546.dart:14:58: Error: A value of type 'Divergent<int>' can't be returned from an async function with return type 'Future<Divergent<Divergent<Divergent<int>>>>'.
- - 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
- - 'Future' is from 'dart:async'.
- Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
- ^" in new self::Divergent::•<core::int>() as{TypeError,ForNonNullableByDefault} self::Divergent<self::Divergent<self::Divergent<core::int>>>;
- if(#t2 is asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>>) {
- [yield] let dynamic #t4 = asy::_awaitHelper(#t2, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<self::Divergent<self::Divergent<core::int>>>(:result);
- }
- else {
- :async_temporary_0 = #t2;
- }
- :return_value = :async_temporary_0;
- break #L2;
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
- }).call() as{TypeError,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<core::int>>>;
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method main() → dynamic {}
-
-constants {
- #C1 = null
- #C2 = #catchError
- #C3 = <core::Type*>[]
- #C4 = #test
- #C5 = #whenComplete
- #C6 = <dynamic>[]
- #C7 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C6}
- #C8 = #timeout
- #C9 = #onTimeout
- #C10 = #then
- #C11 = #onError
- #C12 = #asStream
-}
diff --git a/pkg/front_end/testcases/nnbd/issue42546.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue42546.dart.weak.expect
index e446f7c..e5372a7 100644
--- a/pkg/front_end/testcases/nnbd/issue42546.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/issue42546.dart.weak.expect
@@ -42,11 +42,11 @@
- 'Future' is from 'dart:async'.
- 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
- ^" in (() → asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> async => let final self::Divergent<core::int> #t2 = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42546.dart:14:58: Error: A value of type 'Divergent<int>' can't be returned from an async function with return type 'Future<Divergent<Divergent<Divergent<int>>>>'.
+ ^" in (() → asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> async => let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/issue42546.dart:14:58: Error: A value of type 'Divergent<int>' can't be returned from an async function with return type 'Future<Divergent<Divergent<Divergent<int>>>>'.
- 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
- 'Future' is from 'dart:async'.
Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
- ^" in new self::Divergent::•<core::int>() as{TypeError,ForNonNullableByDefault} self::Divergent<self::Divergent<self::Divergent<core::int>>> in #t2 is asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> ?{FutureOr<dynamic>} await #t2 : #t2).call() as{TypeError,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<core::int>>>;
+ ^" in new self::Divergent::•<core::int>() as{TypeError,ForNonNullableByDefault} self::Divergent<self::Divergent<self::Divergent<core::int>>>).call() as{TypeError,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<core::int>>>;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue42546.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue42546.dart.weak.transformed.expect
deleted file mode 100644
index 5ae2bec..0000000
--- a/pkg/front_end/testcases/nnbd/issue42546.dart.weak.transformed.expect
+++ /dev/null
@@ -1,126 +0,0 @@
-library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/nnbd/issue42546.dart:14:58: Error: A value of type 'Divergent<int>' can't be returned from an async function with return type 'Future<Divergent<Divergent<Divergent<int>>>>'.
-// - 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
-// - 'Future' is from 'dart:async'.
-// Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
-// ^
-//
-// pkg/front_end/testcases/nnbd/issue42546.dart:14:75: Error: A value of type 'Future<Divergent<Divergent<Divergent<int>>>>' can't be assigned to a variable of type 'Future<Divergent<Divergent<int>>>'.
-// - 'Future' is from 'dart:async'.
-// - 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
-// Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
-// ^
-//
-import self as self;
-import "dart:core" as core;
-import "dart:async" as asy;
-import "dart:_internal" as _in;
-
-import "dart:async";
-
-class Divergent<T extends core::Object? = dynamic> extends core::Object implements asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>> {
- synthetic constructor •() → self::Divergent<self::Divergent::T%>
- : super core::Object::•()
- ;
- method noSuchMethod(core::Invocation invocation) → dynamic
- return super.{core::Object::noSuchMethod}(invocation);
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) →? core::bool test = #C1}) → asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C2, 0, #C3, core::List::unmodifiable<dynamic>(core::_GrowableList::_literal1<dynamic>(onError)), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C4: test}))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ whenComplete(() → FutureOr<void>action) → asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 0, #C3, core::List::unmodifiable<dynamic>(core::_GrowableList::_literal1<dynamic>(action)), core::Map::unmodifiable<core::Symbol*, dynamic>(#C7))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () →? FutureOr<self::Divergent<self::Divergent<self::Divergent::T%>>>onTimeout = #C1}) → asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 0, #C3, core::List::unmodifiable<dynamic>(core::_GrowableList::_literal1<dynamic>(timeLimit)), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C9: onTimeout}))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<self::Divergent::T%>>>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ then<R extends core::Object? = dynamic>((self::Divergent<self::Divergent<self::Divergent::T%>>) → FutureOr<self::Divergent::then::R%>onValue, {core::Function? onError = #C1}) → asy::Future<self::Divergent::then::R%>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 0, core::List::unmodifiable<core::Type*>(core::_GrowableList::_literal1<core::Type*>(self::Divergent::then::R%)), core::List::unmodifiable<dynamic>(core::_GrowableList::_literal1<dynamic>(onValue)), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C11: onError}))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Future<self::Divergent::then::R%>;
- no-such-method-forwarder method /* from org-dartlang-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::Divergent<self::Divergent<self::Divergent::T%>>>
- return this.{self::Divergent::noSuchMethod}(new core::_InvocationMirror::_withType(#C12, 0, #C3, #C6, core::Map::unmodifiable<core::Symbol*, dynamic>(#C7))) as{TypeError,ForDynamic,ForNonNullableByDefault} asy::Stream<self::Divergent<self::Divergent<self::Divergent::T%>>>;
-}
-static method test() → dynamic /* originally async */ {
- final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
- core::bool* :is_sync = false;
- FutureOr<dynamic>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L1:
- {
- asy::Future<self::Divergent<self::Divergent<core::int>>> x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue42546.dart:14:75: Error: A value of type 'Future<Divergent<Divergent<Divergent<int>>>>' can't be assigned to a variable of type 'Future<Divergent<Divergent<int>>>'.
- - 'Future' is from 'dart:async'.
- - 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
- Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
- ^" in (() → asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> /* originally async */ {
- final asy::_Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>> :async_future = new asy::_Future::•<self::Divergent<self::Divergent<self::Divergent<core::int>>>>();
- core::bool* :is_sync = false;
- FutureOr<self::Divergent<self::Divergent<self::Divergent<core::int>>>>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L2:
- {
- final self::Divergent<core::int> #t2 = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42546.dart:14:58: Error: A value of type 'Divergent<int>' can't be returned from an async function with return type 'Future<Divergent<Divergent<Divergent<int>>>>'.
- - 'Divergent' is from 'pkg/front_end/testcases/nnbd/issue42546.dart'.
- - 'Future' is from 'dart:async'.
- Future<Divergent<Divergent<int>>> x = (() async => new Divergent<int>())();
- ^" in new self::Divergent::•<core::int>() as{TypeError,ForNonNullableByDefault} self::Divergent<self::Divergent<self::Divergent<core::int>>>;
- if(#t2 is asy::Future<self::Divergent<self::Divergent<self::Divergent<core::int>>>>) {
- [yield] let dynamic #t4 = asy::_awaitHelper(#t2, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<self::Divergent<self::Divergent<core::int>>>(:result);
- }
- else {
- :async_temporary_0 = #t2;
- }
- :return_value = :async_temporary_0;
- break #L2;
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
- }).call() as{TypeError,ForNonNullableByDefault} asy::Future<self::Divergent<self::Divergent<core::int>>>;
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method main() → dynamic {}
-
-constants {
- #C1 = null
- #C2 = #catchError
- #C3 = <core::Type*>[]
- #C4 = #test
- #C5 = #whenComplete
- #C6 = <dynamic>[]
- #C7 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C6}
- #C8 = #timeout
- #C9 = #onTimeout
- #C10 = #then
- #C11 = #onError
- #C12 = #asStream
-}
diff --git a/pkg/front_end/testcases/nnbd/issue42743.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue42743.dart.strong.expect
index eaaabba4..1d21b07 100644
--- a/pkg/front_end/testcases/nnbd/issue42743.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/issue42743.dart.strong.expect
@@ -11,6 +11,6 @@
};
(dynamic _) → asy::Future<core::int?> async {
if(b)
- return let final core::int #t1 = 42 in #t1 is asy::Future<core::int?> ?{FutureOr<dynamic>} await #t1 : #t1;
+ return 42;
};
}
diff --git a/pkg/front_end/testcases/nnbd/issue42743.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue42743.dart.strong.transformed.expect
index 1509333..0ab4a75 100644
--- a/pkg/front_end/testcases/nnbd/issue42743.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue42743.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method main() → dynamic /* originally async */ {
final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
@@ -29,22 +28,12 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L2:
{
if(b) {
- final core::int #t1 = 42;
- if(#t1 is asy::Future<core::int?>) {
- [yield] let dynamic #t2 = asy::_awaitHelper(#t1, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t1;
- }
- :return_value = :async_temporary_0;
+ :return_value = 42;
break #L2;
}
}
diff --git a/pkg/front_end/testcases/nnbd/issue42743.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue42743.dart.weak.expect
index eaaabba4..1d21b07 100644
--- a/pkg/front_end/testcases/nnbd/issue42743.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/issue42743.dart.weak.expect
@@ -11,6 +11,6 @@
};
(dynamic _) → asy::Future<core::int?> async {
if(b)
- return let final core::int #t1 = 42 in #t1 is asy::Future<core::int?> ?{FutureOr<dynamic>} await #t1 : #t1;
+ return 42;
};
}
diff --git a/pkg/front_end/testcases/nnbd/issue42743.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue42743.dart.weak.transformed.expect
index 1509333..0ab4a75 100644
--- a/pkg/front_end/testcases/nnbd/issue42743.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue42743.dart.weak.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method main() → dynamic /* originally async */ {
final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
@@ -29,22 +28,12 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L2:
{
if(b) {
- final core::int #t1 = 42;
- if(#t1 is asy::Future<core::int?>) {
- [yield] let dynamic #t2 = asy::_awaitHelper(#t1, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t1;
- }
- :return_value = :async_temporary_0;
+ :return_value = 42;
break #L2;
}
}
diff --git a/pkg/front_end/testcases/nnbd/later.dart.strong.expect b/pkg/front_end/testcases/nnbd/later.dart.strong.expect
index 17dcee5..df47af6 100644
--- a/pkg/front_end/testcases/nnbd/later.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/later.dart.strong.expect
@@ -120,7 +120,7 @@
await for (core::String s in asy::Stream::fromIterable<core::String>(<core::String>["hest"])) {
core::print(s);
}
- return let final core::String #t2 = "hest" in #t2 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t2 : #t2;
+ return "hest";
}
static method fisk() → dynamic async {
late core::String s1 = invalid-expression "pkg/front_end/testcases/nnbd/later.dart:38:20: Error: `await` expressions are not supported in late local initializers.
@@ -129,7 +129,7 @@
late core::String s2 = "${#C1}${invalid-expression "pkg/front_end/testcases/nnbd/later.dart:39:30: Error: `await` expressions are not supported in late local initializers.
late String s2 = '\${fisk}\${await hest()}\${fisk}';
^^^^^"}${#C1}";
- late core::Function f = () → asy::Future<dynamic> async => let final dynamic #t3 = await self::hest() in #t3 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t3 : #t3;
+ late core::Function f = () → asy::Future<dynamic> async => await self::hest();
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/later.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/later.dart.strong.transformed.expect
index 53a4028..2aba575 100644
--- a/pkg/front_end/testcases/nnbd/later.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/later.dart.strong.transformed.expect
@@ -135,8 +135,6 @@
dynamic :saved_try_context_var1;
dynamic :exception0;
dynamic :stack_trace0;
- FutureOr<dynamic>:async_temporary_0;
- FutureOr<dynamic>:async_temporary_1;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
@@ -164,15 +162,7 @@
:result;
}
}
- final core::String #t5 = "hest";
- if(#t5 is asy::Future<dynamic>) {
- [yield] let dynamic #t6 = asy::_awaitHelper(#t5, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_1 = _in::unsafeCast<core::String>(:result);
- }
- else {
- :async_temporary_1 = #t5;
- }
- :return_value = :async_temporary_1;
+ :return_value = "hest";
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -219,21 +209,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
- [yield] let dynamic #t7 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null;
- final dynamic #t8 = :result;
- if(#t8 is asy::Future<dynamic>) {
- [yield] let dynamic #t9 = asy::_awaitHelper(#t8, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = :result;
- }
- else {
- :async_temporary_0 = #t8;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t5 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result;
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/later.dart.weak.expect b/pkg/front_end/testcases/nnbd/later.dart.weak.expect
index 17dcee5..df47af6 100644
--- a/pkg/front_end/testcases/nnbd/later.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/later.dart.weak.expect
@@ -120,7 +120,7 @@
await for (core::String s in asy::Stream::fromIterable<core::String>(<core::String>["hest"])) {
core::print(s);
}
- return let final core::String #t2 = "hest" in #t2 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t2 : #t2;
+ return "hest";
}
static method fisk() → dynamic async {
late core::String s1 = invalid-expression "pkg/front_end/testcases/nnbd/later.dart:38:20: Error: `await` expressions are not supported in late local initializers.
@@ -129,7 +129,7 @@
late core::String s2 = "${#C1}${invalid-expression "pkg/front_end/testcases/nnbd/later.dart:39:30: Error: `await` expressions are not supported in late local initializers.
late String s2 = '\${fisk}\${await hest()}\${fisk}';
^^^^^"}${#C1}";
- late core::Function f = () → asy::Future<dynamic> async => let final dynamic #t3 = await self::hest() in #t3 is asy::Future<dynamic> ?{FutureOr<dynamic>} await #t3 : #t3;
+ late core::Function f = () → asy::Future<dynamic> async => await self::hest();
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/later.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/later.dart.weak.transformed.expect
index 53a4028..2aba575 100644
--- a/pkg/front_end/testcases/nnbd/later.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/later.dart.weak.transformed.expect
@@ -135,8 +135,6 @@
dynamic :saved_try_context_var1;
dynamic :exception0;
dynamic :stack_trace0;
- FutureOr<dynamic>:async_temporary_0;
- FutureOr<dynamic>:async_temporary_1;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L1:
@@ -164,15 +162,7 @@
:result;
}
}
- final core::String #t5 = "hest";
- if(#t5 is asy::Future<dynamic>) {
- [yield] let dynamic #t6 = asy::_awaitHelper(#t5, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_1 = _in::unsafeCast<core::String>(:result);
- }
- else {
- :async_temporary_1 = #t5;
- }
- :return_value = :async_temporary_1;
+ :return_value = "hest";
break #L1;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -219,21 +209,12 @@
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
dynamic :saved_try_context_var0;
- FutureOr<dynamic>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
{
- [yield] let dynamic #t7 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null;
- final dynamic #t8 = :result;
- if(#t8 is asy::Future<dynamic>) {
- [yield] let dynamic #t9 = asy::_awaitHelper(#t8, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = :result;
- }
- else {
- :async_temporary_0 = #t8;
- }
- :return_value = :async_temporary_0;
+ [yield] let dynamic #t5 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result;
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/return_async.dart.strong.expect b/pkg/front_end/testcases/nnbd/return_async.dart.strong.expect
index 7fe1ab7..2c50b42 100644
--- a/pkg/front_end/testcases/nnbd/return_async.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/return_async.dart.strong.expect
@@ -28,6 +28,6 @@
}, (core::Object e, core::StackTrace s) → void {
completer.{asy::Completer::completeError}(e, s);
});
- return let final asy::Future<void> #t1 = completer.{asy::Completer::future} in #t1 is asy::Future<void> ?{FutureOr<void>} await #t1 : #t1;
+ return completer.{asy::Completer::future};
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/return_async.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/return_async.dart.strong.transformed.expect
index d88bd46..b9094ae 100644
--- a/pkg/front_end/testcases/nnbd/return_async.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/return_async.dart.strong.transformed.expect
@@ -106,8 +106,6 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<void>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
@@ -144,15 +142,7 @@
}, (core::Object e, core::StackTrace s) → void {
completer.{asy::Completer::completeError}(e, s);
});
- final asy::Future<void> #t7 = completer.{asy::Completer::future};
- if(#t7 is asy::Future<void>) {
- [yield] let dynamic #t8 = asy::_awaitHelper(#t7, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<void>(:result);
- }
- else {
- :async_temporary_0 = #t7;
- }
- :return_value = :async_temporary_0;
+ :return_value = completer.{asy::Completer::future};
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/return_async.dart.weak.expect b/pkg/front_end/testcases/nnbd/return_async.dart.weak.expect
index 7fe1ab7..2c50b42 100644
--- a/pkg/front_end/testcases/nnbd/return_async.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/return_async.dart.weak.expect
@@ -28,6 +28,6 @@
}, (core::Object e, core::StackTrace s) → void {
completer.{asy::Completer::completeError}(e, s);
});
- return let final asy::Future<void> #t1 = completer.{asy::Completer::future} in #t1 is asy::Future<void> ?{FutureOr<void>} await #t1 : #t1;
+ return completer.{asy::Completer::future};
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/return_async.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/return_async.dart.weak.transformed.expect
index d88bd46..b9094ae 100644
--- a/pkg/front_end/testcases/nnbd/return_async.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/return_async.dart.weak.transformed.expect
@@ -106,8 +106,6 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<void>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L4:
@@ -144,15 +142,7 @@
}, (core::Object e, core::StackTrace s) → void {
completer.{asy::Completer::completeError}(e, s);
});
- final asy::Future<void> #t7 = completer.{asy::Completer::future};
- if(#t7 is asy::Future<void>) {
- [yield] let dynamic #t8 = asy::_awaitHelper(#t7, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<void>(:result);
- }
- else {
- :async_temporary_0 = #t7;
- }
- :return_value = :async_temporary_0;
+ :return_value = completer.{asy::Completer::future};
break #L4;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
diff --git a/pkg/front_end/testcases/nnbd/return_from_async.dart b/pkg/front_end/testcases/nnbd/return_from_async.dart
deleted file mode 100644
index 93e646e..0000000
--- a/pkg/front_end/testcases/nnbd/return_from_async.dart
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-
-bool caughtFutureOrInt = false;
-
-FutureOr<int> throwFutureOrInt() async {
- throw 'FutureOr<int>';
-}
-
-Future<int> callFutureOrInt() async {
- try {
- return throwFutureOrInt();
- } catch (e) {
- print('Caught "$e"');
- caughtFutureOrInt = true;
- return 0;
- }
-}
-
-bool caughtInt = false;
-
-int throwInt() {
- throw 'int';
-}
-
-Future<int> callInt() async {
- try {
- return throwInt();
- } catch (e) {
- print('Caught "$e"');
- caughtInt = true;
- return 0;
- }
-}
-
-bool caughtFutureInt = false;
-
-Future<int> throwFutureInt() async {
- throw 'Future<int>';
-}
-
-Future<int> callFutureInt() async {
- try {
- return throwFutureInt();
- } catch (e) {
- print('Caught "$e"');
- caughtFutureInt = true;
- return 0;
- }
-}
-
-bool caughtDynamic = false;
-
-dynamic throwDynamic() {
- throw 'dynamic';
-}
-
-Future<int> callDynamic() async {
- try {
- return throwDynamic();
- } catch (e) {
- print('Caught "$e"');
- caughtDynamic = true;
- return 0;
- }
-}
-
-bool caughtFutureNum = false;
-
-Future<int> throwFutureNum() async {
- throw 'Future<num>';
-}
-
-Future<num> callFutureNum() async {
- try {
- return throwFutureNum();
- } catch (e) {
- print('Caught "$e"');
- caughtFutureNum = true;
- return 0;
- }
-}
-
-void main() async {
- await callFutureOrInt();
- if (!caughtFutureOrInt) throw 'Uncaught async return';
- await callInt();
- if (!caughtInt) throw 'Uncaught async return';
- await callFutureInt();
- if (!caughtFutureInt) throw 'Uncaught async return';
- await callDynamic();
- if (!caughtDynamic) throw 'Uncaught async return';
- await callFutureNum();
- if (!caughtFutureNum) throw 'Uncaught async return';
-}
diff --git a/pkg/front_end/testcases/nnbd/return_from_async.dart.outline.expect b/pkg/front_end/testcases/nnbd/return_from_async.dart.outline.expect
deleted file mode 100644
index fce58f8..0000000
--- a/pkg/front_end/testcases/nnbd/return_from_async.dart.outline.expect
+++ /dev/null
@@ -1,34 +0,0 @@
-library /*isNonNullableByDefault*/;
-import self as self;
-import "dart:core" as core;
-import "dart:async" as asy;
-
-import "dart:async";
-
-static field core::bool caughtFutureOrInt;
-static field core::bool caughtInt;
-static field core::bool caughtFutureInt;
-static field core::bool caughtDynamic;
-static field core::bool caughtFutureNum;
-static method throwFutureOrInt() → FutureOr<core::int> async
- ;
-static method callFutureOrInt() → asy::Future<core::int> async
- ;
-static method throwInt() → core::int
- ;
-static method callInt() → asy::Future<core::int> async
- ;
-static method throwFutureInt() → asy::Future<core::int> async
- ;
-static method callFutureInt() → asy::Future<core::int> async
- ;
-static method throwDynamic() → dynamic
- ;
-static method callDynamic() → asy::Future<core::int> async
- ;
-static method throwFutureNum() → asy::Future<core::int> async
- ;
-static method callFutureNum() → asy::Future<core::num> async
- ;
-static method main() → void async
- ;
diff --git a/pkg/front_end/testcases/nnbd/return_from_async.dart.strong.expect b/pkg/front_end/testcases/nnbd/return_from_async.dart.strong.expect
deleted file mode 100644
index 07f9c6e..0000000
--- a/pkg/front_end/testcases/nnbd/return_from_async.dart.strong.expect
+++ /dev/null
@@ -1,94 +0,0 @@
-library /*isNonNullableByDefault*/;
-import self as self;
-import "dart:core" as core;
-import "dart:async" as asy;
-
-import "dart:async";
-
-static field core::bool caughtFutureOrInt = false;
-static field core::bool caughtInt = false;
-static field core::bool caughtFutureInt = false;
-static field core::bool caughtDynamic = false;
-static field core::bool caughtFutureNum = false;
-static method throwFutureOrInt() → FutureOr<core::int> async {
- throw "FutureOr<int>";
-}
-static method callFutureOrInt() → asy::Future<core::int> async {
- try {
- return let final FutureOr<core::int>#t1 = self::throwFutureOrInt() in #t1 is asy::Future<core::int> ?{FutureOr<core::int>} await #t1 : #t1;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureOrInt = true;
- return let final core::int #t2 = 0 in #t2 is asy::Future<core::int> ?{FutureOr<core::int>} await #t2 : #t2;
- }
-}
-static method throwInt() → core::int {
- throw "int";
-}
-static method callInt() → asy::Future<core::int> async {
- try {
- return let final core::int #t3 = self::throwInt() in #t3 is asy::Future<core::int> ?{FutureOr<core::int>} await #t3 : #t3;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtInt = true;
- return let final core::int #t4 = 0 in #t4 is asy::Future<core::int> ?{FutureOr<core::int>} await #t4 : #t4;
- }
-}
-static method throwFutureInt() → asy::Future<core::int> async {
- throw "Future<int>";
-}
-static method callFutureInt() → asy::Future<core::int> async {
- try {
- return let final asy::Future<core::int> #t5 = self::throwFutureInt() in #t5 is asy::Future<core::int> ?{FutureOr<core::int>} await #t5 : #t5;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureInt = true;
- return let final core::int #t6 = 0 in #t6 is asy::Future<core::int> ?{FutureOr<core::int>} await #t6 : #t6;
- }
-}
-static method throwDynamic() → dynamic {
- throw "dynamic";
-}
-static method callDynamic() → asy::Future<core::int> async {
- try {
- return let final dynamic #t7 = self::throwDynamic() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::int> in #t7 is asy::Future<core::int> ?{FutureOr<core::int>} await #t7 : #t7;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtDynamic = true;
- return let final core::int #t8 = 0 in #t8 is asy::Future<core::int> ?{FutureOr<core::int>} await #t8 : #t8;
- }
-}
-static method throwFutureNum() → asy::Future<core::int> async {
- throw "Future<num>";
-}
-static method callFutureNum() → asy::Future<core::num> async {
- try {
- return let final asy::Future<core::int> #t9 = self::throwFutureNum() in #t9 is asy::Future<core::num> ?{FutureOr<core::num>} await #t9 : #t9;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureNum = true;
- return let final core::int #t10 = 0 in #t10 is asy::Future<core::num> ?{FutureOr<core::num>} await #t10 : #t10;
- }
-}
-static method main() → void async {
- await self::callFutureOrInt();
- if(!self::caughtFutureOrInt)
- throw "Uncaught async return";
- await self::callInt();
- if(!self::caughtInt)
- throw "Uncaught async return";
- await self::callFutureInt();
- if(!self::caughtFutureInt)
- throw "Uncaught async return";
- await self::callDynamic();
- if(!self::caughtDynamic)
- throw "Uncaught async return";
- await self::callFutureNum();
- if(!self::caughtFutureNum)
- throw "Uncaught async return";
-}
diff --git a/pkg/front_end/testcases/nnbd/return_from_async.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/return_from_async.dart.strong.transformed.expect
deleted file mode 100644
index 5bd5d9f..0000000
--- a/pkg/front_end/testcases/nnbd/return_from_async.dart.strong.transformed.expect
+++ /dev/null
@@ -1,433 +0,0 @@
-library /*isNonNullableByDefault*/;
-import self as self;
-import "dart:core" as core;
-import "dart:async" as asy;
-import "dart:_internal" as _in;
-
-import "dart:async";
-
-static field core::bool caughtFutureOrInt = false;
-static field core::bool caughtInt = false;
-static field core::bool caughtFutureInt = false;
-static field core::bool caughtDynamic = false;
-static field core::bool caughtFutureNum = false;
-static method throwFutureOrInt() → FutureOr<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L1:
- {
- throw "FutureOr<int>";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callFutureOrInt() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L2:
- {
- try {
- final FutureOr<core::int>#t1 = self::throwFutureOrInt();
- if(#t1 is asy::Future<core::int>) {
- [yield] let dynamic #t2 = asy::_awaitHelper(#t1, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t1;
- }
- :return_value = :async_temporary_0;
- break #L2;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureOrInt = true;
- final core::int #t3 = 0;
- if(#t3 is asy::Future<core::int>) {
- [yield] let dynamic #t4 = asy::_awaitHelper(#t3, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t3;
- }
- :return_value = :async_temporary_2;
- break #L2;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method throwInt() → core::int {
- throw "int";
-}
-static method callInt() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L3:
- {
- try {
- final core::int #t5 = self::throwInt();
- if(#t5 is asy::Future<core::int>) {
- [yield] let dynamic #t6 = asy::_awaitHelper(#t5, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t5;
- }
- :return_value = :async_temporary_0;
- break #L3;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtInt = true;
- final core::int #t7 = 0;
- if(#t7 is asy::Future<core::int>) {
- [yield] let dynamic #t8 = asy::_awaitHelper(#t7, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t7;
- }
- :return_value = :async_temporary_2;
- break #L3;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method throwFutureInt() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L4:
- {
- throw "Future<int>";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callFutureInt() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L5:
- {
- try {
- final asy::Future<core::int> #t9 = self::throwFutureInt();
- if(#t9 is asy::Future<core::int>) {
- [yield] let dynamic #t10 = asy::_awaitHelper(#t9, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t9;
- }
- :return_value = :async_temporary_0;
- break #L5;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureInt = true;
- final core::int #t11 = 0;
- if(#t11 is asy::Future<core::int>) {
- [yield] let dynamic #t12 = asy::_awaitHelper(#t11, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t11;
- }
- :return_value = :async_temporary_2;
- break #L5;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method throwDynamic() → dynamic {
- throw "dynamic";
-}
-static method callDynamic() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L6:
- {
- try {
- final FutureOr<core::int>#t13 = self::throwDynamic() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::int>;
- if(#t13 is asy::Future<core::int>) {
- [yield] let dynamic #t14 = asy::_awaitHelper(#t13, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t13;
- }
- :return_value = :async_temporary_0;
- break #L6;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtDynamic = true;
- final core::int #t15 = 0;
- if(#t15 is asy::Future<core::int>) {
- [yield] let dynamic #t16 = asy::_awaitHelper(#t15, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t15;
- }
- :return_value = :async_temporary_2;
- break #L6;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method throwFutureNum() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L7:
- {
- throw "Future<num>";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callFutureNum() → asy::Future<core::num> /* originally async */ {
- final asy::_Future<core::num> :async_future = new asy::_Future::•<core::num>();
- core::bool* :is_sync = false;
- FutureOr<core::num>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::num>:async_temporary_0;
- FutureOr<core::num>:async_temporary_1;
- FutureOr<core::num>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L8:
- {
- try {
- final asy::Future<core::int> #t17 = self::throwFutureNum();
- if(#t17 is asy::Future<core::num>) {
- [yield] let dynamic #t18 = asy::_awaitHelper(#t17, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t17;
- }
- :return_value = :async_temporary_0;
- break #L8;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureNum = true;
- final core::int #t19 = 0;
- if(#t19 is asy::Future<core::num>) {
- [yield] let dynamic #t20 = asy::_awaitHelper(#t19, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t19;
- }
- :return_value = :async_temporary_2;
- break #L8;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method main() → void /* originally async */ {
- final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
- core::bool* :is_sync = false;
- FutureOr<dynamic>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L9:
- {
- [yield] let dynamic #t21 = asy::_awaitHelper(self::callFutureOrInt(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtFutureOrInt)
- throw "Uncaught async return";
- [yield] let dynamic #t22 = asy::_awaitHelper(self::callInt(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtInt)
- throw "Uncaught async return";
- [yield] let dynamic #t23 = asy::_awaitHelper(self::callFutureInt(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtFutureInt)
- throw "Uncaught async return";
- [yield] let dynamic #t24 = asy::_awaitHelper(self::callDynamic(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtDynamic)
- throw "Uncaught async return";
- [yield] let dynamic #t25 = asy::_awaitHelper(self::callFutureNum(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::num>(:result);
- if(!self::caughtFutureNum)
- throw "Uncaught async return";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
diff --git a/pkg/front_end/testcases/nnbd/return_from_async.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/return_from_async.dart.textual_outline.expect
deleted file mode 100644
index bc32d23..0000000
--- a/pkg/front_end/testcases/nnbd/return_from_async.dart.textual_outline.expect
+++ /dev/null
@@ -1,18 +0,0 @@
-import 'dart:async';
-
-bool caughtFutureOrInt = false;
-FutureOr<int> throwFutureOrInt() async {}
-Future<int> callFutureOrInt() async {}
-bool caughtInt = false;
-int throwInt() {}
-Future<int> callInt() async {}
-bool caughtFutureInt = false;
-Future<int> throwFutureInt() async {}
-Future<int> callFutureInt() async {}
-bool caughtDynamic = false;
-dynamic throwDynamic() {}
-Future<int> callDynamic() async {}
-bool caughtFutureNum = false;
-Future<int> throwFutureNum() async {}
-Future<num> callFutureNum() async {}
-void main() async {}
diff --git a/pkg/front_end/testcases/nnbd/return_from_async.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/return_from_async.dart.textual_outline_modelled.expect
deleted file mode 100644
index 7a7e905..0000000
--- a/pkg/front_end/testcases/nnbd/return_from_async.dart.textual_outline_modelled.expect
+++ /dev/null
@@ -1,18 +0,0 @@
-import 'dart:async';
-
-Future<int> callDynamic() async {}
-Future<int> callFutureInt() async {}
-Future<int> callFutureOrInt() async {}
-Future<int> callInt() async {}
-Future<int> throwFutureInt() async {}
-Future<int> throwFutureNum() async {}
-Future<num> callFutureNum() async {}
-FutureOr<int> throwFutureOrInt() async {}
-bool caughtDynamic = false;
-bool caughtFutureInt = false;
-bool caughtFutureNum = false;
-bool caughtFutureOrInt = false;
-bool caughtInt = false;
-dynamic throwDynamic() {}
-int throwInt() {}
-void main() async {}
diff --git a/pkg/front_end/testcases/nnbd/return_from_async.dart.weak.expect b/pkg/front_end/testcases/nnbd/return_from_async.dart.weak.expect
deleted file mode 100644
index 07f9c6e..0000000
--- a/pkg/front_end/testcases/nnbd/return_from_async.dart.weak.expect
+++ /dev/null
@@ -1,94 +0,0 @@
-library /*isNonNullableByDefault*/;
-import self as self;
-import "dart:core" as core;
-import "dart:async" as asy;
-
-import "dart:async";
-
-static field core::bool caughtFutureOrInt = false;
-static field core::bool caughtInt = false;
-static field core::bool caughtFutureInt = false;
-static field core::bool caughtDynamic = false;
-static field core::bool caughtFutureNum = false;
-static method throwFutureOrInt() → FutureOr<core::int> async {
- throw "FutureOr<int>";
-}
-static method callFutureOrInt() → asy::Future<core::int> async {
- try {
- return let final FutureOr<core::int>#t1 = self::throwFutureOrInt() in #t1 is asy::Future<core::int> ?{FutureOr<core::int>} await #t1 : #t1;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureOrInt = true;
- return let final core::int #t2 = 0 in #t2 is asy::Future<core::int> ?{FutureOr<core::int>} await #t2 : #t2;
- }
-}
-static method throwInt() → core::int {
- throw "int";
-}
-static method callInt() → asy::Future<core::int> async {
- try {
- return let final core::int #t3 = self::throwInt() in #t3 is asy::Future<core::int> ?{FutureOr<core::int>} await #t3 : #t3;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtInt = true;
- return let final core::int #t4 = 0 in #t4 is asy::Future<core::int> ?{FutureOr<core::int>} await #t4 : #t4;
- }
-}
-static method throwFutureInt() → asy::Future<core::int> async {
- throw "Future<int>";
-}
-static method callFutureInt() → asy::Future<core::int> async {
- try {
- return let final asy::Future<core::int> #t5 = self::throwFutureInt() in #t5 is asy::Future<core::int> ?{FutureOr<core::int>} await #t5 : #t5;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureInt = true;
- return let final core::int #t6 = 0 in #t6 is asy::Future<core::int> ?{FutureOr<core::int>} await #t6 : #t6;
- }
-}
-static method throwDynamic() → dynamic {
- throw "dynamic";
-}
-static method callDynamic() → asy::Future<core::int> async {
- try {
- return let final dynamic #t7 = self::throwDynamic() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::int> in #t7 is asy::Future<core::int> ?{FutureOr<core::int>} await #t7 : #t7;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtDynamic = true;
- return let final core::int #t8 = 0 in #t8 is asy::Future<core::int> ?{FutureOr<core::int>} await #t8 : #t8;
- }
-}
-static method throwFutureNum() → asy::Future<core::int> async {
- throw "Future<num>";
-}
-static method callFutureNum() → asy::Future<core::num> async {
- try {
- return let final asy::Future<core::int> #t9 = self::throwFutureNum() in #t9 is asy::Future<core::num> ?{FutureOr<core::num>} await #t9 : #t9;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureNum = true;
- return let final core::int #t10 = 0 in #t10 is asy::Future<core::num> ?{FutureOr<core::num>} await #t10 : #t10;
- }
-}
-static method main() → void async {
- await self::callFutureOrInt();
- if(!self::caughtFutureOrInt)
- throw "Uncaught async return";
- await self::callInt();
- if(!self::caughtInt)
- throw "Uncaught async return";
- await self::callFutureInt();
- if(!self::caughtFutureInt)
- throw "Uncaught async return";
- await self::callDynamic();
- if(!self::caughtDynamic)
- throw "Uncaught async return";
- await self::callFutureNum();
- if(!self::caughtFutureNum)
- throw "Uncaught async return";
-}
diff --git a/pkg/front_end/testcases/nnbd/return_from_async.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/return_from_async.dart.weak.transformed.expect
deleted file mode 100644
index 5bd5d9f..0000000
--- a/pkg/front_end/testcases/nnbd/return_from_async.dart.weak.transformed.expect
+++ /dev/null
@@ -1,433 +0,0 @@
-library /*isNonNullableByDefault*/;
-import self as self;
-import "dart:core" as core;
-import "dart:async" as asy;
-import "dart:_internal" as _in;
-
-import "dart:async";
-
-static field core::bool caughtFutureOrInt = false;
-static field core::bool caughtInt = false;
-static field core::bool caughtFutureInt = false;
-static field core::bool caughtDynamic = false;
-static field core::bool caughtFutureNum = false;
-static method throwFutureOrInt() → FutureOr<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L1:
- {
- throw "FutureOr<int>";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callFutureOrInt() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L2:
- {
- try {
- final FutureOr<core::int>#t1 = self::throwFutureOrInt();
- if(#t1 is asy::Future<core::int>) {
- [yield] let dynamic #t2 = asy::_awaitHelper(#t1, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t1;
- }
- :return_value = :async_temporary_0;
- break #L2;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureOrInt = true;
- final core::int #t3 = 0;
- if(#t3 is asy::Future<core::int>) {
- [yield] let dynamic #t4 = asy::_awaitHelper(#t3, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t3;
- }
- :return_value = :async_temporary_2;
- break #L2;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method throwInt() → core::int {
- throw "int";
-}
-static method callInt() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L3:
- {
- try {
- final core::int #t5 = self::throwInt();
- if(#t5 is asy::Future<core::int>) {
- [yield] let dynamic #t6 = asy::_awaitHelper(#t5, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t5;
- }
- :return_value = :async_temporary_0;
- break #L3;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtInt = true;
- final core::int #t7 = 0;
- if(#t7 is asy::Future<core::int>) {
- [yield] let dynamic #t8 = asy::_awaitHelper(#t7, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t7;
- }
- :return_value = :async_temporary_2;
- break #L3;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method throwFutureInt() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L4:
- {
- throw "Future<int>";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callFutureInt() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L5:
- {
- try {
- final asy::Future<core::int> #t9 = self::throwFutureInt();
- if(#t9 is asy::Future<core::int>) {
- [yield] let dynamic #t10 = asy::_awaitHelper(#t9, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t9;
- }
- :return_value = :async_temporary_0;
- break #L5;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureInt = true;
- final core::int #t11 = 0;
- if(#t11 is asy::Future<core::int>) {
- [yield] let dynamic #t12 = asy::_awaitHelper(#t11, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t11;
- }
- :return_value = :async_temporary_2;
- break #L5;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method throwDynamic() → dynamic {
- throw "dynamic";
-}
-static method callDynamic() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L6:
- {
- try {
- final FutureOr<core::int>#t13 = self::throwDynamic() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::int>;
- if(#t13 is asy::Future<core::int>) {
- [yield] let dynamic #t14 = asy::_awaitHelper(#t13, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t13;
- }
- :return_value = :async_temporary_0;
- break #L6;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtDynamic = true;
- final core::int #t15 = 0;
- if(#t15 is asy::Future<core::int>) {
- [yield] let dynamic #t16 = asy::_awaitHelper(#t15, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t15;
- }
- :return_value = :async_temporary_2;
- break #L6;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method throwFutureNum() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L7:
- {
- throw "Future<num>";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callFutureNum() → asy::Future<core::num> /* originally async */ {
- final asy::_Future<core::num> :async_future = new asy::_Future::•<core::num>();
- core::bool* :is_sync = false;
- FutureOr<core::num>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::num>:async_temporary_0;
- FutureOr<core::num>:async_temporary_1;
- FutureOr<core::num>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L8:
- {
- try {
- final asy::Future<core::int> #t17 = self::throwFutureNum();
- if(#t17 is asy::Future<core::num>) {
- [yield] let dynamic #t18 = asy::_awaitHelper(#t17, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t17;
- }
- :return_value = :async_temporary_0;
- break #L8;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureNum = true;
- final core::int #t19 = 0;
- if(#t19 is asy::Future<core::num>) {
- [yield] let dynamic #t20 = asy::_awaitHelper(#t19, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t19;
- }
- :return_value = :async_temporary_2;
- break #L8;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method main() → void /* originally async */ {
- final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
- core::bool* :is_sync = false;
- FutureOr<dynamic>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L9:
- {
- [yield] let dynamic #t21 = asy::_awaitHelper(self::callFutureOrInt(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtFutureOrInt)
- throw "Uncaught async return";
- [yield] let dynamic #t22 = asy::_awaitHelper(self::callInt(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtInt)
- throw "Uncaught async return";
- [yield] let dynamic #t23 = asy::_awaitHelper(self::callFutureInt(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtFutureInt)
- throw "Uncaught async return";
- [yield] let dynamic #t24 = asy::_awaitHelper(self::callDynamic(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtDynamic)
- throw "Uncaught async return";
- [yield] let dynamic #t25 = asy::_awaitHelper(self::callFutureNum(), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::num>(:result);
- if(!self::caughtFutureNum)
- throw "Uncaught async return";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
diff --git a/pkg/front_end/testcases/nnbd/return_null.dart.strong.expect b/pkg/front_end/testcases/nnbd/return_null.dart.strong.expect
index dab461b..70d918b 100644
--- a/pkg/front_end/testcases/nnbd/return_null.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/return_null.dart.strong.expect
@@ -103,7 +103,7 @@
static method returnAsync4() → FutureOr<core::int?> async {}
static method returnAsync5() → dynamic async {}
static method returnAsync6() → asy::Future<core::int?> async {
- return let final Null #t6 = null in #t6 is asy::Future<core::int?> ?{FutureOr<core::int?>} await #t6 : #t6;
+ return null;
}
static method returnAsync7() → asy::Future<core::int?> async {}
static method yieldSync() → core::Iterable<dynamic> sync* {}
@@ -133,7 +133,7 @@
default:
{}
}
- return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:54:6: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
+ return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:54:6: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
- 'Enum' is from 'pkg/front_end/testcases/nnbd/return_null.dart'.
Enum caseReturn2(Enum e) /* error */ {
^" in null;
@@ -141,38 +141,38 @@
static method localFunctions() → dynamic {
function returnImplicit() → core::String {
core::print("foo");
- return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:63:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:63:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String returnImplicit() /* error */ {
^" in null;
}
function returnExplicit() → core::String {
core::print("foo");
- return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
return null; // error
^" in null as{TypeError,ForNonNullableByDefault} core::String;
}
function returnMixed(core::bool b) → core::String {
if(b) {
core::print("foo");
- return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
+ return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
return null; // error
^" in null as{TypeError,ForNonNullableByDefault} core::String;
}
- return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:72:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:72:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String returnMixed(bool b) /* error */ {
^" in null;
}
function returnAsync1() → asy::Future<dynamic> async {}
function returnAsync2() → FutureOr<dynamic> async {}
function returnAsync3() → FutureOr<core::int> async {
- return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:83:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+ return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:83:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
FutureOr<int> returnAsync3() async {} // error
^" in null;
}
function returnAsync4() → FutureOr<core::int?> async {}
function returnAsync5() → asy::Future<Null> async {}
function returnAsync6() → asy::Future<core::int?> async {
- return let final Null #t13 = null in #t13 is asy::Future<core::int?> ?{FutureOr<core::int?>} await #t13 : #t13;
+ return null;
}
function returnAsync7() → asy::Future<core::int?> async {}
function yieldSync() → core::Iterable<dynamic> sync* {}
@@ -202,7 +202,7 @@
default:
{}
}
- return let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:108:3: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
+ return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:108:3: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
- 'Enum' is from 'pkg/front_end/testcases/nnbd/return_null.dart'.
Enum caseReturn2(Enum e) /* error */ {
^" in null;
diff --git a/pkg/front_end/testcases/nnbd/return_null.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/return_null.dart.strong.transformed.expect
index af2d2ae..2b1a3dc 100644
--- a/pkg/front_end/testcases/nnbd/return_null.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/return_null.dart.strong.transformed.expect
@@ -55,7 +55,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
import "dart:async";
@@ -227,21 +226,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::int?>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L6:
{
- final Null #t8 = null;
- if(#t8 is asy::Future<core::int?>) {
- [yield] let dynamic #t9 = asy::_awaitHelper(#t8, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_0 = #t8;
- }
- :return_value = :async_temporary_0;
+ :return_value = null;
break #L6;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -343,7 +332,7 @@
default:
{}
}
- return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:54:6: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:54:6: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
- 'Enum' is from 'pkg/front_end/testcases/nnbd/return_null.dart'.
Enum caseReturn2(Enum e) /* error */ {
^" in null;
@@ -351,24 +340,24 @@
static method localFunctions() → dynamic {
function returnImplicit() → core::String {
core::print("foo");
- return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:63:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:63:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String returnImplicit() /* error */ {
^" in null;
}
function returnExplicit() → core::String {
core::print("foo");
- return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
+ return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
return null; // error
- ^" in let Null #t13 = null in #t13.==(null) ?{core::String} #t13 as{TypeError,ForNonNullableByDefault} core::String : #t13{core::String};
+ ^" in let Null #t11 = null in #t11.==(null) ?{core::String} #t11 as{TypeError,ForNonNullableByDefault} core::String : #t11{core::String};
}
function returnMixed(core::bool b) → core::String {
if(b) {
core::print("foo");
- return let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
+ return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
return null; // error
- ^" in let Null #t15 = null in #t15.==(null) ?{core::String} #t15 as{TypeError,ForNonNullableByDefault} core::String : #t15{core::String};
+ ^" in let Null #t13 = null in #t13.==(null) ?{core::String} #t13 as{TypeError,ForNonNullableByDefault} core::String : #t13{core::String};
}
- return let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:72:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:72:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String returnMixed(bool b) /* error */ {
^" in null;
}
@@ -432,7 +421,7 @@
try {
#L15:
{
- :return_value = let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:83:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+ :return_value = let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:83:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
FutureOr<int> returnAsync3() async {} // error
^" in null;
break #L15;
@@ -505,21 +494,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::int?>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L18:
{
- final Null #t18 = null;
- if(#t18 is asy::Future<core::int?>) {
- [yield] let dynamic #t19 = asy::_awaitHelper(#t18, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_0 = #t18;
- }
- :return_value = :async_temporary_0;
+ :return_value = null;
break #L18;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -621,7 +600,7 @@
default:
{}
}
- return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:108:3: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
+ return let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:108:3: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
- 'Enum' is from 'pkg/front_end/testcases/nnbd/return_null.dart'.
Enum caseReturn2(Enum e) /* error */ {
^" in null;
@@ -663,7 +642,7 @@
Evaluated: MethodInvocation @ org-dartlang-testcase:///return_null.dart:75:14 -> BoolConstant(true)
Evaluated: VariableGet @ org-dartlang-testcase:///return_null.dart:75:14 -> NullConstant(null)
Evaluated: VariableGet @ org-dartlang-testcase:///return_null.dart:75:14 -> NullConstant(null)
-Extra constant evaluation: evaluated: 422, effectively constant: 12
+Extra constant evaluation: evaluated: 394, effectively constant: 12
Constructor coverage from constants:
diff --git a/pkg/front_end/testcases/nnbd/return_null.dart.weak.expect b/pkg/front_end/testcases/nnbd/return_null.dart.weak.expect
index aef28a4..0513741 100644
--- a/pkg/front_end/testcases/nnbd/return_null.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/return_null.dart.weak.expect
@@ -104,7 +104,7 @@
static method returnAsync4() → FutureOr<core::int?> async {}
static method returnAsync5() → dynamic async {}
static method returnAsync6() → asy::Future<core::int?> async {
- return let final Null #t6 = null in #t6 is asy::Future<core::int?> ?{FutureOr<core::int?>} await #t6 : #t6;
+ return null;
}
static method returnAsync7() → asy::Future<core::int?> async {}
static method yieldSync() → core::Iterable<dynamic> sync* {}
@@ -137,7 +137,7 @@
default:
{}
}
- return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:54:6: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
+ return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:54:6: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
- 'Enum' is from 'pkg/front_end/testcases/nnbd/return_null.dart'.
Enum caseReturn2(Enum e) /* error */ {
^" in null;
@@ -145,38 +145,38 @@
static method localFunctions() → dynamic {
function returnImplicit() → core::String {
core::print("foo");
- return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:63:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:63:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String returnImplicit() /* error */ {
^" in null;
}
function returnExplicit() → core::String {
core::print("foo");
- return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
return null; // error
^" in null as{TypeError,ForNonNullableByDefault} core::String;
}
function returnMixed(core::bool b) → core::String {
if(b) {
core::print("foo");
- return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
+ return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
return null; // error
^" in null as{TypeError,ForNonNullableByDefault} core::String;
}
- return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:72:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:72:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String returnMixed(bool b) /* error */ {
^" in null;
}
function returnAsync1() → asy::Future<dynamic> async {}
function returnAsync2() → FutureOr<dynamic> async {}
function returnAsync3() → FutureOr<core::int> async {
- return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:83:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+ return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:83:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
FutureOr<int> returnAsync3() async {} // error
^" in null;
}
function returnAsync4() → FutureOr<core::int?> async {}
function returnAsync5() → asy::Future<Null> async {}
function returnAsync6() → asy::Future<core::int?> async {
- return let final Null #t13 = null in #t13 is asy::Future<core::int?> ?{FutureOr<core::int?>} await #t13 : #t13;
+ return null;
}
function returnAsync7() → asy::Future<core::int?> async {}
function yieldSync() → core::Iterable<dynamic> sync* {}
@@ -209,7 +209,7 @@
default:
{}
}
- return let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:108:3: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
+ return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:108:3: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
- 'Enum' is from 'pkg/front_end/testcases/nnbd/return_null.dart'.
Enum caseReturn2(Enum e) /* error */ {
^" in null;
diff --git a/pkg/front_end/testcases/nnbd/return_null.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/return_null.dart.weak.transformed.expect
index dba40e5..3643cf7 100644
--- a/pkg/front_end/testcases/nnbd/return_null.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/return_null.dart.weak.transformed.expect
@@ -227,21 +227,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::int?>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L6:
{
- final Null #t6 = null;
- if(#t6 is asy::Future<core::int?>) {
- [yield] let dynamic #t7 = asy::_awaitHelper(#t6, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_0 = #t6;
- }
- :return_value = :async_temporary_0;
+ :return_value = null;
break #L6;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -346,7 +336,7 @@
default:
{}
}
- return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:54:6: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
+ return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:54:6: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
- 'Enum' is from 'pkg/front_end/testcases/nnbd/return_null.dart'.
Enum caseReturn2(Enum e) /* error */ {
^" in null;
@@ -354,24 +344,24 @@
static method localFunctions() → dynamic {
function returnImplicit() → core::String {
core::print("foo");
- return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:63:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:63:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String returnImplicit() /* error */ {
^" in null;
}
function returnExplicit() → core::String {
core::print("foo");
- return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
+ return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
return null; // error
^" in null;
}
function returnMixed(core::bool b) → core::String {
if(b) {
core::print("foo");
- return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
+ return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
return null; // error
^" in null;
}
- return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:72:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
+ return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:72:3: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String returnMixed(bool b) /* error */ {
^" in null;
}
@@ -435,7 +425,7 @@
try {
#L16:
{
- :return_value = let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:83:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+ :return_value = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:83:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
FutureOr<int> returnAsync3() async {} // error
^" in null;
break #L16;
@@ -508,21 +498,11 @@
(core::Object, core::StackTrace) → dynamic :async_op_error;
core::int :await_jump_var = 0;
dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- FutureOr<core::int?>:async_temporary_0;
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
try {
#L19:
{
- final Null #t14 = null;
- if(#t14 is asy::Future<core::int?>) {
- [yield] let dynamic #t15 = asy::_awaitHelper(#t14, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<Null>(:result);
- }
- else {
- :async_temporary_0 = #t14;
- }
- :return_value = :async_temporary_0;
+ :return_value = null;
break #L19;
}
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
@@ -627,7 +607,7 @@
default:
{}
}
- return let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:108:3: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
+ return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:108:3: Error: A non-null value must be returned since the return type 'Enum' doesn't allow null.
- 'Enum' is from 'pkg/front_end/testcases/nnbd/return_null.dart'.
Enum caseReturn2(Enum e) /* error */ {
^" in null;
diff --git a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart b/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart
deleted file mode 100644
index 5b167d0..0000000
--- a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'return_from_async_lib.dart';
-
-abstract class Class {
- FutureOr<int> throwFutureOrInt();
-
- int throwInt();
-
- Future<int> throwFutureInt();
-
- dynamic throwDynamic();
-
- Future<num> throwFutureNum();
-}
-
-bool caughtFutureOrInt = false;
-
-Future<int> callFutureOrInt(Class c) async {
- try {
- return c.throwFutureOrInt();
- } catch (e) {
- print('Caught "$e"');
- caughtFutureOrInt = true;
- return 0;
- }
-}
-
-bool caughtInt = false;
-
-Future<int> callInt(Class c) async {
- try {
- return c.throwInt();
- } catch (e) {
- print('Caught "$e"');
- caughtInt = true;
- return 0;
- }
-}
-
-bool caughtFutureInt = false;
-
-Future<int> callFutureInt(Class c) async {
- try {
- return c.throwFutureInt();
- } catch (e) {
- print('Caught "$e"');
- caughtFutureInt = true;
- return 0;
- }
-}
-
-bool caughtDynamic = false;
-
-Future<int> callDynamic(Class c) async {
- try {
- return c.throwDynamic();
- } catch (e) {
- print('Caught "$e"');
- caughtDynamic = true;
- return 0;
- }
-}
-
-bool caughtFutureNum = false;
-
-Future<num> callFutureNum(Class c) async {
- try {
- return c.throwFutureNum();
- } catch (e) {
- print('Caught "$e"');
- caughtFutureNum = true;
- return 0;
- }
-}
-
-void main() async {
- Class c = new Subclass();
- await callFutureOrInt(c);
- if (!caughtFutureOrInt) throw 'Uncaught async return';
- await callInt(c);
- if (!caughtInt) throw 'Uncaught async return';
- await callFutureInt(c);
- if (!caughtFutureInt) throw 'Uncaught async return';
- await callDynamic(c);
- if (!caughtDynamic) throw 'Uncaught async return';
- await callFutureNum(c);
- if (!caughtFutureNum) throw 'Uncaught async return';
-}
diff --git a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.textual_outline.expect
deleted file mode 100644
index 66339b5..0000000
--- a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.textual_outline.expect
+++ /dev/null
@@ -1,22 +0,0 @@
-import 'dart:async';
-import 'return_from_async_lib.dart';
-
-abstract class Class {
- FutureOr<int> throwFutureOrInt();
- int throwInt();
- Future<int> throwFutureInt();
- dynamic throwDynamic();
- Future<num> throwFutureNum();
-}
-
-bool caughtFutureOrInt = false;
-Future<int> callFutureOrInt(Class c) async {}
-bool caughtInt = false;
-Future<int> callInt(Class c) async {}
-bool caughtFutureInt = false;
-Future<int> callFutureInt(Class c) async {}
-bool caughtDynamic = false;
-Future<int> callDynamic(Class c) async {}
-bool caughtFutureNum = false;
-Future<num> callFutureNum(Class c) async {}
-void main() async {}
diff --git a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.textual_outline_modelled.expect
deleted file mode 100644
index 3c8dcd7..0000000
--- a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.textual_outline_modelled.expect
+++ /dev/null
@@ -1,23 +0,0 @@
-import 'dart:async';
-import 'return_from_async_lib.dart';
-
-Future<int> callDynamic(Class c) async {}
-Future<int> callFutureInt(Class c) async {}
-Future<int> callFutureOrInt(Class c) async {}
-Future<int> callInt(Class c) async {}
-Future<num> callFutureNum(Class c) async {}
-
-abstract class Class {
- Future<int> throwFutureInt();
- Future<num> throwFutureNum();
- FutureOr<int> throwFutureOrInt();
- dynamic throwDynamic();
- int throwInt();
-}
-
-bool caughtDynamic = false;
-bool caughtFutureInt = false;
-bool caughtFutureNum = false;
-bool caughtFutureOrInt = false;
-bool caughtInt = false;
-void main() async {}
diff --git a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.weak.expect b/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.weak.expect
deleted file mode 100644
index 0a614de..0000000
--- a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.weak.expect
+++ /dev/null
@@ -1,122 +0,0 @@
-library /*isNonNullableByDefault*/;
-import self as self;
-import "dart:core" as core;
-import "dart:async" as asy;
-import "return_from_async_lib.dart" as ret;
-
-import "dart:async";
-import "org-dartlang-testcase:///return_from_async_lib.dart";
-
-abstract class Class extends core::Object {
- synthetic constructor •() → self::Class
- : super core::Object::•()
- ;
- abstract method throwFutureOrInt() → FutureOr<core::int>;
- abstract method throwInt() → core::int;
- abstract method throwFutureInt() → asy::Future<core::int>;
- abstract method throwDynamic() → dynamic;
- abstract method throwFutureNum() → asy::Future<core::num>;
-}
-static field core::bool caughtFutureOrInt = false;
-static field core::bool caughtInt = false;
-static field core::bool caughtFutureInt = false;
-static field core::bool caughtDynamic = false;
-static field core::bool caughtFutureNum = false;
-static method callFutureOrInt(self::Class c) → asy::Future<core::int> async {
- try {
- return let final FutureOr<core::int>#t1 = c.{self::Class::throwFutureOrInt}() in #t1 is asy::Future<core::int> ?{FutureOr<core::int>} await #t1 : #t1;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureOrInt = true;
- return let final core::int #t2 = 0 in #t2 is asy::Future<core::int> ?{FutureOr<core::int>} await #t2 : #t2;
- }
-}
-static method callInt(self::Class c) → asy::Future<core::int> async {
- try {
- return let final core::int #t3 = c.{self::Class::throwInt}() in #t3 is asy::Future<core::int> ?{FutureOr<core::int>} await #t3 : #t3;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtInt = true;
- return let final core::int #t4 = 0 in #t4 is asy::Future<core::int> ?{FutureOr<core::int>} await #t4 : #t4;
- }
-}
-static method callFutureInt(self::Class c) → asy::Future<core::int> async {
- try {
- return let final asy::Future<core::int> #t5 = c.{self::Class::throwFutureInt}() in #t5 is asy::Future<core::int> ?{FutureOr<core::int>} await #t5 : #t5;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureInt = true;
- return let final core::int #t6 = 0 in #t6 is asy::Future<core::int> ?{FutureOr<core::int>} await #t6 : #t6;
- }
-}
-static method callDynamic(self::Class c) → asy::Future<core::int> async {
- try {
- return let final dynamic #t7 = c.{self::Class::throwDynamic}() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::int> in #t7 is asy::Future<core::int> ?{FutureOr<core::int>} await #t7 : #t7;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtDynamic = true;
- return let final core::int #t8 = 0 in #t8 is asy::Future<core::int> ?{FutureOr<core::int>} await #t8 : #t8;
- }
-}
-static method callFutureNum(self::Class c) → asy::Future<core::num> async {
- try {
- return let final asy::Future<core::num> #t9 = c.{self::Class::throwFutureNum}() in #t9 is asy::Future<core::num> ?{FutureOr<core::num>} await #t9 : #t9;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureNum = true;
- return let final core::int #t10 = 0 in #t10 is asy::Future<core::num> ?{FutureOr<core::num>} await #t10 : #t10;
- }
-}
-static method main() → void async {
- self::Class c = new ret::Subclass::•();
- await self::callFutureOrInt(c);
- if(!self::caughtFutureOrInt)
- throw "Uncaught async return";
- await self::callInt(c);
- if(!self::caughtInt)
- throw "Uncaught async return";
- await self::callFutureInt(c);
- if(!self::caughtFutureInt)
- throw "Uncaught async return";
- await self::callDynamic(c);
- if(!self::caughtDynamic)
- throw "Uncaught async return";
- await self::callFutureNum(c);
- if(!self::caughtFutureNum)
- throw "Uncaught async return";
-}
-
-library /*isNonNullableByDefault*/;
-import self as ret;
-import "dart:core" as core;
-import "return_from_async.dart" as self;
-import "dart:async" as asy;
-
-import "dart:async";
-import "org-dartlang-testcase:///return_from_async.dart";
-
-class Subclass extends core::Object implements self::Class {
- synthetic constructor •() → ret::Subclass
- : super core::Object::•()
- ;
- method throwFutureOrInt() → FutureOr<core::int> async {
- throw "FutureOr<int>";
- }
- method throwInt() → core::int {
- throw "int";
- }
- method throwFutureInt() → asy::Future<core::int> async {
- throw "Future<int>";
- }
- method throwDynamic() → dynamic {
- throw "dynamic";
- }
- method throwFutureNum() → asy::Future<core::num> async {
- throw "Future<num>";
- }
-}
diff --git a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.weak.transformed.expect
deleted file mode 100644
index 1924b7e..0000000
--- a/pkg/front_end/testcases/nnbd_mixed/return_from_async.dart.weak.transformed.expect
+++ /dev/null
@@ -1,461 +0,0 @@
-library /*isNonNullableByDefault*/;
-import self as self;
-import "dart:core" as core;
-import "dart:async" as asy;
-import "dart:_internal" as _in;
-import "return_from_async_lib.dart" as ret;
-
-import "dart:async";
-import "org-dartlang-testcase:///return_from_async_lib.dart";
-
-abstract class Class extends core::Object {
- synthetic constructor •() → self::Class
- : super core::Object::•()
- ;
- abstract method throwFutureOrInt() → FutureOr<core::int>;
- abstract method throwInt() → core::int;
- abstract method throwFutureInt() → asy::Future<core::int>;
- abstract method throwDynamic() → dynamic;
- abstract method throwFutureNum() → asy::Future<core::num>;
-}
-static field core::bool caughtFutureOrInt = false;
-static field core::bool caughtInt = false;
-static field core::bool caughtFutureInt = false;
-static field core::bool caughtDynamic = false;
-static field core::bool caughtFutureNum = false;
-static method callFutureOrInt(self::Class c) → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L1:
- {
- try {
- final FutureOr<core::int>#t1 = c.{self::Class::throwFutureOrInt}();
- if(#t1 is asy::Future<core::int>) {
- [yield] let dynamic #t2 = asy::_awaitHelper(#t1, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t1;
- }
- :return_value = :async_temporary_0;
- break #L1;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureOrInt = true;
- final core::int #t3 = 0;
- if(#t3 is asy::Future<core::int>) {
- [yield] let dynamic #t4 = asy::_awaitHelper(#t3, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t3;
- }
- :return_value = :async_temporary_2;
- break #L1;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callInt(self::Class c) → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L2:
- {
- try {
- final core::int #t5 = c.{self::Class::throwInt}();
- if(#t5 is asy::Future<core::int>) {
- [yield] let dynamic #t6 = asy::_awaitHelper(#t5, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t5;
- }
- :return_value = :async_temporary_0;
- break #L2;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtInt = true;
- final core::int #t7 = 0;
- if(#t7 is asy::Future<core::int>) {
- [yield] let dynamic #t8 = asy::_awaitHelper(#t7, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t7;
- }
- :return_value = :async_temporary_2;
- break #L2;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callFutureInt(self::Class c) → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L3:
- {
- try {
- final asy::Future<core::int> #t9 = c.{self::Class::throwFutureInt}();
- if(#t9 is asy::Future<core::int>) {
- [yield] let dynamic #t10 = asy::_awaitHelper(#t9, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t9;
- }
- :return_value = :async_temporary_0;
- break #L3;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureInt = true;
- final core::int #t11 = 0;
- if(#t11 is asy::Future<core::int>) {
- [yield] let dynamic #t12 = asy::_awaitHelper(#t11, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t11;
- }
- :return_value = :async_temporary_2;
- break #L3;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callDynamic(self::Class c) → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::int>:async_temporary_0;
- FutureOr<core::int>:async_temporary_1;
- FutureOr<core::int>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L4:
- {
- try {
- final FutureOr<core::int>#t13 = c.{self::Class::throwDynamic}() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::int>;
- if(#t13 is asy::Future<core::int>) {
- [yield] let dynamic #t14 = asy::_awaitHelper(#t13, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_0 = #t13;
- }
- :return_value = :async_temporary_0;
- break #L4;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtDynamic = true;
- final core::int #t15 = 0;
- if(#t15 is asy::Future<core::int>) {
- [yield] let dynamic #t16 = asy::_awaitHelper(#t15, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t15;
- }
- :return_value = :async_temporary_2;
- break #L4;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method callFutureNum(self::Class c) → asy::Future<core::num> /* originally async */ {
- final asy::_Future<core::num> :async_future = new asy::_Future::•<core::num>();
- core::bool* :is_sync = false;
- FutureOr<core::num>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :exception0;
- dynamic :stack_trace0;
- FutureOr<core::num>:async_temporary_0;
- FutureOr<core::num>:async_temporary_1;
- FutureOr<core::num>:async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L5:
- {
- try {
- final asy::Future<core::num> #t17 = c.{self::Class::throwFutureNum}();
- if(#t17 is asy::Future<core::num>) {
- [yield] let dynamic #t18 = asy::_awaitHelper(#t17, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = _in::unsafeCast<core::num>(:result);
- }
- else {
- :async_temporary_0 = #t17;
- }
- :return_value = :async_temporary_0;
- break #L5;
- }
- on core::Object catch(final core::Object e) {
- core::print("Caught \"${e}\"");
- self::caughtFutureNum = true;
- final core::int #t19 = 0;
- if(#t19 is asy::Future<core::num>) {
- [yield] let dynamic #t20 = asy::_awaitHelper(#t19, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_2 = _in::unsafeCast<core::int>(:result);
- }
- else {
- :async_temporary_2 = #t19;
- }
- :return_value = :async_temporary_2;
- break #L5;
- }
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-static method main() → void /* originally async */ {
- final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
- core::bool* :is_sync = false;
- FutureOr<dynamic>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L6:
- {
- self::Class c = new ret::Subclass::•();
- [yield] let dynamic #t21 = asy::_awaitHelper(self::callFutureOrInt(c), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtFutureOrInt)
- throw "Uncaught async return";
- [yield] let dynamic #t22 = asy::_awaitHelper(self::callInt(c), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtInt)
- throw "Uncaught async return";
- [yield] let dynamic #t23 = asy::_awaitHelper(self::callFutureInt(c), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtFutureInt)
- throw "Uncaught async return";
- [yield] let dynamic #t24 = asy::_awaitHelper(self::callDynamic(c), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
- if(!self::caughtDynamic)
- throw "Uncaught async return";
- [yield] let dynamic #t25 = asy::_awaitHelper(self::callFutureNum(c), :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::num>(:result);
- if(!self::caughtFutureNum)
- throw "Uncaught async return";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
-}
-
-library /*isNonNullableByDefault*/;
-import self as ret;
-import "dart:core" as core;
-import "return_from_async.dart" as self;
-import "dart:async" as asy;
-
-import "dart:async";
-import "org-dartlang-testcase:///return_from_async.dart";
-
-class Subclass extends core::Object implements self::Class {
- synthetic constructor •() → ret::Subclass
- : super core::Object::•()
- ;
- method throwFutureOrInt() → FutureOr<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L7:
- {
- throw "FutureOr<int>";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
- }
- method throwInt() → core::int {
- throw "int";
- }
- method throwFutureInt() → asy::Future<core::int> /* originally async */ {
- final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
- core::bool* :is_sync = false;
- FutureOr<core::int>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L8:
- {
- throw "Future<int>";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
- }
- method throwDynamic() → dynamic {
- throw "dynamic";
- }
- method throwFutureNum() → asy::Future<core::num> /* originally async */ {
- final asy::_Future<core::num> :async_future = new asy::_Future::•<core::num>();
- core::bool* :is_sync = false;
- FutureOr<core::num>? :return_value;
- (dynamic) → dynamic :async_op_then;
- (core::Object, core::StackTrace) → dynamic :async_op_error;
- core::int :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L9:
- {
- throw "Future<num>";
- }
- asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
- return;
- }
- on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
- asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
- }
- :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
- :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
- :async_op.call();
- :is_sync = true;
- return :async_future;
- }
-}
diff --git a/pkg/front_end/testcases/nnbd_mixed/return_from_async_lib.dart b/pkg/front_end/testcases/nnbd_mixed/return_from_async_lib.dart
deleted file mode 100644
index 0e4cbb7..0000000
--- a/pkg/front_end/testcases/nnbd_mixed/return_from_async_lib.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'return_from_async.dart';
-
-class Subclass implements Class {
- FutureOr<int> throwFutureOrInt() async {
- throw 'FutureOr<int>';
- }
-
- int throwInt() {
- throw 'int';
- }
-
- Future<int> throwFutureInt() async {
- throw 'Future<int>';
- }
-
- dynamic throwDynamic() {
- throw 'dynamic';
- }
-
- Future<num> throwFutureNum() async {
- throw 'Future<num>';
- }
-}
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index bbb5c64..2e35c64 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -171,6 +171,7 @@
nnbd/covariant_late_field: TypeCheckError
nnbd/getter_vs_setter_type: TypeCheckError
nnbd/issue41180: RuntimeError # Strong mode runtime checking fails due to mixed strong mode.
+nnbd/issue42546: TypeCheckError
nnbd/issue42603: TypeCheckError
nnbd/no_support_for_old_null_aware_index_access_syntax: RuntimeError # Expected.
nnbd/nullable_object_access: TypeCheckError
diff --git a/pkg/front_end/testcases/text_serialization.status b/pkg/front_end/testcases/text_serialization.status
index c21c124..a59dfcd 100644
--- a/pkg/front_end/testcases/text_serialization.status
+++ b/pkg/front_end/testcases/text_serialization.status
@@ -171,6 +171,7 @@
nnbd/covariant_late_field: TypeCheckError
nnbd/getter_vs_setter_type: TypeCheckError
nnbd/issue41180: RuntimeError
+nnbd/issue42546: TypeCheckError
nnbd/issue42603: TypeCheckError
nnbd/no_support_for_old_null_aware_index_access_syntax: RuntimeError # Expected.
nnbd/nullable_object_access: TypeCheckError
diff --git a/pkg/front_end/testcases/weak.status b/pkg/front_end/testcases/weak.status
index 731df3e..56c47dc 100644
--- a/pkg/front_end/testcases/weak.status
+++ b/pkg/front_end/testcases/weak.status
@@ -58,6 +58,7 @@
late_lowering/covariant_late_field: TypeCheckError
nnbd/covariant_late_field: TypeCheckError
nnbd/getter_vs_setter_type: TypeCheckError
+nnbd/issue42546: TypeCheckError
nnbd/issue42603: TypeCheckError
nnbd/no_support_for_old_null_aware_index_access_syntax: RuntimeError # Expected.
nnbd/nullable_object_access: TypeCheckError
diff --git a/pkg/vm_service/test/async_single_step_out_test.dart b/pkg/vm_service/test/async_single_step_out_test.dart
index 7e5f200..a0a3d83 100644
--- a/pkg/vm_service/test/async_single_step_out_test.dart
+++ b/pkg/vm_service/test/async_single_step_out_test.dart
@@ -44,10 +44,6 @@
stepInto, // exit helper via a single step.
hasStoppedAtBreakpoint,
- stoppedAtLine(LINE_B), // await helper
- stepInto,
-
- hasStoppedAtBreakpoint,
stoppedAtLine(20), // return null (weird dispatching)
stepInto, // exit helper via a single step.
diff --git a/runtime/observatory/tests/service/async_single_step_out_test.dart b/runtime/observatory/tests/service/async_single_step_out_test.dart
index 3c6de1b..cfeac6c 100644
--- a/runtime/observatory/tests/service/async_single_step_out_test.dart
+++ b/runtime/observatory/tests/service/async_single_step_out_test.dart
@@ -44,10 +44,6 @@
stepInto, // exit helper via a single step.
hasStoppedAtBreakpoint,
- stoppedAtLine(LINE_B), // await helper
- stepInto,
-
- hasStoppedAtBreakpoint,
stoppedAtLine(20), // return null (weird dispatching)
stepInto, // exit helper via a single step.
diff --git a/runtime/tests/vm/dart/causal_stacks/utils.dart b/runtime/tests/vm/dart/causal_stacks/utils.dart
index fdebc07..6995e01 100644
--- a/runtime/tests/vm/dart/causal_stacks/utils.dart
+++ b/runtime/tests/vm/dart/causal_stacks/utils.dart
@@ -720,22 +720,20 @@
final mixedYieldsExpected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^<asynchronous suspension>$',
- r'^#1 mixedYields3 \(.*/utils.dart:70(:3)?\)$',
+ r'^#1 mixedYields2 \(.*/utils.dart:66(:3)?\)$',
r'^<asynchronous suspension>$',
- r'^#2 mixedYields2 \(.*/utils.dart:66(:3)?\)$',
- r'^<asynchronous suspension>$',
- r'^#3 mixedYields \(.*/utils.dart:61(:3)?\)$',
+ r'^#2 mixedYields \(.*/utils.dart:61(:3)?\)$',
r'^<asynchronous suspension>$',
];
await doTestAwait(
mixedYields,
mixedYieldsExpected +
const <String>[
- r'^#4 doTestAwait ',
+ r'^#3 doTestAwait ',
r'^<asynchronous suspension>$',
- r'^#5 doTestsLazy ',
+ r'^#4 doTestsLazy ',
r'^<asynchronous suspension>$',
- r'^#6 main ',
+ r'^#5 main ',
r'^<asynchronous suspension>$',
],
debugInfoFilename);
@@ -743,7 +741,7 @@
mixedYields,
mixedYieldsExpected +
const <String>[
- r'^#4 doTestAwaitThen.<anonymous closure> ',
+ r'^#3 doTestAwaitThen.<anonymous closure> ',
r'^<asynchronous suspension>$',
],
debugInfoFilename);
@@ -784,22 +782,20 @@
final nonAsyncNoStackExpected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
r'^<asynchronous suspension>$',
- r'^#1 nonAsyncNoStack2 \(.*/utils.dart:97(:36)?\)$',
+ r'^#1 nonAsyncNoStack1 \(.*/utils.dart:95(:36)?\)$',
r'^<asynchronous suspension>$',
- r'^#2 nonAsyncNoStack1 \(.*/utils.dart:95(:36)?\)$',
- r'^<asynchronous suspension>$',
- r'^#3 nonAsyncNoStack \(.*/utils.dart:93(:35)?\)$',
+ r'^#2 nonAsyncNoStack \(.*/utils.dart:93(:35)?\)$',
r'^<asynchronous suspension>$',
];
await doTestAwait(
nonAsyncNoStack,
nonAsyncNoStackExpected +
const <String>[
- r'^#4 doTestAwait ',
+ r'^#3 doTestAwait ',
r'^<asynchronous suspension>$',
- r'^#5 doTestsLazy ',
+ r'^#4 doTestsLazy ',
r'^<asynchronous suspension>$',
- r'^#6 main ',
+ r'^#5 main ',
r'^<asynchronous suspension>$',
],
debugInfoFilename);
@@ -807,7 +803,7 @@
nonAsyncNoStack,
nonAsyncNoStackExpected +
const <String>[
- r'^#4 doTestAwaitThen.<anonymous closure> ',
+ r'^#3 doTestAwaitThen.<anonymous closure> ',
r'^<asynchronous suspension>$',
],
debugInfoFilename);
@@ -968,7 +964,6 @@
],
debugInfoFilename);
await doTestAwaitCatchError(awaitWait, awaitWaitExpected, debugInfoFilename);
-
{
final expected = const <String>[
r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$',
diff --git a/runtime/tests/vm/dart/split_literals.dart b/runtime/tests/vm/dart/split_literals.dart
deleted file mode 100644
index b71e9bd..0000000
--- a/runtime/tests/vm/dart/split_literals.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "split_literals_deferred.dart" deferred as lib;
-
-class Box {
- final contents;
- const Box(this.contents);
- String toString() => "Box($contents)";
-}
-
-main() async {
- print("Root literal!");
- print(const <String>["Root literal in a list!"]);
- print(const <String, String>{"key": "Root literal in a map!"});
- print(const Box("Root literal in a box!"));
-
- await lib.loadLibrary();
- lib.foo();
-}
diff --git a/runtime/tests/vm/dart/split_literals_deferred.dart b/runtime/tests/vm/dart/split_literals_deferred.dart
deleted file mode 100644
index 015ae1d..0000000
--- a/runtime/tests/vm/dart/split_literals_deferred.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "split_literals.dart";
-
-void foo() {
- print("Deferred literal!");
- print(const <String>["Deferred literal in a list!"]);
- print(const <String, String>{"key": "Deferred literal in a map!"});
- print(const Box("Deferred literal in a box!"));
-}
diff --git a/runtime/tests/vm/dart/split_literals_test.dart b/runtime/tests/vm/dart/split_literals_test.dart
deleted file mode 100644
index 6cbc01b..0000000
--- a/runtime/tests/vm/dart/split_literals_test.dart
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "dart:convert";
-import "dart:io";
-
-import "package:expect/expect.dart";
-import "package:path/path.dart" as path;
-
-import "use_flag_test_helper.dart";
-
-main(List<String> args) async {
- if (!isAOTRuntime) {
- return; // Running in JIT: AOT binaries not available.
- }
-
- if (Platform.isAndroid) {
- return; // SDK tree not available on the test device.
- }
-
- // These are the tools we need to be available to run on a given platform:
- if (!File(platformDill).existsSync()) {
- throw "Cannot run test as $platformDill does not exist";
- }
- if (!await testExecutable(genSnapshot)) {
- throw "Cannot run test as $genSnapshot not available";
- }
-
- sanitizedPartitioning(manifest) {
- // Filter core libraries, relativize URIs, and sort to make the results less
- // sensitive to compiler or test harness changes.
- print(manifest);
- var units = <List<String>>[];
- for (var unit in manifest['loadingUnits']) {
- var uris = <String>[];
- for (var uri in unit['libraries']) {
- if (uri.startsWith("dart:")) continue;
- uris.add(Uri.parse(uri).pathSegments.last);
- }
- uris.sort((a, b) => a.compareTo(b));
- units.add(uris);
- }
- units.sort((a, b) => a.first.compareTo(b.first));
- print(units);
- return units;
- }
-
- await withTempDir("split-literals-test", (String tempDir) async {
- final source =
- path.join(sdkDir, "runtime/tests/vm/dart_2/split_literals.dart");
- final dill = path.join(tempDir, "split_literals.dart.dill");
- final snapshot = path.join(tempDir, "split_literals.so");
- final manifest = path.join(tempDir, "split_literals.txt");
- final deferredSnapshot = snapshot + "-2.part.so";
-
- // Compile source to kernel.
- await run(genKernel, <String>[
- "--aot",
- "--platform=$platformDill",
- "-o",
- dill,
- source,
- ]);
-
- // Compile kernel to ELF.
- await run(genSnapshot, <String>[
- "--use_bare_instructions=false", //# object: ok
- "--use_bare_instructions=true", //# bare: ok
- "--snapshot-kind=app-aot-elf",
- "--elf=$snapshot",
- "--loading-unit-manifest=$manifest",
- dill,
- ]);
- var manifestContent = jsonDecode(await new File(manifest).readAsString());
- Expect.equals(2, manifestContent["loadingUnits"].length);
- // Note package:expect doesn't do deep equals on collections.
- Expect.equals(
- "[[split_literals.dart],"
- " [split_literals_deferred.dart]]",
- sanitizedPartitioning(manifestContent).toString());
- Expect.isTrue(await new File(deferredSnapshot).exists());
-
- bool containsSubsequence(haystack, needle) {
- outer:
- for (var i = 0, n = haystack.length - needle.length; i < n; i++) {
- for (var j = 0; j < needle.length; j++) {
- if (haystack[i + j] != needle.codeUnitAt(j)) continue outer;
- }
- return true;
- }
- return false;
- }
-
- var unit_1 = await new File(snapshot).readAsBytes();
- Expect.isTrue(containsSubsequence(unit_1, "Root literal!"));
- Expect.isTrue(containsSubsequence(unit_1, "Root literal in a list!"));
- Expect.isTrue(containsSubsequence(unit_1, "Root literal in a map!"));
- Expect.isTrue(containsSubsequence(unit_1, "Root literal in a box!"));
- Expect.isTrue(!containsSubsequence(unit_1, "Deferred literal!"));
- Expect.isTrue(!containsSubsequence(unit_1, "Deferred literal in a list!"));
- Expect.isTrue(!containsSubsequence(unit_1, "Deferred literal in a map!"));
- Expect.isTrue(!containsSubsequence(unit_1, "Deferred literal in a box!"));
-
- var unit_2 = await new File(deferredSnapshot).readAsBytes();
- Expect.isTrue(!containsSubsequence(unit_2, "Root literal!"));
- Expect.isTrue(!containsSubsequence(unit_2, "Root literal in a list!"));
- Expect.isTrue(!containsSubsequence(unit_2, "Root literal in a map!"));
- Expect.isTrue(!containsSubsequence(unit_2, "Root literal in a box!"));
- Expect.isTrue(containsSubsequence(unit_2, "Deferred literal!"));
- Expect.isTrue(containsSubsequence(unit_2, "Deferred literal in a list!"));
- Expect.isTrue(containsSubsequence(unit_2, "Deferred literal in a map!"));
- Expect.isTrue(containsSubsequence(unit_2, "Deferred literal in a box!"));
- });
-}
diff --git a/runtime/tests/vm/dart_2/split_literals.dart b/runtime/tests/vm/dart_2/split_literals.dart
deleted file mode 100644
index b71e9bd..0000000
--- a/runtime/tests/vm/dart_2/split_literals.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "split_literals_deferred.dart" deferred as lib;
-
-class Box {
- final contents;
- const Box(this.contents);
- String toString() => "Box($contents)";
-}
-
-main() async {
- print("Root literal!");
- print(const <String>["Root literal in a list!"]);
- print(const <String, String>{"key": "Root literal in a map!"});
- print(const Box("Root literal in a box!"));
-
- await lib.loadLibrary();
- lib.foo();
-}
diff --git a/runtime/tests/vm/dart_2/split_literals_deferred.dart b/runtime/tests/vm/dart_2/split_literals_deferred.dart
deleted file mode 100644
index 015ae1d..0000000
--- a/runtime/tests/vm/dart_2/split_literals_deferred.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "split_literals.dart";
-
-void foo() {
- print("Deferred literal!");
- print(const <String>["Deferred literal in a list!"]);
- print(const <String, String>{"key": "Deferred literal in a map!"});
- print(const Box("Deferred literal in a box!"));
-}
diff --git a/runtime/tests/vm/dart_2/split_literals_test.dart b/runtime/tests/vm/dart_2/split_literals_test.dart
deleted file mode 100644
index 6cbc01b..0000000
--- a/runtime/tests/vm/dart_2/split_literals_test.dart
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "dart:convert";
-import "dart:io";
-
-import "package:expect/expect.dart";
-import "package:path/path.dart" as path;
-
-import "use_flag_test_helper.dart";
-
-main(List<String> args) async {
- if (!isAOTRuntime) {
- return; // Running in JIT: AOT binaries not available.
- }
-
- if (Platform.isAndroid) {
- return; // SDK tree not available on the test device.
- }
-
- // These are the tools we need to be available to run on a given platform:
- if (!File(platformDill).existsSync()) {
- throw "Cannot run test as $platformDill does not exist";
- }
- if (!await testExecutable(genSnapshot)) {
- throw "Cannot run test as $genSnapshot not available";
- }
-
- sanitizedPartitioning(manifest) {
- // Filter core libraries, relativize URIs, and sort to make the results less
- // sensitive to compiler or test harness changes.
- print(manifest);
- var units = <List<String>>[];
- for (var unit in manifest['loadingUnits']) {
- var uris = <String>[];
- for (var uri in unit['libraries']) {
- if (uri.startsWith("dart:")) continue;
- uris.add(Uri.parse(uri).pathSegments.last);
- }
- uris.sort((a, b) => a.compareTo(b));
- units.add(uris);
- }
- units.sort((a, b) => a.first.compareTo(b.first));
- print(units);
- return units;
- }
-
- await withTempDir("split-literals-test", (String tempDir) async {
- final source =
- path.join(sdkDir, "runtime/tests/vm/dart_2/split_literals.dart");
- final dill = path.join(tempDir, "split_literals.dart.dill");
- final snapshot = path.join(tempDir, "split_literals.so");
- final manifest = path.join(tempDir, "split_literals.txt");
- final deferredSnapshot = snapshot + "-2.part.so";
-
- // Compile source to kernel.
- await run(genKernel, <String>[
- "--aot",
- "--platform=$platformDill",
- "-o",
- dill,
- source,
- ]);
-
- // Compile kernel to ELF.
- await run(genSnapshot, <String>[
- "--use_bare_instructions=false", //# object: ok
- "--use_bare_instructions=true", //# bare: ok
- "--snapshot-kind=app-aot-elf",
- "--elf=$snapshot",
- "--loading-unit-manifest=$manifest",
- dill,
- ]);
- var manifestContent = jsonDecode(await new File(manifest).readAsString());
- Expect.equals(2, manifestContent["loadingUnits"].length);
- // Note package:expect doesn't do deep equals on collections.
- Expect.equals(
- "[[split_literals.dart],"
- " [split_literals_deferred.dart]]",
- sanitizedPartitioning(manifestContent).toString());
- Expect.isTrue(await new File(deferredSnapshot).exists());
-
- bool containsSubsequence(haystack, needle) {
- outer:
- for (var i = 0, n = haystack.length - needle.length; i < n; i++) {
- for (var j = 0; j < needle.length; j++) {
- if (haystack[i + j] != needle.codeUnitAt(j)) continue outer;
- }
- return true;
- }
- return false;
- }
-
- var unit_1 = await new File(snapshot).readAsBytes();
- Expect.isTrue(containsSubsequence(unit_1, "Root literal!"));
- Expect.isTrue(containsSubsequence(unit_1, "Root literal in a list!"));
- Expect.isTrue(containsSubsequence(unit_1, "Root literal in a map!"));
- Expect.isTrue(containsSubsequence(unit_1, "Root literal in a box!"));
- Expect.isTrue(!containsSubsequence(unit_1, "Deferred literal!"));
- Expect.isTrue(!containsSubsequence(unit_1, "Deferred literal in a list!"));
- Expect.isTrue(!containsSubsequence(unit_1, "Deferred literal in a map!"));
- Expect.isTrue(!containsSubsequence(unit_1, "Deferred literal in a box!"));
-
- var unit_2 = await new File(deferredSnapshot).readAsBytes();
- Expect.isTrue(!containsSubsequence(unit_2, "Root literal!"));
- Expect.isTrue(!containsSubsequence(unit_2, "Root literal in a list!"));
- Expect.isTrue(!containsSubsequence(unit_2, "Root literal in a map!"));
- Expect.isTrue(!containsSubsequence(unit_2, "Root literal in a box!"));
- Expect.isTrue(containsSubsequence(unit_2, "Deferred literal!"));
- Expect.isTrue(containsSubsequence(unit_2, "Deferred literal in a list!"));
- Expect.isTrue(containsSubsequence(unit_2, "Deferred literal in a map!"));
- Expect.isTrue(containsSubsequence(unit_2, "Deferred literal in a box!"));
- });
-}
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 12ec76e..ef22f90 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -289,7 +289,7 @@
ClassDeserializationCluster() : DeserializationCluster("Class") {}
~ClassDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
predefined_start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
intptr_t count = d->ReadUnsigned();
@@ -311,7 +311,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
ClassTable* table = d->isolate_group()->class_table();
for (intptr_t id = predefined_start_index_; id < predefined_stop_index_;
@@ -464,7 +464,7 @@
: DeserializationCluster("TypeArguments") {}
~TypeArgumentsDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -476,13 +476,13 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
TypeArgumentsPtr type_args = static_cast<TypeArgumentsPtr>(d->Ref(id));
const intptr_t length = d->ReadUnsigned();
Deserializer::InitializeHeader(type_args, kTypeArgumentsCid,
TypeArguments::InstanceSize(length),
- stamp_canonical);
+ is_canonical);
type_args->untag()->length_ = Smi::New(length);
type_args->untag()->hash_ = Smi::New(d->Read<int32_t>());
type_args->untag()->nullability_ = Smi::New(d->ReadUnsigned());
@@ -494,15 +494,22 @@
}
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- if (canonicalize) {
- Thread* thread = Thread::Current();
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
+ if (is_canonical && (d->isolate() != Dart::vm_isolate())) {
+ CanonicalTypeArgumentsSet table(
+ d->zone(),
+ d->isolate_group()->object_store()->canonical_type_arguments());
TypeArguments& type_arg = TypeArguments::Handle(d->zone());
for (intptr_t i = start_index_; i < stop_index_; i++) {
type_arg ^= refs.At(i);
- type_arg = type_arg.Canonicalize(thread, nullptr);
- refs.SetAt(i, type_arg);
+ ASSERT(type_arg.IsCanonical());
+ bool present = table.Insert(type_arg);
+ // Two recursive types with different topology (and hashes) may be
+ // equal.
+ ASSERT(!present || type_arg.IsRecursive());
}
+ d->isolate_group()->object_store()->set_canonical_type_arguments(
+ table.Release());
}
}
};
@@ -551,7 +558,7 @@
PatchClassDeserializationCluster() : DeserializationCluster("PatchClass") {}
~PatchClassDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -562,8 +569,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
PatchClassPtr cls = static_cast<PatchClassPtr>(d->Ref(id));
Deserializer::InitializeHeader(cls, kPatchClassCid,
@@ -661,7 +667,7 @@
FunctionDeserializationCluster() : DeserializationCluster("Function") {}
~FunctionDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -671,8 +677,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
Snapshot::Kind kind = d->kind();
for (intptr_t id = start_index_; id < stop_index_; id++) {
@@ -720,7 +725,7 @@
}
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
if (d->kind() == Snapshot::kFullAOT) {
Function& func = Function::Handle(d->zone());
for (intptr_t i = start_index_; i < stop_index_; i++) {
@@ -811,7 +816,7 @@
ClosureDataDeserializationCluster() : DeserializationCluster("ClosureData") {}
~ClosureDataDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -822,8 +827,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
ClosureDataPtr data = static_cast<ClosureDataPtr>(d->Ref(id));
Deserializer::InitializeHeader(data, kClosureDataCid,
@@ -893,7 +897,7 @@
: DeserializationCluster("FfiTrampolineData") {}
~FfiTrampolineDataDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -904,8 +908,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
FfiTrampolineDataPtr data = static_cast<FfiTrampolineDataPtr>(d->Ref(id));
Deserializer::InitializeHeader(data, kFfiTrampolineDataCid,
@@ -1012,7 +1015,7 @@
FieldDeserializationCluster() : DeserializationCluster("Field") {}
~FieldDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -1022,8 +1025,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
Snapshot::Kind kind = d->kind();
for (intptr_t id = start_index_; id < stop_index_; id++) {
@@ -1079,7 +1081,7 @@
}
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
Field& field = Field::Handle(d->zone());
if (!IsolateGroup::Current()->use_field_guards()) {
for (intptr_t i = start_index_; i < stop_index_; i++) {
@@ -1155,7 +1157,7 @@
ScriptDeserializationCluster() : DeserializationCluster("Script") {}
~ScriptDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -1165,8 +1167,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
ScriptPtr script = static_cast<ScriptPtr>(d->Ref(id));
Deserializer::InitializeHeader(script, kScriptCid,
@@ -1231,7 +1232,7 @@
LibraryDeserializationCluster() : DeserializationCluster("Library") {}
~LibraryDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -1241,8 +1242,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
LibraryPtr lib = static_cast<LibraryPtr>(d->Ref(id));
Deserializer::InitializeHeader(lib, kLibraryCid, Library::InstanceSize());
@@ -1304,7 +1304,7 @@
NamespaceDeserializationCluster() : DeserializationCluster("Namespace") {}
~NamespaceDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -1314,8 +1314,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
NamespacePtr ns = static_cast<NamespacePtr>(d->Ref(id));
Deserializer::InitializeHeader(ns, kNamespaceCid,
@@ -1371,7 +1370,7 @@
: DeserializationCluster("KernelProgramInfo") {}
~KernelProgramInfoDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -1382,8 +1381,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
KernelProgramInfoPtr info = static_cast<KernelProgramInfoPtr>(d->Ref(id));
Deserializer::InitializeHeader(info, kKernelProgramInfoCid,
@@ -1393,7 +1391,7 @@
}
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
Array& array = Array::Handle(d->zone());
KernelProgramInfo& info = KernelProgramInfo::Handle(d->zone());
for (intptr_t id = start_index_; id < stop_index_; id++) {
@@ -1419,26 +1417,9 @@
objects_.Add(code);
}
- if (s->kind() == Snapshot::kFullAOT && FLAG_use_bare_instructions) {
- if (FLAG_retain_function_objects) {
- ObjectPoolPtr pool = code->untag()->object_pool_;
- if ((pool != ObjectPool::null()) && s->InCurrentLoadingUnit(code)) {
- const intptr_t length = pool->untag()->length_;
- uint8_t* entry_bits = pool->untag()->entry_bits();
- for (intptr_t i = 0; i < length; i++) {
- auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
- if (entry_type == ObjectPool::EntryType::kTaggedObject) {
- s->Push(pool->untag()->data()[i].raw_obj_);
- }
- }
- }
- }
- } else {
- if (s->InCurrentLoadingUnit(code->untag()->object_pool_)) {
- s->Push(code->untag()->object_pool_);
- }
+ if (!(s->kind() == Snapshot::kFullAOT && FLAG_use_bare_instructions)) {
+ s->Push(code->untag()->object_pool_);
}
-
s->Push(code->untag()->owner_);
s->Push(code->untag()->exception_handlers_);
s->Push(code->untag()->pc_descriptors_);
@@ -1550,6 +1531,20 @@
}
void WriteAlloc(Serializer* s) {
+ Sort(&objects_);
+ auto loading_units = s->loading_units();
+ if (loading_units != nullptr) {
+ for (intptr_t i = LoadingUnit::kRootId + 1; i < loading_units->length();
+ i++) {
+ auto unit_objects = loading_units->At(i)->deferred_objects();
+ Sort(unit_objects);
+ for (intptr_t j = 0; j < unit_objects->length(); j++) {
+ deferred_objects_.Add(unit_objects->At(j)->ptr());
+ }
+ }
+ }
+ s->PrepareInstructions(&objects_);
+
s->WriteCid(kCodeCid);
const intptr_t count = objects_.length();
s->WriteUnsigned(count);
@@ -1610,11 +1605,7 @@
// No need to write object pool out if we are producing full AOT
// snapshot with bare instructions.
if (!(kind == Snapshot::kFullAOT && FLAG_use_bare_instructions)) {
- if (s->InCurrentLoadingUnit(code->untag()->object_pool_)) {
- WriteField(code, object_pool_);
- } else {
- WriteFieldValue(object_pool_, ObjectPool::null());
- }
+ WriteField(code, object_pool_);
#if defined(DART_PRECOMPILER)
} else if (FLAG_write_v8_snapshot_profile_to != nullptr &&
code->untag()->object_pool_ != ObjectPool::null()) {
@@ -1695,8 +1686,7 @@
s->Write<int32_t>(code->untag()->state_bits_);
}
- GrowableArray<CodePtr>* objects() { return &objects_; }
- GrowableArray<CodePtr>* deferred_objects() { return &deferred_objects_; }
+ GrowableArray<CodePtr>* discovered_objects() { return &objects_; }
// Some code objects would have their owners dropped from the snapshot,
// which makes it is impossible to recover program structure when
@@ -1742,7 +1732,7 @@
CodeDeserializationCluster() : DeserializationCluster("Code") {}
~CodeDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
PageSpace* old_space = d->heap()->old_space();
start_index_ = d->next_index();
const intptr_t count = d->ReadUnsigned();
@@ -1760,8 +1750,7 @@
deferred_stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
ReadFill(d, id, false);
}
@@ -1816,7 +1805,7 @@
code->untag()->state_bits_ = d->Read<int32_t>();
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
d->EndInstructions(refs, start_index_, stop_index_);
#if !defined(PRODUCT)
@@ -1864,17 +1853,12 @@
ObjectPoolPtr pool = ObjectPool::RawCast(object);
objects_.Add(pool);
- if (s->kind() == Snapshot::kFullAOT && FLAG_use_bare_instructions &&
- FLAG_retain_function_objects) {
- // Treat pool as weak.
- } else {
- const intptr_t length = pool->untag()->length_;
- uint8_t* entry_bits = pool->untag()->entry_bits();
- for (intptr_t i = 0; i < length; i++) {
- auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
- if (entry_type == ObjectPool::EntryType::kTaggedObject) {
- s->Push(pool->untag()->data()[i].raw_obj_);
- }
+ const intptr_t length = pool->untag()->length_;
+ uint8_t* entry_bits = pool->untag()->entry_bits();
+ for (intptr_t i = 0; i < length; i++) {
+ auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
+ if (entry_type == ObjectPool::EntryType::kTaggedObject) {
+ s->Push(pool->untag()->data()[i].raw_obj_);
}
}
}
@@ -1893,9 +1877,6 @@
}
void WriteFill(Serializer* s) {
- bool weak = s->kind() == Snapshot::kFullAOT && FLAG_use_bare_instructions &&
- FLAG_retain_function_objects;
-
const intptr_t count = objects_.length();
for (intptr_t i = 0; i < count; i++) {
ObjectPoolPtr pool = objects_[i];
@@ -1916,12 +1897,7 @@
s->WriteElementRef(StubCode::CallBootstrapNative().ptr(), j);
break;
}
- if (weak && !s->HasRef(entry.raw_obj_)) {
- // Any value will do, but null has the shortest id.
- s->WriteElementRef(Object::null(), j);
- } else {
- s->WriteElementRef(entry.raw_obj_, j);
- }
+ s->WriteElementRef(entry.raw_obj_, j);
break;
}
case ObjectPool::EntryType::kImmediate: {
@@ -1950,7 +1926,7 @@
ObjectPoolDeserializationCluster() : DeserializationCluster("ObjectPool") {}
~ObjectPoolDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -1962,10 +1938,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
- fill_position_ = d->position();
-
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id += 1) {
const intptr_t length = d->ReadUnsigned();
ObjectPoolPtr pool = static_cast<ObjectPoolPtr>(d->Ref(id + 0));
@@ -1995,41 +1968,6 @@
}
}
}
-
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- intptr_t restore_position = d->position();
- d->set_position(fill_position_);
-
- ObjectPool& pool = ObjectPool::Handle();
- Object& entry = Object::Handle();
- for (intptr_t id = start_index_; id < stop_index_; id += 1) {
- pool ^= refs.At(id);
- const intptr_t length = d->ReadUnsigned();
- for (intptr_t j = 0; j < length; j++) {
- const uint8_t entry_bits = d->Read<uint8_t>();
- switch (ObjectPool::TypeBits::decode(entry_bits)) {
- case ObjectPool::EntryType::kTaggedObject:
- entry = refs.At(d->ReadUnsigned());
- pool.SetObjectAt(j, entry);
- break;
- case ObjectPool::EntryType::kImmediate:
- d->Read<intptr_t>();
- break;
- case ObjectPool::EntryType::kNativeFunction: {
- // Read nothing.
- break;
- }
- default:
- UNREACHABLE();
- }
- }
- }
-
- d->set_position(restore_position);
- }
-
- private:
- intptr_t fill_position_ = 0;
};
#if defined(DART_PRECOMPILER)
@@ -2152,7 +2090,7 @@
: DeserializationCluster("WeakSerializationReference") {}
~WeakSerializationReferenceDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2166,8 +2104,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
auto const ref = static_cast<WeakSerializationReferencePtr>(d->Ref(id));
Deserializer::InitializeHeader(
@@ -2226,7 +2163,7 @@
: DeserializationCluster("PcDescriptors") {}
~PcDescriptorsDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2238,8 +2175,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id += 1) {
const intptr_t length = d->ReadUnsigned();
PcDescriptorsPtr desc = static_cast<PcDescriptorsPtr>(d->Ref(id));
@@ -2321,7 +2257,7 @@
: DeserializationCluster("ROData"), cid_(cid) {}
~RODataDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
intptr_t count = d->ReadUnsigned();
uint32_t running_offset = 0;
@@ -2332,25 +2268,21 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
// No-op.
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- if (canonicalize && IsStringClassId(cid_)) {
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
+ if (is_canonical && IsStringClassId(cid_) &&
+ (d->isolate() != Dart::vm_isolate())) {
CanonicalStringSet table(
d->zone(), d->isolate_group()->object_store()->symbol_table());
String& str = String::Handle(d->zone());
- String& str2 = String::Handle(d->zone());
for (intptr_t i = start_index_; i < stop_index_; i++) {
str ^= refs.At(i);
- str2 ^= table.InsertOrGet(str);
- if (str.ptr() == str2.ptr()) {
- // str.SetCanonical();
- } else {
- FATAL("Lost canonicalization race");
- refs.SetAt(i, str2);
- }
+ ASSERT(str.IsCanonical());
+ bool present = table.Insert(str);
+ ASSERT(!present);
}
d->isolate_group()->object_store()->set_symbol_table(table.Release());
}
@@ -2417,7 +2349,7 @@
: DeserializationCluster("ExceptionHandlers") {}
~ExceptionHandlersDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2429,8 +2361,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
ExceptionHandlersPtr handlers =
static_cast<ExceptionHandlersPtr>(d->Ref(id));
@@ -2506,7 +2437,7 @@
ContextDeserializationCluster() : DeserializationCluster("Context") {}
~ContextDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2518,8 +2449,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
ContextPtr context = static_cast<ContextPtr>(d->Ref(id));
const intptr_t length = d->ReadUnsigned();
@@ -2584,7 +2514,7 @@
: DeserializationCluster("ContextScope") {}
~ContextScopeDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2596,8 +2526,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
ContextScopePtr scope = static_cast<ContextScopePtr>(d->Ref(id));
const intptr_t length = d->ReadUnsigned();
@@ -2653,7 +2582,7 @@
: DeserializationCluster("UnlinkedCall") {}
~UnlinkedCallDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2664,8 +2593,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
UnlinkedCallPtr unlinked = static_cast<UnlinkedCallPtr>(d->Ref(id));
Deserializer::InitializeHeader(unlinked, kUnlinkedCallCid,
@@ -2722,7 +2650,7 @@
ICDataDeserializationCluster() : DeserializationCluster("ICData") {}
~ICDataDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2732,8 +2660,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
ICDataPtr ic = static_cast<ICDataPtr>(d->Ref(id));
Deserializer::InitializeHeader(ic, kICDataCid, ICData::InstanceSize());
@@ -2788,7 +2715,7 @@
: DeserializationCluster("MegamorphicCache") {}
~MegamorphicCacheDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2799,8 +2726,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
MegamorphicCachePtr cache = static_cast<MegamorphicCachePtr>(d->Ref(id));
Deserializer::InitializeHeader(cache, kMegamorphicCacheCid,
@@ -2811,7 +2737,7 @@
}
#if defined(DART_PRECOMPILED_RUNTIME)
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
if (FLAG_use_bare_instructions) {
// By default, every megamorphic call site will load the target
// [Function] from the hash table and call indirectly via loading the
@@ -2880,7 +2806,7 @@
: DeserializationCluster("SubtypeTestCache") {}
~SubtypeTestCacheDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2891,8 +2817,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
SubtypeTestCachePtr cache = static_cast<SubtypeTestCachePtr>(d->Ref(id));
Deserializer::InitializeHeader(cache, kSubtypeTestCacheCid,
@@ -2944,7 +2869,7 @@
LoadingUnitDeserializationCluster() : DeserializationCluster("LoadingUnit") {}
~LoadingUnitDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -2955,8 +2880,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
LoadingUnitPtr unit = static_cast<LoadingUnitPtr>(d->Ref(id));
Deserializer::InitializeHeader(unit, kLoadingUnitCid,
@@ -3015,7 +2939,7 @@
: DeserializationCluster("LanguageError") {}
~LanguageErrorDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3026,8 +2950,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
LanguageErrorPtr error = static_cast<LanguageErrorPtr>(d->Ref(id));
Deserializer::InitializeHeader(error, kLanguageErrorCid,
@@ -3083,7 +3006,7 @@
: DeserializationCluster("UnhandledException") {}
~UnhandledExceptionDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3094,8 +3017,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
UnhandledExceptionPtr exception =
static_cast<UnhandledExceptionPtr>(d->Ref(id));
@@ -3204,35 +3126,13 @@
};
#endif // !DART_PRECOMPILED_RUNTIME
-class AbstractInstanceDeserializationCluster : public DeserializationCluster {
- protected:
- explicit AbstractInstanceDeserializationCluster(const char* name)
- : DeserializationCluster(name) {}
-
- public:
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- if (canonicalize) {
- Thread* thread = Thread::Current();
- SafepointMutexLocker ml(
- thread->isolate_group()->constant_canonicalization_mutex());
- Instance& instance = Instance::Handle(d->zone());
- for (intptr_t i = start_index_; i < stop_index_; i++) {
- instance ^= refs.At(i);
- instance = instance.CanonicalizeLocked(thread);
- refs.SetAt(i, instance);
- }
- }
- }
-};
-
-class InstanceDeserializationCluster
- : public AbstractInstanceDeserializationCluster {
+class InstanceDeserializationCluster : public DeserializationCluster {
public:
explicit InstanceDeserializationCluster(intptr_t cid)
- : AbstractInstanceDeserializationCluster("Instance"), cid_(cid) {}
+ : DeserializationCluster("Instance"), cid_(cid) {}
~InstanceDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3246,7 +3146,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
intptr_t next_field_offset = next_field_offset_in_words_ << kWordSizeLog2;
intptr_t instance_size =
Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize);
@@ -3255,7 +3155,7 @@
for (intptr_t id = start_index_; id < stop_index_; id++) {
InstancePtr instance = static_cast<InstancePtr>(d->Ref(id));
Deserializer::InitializeHeader(instance, cid_, instance_size,
- stamp_canonical);
+ is_canonical);
intptr_t offset = Instance::NextFieldOffset();
while (offset < next_field_offset) {
if (unboxed_fields_bitmap.Get(offset / kWordSize)) {
@@ -3330,7 +3230,7 @@
: DeserializationCluster("LibraryPrefix") {}
~LibraryPrefixDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3341,8 +3241,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
LibraryPrefixPtr prefix = static_cast<LibraryPrefixPtr>(d->Ref(id));
Deserializer::InitializeHeader(prefix, kLibraryPrefixCid,
@@ -3425,7 +3324,7 @@
TypeDeserializationCluster() : DeserializationCluster("Type") {}
~TypeDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3435,11 +3334,11 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
TypePtr type = static_cast<TypePtr>(d->Ref(id));
Deserializer::InitializeHeader(type, kTypeCid, Type::InstanceSize(),
- stamp_canonical);
+ is_canonical);
ReadFromTo(type);
const uint8_t combined = d->Read<uint8_t>();
type->untag()->type_state_ = combined >> kNullabilityBitSize;
@@ -3447,15 +3346,20 @@
}
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- if (canonicalize) {
- Thread* thread = Thread::Current();
- AbstractType& type = AbstractType::Handle(d->zone());
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
+ if (is_canonical && (d->isolate() != Dart::vm_isolate())) {
+ CanonicalTypeSet table(
+ d->zone(), d->isolate_group()->object_store()->canonical_types());
+ Type& type = Type::Handle(d->zone());
for (intptr_t i = start_index_; i < stop_index_; i++) {
type ^= refs.At(i);
- type = type.Canonicalize(thread, nullptr);
- refs.SetAt(i, type);
+ ASSERT(type.IsCanonical());
+ bool present = table.Insert(type);
+ // Two recursive types with different topology (and hashes) may be
+ // equal.
+ ASSERT(!present || type.IsRecursive());
}
+ d->isolate_group()->object_store()->set_canonical_types(table.Release());
}
Type& type = Type::Handle(d->zone());
@@ -3536,7 +3440,7 @@
: DeserializationCluster("FunctionType") {}
~FunctionTypeDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3547,12 +3451,11 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
FunctionTypePtr type = static_cast<FunctionTypePtr>(d->Ref(id));
- Deserializer::InitializeHeader(type, kFunctionTypeCid,
- FunctionType::InstanceSize(),
- stamp_canonical);
+ Deserializer::InitializeHeader(
+ type, kFunctionTypeCid, FunctionType::InstanceSize(), is_canonical);
ReadFromTo(type);
const uint8_t combined = d->Read<uint8_t>();
type->untag()->type_state_ = combined >> kNullabilityBitSize;
@@ -3561,15 +3464,22 @@
}
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- if (canonicalize) {
- Thread* thread = Thread::Current();
- AbstractType& type = AbstractType::Handle(d->zone());
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
+ if (is_canonical && (d->isolate() != Dart::vm_isolate())) {
+ CanonicalFunctionTypeSet table(
+ d->zone(),
+ d->isolate_group()->object_store()->canonical_function_types());
+ FunctionType& type = FunctionType::Handle(d->zone());
for (intptr_t i = start_index_; i < stop_index_; i++) {
type ^= refs.At(i);
- type = type.Canonicalize(thread, nullptr);
- refs.SetAt(i, type);
+ ASSERT(type.IsCanonical());
+ bool present = table.Insert(type);
+ // Two recursive types with different topology (and hashes) may be
+ // equal.
+ ASSERT(!present || type.IsRecursive());
}
+ d->isolate_group()->object_store()->set_canonical_function_types(
+ table.Release());
}
FunctionType& type = FunctionType::Handle(d->zone());
@@ -3632,7 +3542,7 @@
TypeRefDeserializationCluster() : DeserializationCluster("TypeRef") {}
~TypeRefDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3642,16 +3552,16 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
TypeRefPtr type = static_cast<TypeRefPtr>(d->Ref(id));
- Deserializer::InitializeHeader(type, kTypeRefCid, TypeRef::InstanceSize(),
- stamp_canonical);
+ Deserializer::InitializeHeader(type, kTypeRefCid,
+ TypeRef::InstanceSize());
ReadFromTo(type);
}
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
TypeRef& type_ref = TypeRef::Handle(d->zone());
Code& stub = Code::Handle(d->zone());
@@ -3731,7 +3641,7 @@
: DeserializationCluster("TypeParameter") {}
~TypeParameterDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3742,12 +3652,11 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
TypeParameterPtr type = static_cast<TypeParameterPtr>(d->Ref(id));
- Deserializer::InitializeHeader(type, kTypeParameterCid,
- TypeParameter::InstanceSize(),
- stamp_canonical);
+ Deserializer::InitializeHeader(
+ type, kTypeParameterCid, TypeParameter::InstanceSize(), is_canonical);
ReadFromTo(type);
type->untag()->parameterized_class_id_ = d->Read<int32_t>();
type->untag()->base_ = d->Read<uint16_t>();
@@ -3758,15 +3667,20 @@
}
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- if (canonicalize) {
- Thread* thread = Thread::Current();
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
+ if (is_canonical && (d->isolate() != Dart::vm_isolate())) {
+ CanonicalTypeParameterSet table(
+ d->zone(),
+ d->isolate_group()->object_store()->canonical_type_parameters());
TypeParameter& type_param = TypeParameter::Handle(d->zone());
for (intptr_t i = start_index_; i < stop_index_; i++) {
type_param ^= refs.At(i);
- type_param ^= type_param.Canonicalize(thread, nullptr);
- refs.SetAt(i, type_param);
+ ASSERT(type_param.IsCanonical());
+ bool present = table.Insert(type_param);
+ ASSERT(!present);
}
+ d->isolate_group()->object_store()->set_canonical_type_parameters(
+ table.Release());
}
TypeParameter& type_param = TypeParameter::Handle(d->zone());
@@ -3825,14 +3739,12 @@
};
#endif // !DART_PRECOMPILED_RUNTIME
-class ClosureDeserializationCluster
- : public AbstractInstanceDeserializationCluster {
+class ClosureDeserializationCluster : public DeserializationCluster {
public:
- ClosureDeserializationCluster()
- : AbstractInstanceDeserializationCluster("Closure") {}
+ ClosureDeserializationCluster() : DeserializationCluster("Closure") {}
~ClosureDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3842,11 +3754,11 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
ClosurePtr closure = static_cast<ClosurePtr>(d->Ref(id));
Deserializer::InitializeHeader(closure, kClosureCid,
- Closure::InstanceSize(), stamp_canonical);
+ Closure::InstanceSize(), is_canonical);
ReadFromTo(closure);
}
}
@@ -3899,7 +3811,7 @@
MintDeserializationCluster() : DeserializationCluster("int") {}
~MintDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
PageSpace* old_space = d->heap()->old_space();
start_index_ = d->next_index();
@@ -3912,7 +3824,7 @@
MintPtr mint = static_cast<MintPtr>(
AllocateUninitialized(old_space, Mint::InstanceSize()));
Deserializer::InitializeHeader(mint, kMintCid, Mint::InstanceSize(),
- stamp_canonical);
+ is_canonical);
mint->untag()->value_ = value;
d->AssignRef(mint);
}
@@ -3920,24 +3832,19 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {}
+ void ReadFill(Deserializer* d, bool is_canonical) {}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- if (canonicalize) {
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
+ if (is_canonical && (d->isolate() != Dart::vm_isolate())) {
const Class& mint_cls = Class::Handle(
- d->zone(), d->isolate_group()->object_store()->mint_class());
+ d->zone(), IsolateGroup::Current()->object_store()->mint_class());
+ mint_cls.set_constants(Object::null_array());
Object& number = Object::Handle(d->zone());
- Mint& number2 = Mint::Handle(d->zone());
for (intptr_t i = start_index_; i < stop_index_; i++) {
number = refs.At(i);
- if (!number.IsMint()) continue;
- number2 =
- mint_cls.LookupCanonicalMint(d->zone(), Mint::Cast(number).value());
- if (number2.IsNull()) {
- number.SetCanonical();
+ if (number.IsMint()) {
+ ASSERT(number.IsCanonical());
mint_cls.InsertCanonicalMint(d->zone(), Mint::Cast(number));
- } else {
- refs.SetAt(i, number2);
}
}
}
@@ -3984,7 +3891,7 @@
DoubleDeserializationCluster() : DeserializationCluster("double") {}
~DoubleDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -3994,35 +3901,14 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
DoublePtr dbl = static_cast<DoublePtr>(d->Ref(id));
Deserializer::InitializeHeader(dbl, kDoubleCid, Double::InstanceSize(),
- stamp_canonical);
+ is_canonical);
dbl->untag()->value_ = d->Read<double>();
}
}
-
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- if (canonicalize) {
- const Class& cls = Class::Handle(
- d->zone(), d->isolate_group()->object_store()->double_class());
- SafepointMutexLocker ml(
- d->isolate_group()->constant_canonicalization_mutex());
- Double& dbl = Double::Handle(d->zone());
- Double& dbl2 = Double::Handle(d->zone());
- for (intptr_t i = start_index_; i < stop_index_; i++) {
- dbl ^= refs.At(i);
- dbl2 = cls.LookupCanonicalDouble(d->zone(), dbl.value());
- if (dbl2.IsNull()) {
- dbl.SetCanonical();
- cls.InsertCanonicalDouble(d->zone(), dbl);
- } else {
- refs.SetAt(i, dbl2);
- }
- }
- }
- }
};
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -4069,7 +3955,7 @@
: DeserializationCluster("GrowableObjectArray") {}
~GrowableObjectArrayDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4080,13 +3966,13 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
GrowableObjectArrayPtr list =
static_cast<GrowableObjectArrayPtr>(d->Ref(id));
Deserializer::InitializeHeader(list, kGrowableObjectArrayCid,
GrowableObjectArray::InstanceSize(),
- stamp_canonical);
+ is_canonical);
ReadFromTo(list);
}
}
@@ -4142,7 +4028,7 @@
: DeserializationCluster("TypedData"), cid_(cid) {}
~TypedDataDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4155,17 +4041,15 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
intptr_t element_size = TypedData::ElementSizeInBytes(cid_);
for (intptr_t id = start_index_; id < stop_index_; id++) {
TypedDataPtr data = static_cast<TypedDataPtr>(d->Ref(id));
const intptr_t length = d->ReadUnsigned();
const intptr_t length_in_bytes = length * element_size;
- Deserializer::InitializeHeader(data, cid_,
- TypedData::InstanceSize(length_in_bytes),
- stamp_canonical);
+ Deserializer::InitializeHeader(
+ data, cid_, TypedData::InstanceSize(length_in_bytes), is_canonical);
data->untag()->length_ = Smi::New(length);
data->untag()->RecomputeDataField();
uint8_t* cdata = reinterpret_cast<uint8_t*>(data->untag()->data());
@@ -4222,7 +4106,7 @@
: DeserializationCluster("TypedDataView"), cid_(cid) {}
~TypedDataViewDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4233,17 +4117,16 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
TypedDataViewPtr view = static_cast<TypedDataViewPtr>(d->Ref(id));
- Deserializer::InitializeHeader(view, cid_, TypedDataView::InstanceSize());
+ Deserializer::InitializeHeader(view, cid_, TypedDataView::InstanceSize(),
+ is_canonical);
ReadFromTo(view);
}
}
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- ASSERT(!canonicalize);
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
auto& view = TypedDataView::Handle(d->zone());
for (intptr_t id = start_index_; id < stop_index_; id++) {
view ^= refs.At(id);
@@ -4303,7 +4186,7 @@
: DeserializationCluster("ExternalTypedData"), cid_(cid) {}
~ExternalTypedDataDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4314,8 +4197,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
intptr_t element_size = ExternalTypedData::ElementSizeInBytes(cid_);
for (intptr_t id = start_index_; id < stop_index_; id++) {
@@ -4376,7 +4258,7 @@
StackTraceDeserializationCluster() : DeserializationCluster("StackTrace") {}
~StackTraceDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4387,8 +4269,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
StackTracePtr trace = static_cast<StackTracePtr>(d->Ref(id));
Deserializer::InitializeHeader(trace, kStackTraceCid,
@@ -4442,7 +4323,7 @@
RegExpDeserializationCluster() : DeserializationCluster("RegExp") {}
~RegExpDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4452,8 +4333,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
RegExpPtr regexp = static_cast<RegExpPtr>(d->Ref(id));
Deserializer::InitializeHeader(regexp, kRegExpCid,
@@ -4508,7 +4388,7 @@
: DeserializationCluster("WeakProperty") {}
~WeakPropertyDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4519,8 +4399,7 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
- ASSERT(!stamp_canonical); // Never canonical.
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
WeakPropertyPtr property = static_cast<WeakPropertyPtr>(d->Ref(id));
Deserializer::InitializeHeader(property, kWeakPropertyCid,
@@ -4599,14 +4478,13 @@
};
#endif // !DART_PRECOMPILED_RUNTIME
-class LinkedHashMapDeserializationCluster
- : public AbstractInstanceDeserializationCluster {
+class LinkedHashMapDeserializationCluster : public DeserializationCluster {
public:
LinkedHashMapDeserializationCluster()
- : AbstractInstanceDeserializationCluster("LinkedHashMap") {}
+ : DeserializationCluster("LinkedHashMap") {}
~LinkedHashMapDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4617,14 +4495,13 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
PageSpace* old_space = d->heap()->old_space();
for (intptr_t id = start_index_; id < stop_index_; id++) {
LinkedHashMapPtr map = static_cast<LinkedHashMapPtr>(d->Ref(id));
- Deserializer::InitializeHeader(map, kLinkedHashMapCid,
- LinkedHashMap::InstanceSize(),
- stamp_canonical);
+ Deserializer::InitializeHeader(
+ map, kLinkedHashMapCid, LinkedHashMap::InstanceSize(), is_canonical);
map->untag()->type_arguments_ =
static_cast<TypeArgumentsPtr>(d->ReadRef());
@@ -4708,14 +4585,13 @@
};
#endif // !DART_PRECOMPILED_RUNTIME
-class ArrayDeserializationCluster
- : public AbstractInstanceDeserializationCluster {
+class ArrayDeserializationCluster : public DeserializationCluster {
public:
explicit ArrayDeserializationCluster(intptr_t cid)
- : AbstractInstanceDeserializationCluster("Array"), cid_(cid) {}
+ : DeserializationCluster("Array"), cid_(cid) {}
~ArrayDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4727,12 +4603,12 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
ArrayPtr array = static_cast<ArrayPtr>(d->Ref(id));
const intptr_t length = d->ReadUnsigned();
Deserializer::InitializeHeader(array, cid_, Array::InstanceSize(length),
- stamp_canonical);
+ is_canonical);
array->untag()->type_arguments_ =
static_cast<TypeArgumentsPtr>(d->ReadRef());
array->untag()->length_ = Smi::New(length);
@@ -4787,40 +4663,13 @@
};
#endif // !DART_PRECOMPILED_RUNTIME
-class StringDeserializationCluster : public DeserializationCluster {
- protected:
- explicit StringDeserializationCluster(const char* name)
- : DeserializationCluster(name) {}
-
- public:
- void PostLoad(Deserializer* d, const Array& refs, bool canonicalize) {
- if (canonicalize) {
- CanonicalStringSet table(
- d->zone(), d->isolate_group()->object_store()->symbol_table());
- String& str = String::Handle(d->zone());
- String& str2 = String::Handle(d->zone());
- for (intptr_t i = start_index_; i < stop_index_; i++) {
- str ^= refs.At(i);
- str2 ^= table.InsertOrGet(str);
- if (str.ptr() == str2.ptr()) {
- str.SetCanonical();
- } else {
- refs.SetAt(i, str2);
- }
- }
- d->isolate_group()->object_store()->set_symbol_table(table.Release());
- }
- }
-};
-
-class OneByteStringDeserializationCluster
- : public StringDeserializationCluster {
+class OneByteStringDeserializationCluster : public DeserializationCluster {
public:
OneByteStringDeserializationCluster()
- : StringDeserializationCluster("OneByteString") {}
+ : DeserializationCluster("OneByteString") {}
~OneByteStringDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4832,13 +4681,13 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
OneByteStringPtr str = static_cast<OneByteStringPtr>(d->Ref(id));
const intptr_t length = d->ReadUnsigned();
Deserializer::InitializeHeader(str, kOneByteStringCid,
OneByteString::InstanceSize(length),
- stamp_canonical);
+ is_canonical);
str->untag()->length_ = Smi::New(length);
StringHasher hasher;
for (intptr_t j = 0; j < length; j++) {
@@ -4849,6 +4698,21 @@
String::SetCachedHash(str, hasher.Finalize());
}
}
+
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
+ if (is_canonical && (d->isolate() != Dart::vm_isolate())) {
+ CanonicalStringSet table(
+ d->zone(), d->isolate_group()->object_store()->symbol_table());
+ String& str = String::Handle(d->zone());
+ for (intptr_t i = start_index_; i < stop_index_; i++) {
+ str ^= refs.At(i);
+ ASSERT(str.IsCanonical());
+ bool present = table.Insert(str);
+ ASSERT(!present);
+ }
+ d->isolate_group()->object_store()->set_symbol_table(table.Release());
+ }
+ }
};
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -4893,14 +4757,13 @@
};
#endif // !DART_PRECOMPILED_RUNTIME
-class TwoByteStringDeserializationCluster
- : public StringDeserializationCluster {
+class TwoByteStringDeserializationCluster : public DeserializationCluster {
public:
TwoByteStringDeserializationCluster()
- : StringDeserializationCluster("TwoByteString") {}
+ : DeserializationCluster("TwoByteString") {}
~TwoByteStringDeserializationCluster() {}
- void ReadAlloc(Deserializer* d, bool stamp_canonical) {
+ void ReadAlloc(Deserializer* d, bool is_canonical) {
start_index_ = d->next_index();
PageSpace* old_space = d->heap()->old_space();
const intptr_t count = d->ReadUnsigned();
@@ -4912,13 +4775,13 @@
stop_index_ = d->next_index();
}
- void ReadFill(Deserializer* d, bool stamp_canonical) {
+ void ReadFill(Deserializer* d, bool is_canonical) {
for (intptr_t id = start_index_; id < stop_index_; id++) {
TwoByteStringPtr str = static_cast<TwoByteStringPtr>(d->Ref(id));
const intptr_t length = d->ReadUnsigned();
Deserializer::InitializeHeader(str, kTwoByteStringCid,
TwoByteString::InstanceSize(length),
- stamp_canonical);
+ is_canonical);
str->untag()->length_ = Smi::New(length);
StringHasher hasher;
for (intptr_t j = 0; j < length; j++) {
@@ -4930,6 +4793,21 @@
String::SetCachedHash(str, hasher.Finalize());
}
}
+
+ void PostLoad(Deserializer* d, const Array& refs, bool is_canonical) {
+ if (is_canonical && (d->isolate() != Dart::vm_isolate())) {
+ CanonicalStringSet table(
+ d->zone(), d->isolate_group()->object_store()->symbol_table());
+ String& str = String::Handle(d->zone());
+ for (intptr_t i = start_index_; i < stop_index_; i++) {
+ str ^= refs.At(i);
+ ASSERT(str.IsCanonical());
+ bool present = table.Insert(str);
+ ASSERT(!present);
+ }
+ d->isolate_group()->object_store()->set_symbol_table(table.Release());
+ }
+ }
};
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -5309,26 +5187,16 @@
const Object* deferred_object = (*unit_->deferred_objects())[i];
ASSERT(deferred_object->IsCode());
CodePtr code = static_cast<CodePtr>(deferred_object->ptr());
- if (FLAG_use_bare_instructions) {
- if (FLAG_retain_function_objects) {
- ObjectPoolPtr pool = code->untag()->object_pool_;
- if (pool != ObjectPool::null()) {
- const intptr_t length = pool->untag()->length_;
- uint8_t* entry_bits = pool->untag()->entry_bits();
- for (intptr_t i = 0; i < length; i++) {
- auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
- if (entry_type == ObjectPool::EntryType::kTaggedObject) {
- s->Push(pool->untag()->data()[i].raw_obj_);
- }
- }
- }
- }
- } else {
- s->Push(code->untag()->object_pool_);
- }
s->Push(code->untag()->compressed_stackmaps_);
s->Push(code->untag()->code_source_map_);
}
+ {
+ GrowableArray<CodePtr> raw_codes(num_deferred_objects);
+ for (intptr_t i = 0; i < num_deferred_objects; i++) {
+ raw_codes.Add((*unit_->deferred_objects())[i]->ptr());
+ }
+ s->PrepareInstructions(&raw_codes);
+ }
}
void WriteRoots(Serializer* s) {
@@ -5348,33 +5216,9 @@
ASSERT(s->RefId(code) == (start_index + i));
s->WriteInstructions(code->untag()->instructions_,
code->untag()->unchecked_offset_, code, false);
- if (!FLAG_use_bare_instructions) {
- s->WriteRootRef(code->untag()->object_pool_, "deferred-code");
- }
s->WriteRootRef(code->untag()->compressed_stackmaps_, "deferred-code");
s->WriteRootRef(code->untag()->code_source_map_, "deferred-code");
}
-
- if (FLAG_use_bare_instructions && FLAG_retain_function_objects) {
- ObjectPoolPtr pool =
- s->isolate_group()->object_store()->global_object_pool();
- const intptr_t length = pool->untag()->length_;
- uint8_t* entry_bits = pool->untag()->entry_bits();
- intptr_t last_write = 0;
- for (intptr_t i = 0; i < length; i++) {
- auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
- if (entry_type == ObjectPool::EntryType::kTaggedObject) {
- if (s->IsWritten(pool->untag()->data()[i].raw_obj_)) {
- intptr_t skip = i - last_write;
- s->WriteUnsigned(skip);
- s->WriteRootRef(pool->untag()->data()[i].raw_obj_,
- "deferred-literal");
- last_write = i;
- }
- }
- }
- s->WriteUnsigned(length - last_write);
- }
#endif
}
@@ -5410,29 +5254,12 @@
ASSERT(unchecked_entry_point != 0);
func->untag()->unchecked_entry_point_ = unchecked_entry_point;
}
- if (!FLAG_use_bare_instructions) {
- code->untag()->object_pool_ = static_cast<ObjectPoolPtr>(d->ReadRef());
- }
code->untag()->compressed_stackmaps_ =
static_cast<CompressedStackMapsPtr>(d->ReadRef());
code->untag()->code_source_map_ =
static_cast<CodeSourceMapPtr>(d->ReadRef());
}
- if (FLAG_use_bare_instructions && FLAG_retain_function_objects) {
- ObjectPoolPtr pool =
- d->isolate_group()->object_store()->global_object_pool();
- const intptr_t length = pool->untag()->length_;
- uint8_t* entry_bits = pool->untag()->entry_bits();
- for (intptr_t i = d->ReadUnsigned(); i < length; i += d->ReadUnsigned()) {
- auto entry_type = ObjectPool::TypeBits::decode(entry_bits[i]);
- ASSERT(entry_type == ObjectPool::EntryType::kTaggedObject);
- // The existing entry will usually be null, but it might also be an
- // equivalent object that was duplicated in another loading unit.
- pool->untag()->data()[i].raw_obj_ = d->ReadRef();
- }
- }
-
// Reinitialize the dispatch table by rereading the table's serialization
// in the root snapshot.
IsolateGroup* group = d->thread()->isolate()->group();
@@ -5845,9 +5672,6 @@
// TODO(41974): Are these always type testing stubs?
unit_id = LoadingUnit::kRootId;
}
- if (unit_id == LoadingUnit::kRootId) {
- return true;
- }
if (unit_id != current_loading_unit_id_) {
if (record) {
(*loading_units_)[unit_id]->AddDeferredObject(static_cast<CodePtr>(obj));
@@ -5858,58 +5682,11 @@
}
#if !defined(DART_PRECOMPILED_RUNTIME)
-void Serializer::PrepareInstructions() {
- if (!Snapshot::IncludesCode(kind())) return;
-
- CodeSerializationCluster* cluster =
- static_cast<CodeSerializationCluster*>(clusters_by_cid_[kCodeCid]);
-
- // Code objects that have identical/duplicate instructions must be adjacent in
- // the order that Code objects are written because the encoding of the
- // reference from the Code to the Instructions assumes monotonically
- // increasing offsets as part of a delta encoding. Also the code order table
- // that allows for mapping return addresses back to Code objects depends on
- // this sorting.
- if (cluster != nullptr) {
- CodeSerializationCluster::Sort(cluster->objects());
- }
- if ((loading_units_ != nullptr) &&
- (current_loading_unit_id_ == LoadingUnit::kRootId)) {
- for (intptr_t i = LoadingUnit::kRootId + 1; i < loading_units_->length();
- i++) {
- auto unit_objects = loading_units_->At(i)->deferred_objects();
- CodeSerializationCluster::Sort(unit_objects);
- for (intptr_t j = 0; j < unit_objects->length(); j++) {
- cluster->deferred_objects()->Add(unit_objects->At(j)->ptr());
- }
- }
- }
-
+void Serializer::PrepareInstructions(GrowableArray<CodePtr>* code_objects) {
#if defined(DART_PRECOMPILER) && !defined(TARGET_ARCH_IA32)
if ((kind() == Snapshot::kFullAOT) && FLAG_use_bare_instructions) {
- // Group the code objects whose instructions are not being deferred in this
- // snapshot unit in the order they will be written: first the code objects
- // encountered for this first time in this unit being written by the
- // CodeSerializationCluster, then code object previously deferred whose
- // instructions are now written by UnitSerializationRoots. This order needs
- // to be known to finalize bare-instructions-mode's PC-relative calls.
- GrowableArray<CodePtr> code_objects;
- if (cluster != nullptr) {
- auto in = cluster->objects();
- for (intptr_t i = 0; i < in->length(); i++) {
- code_objects.Add(in->At(i));
- }
- }
- if (loading_units_ != nullptr) {
- auto in =
- loading_units_->At(current_loading_unit_id_)->deferred_objects();
- for (intptr_t i = 0; i < in->length(); i++) {
- code_objects.Add(in->At(i)->ptr());
- }
- }
-
GrowableArray<ImageWriterCommand> writer_commands;
- RelocateCodeObjects(vm_, &code_objects, &writer_commands);
+ RelocateCodeObjects(vm_, code_objects, &writer_commands);
image_writer_->PrepareForSerialization(&writer_commands);
}
#endif // defined(DART_PRECOMPILER) && !defined(TARGET_ARCH_IA32)
@@ -6117,22 +5894,6 @@
}
GrowableArray<SerializationCluster*> canonical_clusters;
- // The order that PostLoad runs matters for some classes. Explicitly place
- // these clusters first, then add the rest ordered by class id.
-#define ADD_NEXT(cid) \
- if (canonical_clusters_by_cid_[cid] != nullptr) { \
- canonical_clusters.Add(canonical_clusters_by_cid_[cid]); \
- canonical_clusters_by_cid_[cid] = nullptr; \
- }
- ADD_NEXT(kOneByteStringCid)
- ADD_NEXT(kTwoByteStringCid)
- ADD_NEXT(kMintCid)
- ADD_NEXT(kDoubleCid)
- ADD_NEXT(kTypeParameterCid)
- ADD_NEXT(kTypeCid)
- ADD_NEXT(kTypeArgumentsCid)
- ADD_NEXT(kClosureCid)
-#undef ADD_NEXT
for (intptr_t cid = 0; cid < num_cids_; cid++) {
if (canonical_clusters_by_cid_[cid] != nullptr) {
canonical_clusters.Add(canonical_clusters_by_cid_[cid]);
@@ -6159,8 +5920,6 @@
}
#endif
- PrepareInstructions();
-
intptr_t num_objects = num_base_objects_ + num_written_objects_;
#if defined(ARCH_IS_64_BIT)
if (!Utils::IsInt(32, num_objects)) {
@@ -6278,7 +6037,8 @@
ASSERT(code_cluster != nullptr);
// Reference IDs in a cluster are allocated sequentially, so we can use the
// first code object's reference ID to calculate the cluster index.
- const intptr_t first_code_id = RefId(code_cluster->objects()->At(0));
+ const intptr_t first_code_id =
+ RefId(code_cluster->discovered_objects()->At(0));
// The first object in the code cluster must have its reference ID allocated.
ASSERT(IsAllocatedReference(first_code_id));
@@ -6968,17 +6728,18 @@
ASSERT_EQUAL(next_ref_index_ - kFirstReference, num_objects_);
{
- TIMELINE_DURATION(thread(), Isolate, "PostLoad");
+ TIMELINE_DURATION(thread(), Isolate, "ReadFill");
for (intptr_t i = 0; i < num_canonical_clusters_; i++) {
- bool stamp_canonical = isolate() == Dart::vm_isolate();
- canonical_clusters_[i]->ReadFill(this, stamp_canonical);
+ TIMELINE_DURATION(thread(), Isolate, canonical_clusters_[i]->name());
+ canonical_clusters_[i]->ReadFill(this, /*is_canonical*/ true);
#if defined(DEBUG)
int32_t section_marker = Read<int32_t>();
ASSERT(section_marker == kSectionMarker);
#endif
}
for (intptr_t i = 0; i < num_clusters_; i++) {
- clusters_[i]->ReadFill(this, /*stamp_canonical*/ false);
+ TIMELINE_DURATION(thread(), Isolate, clusters_[i]->name());
+ clusters_[i]->ReadFill(this, /*is_canonical*/ false);
#if defined(DEBUG)
int32_t section_marker = Read<int32_t>();
ASSERT(section_marker == kSectionMarker);
@@ -6999,22 +6760,26 @@
roots->PostLoad(this, refs);
#if defined(DEBUG)
- isolate()->ValidateClassTable();
- if (isolate() != Dart::vm_isolate()) {
- isolate_group()->heap()->Verify();
+ Isolate* isolate = thread()->isolate();
+ isolate->ValidateClassTable();
+ if (isolate != Dart::vm_isolate()) {
+ isolate->group()->heap()->Verify();
}
#endif
+ // TODO(rmacnak): When splitting literals, load clusters requiring
+ // canonicalization first, canonicalize and update the ref array, the load
+ // the remaining clusters to avoid a full heap walk to update references to
+ // the losers of any canonicalization races.
{
TIMELINE_DURATION(thread(), Isolate, "PostLoad");
for (intptr_t i = 0; i < num_canonical_clusters_; i++) {
TIMELINE_DURATION(thread(), Isolate, canonical_clusters_[i]->name());
- bool canonicalize = isolate() != Dart::vm_isolate();
- canonical_clusters_[i]->PostLoad(this, refs, canonicalize);
+ canonical_clusters_[i]->PostLoad(this, refs, /*is_canonical*/ true);
}
for (intptr_t i = 0; i < num_clusters_; i++) {
TIMELINE_DURATION(thread(), Isolate, clusters_[i]->name());
- clusters_[i]->PostLoad(this, refs, /*canonicalize*/ false);
+ clusters_[i]->PostLoad(this, refs, /*is_canonical*/ false);
}
}
}
diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h
index d35b83a..ac72aed 100644
--- a/runtime/vm/clustered_snapshot.h
+++ b/runtime/vm/clustered_snapshot.h
@@ -116,20 +116,16 @@
// Allocate memory for all objects in the cluster and write their addresses
// into the ref array. Do not touch this memory.
- virtual void ReadAlloc(Deserializer* deserializer, bool stamp_canonical) = 0;
+ virtual void ReadAlloc(Deserializer* deserializer, bool is_canonical) = 0;
// Initialize the cluster's objects. Do not touch the memory of other objects.
- virtual void ReadFill(Deserializer* deserializer, bool stamp_canonical) = 0;
+ virtual void ReadFill(Deserializer* deserializer, bool is_canonical) = 0;
// Complete any action that requires the full graph to be deserialized, such
// as rehashing.
virtual void PostLoad(Deserializer* deserializer,
const Array& refs,
- bool canonicalize) {
- if (canonicalize) {
- FATAL1("%s needs canonicalization but doesn't define PostLoad", name());
- }
- }
+ bool is_canonical) {}
const char* name() const { return name_; }
@@ -351,7 +347,7 @@
Write<int32_t>(cid);
}
- void PrepareInstructions();
+ void PrepareInstructions(GrowableArray<CodePtr>* codes);
void WriteInstructions(InstructionsPtr instr,
uint32_t unchecked_offset,
CodePtr code,
@@ -384,7 +380,6 @@
void set_loading_units(GrowableArray<LoadingUnitSerializationData*>* units) {
loading_units_ = units;
}
- intptr_t current_loading_unit_id() { return current_loading_unit_id_; }
void set_current_loading_unit_id(intptr_t id) {
current_loading_unit_id_ = id;
}
@@ -419,13 +414,6 @@
FATAL("Missing ref");
}
- bool HasRef(ObjectPtr object) const {
- return heap_->GetObjectId(object) != kUnreachableReference;
- }
- bool IsWritten(ObjectPtr object) const {
- return heap_->GetObjectId(object) > num_base_objects_;
- }
-
private:
const char* ReadOnlyObjectType(intptr_t cid);
@@ -585,8 +573,6 @@
uword ReadWordWith32BitReads() { return stream_.ReadWordWith32BitReads(); }
- intptr_t position() const { return stream_.Position(); }
- void set_position(intptr_t p) { stream_.SetPosition(p); }
const uint8_t* CurrentBufferAddress() const {
return stream_.AddressOfCurrentPosition();
}
diff --git a/runtime/vm/compiler/relocation.cc b/runtime/vm/compiler/relocation.cc
index ff5ea61..f19bbbd 100644
--- a/runtime/vm/compiler/relocation.cc
+++ b/runtime/vm/compiler/relocation.cc
@@ -71,15 +71,8 @@
// We're guaranteed to have all calls resolved, since
// * backwards calls are resolved eagerly
// * forward calls are resolved once the target is written
- if (!all_unresolved_calls_.IsEmpty()) {
- for (auto call : all_unresolved_calls_) {
- OS::PrintErr("Unresolved call to %s from %s\n",
- Object::Handle(call->callee).ToCString(),
- Object::Handle(call->caller).ToCString());
- }
- }
- RELEASE_ASSERT(all_unresolved_calls_.IsEmpty());
- RELEASE_ASSERT(unresolved_calls_by_destination_.IsEmpty());
+ ASSERT(all_unresolved_calls_.IsEmpty());
+ ASSERT(unresolved_calls_by_destination_.IsEmpty());
// Any trampolines we created must be patched with the right offsets.
auto it = trampolines_by_destination_.GetIterator();
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index 9694444..5bdddc8 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -86,7 +86,7 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 4;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 48;
+ 52;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
88;
static constexpr dart::compiler::target::word Class_super_type_offset = 44;
@@ -611,7 +611,7 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 96;
+ 104;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
164;
static constexpr dart::compiler::target::word Class_super_type_offset = 88;
@@ -1140,7 +1140,7 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 4;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 48;
+ 52;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
88;
static constexpr dart::compiler::target::word Class_super_type_offset = 44;
@@ -1662,7 +1662,7 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 96;
+ 104;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
164;
static constexpr dart::compiler::target::word Class_super_type_offset = 88;
@@ -2194,7 +2194,7 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 4;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 48;
+ 52;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
88;
static constexpr dart::compiler::target::word Class_super_type_offset = 44;
@@ -2713,7 +2713,7 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 96;
+ 104;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
164;
static constexpr dart::compiler::target::word Class_super_type_offset = 88;
@@ -3236,7 +3236,7 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 4;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 48;
+ 52;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
88;
static constexpr dart::compiler::target::word Class_super_type_offset = 44;
@@ -3752,7 +3752,7 @@
static constexpr dart::compiler::target::word Array_tags_offset = 0;
static constexpr dart::compiler::target::word Array_type_arguments_offset = 8;
static constexpr dart::compiler::target::word Class_declaration_type_offset =
- 96;
+ 104;
static constexpr dart::compiler::target::word Class_num_type_arguments_offset =
164;
static constexpr dart::compiler::target::word Class_super_type_offset = 88;
@@ -4280,7 +4280,7 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
4;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 48;
+ AOT_Class_declaration_type_offset = 52;
static constexpr dart::compiler::target::word
AOT_Class_num_type_arguments_offset = 88;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
@@ -4864,7 +4864,7 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 96;
+ AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
AOT_Class_num_type_arguments_offset = 164;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
@@ -5454,7 +5454,7 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 96;
+ AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
AOT_Class_num_type_arguments_offset = 164;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
@@ -6043,7 +6043,7 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
4;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 48;
+ AOT_Class_declaration_type_offset = 52;
static constexpr dart::compiler::target::word
AOT_Class_num_type_arguments_offset = 88;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 44;
@@ -6620,7 +6620,7 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 96;
+ AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
AOT_Class_num_type_arguments_offset = 164;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
@@ -7203,7 +7203,7 @@
static constexpr dart::compiler::target::word AOT_Array_type_arguments_offset =
8;
static constexpr dart::compiler::target::word
- AOT_Class_declaration_type_offset = 96;
+ AOT_Class_declaration_type_offset = 104;
static constexpr dart::compiler::target::word
AOT_Class_num_type_arguments_offset = 164;
static constexpr dart::compiler::target::word AOT_Class_super_type_offset = 88;
diff --git a/runtime/vm/compiler/type_testing_stubs_arm.cc b/runtime/vm/compiler/type_testing_stubs_arm.cc
index ccd9d36..ed1ace2 100644
--- a/runtime/vm/compiler/type_testing_stubs_arm.cc
+++ b/runtime/vm/compiler/type_testing_stubs_arm.cc
@@ -20,8 +20,16 @@
const Type& type,
const Class& type_class) {
BuildOptimizedTypeTestStubFastCases(assembler, hi, type, type_class);
- __ Branch(compiler::Address(
- THR, compiler::target::Thread::slow_type_test_entry_point_offset()));
+ if (!compiler::IsSameObject(
+ compiler::NullObject(),
+ compiler::CastHandle<Object>(slow_type_test_stub))) {
+ __ GenerateUnRelocatedPcRelativeTailCall();
+ unresolved_calls->Add(new compiler::UnresolvedPcRelativeCall(
+ __ CodeSize(), slow_type_test_stub, /*is_tail_call=*/true));
+ } else {
+ __ Branch(compiler::Address(
+ THR, compiler::target::Thread::slow_type_test_entry_point_offset()));
+ }
}
} // namespace dart
diff --git a/runtime/vm/compiler/type_testing_stubs_arm64.cc b/runtime/vm/compiler/type_testing_stubs_arm64.cc
index 850b198..0540b01 100644
--- a/runtime/vm/compiler/type_testing_stubs_arm64.cc
+++ b/runtime/vm/compiler/type_testing_stubs_arm64.cc
@@ -20,11 +20,19 @@
const Type& type,
const Class& type_class) {
BuildOptimizedTypeTestStubFastCases(assembler, hi, type, type_class);
- __ ldr(
- TMP,
- compiler::Address(
- THR, compiler::target::Thread::slow_type_test_entry_point_offset()));
- __ br(TMP);
+ if (!compiler::IsSameObject(
+ compiler::NullObject(),
+ compiler::CastHandle<Object>(slow_type_test_stub))) {
+ __ GenerateUnRelocatedPcRelativeTailCall();
+ unresolved_calls->Add(new compiler::UnresolvedPcRelativeCall(
+ __ CodeSize(), slow_type_test_stub, /*is_tail_call=*/true));
+ } else {
+ __ ldr(TMP,
+ compiler::Address(
+ THR,
+ compiler::target::Thread::slow_type_test_entry_point_offset()));
+ __ br(TMP);
+ }
}
} // namespace dart
diff --git a/runtime/vm/compiler/type_testing_stubs_x64.cc b/runtime/vm/compiler/type_testing_stubs_x64.cc
index 7722cee..f7a974c 100644
--- a/runtime/vm/compiler/type_testing_stubs_x64.cc
+++ b/runtime/vm/compiler/type_testing_stubs_x64.cc
@@ -20,8 +20,16 @@
const Type& type,
const Class& type_class) {
BuildOptimizedTypeTestStubFastCases(assembler, hi, type, type_class);
- __ jmp(compiler::Address(
- THR, compiler::target::Thread::slow_type_test_entry_point_offset()));
+ if (!compiler::IsSameObject(
+ compiler::NullObject(),
+ compiler::CastHandle<Object>(slow_type_test_stub))) {
+ __ GenerateUnRelocatedPcRelativeTailCall();
+ unresolved_calls->Add(new compiler::UnresolvedPcRelativeCall(
+ __ CodeSize(), slow_type_test_stub, /*is_tail_call=*/true));
+ } else {
+ __ jmp(compiler::Address(
+ THR, compiler::target::Thread::slow_type_test_entry_point_offset()));
+ }
}
} // namespace dart
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index fae18df..d98aa2d 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -20212,11 +20212,9 @@
}
}
ASSERT(this->Equals(type));
- // TODO(rmacnak): Revisit immediately returning type after to changes to
- // recanonicalization on load for literal splitting.
- if (type.IsCanonical()) {
- return type.ptr();
- }
+ ASSERT(type.IsCanonical());
+ ASSERT(type.IsOld());
+ return type.ptr();
}
Type& type = Type::Handle(zone);
diff --git a/runtime/vm/program_visitor.cc b/runtime/vm/program_visitor.cc
index b8e3de1..9082979 100644
--- a/runtime/vm/program_visitor.cc
+++ b/runtime/vm/program_visitor.cc
@@ -1371,15 +1371,9 @@
MergeAssignment(obj_, id);
obj_ = code.compressed_stackmaps();
MergeAssignment(obj_, id);
- if (!FLAG_use_bare_instructions) {
- obj_ = code.object_pool();
- MergeAssignment(obj_, id);
- }
}
void MergeAssignment(const Object& obj, intptr_t id) {
- if (obj.IsNull()) return;
-
intptr_t old_id = heap_->GetLoadingUnit(obj_.ptr());
if (old_id == WeakTable::kNoValue) {
heap_->SetLoadingUnit(obj_.ptr(), id);
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 8a02e59..d209ad2 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -28,8 +28,8 @@
// * Target architecture
// * DART_PRECOMPILED_RUNTIME (i.e, AOT vs. JIT)
//
-// That is, fields in UntaggedObject and its subclasses should only be included or
-// excluded conditionally based on these factors. Otherwise, the generated
+// That is, fields in UntaggedObject and its subclasses should only be included
+// or excluded conditionally based on these factors. Otherwise, the generated
// offsets can be wrong (which should be caught by offset checking in dart.cc).
//
// TODO(dartbug.com/43646): Add DART_PRECOMPILER as another axis.
@@ -819,6 +819,8 @@
POINTER_FIELD(LibraryPtr, library)
POINTER_FIELD(TypeArgumentsPtr, type_parameters) // Array of TypeParameter.
POINTER_FIELD(AbstractTypePtr, super_type)
+ POINTER_FIELD(ArrayPtr,
+ constants) // Canonicalized const instances of this class.
POINTER_FIELD(TypePtr, declaration_type) // Declaration type for this class.
POINTER_FIELD(ArrayPtr,
invocation_dispatcher_cache) // Cache for dispatcher functions.
@@ -828,9 +830,7 @@
direct_implementors) // Array of Class.
POINTER_FIELD(GrowableObjectArrayPtr, direct_subclasses) // Array of Class.
POINTER_FIELD(ArrayPtr, dependent_code) // CHA optimized codes.
- POINTER_FIELD(ArrayPtr,
- constants) // Canonicalized const instances of this class.
- VISIT_TO(ObjectPtr, constants)
+ VISIT_TO(ObjectPtr, dependent_code)
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFullAOT:
@@ -1642,8 +1642,6 @@
friend class Object;
friend class CodeSerializationCluster;
- friend class UnitSerializationRoots;
- friend class UnitDeserializationRoots;
};
class UntaggedInstructions : public UntaggedObject {
diff --git a/tests/ffi/structs_test.dart b/tests/ffi/structs_test.dart
index 6bc1ed1..a38c241 100644
--- a/tests/ffi/structs_test.dart
+++ b/tests/ffi/structs_test.dart
@@ -24,6 +24,7 @@
testBareStruct();
testTypeTest();
testUtf8();
+ testDotDotRef();
}
}
@@ -135,3 +136,10 @@
Expect.equals(test, Utf8.fromUtf8(medium));
calloc.free(medium);
}
+
+void testDotDotRef() {
+ final pointer = calloc<Coordinate>()
+ ..ref.x = 1
+ ..ref.y = 1;
+ calloc.free(pointer);
+}
diff --git a/tests/ffi_2/structs_test.dart b/tests/ffi_2/structs_test.dart
index 2759056..57bdbc6 100644
--- a/tests/ffi_2/structs_test.dart
+++ b/tests/ffi_2/structs_test.dart
@@ -24,6 +24,7 @@
testBareStruct();
testTypeTest();
testUtf8();
+ testDotDotRef();
}
}
@@ -135,3 +136,10 @@
Expect.equals(test, Utf8.fromUtf8(medium));
calloc.free(medium);
}
+
+void testDotDotRef() {
+ final pointer = calloc<Coordinate>()
+ ..ref.x = 1
+ ..ref.y = 1;
+ calloc.free(pointer);
+}
diff --git a/tests/language/async/explicit_await_test.dart b/tests/language/async/explicit_await_test.dart
deleted file mode 100644
index 545e5c5..0000000
--- a/tests/language/async/explicit_await_test.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:expect/expect.dart';
-
-bool caughtInMethod1 = false;
-bool caughtInMethod2 = false;
-bool caughtInMain = false;
-
-Future<Object> f() {
- return new Future<Future<Object>>.value(new Future<Object>.delayed(
- const Duration(seconds: 1), () => throw 'foo'));
-}
-
-Future<Object> method1() async {
- try {
- return await f();
- } catch (e) {
- print('caught in method1: $e');
- caughtInMethod1 = true;
- }
- return new Object();
-}
-
-Future<Object> method2() async {
- try {
- return method1();
- } catch (e) {
- print('caught in method2: $e');
- caughtInMethod2 = true;
- }
- return new Object();
-}
-
-void main() async {
- try {
- print(await method2());
- print('Done');
- } catch (e) {
- print('caught in main: $e');
- caughtInMain = true;
- }
- Expect.isTrue(caughtInMethod1, "Exception should be caught in 'method1'.");
- Expect.isFalse(
- caughtInMethod2, "Exception should not be caught in 'method2'.");
- Expect.isFalse(caughtInMain, "Exception should not be caught in 'main'.");
-}
diff --git a/tests/language/async/implicit_await_test.dart b/tests/language/async/implicit_await_test.dart
deleted file mode 100644
index 9c79259..0000000
--- a/tests/language/async/implicit_await_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:expect/expect.dart';
-
-bool caughtInF = false;
-bool caughtInMain = false;
-
-class A {}
-
-class AAndFutureOfA implements A, Future<A> {
- noSuchMethod(Invocation i) => throw 0;
-}
-
-Future<A> f(A a) async {
- try {
- // Statically looks like no `await` is needed, but dynamically it is needed.
- // So we should check dynamically whether to await.
- return a;
- } catch (e) {
- caughtInF = true;
- }
- return new A();
-}
-
-void main() async {
- try {
- print(await f(AAndFutureOfA()));
- print('Done');
- } catch (e) {
- caughtInMain = true;
- }
- Expect.isTrue(caughtInF, "Exception should be caught in 'f'.");
- Expect.isFalse(caughtInMain, "Exception should not be caught in 'main'.");
-}
diff --git a/tools/VERSION b/tools/VERSION
index 9270cb0..5e91b59 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 12
PATCH 0
PRERELEASE 259
-PRERELEASE_PATCH 1
\ No newline at end of file
+PRERELEASE_PATCH 8
\ No newline at end of file