swift icon indicating copy to clipboard operation
swift copied to clipboard

[SR-2155] Change interpretation of * in @available()

Open devincoughlin opened this issue 10 years ago • 0 comments

Previous ID SR-2155
Radar None
Original Reporter @devincoughlin
Type Bug

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: d6a2209861fe8c82d20c93d3100634a2

cloned from:

  • SR-2153 Deprecation warning despite #available check

Issue Description:

The current interpretation of * in @available is counter-intuitive and differs from its interpretation in #available.

Here is an example:

@available(OSX, deprecated=10.10)
@available(*, deprecated)
func foo() { }

Right now the compiler treats this as "foo() is deprecated on all versions of all platforms" – that is, the * wins over the OSX.

In my opinion a more natural interpretation of the above is: "foo() was deprecated on OSX in version 10.10 and is deprecated for all versions on all other platforms." It appears the authors of the Dispatch overlay thought similarly, because they used the above annotations thinking it had this second meaning (see https://bugs.swift.org/browse/SR-2153).

devincoughlin avatar Jul 23 '16 02:07 devincoughlin