     }
     return _openExistential(rootValue, do: open2)
   }
-  var returnValue:AnyKeyPath = _openExistential(rootRoot, do: open)
-  _processAppendingKeyPathType(root: &returnValue, leaf: leaf)
-  if let returnValue = returnValue as? Result
-  {
-      return returnValue
+  var returnValue: AnyKeyPath = _openExistential(rootRoot, do: open)
+  _processOffsetForAppendedKeyPath(appendedKeyPath: &returnValue, root: root, leaf: leaf)
+  if let returnValue = returnValue as? Result {
+    return returnValue
   }
   return nil
 }

                                     offset: KeyPathPatternStoredOffset) {
    let previous = updatePreviousComponentAddr()
    switch kind {
    case .class:
      // A mutable class property can end the reference prefix.
      if mutable {

  var genericEnvironment: UnsafeRawPointer?
  let patternArgs: UnsafeRawPointer?
  var base: Any.Type
  var structOffset: UInt32 = 0
  var isPureStruct: [Bool] = []

  init(destData: UnsafeMutableRawBufferPointer,
       patternArgs: UnsafeRawPointer?,
