Equatable + import Foundation cause compiler crash on Linux

Bug reproduce step:

  1. Add a C target define uint32 as a struct

    typedef uint32_t CAttribute __attribute((swift_newtype(struct)));
  2. import the C module and use the type in our Swift code. If we add Equatable to our Swift type and have import Foundation statement in the same module, we'll get a compiler crash here.

    import CDemoKit
    import Foundation
    public struct Demo {
        var attribute: CAttribute
    extension Demo: Equatable {}

Comment on Line 2 or Line 7 will not crash the compiler.

Cannot look up associated type for imported conformance:
(struct_type decl=CDemoKit.(file).CAttribute)
(associated_type_decl "_ObjectiveCType" access=public overridden=)

See full crash log and reproduce DemoKit package on this GitHub issue

Besides this stable reproducible issue mentioned here, I've also encountered a lot of other ObjectiveC related compiler crash on Linux. :face_exhaling:

On other platforms, such as Linux, no Objective-C runtime is present, because it isn’t necessary.

Reading Platform Support on swift.org again, I noticed it said unnecessary to include ObjC on Linux instead of impossible. Wondering if we can just provide a full ObjC supported Swift on Linux so that we'll never meet so many annoying diff behaviors and compilers crash on non-Darwin platform. :slight_smile:

And who is going provide that? Apple won't, they're keeping a tight lock on Objective-C and even more so on swift-corelibs-foundation (up to rejecting perfectly fine fixes from the community). Instead we will eventually get the rewritten (but rudimentary) new Swift Foundation...

I do not know. Maybe Apple can provide it. Or at least we should not see any confusion ObjC related compiler crash on Linux.