xcodexcode13.3

Xcode 13.3 warning: 'self' refers to the method 'X.Y.self', which may be unexpected, use 'X.Y.self' to silence this warning


I'm in the process of updating some code to use Xcode 13.3 and came across some new warnings that I'm unsure how to remove. Here's the gist of the code:

struct Link: Codable {
    let href: URL
}

struct FooLinks: Codable {
    let `self`: Link // <--- this is the culprit
}

struct Foo: Codable {
    let links: FooLinks
}

The warnings don't show up in the editor, only in the build log, and are as follows:

<unknown>:0: warning: 'self' refers to the method 'Foo.FooLinks.CodingKeys.self', which may be unexpected
<unknown>:0: note: use 'Foo.FooLinks.CodingKeys.self' to silence this warning
<unknown>:0: warning: 'self' refers to the method 'Foo.FooLinks.self', which may be unexpected
<unknown>:0: note: use 'Foo.FooLinks.self' to silence this warning
<unknown>:0: warning: 'self' refers to the method 'Foo.FooLinks.self', which may be unexpected
<unknown>:0: note: use 'Foo.FooLinks.self' to silence this warning

None of the suggested fixes make any sense to me. Is there a way to get rid of the warnings without renaming the offending self property?


Solution

  • This issue has been resolved in Xcode 14.0 beta