anchor.diff:                      f.SetValue(currentTuple, nestedTuple)
                       currentTuple <- nestedTuple
                   tuple :?> 'Tuple)
  +#endif
   
       member _.IsStructTuple = typeof<'Tuple>.IsValueType
       /// Tuple element shape definitions
  
positive.code:         emitDynamicMethod<Setter<'DeclaringType, 'Property>>
              injectionId [|typeof<'DeclaringType>.MakeByRefType(); typeof<'Property>|] typeof<System.Void> builder
  
      /// Emits a dynamic method that injects uninitialized values to supplied static method or ctor
      let emitUninitializedCtor<'DeclaringType> (ctor : MethodBase) =
          let builder (gen : ILGenerator) =
              for p in ctor.GetParameters() do
                  let pt = p.ParameterType
                  if not pt.IsValueType then
                      gen.Emit OpCodes.Ldnull
                  elif pt = typeof<bool> || pt = typeof<byte> || pt = typeof<sbyte> ||
                      pt = typeof<char> || pt = typeof<uint16> || pt = typeof<int16> ||
                      pt = typeof<int32> || pt = typeof<uint32> then
                      gen.Emit OpCodes.Ldc_I4_0
                  elif pt = typeof<int64> || pt = typeof<uint64> then
                      gen.Emit OpCodes.Ldc_I4_0 ; gen.Emit OpCodes.Conv_I8
                  elif pt = typeof<single> then gen.Emit(OpCodes.Ldc_R4, 0.0f)
                  elif pt = typeof<double> then gen.Emit(OpCodes.Ldc_R8, 0.0)
                  elif pt = typeof<IntPtr> then gen.Emit OpCodes.Ldc_I4_0; gen.Emit OpCodes.Conv_I
                  elif pt = typeof<UIntPtr> then gen.Emit OpCodes.Ldc_I4_0; gen.Emit OpCodes.Conv_U
                  else
                      assert(not pt.IsPrimitive)
                      let lvar = gen.DeclareLocal pt
                      gen.Emit(OpCodes.Ldloca_S, lvar.LocalIndex)
                      gen.Emit(OpCodes.Initobj, pt)
                      gen.Emit(OpCodes.Ldloc, lvar.LocalIndex)
  
              match ctor with
              | :? ConstructorInfo as c -> gen.Emit(OpCodes.Newobj, c)
  
negative.code: 
          emitDynamicMethod<Func<SerializationInfo, StreamingContext, 'T>> "serializableCtor" 
              [|typeof<SerializationInfo>; typeof<StreamingContext>|] typeof<'T> builder
  #endif
  
  [<AutoOpen>]
  module private ShapeTupleImpl =
  
      [<NoEquality; NoComparison>]
      type TupleInfo =
          { 
              Current : Type
              Fields : (MemberInfo * FieldInfo) []
              Nested : (FieldInfo * TupleInfo) option
          }
  
      let rec mkTupleInfo (t : Type) =
          if t.IsValueType then
              let fields = t.GetFields()
              let getField (f : FieldInfo) = f :> MemberInfo, f
              let fs, nested =
                  if fields.Length = 8 then
                      let nestedField = fields.[7]
                      let nestedInfo = mkTupleInfo nestedField.FieldType
                      Array.map getField fields.[..6], Some(nestedField, nestedInfo)
                  else
                      Array.map getField fields, None
  
              { Current = t ; Fields = fs ; Nested = nested }
          else
              let props = t.GetProperties()
              let fields = t.GetFields(BindingFlags.NonPublic ||| BindingFlags.Instance)
              let getField (p : PropertyInfo) =
                  let field = fields |> Array.find(fun f -> f.Name = "m_" + p.Name)
                  p :> MemberInfo, field
  
              let fs, nested =
                  if props.Length = 8 then
                      let nestedField = fields.[7]
                      let nestedInfo = mkTupleInfo nestedField.FieldType
                      Array.map getField props.[..6], Some(nestedField, nestedInfo)
                  else
                      Array.map getField props, None
  
              { Current = t ; Fields = fs ; Nested = nested }
  
      let gatherTupleMembers (tI : TupleInfo) =
          let rec aux (ctx : MemberInfo list) (tI : TupleInfo) = seq {
              for p,f in tI.Fields do
                  yield p, f :> MemberInfo :: ctx |> List.rev |> List.toArray
  
              match tI.Nested with
              | Some (fI,n) -> yield! aux (fI :> MemberInfo :: ctx) n
              | None -> ()
          }
  
          aux [] tI
  
      let gatherNestedFields (tI : TupleInfo) =
          let rec aux fs (tI : TupleInfo) =
              match tI.Nested with
              | Some (fI,n) -> aux (fI :: fs) n
              | _ -> List.rev fs
  
          aux [] tI
          |> List.toArray
  
  #if TYPESHAPE_EMIT
      open System.Reflection.Emit
  
      let emitCreateUninitializedTuple<'Tuple> (tupleInfo : TupleInfo) =
          let builder (gen : ILGenerator) =
              let rec emitCtor (tI : TupleInfo) =
                  for (_,field) in tI.Fields do
                      ldDefaultValue gen field.FieldType
  
                  match tI.Nested with
                  | None -> ()
                  | Some (_,nestedTupleInfo) -> emitCtor nestedTupleInfo
  
                  let ctorInfo = tI.Current.GetConstructors().[0]
                  gen.Emit(OpCodes.Newobj, ctorInfo)
  
              emitCtor tupleInfo
              gen.Emit OpCodes.Ret
  
          emitDynamicMethod<Func<'Tuple>> "tupleCtor" [||] typeof<'Tuple> builder
  
      let emitConstructorFunc<'Args, 'T> (arity : int) (ctorInfo : ConstructorInfo) =
          let builder (gen : ILGenerator) =
              match arity with
              | 0 -> ()
              | 1 -> gen.Emit OpCodes.Ldarg_0
              | _ ->
                  let argsTupleInfo = mkTupleInfo typeof<'Args>
                  let parentFields = new ResizeArray<FieldInfo>()
                  let rec ldTupleElems (tI : TupleInfo) =
                      for (_,field) in tI.Fields do
                          gen.Emit OpCodes.Ldarg_0
                          for parentFld in parentFields do gen.Emit(OpCodes.Ldfld, parentFld)
                          gen.Emit(OpCodes.Ldfld, field)
  
                      match tI.Nested with
                      | None -> ()
                      | Some (field, nested) ->
                          parentFields.Add field
                          ldTupleElems nested
  
                  ldTupleElems argsTupleInfo
  
              gen.Emit(OpCodes.Newobj, ctorInfo)
              gen.Emit OpCodes.Ret
                  
          emitDynamicMethod<Func<'Args, 'T>> "constructorFunc" [|typeof<'Args>|] typeof<'T> builder
  #endif
  
  //-------------------------
  