Migration: fix handling of bound -> type param downcast.

I don't recall what I was thinking when I decided to change the
nullability of the type to "always" when doing this downcast--AFAICT
it doesn't make any sense.

Change-Id: I41d1d2a30722010d2b9b93bb53979ce881e24319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124905
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
Paul Berry 2019-11-14 14:03:16 +00:00 committed by commit-bot@chromium.org
parent 7b3aa88ebe
commit 3bd7ed38fb
2 changed files with 3 additions and 4 deletions

View file

@ -2346,8 +2346,7 @@ mixin _AssignmentChecker {
// Assume an assignment to the type parameter's bound.
_checkAssignment(origin,
source: source,
destination:
_getTypeParameterTypeBound(destination).withNode(_graph.always),
destination: _getTypeParameterTypeBound(destination),
hard: false);
} else if (destinationType is InterfaceType) {
assert(source.typeArguments.isEmpty,

View file

@ -97,7 +97,7 @@ class AssignmentCheckerTest extends Object
var t2 = typeParameterType(typeParameter('T', bound));
assign(t1, t2, hard: true);
assertEdge(t1.node, t2.node, hard: true);
assertNoEdge(t1.node, bound.node);
assertEdge(t1.node, bound.node, hard: false);
assertEdge(t1.typeArguments[0].node, bound.typeArguments[0].node,
hard: false);
}
@ -457,7 +457,7 @@ class C<T extends List<int>> {
var parameterType = decoratedTypeAnnotation('List<int> x');
var tType = decoratedTypeAnnotation('T f');
assertEdge(parameterType.node, tType.node, hard: true);
assertNoEdge(parameterType.node, boundType.node);
assertEdge(parameterType.node, boundType.node, hard: false);
// TODO(mfairhurst): Confirm we want this edge.
assertEdge(
parameterType.typeArguments[0].node, boundType.typeArguments[0].node,