mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[vm/kernel] Remove Function parameters from Local type parameters
When calling SetupFunctionParameters, Function type arguments were copied into local type parameters. Local type parameters = previous type parameter + function type parameters. At BuildTypeParameterType(), local type parameters contains duplicated type parameter from function, which ends up with returning wrong type. Bug: https://github.com/dart-lang/sdk/issues/37382 Change-Id: I8f486b0b9a9120845349fe1734bbfcc35f1126a1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108501 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Zichang Guo <zichangguo@google.com>
This commit is contained in:
parent
f743594375
commit
90088a386b
14
runtime/tests/vm/dart/regress_37382_test.dart
Normal file
14
runtime/tests/vm/dart/regress_37382_test.dart
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright (c) 2019, 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';
|
||||
|
||||
class A<X, Y> {
|
||||
R f<R>(R Function<S, T>(A<S, T>) t) => t<X, Y>(this);
|
||||
}
|
||||
|
||||
main() {
|
||||
A<num, num> a = A<int, int>();
|
||||
Expect.equals(a.f.runtimeType.toString(), '<R>(<S, T>(A<S, T>) => R) => R');
|
||||
}
|
|
@ -3124,9 +3124,7 @@ void TypeTranslator::SetupFunctionParameters(
|
|||
function_node_helper->SetJustRead(FunctionNodeHelper::kTypeParameters);
|
||||
}
|
||||
|
||||
ActiveTypeParametersScope scope(
|
||||
active_class_, &function,
|
||||
TypeArguments::Handle(Z, function.type_parameters()), Z);
|
||||
ActiveTypeParametersScope scope(active_class_, function, Z);
|
||||
|
||||
function_node_helper->ReadUntilExcluding(
|
||||
FunctionNodeHelper::kPositionalParameters);
|
||||
|
|
Loading…
Reference in a new issue