Compiler crash if move classes to a separate file/extension

I've got a class, Component<Component.Model, Component.Logic>. If I define Model and Logic inside the Component (in the same file), everything compiles OK. If I move them to another file (and create an extension there), compiler crashes, sometimes. And sometimes it does not crash (most of the time to be fair). So almost all Model and Logic classes are in a separate files, and some of them are not. :slight_smile:

Is there a way of finding out what is happening here and, maybe, create a workaround? Or the only way is to make a test project, send it to bugs.swift.org and wait?

Thanks!

Error is something like this:

1.	Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
2.	
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for module Version2022)
4.	While deserializing SIL function "$s11Version202213MainComponentC5LogicC012createSearchC0AA0f7OverlayC0CSgyF"
5.	While deserializing decl @ 209549 (XREF) in 'Version2022'
6.	Cross-reference to module 'Version2022'
	... SearchOverlayComponent
7.	While evaluating request ModuleQualifiedLookupRequest(0x153198200 Module name=Version2022, Version2022.Version2022, 'SearchOverlayComponent', { NL_RemoveNonVisible, NL_RemoveOverridden })
8.	While evaluating request LookupInModuleRequest(0x153198200 Module name=Version2022, 'SearchOverlayComponent', QualifiedLookup, Overloadable, 0x153198200 Module name=Version2022, { NL_RemoveNonVisible, NL_RemoveOverridden })
9.	While reading from module 'Version2022' with full misc version '5.5.2(5.5.2)/Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)'
10.	While deserializing 'SearchOverlayComponent' (ClassDecl @ 250313) in 'Version2022'
11.	    ...decl is named 'SearchOverlayComponent'
12.	*** DESERIALIZATION FAILURE ***
module 'Version2022' with full misc version '5.5.2(5.5.2)/Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)'
top-level value not found
Cross-reference to module 'Version2022'
... SearchOverlayComponent

Please file a bug report, because the compiler should not crash regardless of the input.

1 Like

Yup, here it is. [SR-15748] Compiler crashes (Trap 6) if one of classes is moved from containing class into separate file/extension - Swift