You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.2.0
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: 06200a007682f91795b6d57068c70540
Issue Description:
Swift supports marking a property setter as unavailable, but unfortunately if the property is of Array type this breaks the ability to subscript the property.
unnamed.swift:9:13: error: setter for 'bars' is unavailable
_ = bars[2]
^~~~
unnamed.swift:5:9: note: setter for 'bars' has been explicitly marked unavailable here
set { fatalError() }
^
The text was updated successfully, but these errors were encountered:
I don't think this ever worked even when Sema computed LValueAccessKind. We model this as a LoadExpr of a SubscriptExpr of lvalue type, so the availability checking thinks its a call of the setter.
Fixing this correctly would require pulling the LValueAccessKind computation back into Sema though. I'm not opposed to that in principle, as long as we find a way of doing it without duplicating similar logic in SILGen (which also implies the Sema calculation has to be "correct"; in the old world, SILGen duplicated the calculation because the Sema one wasn't right in some cases IIRC).
Also let's add it back either as a separate pass that builds a side table, or a reusable visitor of some kind. The old mutable approach had problems when ASTs got "re-type checked" in weird states.
Environment
Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.2.0
Additional Detail from JIRA
md5: 06200a007682f91795b6d57068c70540
Issue Description:
Swift supports marking a property setter as
unavailable
, but unfortunately if the property is ofArray
type this breaks the ability to subscript the property.Example:
This fails to compile with the error
The text was updated successfully, but these errors were encountered: