When writing a Swift enum like
Given a module name "Foo", Swift synthesizes the following ObjC declaration:
In an Xcode project, this works perfectly fine. Casting MyError.A to NSError and looking at the domain property yields the string "Foo.MyError".
However, for some reason, when testing this at the command-line with a manual invocation of swiftc, the bridged NSError loses the module name in the domain string, so it just has "MyError". I've tested this both in an executable context (e.g. swiftc -module-name Foo -emit-objc-header foo.swift main.swift where foo.swift defines the error and main.swift prints it out) and in a library context (e.g. compiling foo.swift as a library, and then linking to it from a separate compilation of main.swift that imports the Foo module). I don't know what's different about an Xcode project that causes the error domain to work.