I stumbled across a seemingly rough edge with availability annotations:
struct Foo {
let bar: String
}
@available(*, deprecated)
extension Foo: ExpressibleByStringLiteral {
init(stringLiteral value: StringLiteralType) {
self.bar = value
}
}
let a: Foo = Foo(stringLiteral: "") // warning: 'init(stringLiteral:)' is deprecated
let b: Foo = "" // no warning
It even compiles fine when using unavailable
instead of deprecated
.
I tried searching the forums but nobody seems to have mentioned it. I'm not sure if this behavior is intended or if it's an oversight in the compiler.
Any thoughts would be appreciated.