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
hamishknight opened this issue
Oct 24, 2019
· 6 comments
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwarekey pathsFeature: key paths (both native and Objective-C)
On master we currently support subscripts with default arguments (SR-6118), however they don't appear to currently work with key paths. The following hits an assertion:
structS {
subscript(x: Int = 0) -> Int { x }
}
_ = \S.[]
There were primarily two issues here. The first is that this code seemed to expect that the number of `Hashable` parameters would equal the number of labels. This both triggered the assertion above and caused this function to return the wrong size (it should have returned the number of parameters, not labels). The second issue is that lowering a keypath with default parameters requires that code to be able to lower default parameters, which it could not.
Thanks to @xedin for the help with this patch. I couldn't have done it without your guidance.
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwarekey pathsFeature: key paths (both native and Objective-C)
Environment
Swift version 5.1.1-dev (Swift 9721fd7)
Target: x86_64-apple-darwin18.7.0
Additional Detail from JIRA
md5: f9a220d52a1805e08c3fef90e7d87cad
Issue Description:
On master we currently support subscripts with default arguments (SR-6118), however they don't appear to currently work with key paths. The following hits an assertion:
The text was updated successfully, but these errors were encountered: