[SR-7398] Preserve availability on ObjC subscript getters and setters #49941
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
Additional Detail from JIRA
md5: f62fe61cb3743b3aba8e5875b9480892
relates to:
@available
Issue Description:
When the Objective-C code above is imported into Swift, the methods are mapped to a true subscript declaration. However, any availability attributes on the original methods are lost…or rather, the getter's availability is copied onto the subscript, but not the setter's.
The relevant functions here are
buildSubscriptGetterDecl
andbuildSubscriptSetterDecl
in ClangImporter.cpp; these functions should callImpl.importAttributes
to get the correct attributes for the getter and setter. We also need to figure out what's pulling the getter's availability onto the subscript; that's not really correct if the getter is deprecated but the setter is not.Tests for this would look something like b0e12f4#diff-348ce3800f609e6140007f774b227469R874.
The text was updated successfully, but these errors were encountered: