Skip to content

Commit

Permalink
[cfe] Place return type into parameter scope in TypeBuilderComputer
Browse files Browse the repository at this point in the history
Closes flutter/flutter#143689

Change-Id: Icf2a7631134fa31ef50c0feba5099870aaf2d3b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355401
Reviewed-by: Jens Johansen <[email protected]>
Commit-Queue: Chloe Stefantsova <[email protected]>
  • Loading branch information
chloestefantsova authored and Commit Queue committed Mar 5, 2024
1 parent a257981 commit 9ba8663
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 12 deletions.
5 changes: 3 additions & 2 deletions pkg/front_end/lib/src/fasta/kernel/type_builder_computer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ class _TypeBuilderComputerHelper
@override
TypeBuilder visitFunctionType(FunctionType node,
Map<TypeParameter, NominalVariableBuilder> pendingNominalVariables) {
TypeBuilder returnType =
node.returnType.accept1(this, pendingNominalVariables);
List<StructuralVariableBuilder>? typeVariables = null;
if (node.typeParameters.isNotEmpty) {
typeVariables = <StructuralVariableBuilder>[
Expand All @@ -176,6 +174,9 @@ class _TypeBuilderComputerHelper
];
}

TypeBuilder returnType =
node.returnType.accept1(this, pendingNominalVariables);

List<DartType> positionalParameters = node.positionalParameters;
List<NamedType> namedParameters = node.namedParameters;
List<ParameterBuilder> formals = new List<ParameterBuilder>.filled(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
library;
import self as self;
import "dart:core" as core;

import "org-dartlang-testcase:///typedef_from_dill_lib.dart";

typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
static method main() → void {
core::print("hello");
}

library;
import self as self2;
import "dart:core" as core;

typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
library;
import self as self;
import "dart:core" as core;

import "org-dartlang-testcase:///typedef_from_dill_lib.dart";

typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
static method main() → void {
core::print("hello");
}

library;
import self as self2;
import "dart:core" as core;

typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
library;
import self as self;
import "dart:core" as core;

import "org-dartlang-testcase:///typedef_from_dill_lib.dart";

typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
static method main() → void {
core::print("hello");
}

library;
import self as self2;
import "dart:core" as core;

typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
library;
import self as self;
import "dart:core" as core;

import "org-dartlang-testcase:///typedef_from_dill_lib.dart";

typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
static method main() → void {
core::print("hello");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
library;
import self as self;
import "dart:core" as core;

import "org-dartlang-testcase:///typedef_from_dill_lib.dart";

typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
static method main() → void
;

library;
import self as self2;
import "dart:core" as core;

typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
library;
import self as self;
import "dart:core" as core;

import "org-dartlang-testcase:///typedef_from_dill_lib.dart";

typedef Bar = <R extends core::Object? = dynamic>(() → R%) → R%;
static method main() → void {
core::print("hello");
}

library;
import self as self2;
import "dart:core" as core;

typedef Foo = <R extends core::Object? = dynamic>(() → R%) → R%;
2 changes: 0 additions & 2 deletions pkg/front_end/testcases/incremental.status
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

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

reproduce_DillTypeAliasBuilder_type_crash: Crash

# http://dartbug.com/41812#issuecomment-684825703
#strongmode_mixins_2: Crash

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
main = main::main;
library from "org-dartlang-test:///lib.dart" as lib {

typedef Foo = <R extends dart.core::Object? = dynamic>(() → R%) → R%;
}
library from "org-dartlang-test:///main.dart" as main {

import "org-dartlang-test:///lib.dart";

typedef Bar = <R extends dart.core::Object? = dynamic>(() → R%) → R%;
static method main() → dynamic {
dart.core::print("hello ${#C1}");
}
}
constants {
#C1 = TypeLiteralConstant(<R extends dart.core::Object? = dynamic>(() →* R*) →* R*)
}
2 changes: 0 additions & 2 deletions pkg/front_end/testcases/modular.status
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# Status file for the modular_suite.dart test suite.

general/with_dependencies/typedef_from_dill/typedef_from_dill: Crash

constructor_tearoffs/call_instantiation: TypeCheckError
enhanced_enums/declared_hashcode: TypeCheckError
enhanced_enums/declared_index: TypeCheckError
Expand Down
2 changes: 0 additions & 2 deletions pkg/front_end/testcases/outline.status
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# 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.

general/with_dependencies/typedef_from_dill/typedef_from_dill: Crash

const_functions/const_functions_const_factory: VerificationError
enhanced_enums/declared_hashcode: TypeCheckError
enhanced_enums/declared_index: TypeCheckError
Expand Down
2 changes: 0 additions & 2 deletions pkg/front_end/testcases/strong.status
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# Kernel ASTs directly, that is, code in pkg/fasta/lib/src/kernel/ with
# strong-mode enabled.

general/with_dependencies/typedef_from_dill/typedef_from_dill: Crash

# BAD ONES:
class_modifiers/issue52115/main: SemiFuzzFailure # https://github.com/dart-lang/sdk/issues/53109
class_modifiers/issue52316/main: SemiFuzzFailure # https://github.com/dart-lang/sdk/issues/53109
Expand Down
2 changes: 0 additions & 2 deletions pkg/front_end/testcases/weak.status
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# Status file for the weak_suite.dart test suite.

general/with_dependencies/typedef_from_dill/typedef_from_dill: Crash

# BAD ONES:
class_modifiers/issue52115/main: SemiFuzzFailure # https://github.com/dart-lang/sdk/issues/53109
class_modifiers/issue52316/main: SemiFuzzFailure # https://github.com/dart-lang/sdk/issues/53109
Expand Down

0 comments on commit 9ba8663

Please sign in to comment.