-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix keypath-as-function crasher #27586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The autoclosures generated for the keypath-as-function feature were not added to the list of closures that needed captures computed. In top-level code, this caused a crash. Fixes rdar://problem/56055600.
I'm trying to see if I can get an assertion in that would have caught this bug, but let's test the fix. @swift-ci please smoke test |
@swift-ci please smoke test linux platform |
@@ -0,0 +1,2 @@ | |||
// RUN: %target-swift-frontend %s -emit-silgen -o /dev/null | |||
let _: ([Int]) -> Int = \[Int].count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A FileCheck test in test/SILGen/ might be better since then you can CHECK: that the closure's SIL function has the capture as a parameter.
Before using the capture info, SILGen now asserts that it has computed, except for declarations which are not in a local context and therefore can’t have captures. This causes failures in REPL tests, but they are actual failures—there’s a bug in TypeCheckREPL.
REPLChecker::generatePrintOfExpression() type-checked the closures it generated, but did not add them to the ClosuresWithUncomputedCaptures list.
15ee2b2
to
783a572
Compare
@swift-ci please smoke test |
@swift-ci please smoke test |
@swift-ci please smoke test |
The autoclosures generated for the keypath-as-function feature were not added to the list of closures that needed captures computed. In top-level code, this caused a crash. Fixes rdar://problem/56055600.