Skip to content
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

Fix keypath-as-function crasher #27586

Merged
merged 5 commits into from Oct 16, 2019

Conversation

@brentdax
Copy link
Contributor

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.
@brentdax

This comment has been minimized.

Copy link
Contributor Author

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

@brentdax

This comment has been minimized.

Copy link
Contributor Author

commented Oct 9, 2019

@swift-ci please smoke test linux platform

lib/SIL/TypeLowering.cpp Outdated Show resolved Hide resolved
lib/SILGen/SILGenProlog.cpp Outdated Show resolved Hide resolved
@@ -0,0 +1,2 @@
// RUN: %target-swift-frontend %s -emit-silgen -o /dev/null
let _: ([Int]) -> Int = \[Int].count

This comment has been minimized.

Copy link
@slavapestov

slavapestov Oct 10, 2019

Member

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.

brentdax added 2 commits Oct 10, 2019
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.
@brentdax brentdax force-pushed the brentdax:everything-evil branch from 15ee2b2 to 783a572 Oct 12, 2019
@brentdax

This comment has been minimized.

Copy link
Contributor Author

commented Oct 12, 2019

@swift-ci please smoke test

@brentdax

This comment has been minimized.

Copy link
Contributor Author

commented Oct 14, 2019

@swift-ci please smoke test

@brentdax

This comment has been minimized.

Copy link
Contributor Author

commented Oct 14, 2019

@swift-ci please smoke test

@brentdax brentdax merged commit ecf76c8 into apple:master Oct 16, 2019
2 checks passed
2 checks passed
Swift Test Linux Platform (smoke test)
Details
Swift Test OS X Platform (smoke test)
Details
@brentdax brentdax deleted the brentdax:everything-evil branch Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.