[SR-11896] Key path obtained through dynamic member lookup is incorrectly writable #54313
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
key paths
Feature: key paths (both native and Objective-C)
type checker
Area → compiler: Semantic analysis
Environment
Swift version 5.1.2-dev (Swift b7537cf)
Target: x86_64-apple-darwin18.5.0
Additional Detail from JIRA
md5: a26a851e8f52793c8b691e34ce2913af
Issue Description:
We incorrectly allow the following code to compile:
The key path
\R.i
is incorrectly inferred to be aWritableKeyPath
, it should instead have been inferred as aKeyPath
due to the fact that it's transformed into\R.[dynamicMember: \S.i]
, and thedynamicMember:
subscript is not settable.The text was updated successfully, but these errors were encountered: