[SR-12531] Type-checker fails when determining subclassibility of keypath types #54974
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
type checker
Area → compiler: Semantic analysis
Additional Detail from JIRA
md5: 0b854524f63fd94b3e636a8512220ff9
Issue Description:
The Problem:
I got this error today in Xcode 11.4. This seems like a compiler bug:
This seems wrong, because WritableKeyPath inherits from KeyPath, which inherits from PartialKeyPath. By definition then, any subclass of WritableKeyPath is a subclass of PartialKeyPath when they share the same root, so what am I missing here?
This also happens on Xcode 11.3 and 10.3.
Here is the underlying code:
The faulty compiler error is thrown on the subscript declaration.
Current Workaround
Changing the subscript declaration to the below code compiles fine, even though it seems to say the same thing (unless I'm missing something):
The text was updated successfully, but these errors were encountered: