Skip to content

Commit 9ba8663

Browse files
chloestefantsovaCommit Queue
authored andcommitted
[cfe] Place return type into parameter scope in TypeBuilderComputer
Closes flutter/flutter#143689 Change-Id: Icf2a7631134fa31ef50c0feba5099870aaf2d3b6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355401 Reviewed-by: Jens Johansen <jensj@google.com> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
1 parent a257981 commit 9ba8663

13 files changed

Lines changed: 109 additions & 12 deletions

pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ class _TypeBuilderComputerHelper
165165
@override
166166
TypeBuilder visitFunctionType(FunctionType node,
167167
Map<TypeParameter, NominalVariableBuilder> pendingNominalVariables) {
168-
TypeBuilder returnType =
169-
node.returnType.accept1(this, pendingNominalVariables);
170168
List<StructuralVariableBuilder>? typeVariables = null;
171169
if (node.typeParameters.isNotEmpty) {
172170
typeVariables = <StructuralVariableBuilder>[
@@ -176,6 +174,9 @@ class _TypeBuilderComputerHelper
176174
];
177175
}
178176

177+
TypeBuilder returnType =
178+
node.returnType.accept1(this, pendingNominalVariables);
179+
179180
List<DartType> positionalParameters = node.positionalParameters;
180181
List<NamedType> namedParameters = node.namedParameters;
181182
List<ParameterBuilder> formals = new List<ParameterBuilder>.filled(
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
import "org-dartlang-testcase:///typedef_from_dill_lib.dart";
6+
7+
typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
8+
static method main() → void {
9+
core::print("hello");
10+
}
11+
12+
library;
13+
import self as self2;
14+
import "dart:core" as core;
15+
16+
typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
import "org-dartlang-testcase:///typedef_from_dill_lib.dart";
6+
7+
typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
8+
static method main() → void {
9+
core::print("hello");
10+
}
11+
12+
library;
13+
import self as self2;
14+
import "dart:core" as core;
15+
16+
typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
import "org-dartlang-testcase:///typedef_from_dill_lib.dart";
6+
7+
typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
8+
static method main() → void {
9+
core::print("hello");
10+
}
11+
12+
library;
13+
import self as self2;
14+
import "dart:core" as core;
15+
16+
typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
import "org-dartlang-testcase:///typedef_from_dill_lib.dart";
6+
7+
typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
8+
static method main() → void {
9+
core::print("hello");
10+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
import "org-dartlang-testcase:///typedef_from_dill_lib.dart";
6+
7+
typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
8+
static method main() → void
9+
;
10+
11+
library;
12+
import self as self2;
13+
import "dart:core" as core;
14+
15+
typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
import "org-dartlang-testcase:///typedef_from_dill_lib.dart";
6+
7+
typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
8+
static method main() → void {
9+
core::print("hello");
10+
}
11+
12+
library;
13+
import self as self2;
14+
import "dart:core" as core;
15+
16+
typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;

pkg/front_end/testcases/incremental.status

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
# Status file for the test suite ../test/incremental_suite.dart.
66

7-
reproduce_DillTypeAliasBuilder_type_crash: Crash
8-
97
# http://dartbug.com/41812#issuecomment-684825703
108
#strongmode_mixins_2: Crash
119

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
main = main::main;
2+
library from "org-dartlang-test:///lib.dart" as lib {
3+
4+
typedef Foo = <R extends dart.core::Object? = dynamic>(() → R%) → R%;
5+
}
6+
library from "org-dartlang-test:///main.dart" as main {
7+
8+
import "org-dartlang-test:///lib.dart";
9+
10+
typedef Bar = <R extends dart.core::Object? = dynamic>(() → R%) → R%;
11+
static method main() → dynamic {
12+
dart.core::print("hello ${#C1}");
13+
}
14+
}
15+
constants {
16+
#C1 = TypeLiteralConstant(<R extends dart.core::Object? = dynamic>(() →* R*) →* R*)
17+
}

pkg/front_end/testcases/modular.status

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
# Status file for the modular_suite.dart test suite.
66

7-
general/with_dependencies/typedef_from_dill/typedef_from_dill: Crash
8-
97
constructor_tearoffs/call_instantiation: TypeCheckError
108
enhanced_enums/declared_hashcode: TypeCheckError
119
enhanced_enums/declared_index: TypeCheckError

0 commit comments

Comments
 (0)