Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,7 @@ Expr *AutoClosureExpr::getUnwrappedCurryThunkExpr() const {
body = body->getSemanticsProvidingExpr();

if (auto *openExistential = dyn_cast<OpenExistentialExpr>(body)) {
body = openExistential->getSubExpr();
body = openExistential->getSubExpr()->getSemanticsProvidingExpr();
}

if (auto *outerCall = dyn_cast<ApplyExpr>(body)) {
Expand All @@ -1963,7 +1963,7 @@ Expr *AutoClosureExpr::getUnwrappedCurryThunkExpr() const {
innerBody = innerBody->getSemanticsProvidingExpr();

if (auto *openExistential = dyn_cast<OpenExistentialExpr>(innerBody)) {
innerBody = openExistential->getSubExpr();
innerBody = openExistential->getSubExpr()->getSemanticsProvidingExpr();
if (auto *ICE = dyn_cast<ImplicitConversionExpr>(innerBody))
innerBody = ICE->getSyntacticSubExpr();
}
Expand Down
12 changes: 12 additions & 0 deletions validation-test/compiler_crashers_2_fixed/sr12994.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -index-store-path %t/idx -o %t/file.o -typecheck -primary-file %s -verify

protocol MyProto {
func compile() throws
}

func compile(x: MyProto) throws {
try x.compile
// expected-error@-1 {{expression resolves to an unused function}}
// expected-warning@-2 {{no calls to throwing functions occur within 'try' expression}}
}