Skip to content

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

Merged
merged 5 commits into from
Oct 16, 2019
Merged

Conversation

beccadax
Copy link
Contributor

@beccadax beccadax commented Oct 9, 2019

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.

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.
@beccadax
Copy link
Contributor Author

beccadax commented Oct 9, 2019

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

@beccadax
Copy link
Contributor Author

beccadax commented Oct 9, 2019

@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
Copy link
Contributor

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.
@beccadax
Copy link
Contributor Author

@swift-ci please smoke test

@beccadax
Copy link
Contributor Author

@swift-ci please smoke test

@beccadax
Copy link
Contributor Author

@swift-ci please smoke test

@beccadax beccadax merged commit ecf76c8 into swiftlang:master Oct 16, 2019
@beccadax beccadax deleted the everything-evil branch October 18, 2019 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants