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

[SR-7771] Forming Single-Element Tuple Abstraction Patterns Causes SILGen Instability #50310

Closed
CodaFi opened this issue May 24, 2018 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@CodaFi
Copy link
Member

CodaFi commented May 24, 2018

Previous ID SR-7771
Radar None
Original Reporter @CodaFi
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 451872f2cc8dcbecb5c2e00452fd8929

Issue Description:

SILGen is not set up to handle the case where its abstraction pattern is a single-element tuple and the substituted type is a single element. This simple piece of code crashes the result plan builder trying to lower exactly this case:

func foo(x: Int = 3) -> Int {
  return x
}
foo(x:)()

Unless we remove all the sources trying to form these kinds of abstraction patterns, all the parts of SILGen that just check isTuple() without checking the substType have the potential to trigger more bugs. The current representation for enum cases (and their associated thunks) are also subject to this but we will not see the consequences of this until SE-0155 is implemented.

@CodaFi
Copy link
Member Author

CodaFi commented May 25, 2018

Discussed this with @belkadan and @jckarter. Consensus is that the defaults should not be considered when the function is spelled and then immediately applied in selector form.

@slavapestov
Copy link
Member

Looks like the crashes are gone because we don't build argument tuple AbstractionPatterns anymore.

#21342

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

3 participants