@escaping and generics crashes Fire

(Paul Stevenson) #1

will post a cut down project if I can…

but a method

private func xyz(doit: @escaping ABC) -> EFG

will crash the compiler if the line
is actually called, (but not if it’s commented out)…

(Paul Stevenson) #2

actually seems to happen if the return type is an optional
in cases where it wasn’t it compiled ok.

func xyz(doit: @escaping () -> T?)

(Carlo Kok) #3


func xyz<T>(doit: @escaping () -> T?)

on all 4 platforms; can you give me a more complete testcases + platform you used to test it on? (Also which version are you using?)

(Paul Stevenson) #4

I’ll see what I can grab…
2151 build for Android

but it’s when you call it in the method…

func xyz(doit: @escaping () -> T?)

but in our case… it’s in a closure…
and that might be an issue.
I filed another bug and commented on one that Taras Vosniak filed a year ago… I have the same issue happening in Android Studio when there is a closure call inside another closure…
I’m thinking they might be related.

I’ll see if I can get some small reproducible code for you.
I was focused today on working around them so we can get an Android build.

(Paul Stevenson) #5

I tried to cut down the code that causes it…
no success… I’ll try again tomorrow.

it’s a
func xyz(doit: @escaping (AnyObject) try -> T?)
try doit(something). // its this line that causes the NRE

but it might be something more complicated to create the circumstance… sorry.

(marc hoffman) #6

Not to be nitpick, but words matter, and affect who’s attention an issue needs (e.g. mine or Carlo’s ;), when i hear “Fire crashes”, i think, “bug in the editor, and when you type this, it brings don the IDE.” . This is a bug in the compiler, rom what i understand, not in Fire :wink: