Skip to content

Commit 39d0385

Browse files
committed
Sema: Fix a crasher by removing TVO_CanBindToInOut in a couple of spots
1 parent 586dda2 commit 39d0385

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/Sema/CSGen.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,7 @@ namespace {
26022602

26032603
Type visitDiscardAssignmentExpr(DiscardAssignmentExpr *expr) {
26042604
auto locator = CS.getConstraintLocator(expr);
2605-
auto typeVar = CS.createTypeVariable(locator, TVO_CanBindToInOut);
2605+
auto typeVar = CS.createTypeVariable(locator, /*options=*/0);
26062606
return LValueType::get(typeVar);
26072607
}
26082608

@@ -2616,10 +2616,9 @@ namespace {
26162616
auto destTy = CS.computeAssignDestType(expr->getDest(), expr->getLoc());
26172617
if (!destTy)
26182618
return Type();
2619-
if (destTy->getRValueType()->is<UnresolvedType>()) {
2619+
if (destTy->is<UnresolvedType>()) {
26202620
return CS.createTypeVariable(CS.getConstraintLocator(expr),
2621-
TVO_CanBindToLValue |
2622-
TVO_CanBindToInOut);
2621+
/*options=*/0);
26232622
}
26242623

26252624
// The source must be convertible to the destination.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
// See https://swift.org/LICENSE.txt for license information
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -emit-ir
8+
// RUN: not %target-swift-frontend %s -emit-ir
99
// REQUIRES: asserts
1010
&[_=(&_

0 commit comments

Comments
 (0)