[SR-700] Domain of NSErrors created from Swift ErrorTypes sometimes don't match synthesized Domain constant #43315
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
good first issue
Good for newcomers
Environment
Apple Swift version 2.1.1 (swiftlang-700.1.101.15 clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Apple Swift version 2.2 (swiftlang-703.0.6.5 clang-703.0.21)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: bee4248122994eee9b64fe5c8b938056
Issue Description:
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
toNSError
and looking at thedomain
property yields the string"Foo.MyError"
.However, for some reason, when testing this at the command-line with a manual invocation of
swiftc
, the bridgedNSError
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
wherefoo.swift
defines the error andmain.swift
prints it out) and in a library context (e.g. compilingfoo.swift
as a library, and then linking to it from a separate compilation ofmain.swift
that imports theFoo
module). I don't know what's different about an Xcode project that causes the error domain to work.Reproduction:
The text was updated successfully, but these errors were encountered: