File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -3573,12 +3573,10 @@ namespace {
3573
3573
3574
3574
auto &tc = cs.getTypeChecker ();
3575
3575
3576
- // Since this is literal initialization, we don't
3577
- // really need to keep wrapping coercion around .
3576
+ // If this is a literal that got converted into constructor call
3577
+ // lets put proper source information in place .
3578
3578
if (expr->isLiteralInit ()) {
3579
3579
auto *literalInit = expr->getSubExpr ();
3580
- // If literal got converted into constructor call
3581
- // lets put proper source information in place.
3582
3580
if (auto *call = dyn_cast<CallExpr>(literalInit)) {
3583
3581
call->getFn ()->forEachChildExpr ([&](Expr *subExpr) -> Expr * {
3584
3582
auto *TE = dyn_cast<TypeExpr>(subExpr);
@@ -3600,7 +3598,10 @@ namespace {
3600
3598
}
3601
3599
3602
3600
literalInit->setImplicit (false );
3603
- return literalInit;
3601
+
3602
+ // Keep the coercion around, because it contains the source range
3603
+ // for the original constructor call.
3604
+ return expr;
3604
3605
}
3605
3606
3606
3607
// Turn the subexpression into an rvalue.
Original file line number Diff line number Diff line change @@ -953,7 +953,7 @@ func SR_6272_a() {
953
953
case bar
954
954
}
955
955
956
- // expected-error@+2 {{binary operator '*' cannot be applied to operands of type 'Int' and 'Float'}} {{35-35=Int(}} {{42-42 =)}}
956
+ // expected-error@+2 {{binary operator '*' cannot be applied to operands of type 'Int' and 'Float'}} {{35-35=Int(}} {{43-43 =)}}
957
957
// expected-note@+1 {{expected an argument list of type '(Int, Int)'}}
958
958
let _: Int = Foo . bar. rawValue * Float( 0 )
959
959
You can’t perform that action at this time.
0 commit comments