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-5874] Runtime crash when using optional extension for closure #48444

Open
swift-ci opened this issue Sep 12, 2017 · 6 comments
Open

[SR-5874] Runtime crash when using optional extension for closure #48444

swift-ci opened this issue Sep 12, 2017 · 6 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Sep 12, 2017

Previous ID SR-5874
Radar None
Original Reporter mikekasp (JIRA User)
Type Bug
Environment

Xcode 8.3.3 - Xcode 9

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, CompilerCrash, SILGen
Assignee None
Priority Medium

md5: 60e185a14e55cd47c86630bf1fa588d5

Issue Description:

The following code crashes always:

extension Optional { // where Wrapped == ()->() { // With this, no crash
    var method: Bool { return false }
}

class bar {
    var t: Bool = false {
        didSet {
            self.stuff(closure: { print("\(self)") })
        }
    }

     func stuff(closure: (() -> ())? = nil) {
        closure.method
    }
}

bar().t = false
@belkadan
Copy link
Contributor

@belkadan belkadan commented Sep 12, 2017

On near-master:

Assertion failed: (isPlusOne(SGF) && "Can not forward borrowed RValues"), function forwardInto, file /Volumes/Data/swift-public/swift/lib/SILGen/RValue.cpp, line 533.

1.  While emitting SIL for 'stuff(closure:)' at <stdin>:12:6

@jckarter? Or @gottesmm, for ownership?

@gottesmm
Copy link
Member

@gottesmm gottesmm commented Sep 12, 2017

This would be on me, but before we get to that mikekasp (JIRA User) are you using the actual toolchain in Xcode? Or are you using a custom toolchain?

@gottesmm
Copy link
Member

@gottesmm gottesmm commented Sep 12, 2017

The reason why I am asking is that I thought that assertion was not enabled in the actual Xcode toolchain.

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Sep 12, 2017

Comment by Mike Kasperlik (JIRA)

Using the standard toolchain. Nothing custom.

@gottesmm
Copy link
Member

@gottesmm gottesmm commented Sep 12, 2017

Oh. I misunderstood. The assert is from a near master build by Jordan. Sorry for the noise!

@gottesmm
Copy link
Member

@gottesmm gottesmm commented Sep 12, 2017

@swift-ci sync

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants