File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1753,10 +1753,11 @@ Expr *FailureDiagnosis::typeCheckChildIndependently(
1753
1753
CS.cacheExprTypes (savedExpr);
1754
1754
return savedExpr;
1755
1755
}
1756
-
1757
- CS.TC .addExprForDiagnosis (subExpr, subExpr);
1758
1756
}
1759
1757
1758
+ // Mark current expression as about to be diagnosed.
1759
+ CS.TC .addExprForDiagnosis (subExpr, subExpr);
1760
+
1760
1761
// Validate contextual type before trying to use it.
1761
1762
std::tie (convertType, convertTypePurpose) =
1762
1763
validateContextualType (convertType, convertTypePurpose);
@@ -5651,6 +5652,15 @@ bool FailureDiagnosis::visitAssignExpr(AssignExpr *assignExpr) {
5651
5652
return true ;
5652
5653
}
5653
5654
5655
+ // Situation like `var foo = &bar` didn't get diagnosed early
5656
+ // because originally its parent is a `SequenceExpr` which hasn't
5657
+ // been folded yet, and could represent an operator which accepts
5658
+ // `inout` arguments.
5659
+ if (auto *AddrOf = dyn_cast<InOutExpr>(assignExpr->getSrc ())) {
5660
+ diagnose (AddrOf->getLoc (), diag::extraneous_address_of);
5661
+ return true ;
5662
+ }
5663
+
5654
5664
if (CS.TC .diagnoseSelfAssignment (assignExpr))
5655
5665
return true ;
5656
5666
You can’t perform that action at this time.
0 commit comments