mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Fix exception in migration of ?? operator when the right hand side is a generic type
Change-Id: Ie372522f9493e2ccea8284f8583b0f43153adbbd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123884 Reviewed-by: Paul Berry <paulberry@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
ed1910006c
commit
9bffff6dfc
2 changed files with 12 additions and 1 deletions
|
@ -378,7 +378,9 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
|
|||
rightType = rightOperand.accept(this);
|
||||
});
|
||||
var ifNullNode = NullabilityNode.forIfNotNull();
|
||||
expressionType = DecoratedType(node.staticType, ifNullNode);
|
||||
expressionType = _decorateUpperOrLowerBound(
|
||||
node, node.staticType, leftType, rightType, true,
|
||||
node: ifNullNode);
|
||||
_connect(
|
||||
rightType.node, expressionType.node, IfNullOrigin(source, node));
|
||||
} finally {
|
||||
|
|
|
@ -1201,6 +1201,15 @@ int f(int i, int j) => i ?? j;
|
|||
assertEdge(right, expression, guards: [left], hard: false);
|
||||
}
|
||||
|
||||
test_binaryExpression_questionQuestion_genericReturnType() async {
|
||||
await analyze('''
|
||||
class C<E> {
|
||||
C<E> operator +(C<E> c) => this;
|
||||
}
|
||||
C<int> f(C<int> i, C<int> j) => i ?? j;
|
||||
''');
|
||||
}
|
||||
|
||||
test_binaryExpression_right_dynamic() async {
|
||||
await analyze('''
|
||||
class C {
|
||||
|
|
Loading…
Reference in a new issue