@escaping and generics crashes Fire

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
doit()
is actually called, (but not if it’s commented out)…

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?)
{}

Tried


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?)

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?)
{
doit()
}

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.

1 Like

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?)
{
promise.then()
{
try doit(something). // its this line that causes the NRE
}
}

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

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: