Skip to content

Commit 2a0172d

Browse files
authored
Merge pull request #85507 from hamishknight/err-fix
[CS] Fix a couple of missing error paths
2 parents d704461 + 3f4c3b5 commit 2a0172d

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

lib/Sema/CSSyntacticElement.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,6 +2212,8 @@ class SyntacticElementSolutionApplication
22122212

22132213
if (auto newResultTarget = rewriter.rewriteTarget(target)) {
22142214
resultExpr = newResultTarget->getAsExpr();
2215+
} else {
2216+
hadError = true;
22152217
}
22162218

22172219
switch (mode) {
@@ -2259,8 +2261,11 @@ class SyntacticElementSolutionApplication
22592261
}
22602262

22612263
auto *resultExpr = thenStmt->getResult();
2262-
if (auto newResultTarget = rewriter.rewriteTarget(*target))
2264+
if (auto newResultTarget = rewriter.rewriteTarget(*target)) {
22632265
resultExpr = newResultTarget->getAsExpr();
2266+
} else {
2267+
hadError = true;
2268+
}
22642269

22652270
thenStmt->setResult(resultExpr);
22662271

validation-test/compiler_crashers/DiagnoseWalker-walkToExprPre-50b7d0.swift renamed to validation-test/compiler_crashers_fixed/DiagnoseWalker-walkToExprPre-50b7d0.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// {"kind":"typecheck","original":"7f0c85e8","signature":"diagSyntacticUseRestrictions(swift::Expr const*, swift::DeclContext const*, bool)::DiagnoseWalker::walkToExprPre(swift::Expr*)","signatureAssert":"Assertion failed: (Ptr && \"Cannot dereference a null Type!\"), function operator->"}
2-
// RUN: not --crash %target-swift-frontend -typecheck %s
2+
// RUN: not %target-swift-frontend -typecheck %s
33
class a<b, c>: ExpressibleByDictionaryLiteral {
44
typealias Key = b
55
typealias Value = c
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// {"kind":"typecheck","signature":"(anonymous namespace)::ImplicitSelfUsageChecker::isClosureRequiringSelfQualification(swift::AbstractClosureExpr const*, bool)","signatureAssert":"Assertion failed: (Ptr && \"Cannot dereference a null Type!\"), function operator->"}
2-
// RUN: not --crash %target-swift-frontend -typecheck %s
2+
// RUN: not %target-swift-frontend -typecheck %s
33
struct a : ExpressibleByBooleanLiteral {
44
c(d : Bool -> (
55
}

0 commit comments

Comments
 (0)