anchor.diff:          //printfn "Not eliminating because no Run found"
           None
   
  -let IsILMethodRefDeclaringTypeSystemString (ilg: ILGlobals) (mref: ILMethodRef) =
  -    mref.DeclaringTypeRef.Scope.IsAssemblyRef &&
  -    mref.DeclaringTypeRef.Scope.AssemblyRef.Name = ilg.typ_String.TypeRef.Scope.AssemblyRef.Name &&
  -    mref.DeclaringTypeRef.BasicQualifiedName = ilg.typ_String.BasicQualifiedName
  -                
  -let IsILMethodRefSystemStringConcatOverload (ilg: ILGlobals) (mref: ILMethodRef) =
  -    IsILMethodRefDeclaringTypeSystemString ilg mref &&
  +let IsILMethodRefSystemStringConcat (mref: ILMethodRef) =
       mref.Name = "Concat" &&
  -    mref.ReturnType.BasicQualifiedName = ilg.typ_String.BasicQualifiedName &&
  -    mref.ArgCount >= 2 && mref.ArgCount <= 4 && mref.ArgTypes |> List.forall(fun ilty -> ilty.BasicQualifiedName = ilg.typ_String.BasicQualifiedName)
  -
  -let IsILMethodRefSystemStringConcatArray (ilg: ILGlobals) (mref: ILMethodRef) =
  -    IsILMethodRefDeclaringTypeSystemString ilg mref &&
  +    mref.DeclaringTypeRef.Name = "System.String" &&
  +    (mref.ReturnType.IsNominal && mref.ReturnType.TypeRef.Name = "System.String") &&
  +    (mref.ArgCount >= 2 && mref.ArgCount <= 4 &&
  +        mref.ArgTypes 
  +        |> List.forall (fun ilTy ->
  +            ilTy.IsNominal && ilTy.TypeRef.Name = "System.String"))
  +
  +let IsILMethodRefSystemStringConcatArray (mref: ILMethodRef) =
       mref.Name = "Concat" &&
  -    mref.ReturnType.BasicQualifiedName = ilg.typ_String.BasicQualifiedName &&
  -    mref.ArgCount = 1 && mref.ArgTypes.Head.BasicQualifiedName = "System.String[]"
  +    mref.DeclaringTypeRef.Name = "System.String" &&
  +    (mref.ReturnType.IsNominal && mref.ReturnType.TypeRef.Name = "System.String") &&
  +    (mref.ArgCount = 1 && 
  +        mref.ArgTypes
  +        |> List.forall (fun ilTy ->          
  +            match ilTy with
  +            | ILType.Array (shape, ilTy) when shape = ILArrayShape.SingleDimensional &&
  +                                              ilTy.IsNominal &&
  +                                              ilTy.TypeRef.Name = "System.String" -> true
  +            | _ -> false))
       
   /// Optimize/analyze an expression
   let rec OptimizeExpr cenv (env: IncrementalOptimizationEnv) expr =
  
positive.code: and MakeOptimizedSystemStringConcatCall cenv env m args =
      let rec optimizeArg argExpr accArgs =
          match argExpr, accArgs with
          | Expr.Op(TOp.ILCall(_, _, _, _, _, _, _, methRef, _, _, _), _, [ Expr.Op(TOp.Array, _, args, _) ], _), _ when IsILMethodRefSystemStringConcatArray cenv.g.ilg methRef ->
              optimizeArgs args accArgs
  
          | Expr.Op(TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, args, _), _ when IsILMethodRefSystemStringConcatOverload cenv.g.ilg mref ->
              optimizeArgs args accArgs
  
          // Optimize string constants, e.g. "1" + "2" will turn into "12"
  
negative.code:     | TOp.ILAsm ([], [ty]), _, [a] when typeEquiv cenv.g (tyOfExpr cenv.g a) ty -> OptimizeExpr cenv env a
  
      // Optimize calls when concatenating strings, e.g. "1" + "2" + "3" + "4" .. etc.
      | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, [ Expr.Op(TOp.Array, _, args, _) ] 
        when IsILMethodRefSystemStringConcatArray mref ->
          MakeOptimizedSystemStringConcatCall cenv env m args
      | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, args 
        when IsILMethodRefSystemStringConcat mref ->
          MakeOptimizedSystemStringConcatCall cenv env m args
  
      | _ -> 
  