[SR-13586] Bad diagnostic when we only have subscript(dynamicMember: WritableKeyPath) and the property is not settable #56021
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
macOS 10.15.6
Xcode 12.0 GM (because AppStore version crashes when opening developer documentation)
Additional Detail from JIRA
md5: f05aa3b580e68340b6148c9f92d92c4e
Issue Description:
1) define a struct (say `Core`) with a read-only property;
2) define another struct (say `Wrapper`) that has `var core: Core`;
3) make `Wrapper` use `dynamicMemberLookup` and define subscript with writeable key path;
4) instantiate wrapper and try checking for the `core` property using dynamic member lookup
The compiler, on `if` line , says that it can't write to `someVar` because the property is `get-only`.
Even trying to extract a value throws the same error on assignment statement:
The text was updated successfully, but these errors were encountered: