Is this a compiler bug?

This is the top of the crash report delivered via TestFlight for an app that I'm working on. I'm using all of the cutting-edge generics features in Swift 5.7 and I'm wondering if the the error messages seem to indicate that I've stumbled upon a bug in the compiler. Can anyone shed any light on this for me?

Where is the actual crash log ? This looks like it is just part of the callstack

I think I've seen crashes like this before when the program is trying to access type metadata for a type that doesn't exist on an older deployment target. A specific case that comes to mind is when using buildLimitedAvailability in the result builder transform with a result type that has a more limited availability than the builder type, because there are some missing diagnostics in the availability checker. There may be other cases where some invalid code accidentally gets passed type checking, but I can't speculate much further without more information.

1 Like

Thanks so much!! I’m going to look into that right now. I understand that you’re speculating when it comes to the exact idea regarding result builders - is there anything that you do know for certain based on the call stack? For example, can we be at least certain that this is a flaw in the compiler, and not a flaw in my logic? (The way an "index out of bounds" error would be clearly my fault)

The only thing I know for certain from those two frames in the call stack is that the runtime was trying to retrieve an associated type witness. There is a compiler bug somewhere, but I am not sure whether it's purely a compiler/runtime bug or if it's invalid code that you wrote that was not diagnosed by the compiler when building your code. The example I gave with missing availability checker diagnostics is a case of the latter; ultimately the failure is caused by a bug in the programmer's code, but it's also a bug that invalid code was not diagnosed by the compiler.