mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
[dartdevc] Update instantiated type arguments in tear-offs
They now become a `Object*` or `Object?` if the library where the method is defined is legacy or null safe. Change-Id: Ia3de0d728187b9c5bf64cc8c08aa075e63aff942 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136723 Reviewed-by: Sigmund Cherem <sigmund@google.com> Reviewed-by: Mark Zhou <markzipan@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
cfc23cde53
commit
9d1b5ced65
2 changed files with 6 additions and 9 deletions
|
@ -1378,8 +1378,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
result = f.computeThisFunctionType(member.enclosingLibrary.nonNullable);
|
||||
} else {
|
||||
DartType reifyParameter(VariableDeclaration p) => isCovariantParameter(p)
|
||||
? _coreTypes.objectClass.getThisType(
|
||||
_coreTypes, _coreTypes.objectClass.enclosingLibrary.nonNullable)
|
||||
? _coreTypes.objectRawType(member.enclosingLibrary.nullable)
|
||||
: p.type;
|
||||
NamedType reifyNamedParameter(VariableDeclaration p) =>
|
||||
NamedType(p.name, reifyParameter(p));
|
||||
|
|
|
@ -48,7 +48,6 @@ main() {
|
|||
Expect.equals(namedTToVoid.runtimeType, namedSToVoid.runtimeType);
|
||||
Expect.equals(
|
||||
namedNullableTToVoid.runtimeType, namedNullableSToVoid.runtimeType);
|
||||
Expect.equals(A().fn.runtimeType, legacy.A().fn.runtimeType);
|
||||
Expect.equals(requiredTToVoid.runtimeType, requiredSToVoid.runtimeType);
|
||||
Expect.equals(
|
||||
requiredNullableTToVoid.runtimeType, requiredNullableSToVoid.runtimeType);
|
||||
|
@ -62,12 +61,11 @@ main() {
|
|||
optionalTToVoid.runtimeType, legacy.optionalRToVoid.runtimeType);
|
||||
Expect.notEquals(namedTToVoid.runtimeType, legacy.namedRToVoid.runtimeType);
|
||||
|
||||
// TODO(nshahan) What should the bound be of the type arguments in the
|
||||
// tearoffs? Object?, Object*, B etc?
|
||||
Expect.equals(A().fn.runtimeType, legacy.A().fn.runtimeType);
|
||||
Expect.equals(A().fn.runtimeType, legacy.rawAFnTearoff.runtimeType);
|
||||
Expect.equals(A<B>().fn.runtimeType, legacy.A<C>().fn.runtimeType);
|
||||
Expect.equals(A<C>().fn.runtimeType, legacy.A<C>().fn.runtimeType);
|
||||
// Type arguments in methods tear-offs from null safe libraries become Object?
|
||||
// and Object* from legacy libraries and are not equal.
|
||||
Expect.notEquals(A().fn.runtimeType, legacy.A().fn.runtimeType);
|
||||
Expect.notEquals(A().fn.runtimeType, legacy.rawAFnTearoff.runtimeType);
|
||||
Expect.notEquals(A<C>().fn.runtimeType, legacy.A<C>().fn.runtimeType);
|
||||
|
||||
// Same signatures but one is from a legacy library.
|
||||
Expect.equals(positionalTToVoidWithBound.runtimeType,
|
||||
|
|
Loading…
Reference in a new issue