Mysterious compile error at "<unknown>:0"

Hi all, I have some code that looks like this:

enum SessionUser: Equatable, Decodable {
    case oauthUser(_ info: OAuthUserInfo)
    case legacyUser(_ info: UserModel)

Which is failing with these compile errors:

<unknown>:0: error: type 'SessionUser' has no member 'oauthUser(info:)'
<unknown>:0: error: type 'SessionUser' has no member 'legacyUser(info:)'

There are no line numbers and no other useful diagnostics, so it's pretty mystifying (and it makes it hard to narrow it down to a clean repro case). This is in a largish Swift project with a bunch of Swift and Obj-C frameworks pulled in via CocoaPods. As far as I know we aren't doing anything weird, and I've never encountered an error like that.

I tried a clean build, and I tried changing all the symbol names in case it's some kind of naming clash, to no avail.

Same error occurs in both Xcode 13 and in 13.2 beta.

Is it something to do with precompiled headers or bridging headers, possibly…?

I guess I can try rebooting, doing a full wipe of all build data, then deleting random bits of code until I find something that makes a difference. This is pretty annoying as it's a complete blocker until I can figure it out.

Any advice appreciated!

<unknown>:0 generally indicates some kind of synthesized code; in this case I'm guessing the compiler logic that synthesizes Decodable doesn't understand how to construct enums that have custom parameter labels. That would make two bugs here (for the synthesized code should have a valid source location even if it's just the location of the enum, and it should support enums with parameter labels.

Sorry for the inconvenience! As a workaround, you could either write out the Decodable conformance manually, or forego the labels and just use e.g. oauthUser(OAuthUserInfo).


Thanks, Jordan! That was it, and just omitting the labels works a treat.

Terms of Service

Privacy Policy

Cookie Policy