File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -375,9 +375,21 @@ public class KeyPath<Root, Value>: PartialKeyPath<Root> {
375375 return _openExistential ( valueType, do: project2)
376376 }
377377
378- if let result = _openExistential ( curBase, do: project) {
378+ let result = _openExistential ( curBase, do: project)
379+
380+ if let result = result {
379381 return result
380382 }
383+
384+ // Note: This should never be taken. The only time this will occur is if
385+ // the API keypath is referencing has a nullability violation.
386+ // In certain cases, `Value` has the same layout as `Value?` and the
387+ // "nullptr" representation of `Value` is represented as `nil` for
388+ // `Value?`. If we're returning a `Value`, but manage to get its `nil`
389+ // representation, then the above check will fail.
390+ if _slowPath ( isLast) {
391+ _preconditionFailure ( " Could not resolve KeyPath " )
392+ }
381393 }
382394 }
383395 }
You can’t perform that action at this time.
0 commit comments