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-7858] Compiler crash when applying escaping closure with a generic type parameter #50393
Comments
Comment by Guido Marucci Blas (JIRA) Here is a reduced version of the issue to easily reproduce it https://gist.github.com/guidomb/57b8ac391dfeb0514c9ae872b6574175 |
@swift-ci create |
I am going to fix this real quick. I just want to make the test case slightly smaller. |
Keep in mind, I am not sure if this is a regression from the +0 work. We could have done this later and just not hit this problem. The problem here is that we have a guaranteed parameter and we are trying to forward it into memory as a +1 value. So we are catching a real problem here. |
Smaller: class Klass {}
struct MyStruct1: Error {
let b: Klass
}
enum Enum1<T2> {
func enum1Func<FT1>(_ : (T2) -> FT1) -> Enum1<FT1> {}
}
protocol MyProtocol {
func execute() -> Enum1<MyStruct1>
}
enum Enum2<T> {
case bar(T)
}
struct Test {
func testFunc(k: MyProtocol) -> Enum1<Enum2<Error>> {
return k.execute().enum1Func(Enum2.bar)
}
} |
FYI pasted the wrong one. Got an even smaller version. |
class Klass: Error {}
enum Enum<T> {
static func enum1Func(_ : (T) -> Enum<Error>) -> Enum<Error> {}
}
func bar<T>(t: T) -> Enum<T> {}
func testFunc() -> Enum<Error> {
return Enum<Klass>.enum1Func(bar)
} |
(function_conversion_expr implicit type='(Klass) -> Foo<Error>' location=test.swift:11:31 range=[test.swift:11:31 - line:11:31] (declref_expr type='(Error) -> Foo<Error>' location=test.swift:11:31 range=[test.swift:11:31 - line:11:31] decl=test.(file).bar(t🙂@test.swift:8:6 [with Error] function_ref=unapplied)) |
This was fixed by: |
guidomb (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"? |
Comment by Guido Marucci Blas (JIRA) This is no longer an issue. |
Thanks! Updating the state to closed. |
Environment
This crash can be reproduced with Swift 4.2 both on macOS and Ubuntu. I used
Swift 4.2 2018-05-12
Swift 4.2 2018-06-01
Additional Detail from JIRA
md5: 7f925e1830d691068220ceeee2abd0e1
Issue Description:
Here is the stacktrace
This is the file that makes the compiler crash
And the exact line that produces the crash is
Changing that line to
Avoids the compiler crash.
To give you more context about the types being used in this example
The text was updated successfully, but these errors were encountered: