[SR-11457] Incorrect diagnostic when assigning incorrect type through keypath #53858
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
key paths
Feature: key paths (both native and Objective-C)
Environment
Xcode 11GM
Additional Detail from JIRA
md5: af9fa220b8670a12e92a4c0e6c0271b7
Issue Description:
When assigning through a WritableKeyPath, if the assigned value is of the wrong type, the error will be "Cannot assign through subscript, ... is immutable" rather than something pointing to the value of the type. For example:
Note that
"abc".prefix(1)
is a Substring rather than a String, a subtle point that makes this a particularly confusing error.The text was updated successfully, but these errors were encountered: