Skip to content

Commit f1f9e88

Browse files
committed
Cache expression types in failure diagnosis.
After we call into typeCheckExpression() we need to cache the resulting types in the constraint system type map because we later call into code that reads the types out of the type map. Fixes rdar://problem/30376186 as well as a couple crashers.
1 parent 8af3196 commit f1f9e88

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,6 +3510,8 @@ Expr *FailureDiagnosis::typeCheckChildIndependently(
35103510
convertTypePurpose, TCEOptions,
35113511
listener, CS);
35123512

3513+
CS->cacheExprTypes(subExpr);
3514+
35133515
// This is a terrible hack to get around the fact that typeCheckExpression()
35143516
// might change subExpr to point to a new OpenExistentialExpr. In that case,
35153517
// since the caller passed subExpr by value here, they would be left
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
A(_{}struct A{var f

validation-test/compiler_crashers/28654-hastype-e-expected-type-to-have-been-set.swift renamed to validation-test/compiler_crashers_fixed/28654-hastype-e-expected-type-to-have-been-set.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// REQUIRES: asserts
9-
// RUN: not --crash %target-swift-frontend %s -emit-ir
9+
// RUN: not %target-swift-frontend %s -emit-ir
1010
struct A{let d}A(_
1111
print(

0 commit comments

Comments
 (0)