diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index a907da79373..2470c7ae215 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -29,8 +29,6 @@ let _ = if logging then dprintn "* warning: Il.logging is on" -let int_order = LanguagePrimitives.FastGenericComparer - let notlazy v = Lazy<_>.CreateFromValue v /// A little ugly, but the idea is that if a data structure does not @@ -99,8 +97,6 @@ let rec splitNamespaceAux (nm: string) = let splitNamespace nm = memoizeNamespaceTable.GetOrAdd(nm, splitNamespaceAux) -let splitNamespaceMemoized nm = splitNamespace nm - // ++GLOBAL MUTABLE STATE (concurrency-safe) let memoizeNamespaceArrayTable = ConcurrentDictionary() @@ -152,11 +148,6 @@ splitILTypeNameWithPossibleStaticArguments "Foo.Bar,\"1.0\"" = ([| "Foo" |], "Ba splitILTypeNameWithPossibleStaticArguments "Foo.Bar.Bar,\"1.0\"" = ([| "Foo"; "Bar" |], "Bar,\"1.0\"") *) -let unsplitTypeName (ns, n) = - match ns with - | [] -> String.concat "." ns + "." + n - | _ -> n - let splitTypeNameRightAux (nm: string) = let idx = nm.LastIndexOf '.' @@ -434,8 +425,6 @@ type AssemblyRefData = /// Global state: table of all assembly references keyed by AssemblyRefData. let AssemblyRefUniqueStampGenerator = UniqueStampGenerator() -let isMscorlib data = data.assemRefName = "mscorlib" - [] type ILAssemblyRef(data) = let pkToken key = @@ -3249,9 +3238,6 @@ let mkILMethods xs = let mkILMethodsComputed f = ILMethodDefs f let emptyILMethods = mkILMethodsFromArray [||] -let filterILMethodDefs f (mdefs: ILMethodDefs) = - ILMethodDefs(fun () -> mdefs.AsArray() |> Array.filter f) - // -------------------------------------------------------------------- // Operations and defaults for modules, assemblies etc. // -------------------------------------------------------------------- @@ -3460,11 +3446,6 @@ let mkLdcInt32 i = else AI_ldc(DT_I4, ILConst.I4 i) -let tname_CompilerGeneratedAttribute = - "System.Runtime.CompilerServices.CompilerGeneratedAttribute" - -let tname_DebuggableAttribute = "System.Diagnostics.DebuggableAttribute" - (* NOTE: ecma_ prefix refers to the standard "mscorlib" *) let ecmaPublicKey = PublicKeyToken(Bytes.ofInt32Array [| 0xde; 0xad; 0xbe; 0xef; 0xca; 0xfe; 0xfa; 0xce |]) @@ -3819,14 +3800,6 @@ let mkILClassCtor impl = body = notlazy impl ) -// -------------------------------------------------------------------- -// Make a virtual method, where the overriding is simply the default -// (i.e. overrides by name/signature) -// -------------------------------------------------------------------- - -let mk_ospec (ty: ILType, callconv, nm, genparams, formal_args, formal_ret) = - OverridesSpec(mkILMethRef (ty.TypeRef, callconv, nm, genparams, formal_args, formal_ret), ty) - let mkILGenericVirtualMethod (nm, callconv: ILCallingConv, access, genparams, actual_args, actual_ret, impl) = let attributes = convertMemberAccess access @@ -3953,11 +3926,6 @@ let cdef_cctorCode2CodeOrCreate tag imports f (cd: ILTypeDef) = cd.With(methods = methods) -let codeOfMethodDef (md: ILMethodDef) = - match md.Code with - | Some x -> x - | None -> failwith "codeOfmdef: not IL" - let mkRefToILMethod (tref, md: ILMethodDef) = mkILMethRef (tref, md.CallingConv, md.Name, md.GenericParams.Length, md.ParameterTypes, md.Return.Type) @@ -4363,10 +4331,6 @@ let computeILEnumInfo (mdName, mdFields: ILFieldDefs) = let sigptr_get_byte bytes sigptr = Bytes.get bytes sigptr, sigptr + 1 -let sigptr_get_bool bytes sigptr = - let b0, sigptr = sigptr_get_byte bytes sigptr - (b0 = 0x01), sigptr - let sigptr_get_u8 bytes sigptr = let b0, sigptr = sigptr_get_byte bytes sigptr byte b0, sigptr @@ -4490,11 +4454,6 @@ let mkRefToILAssembly (m: ILAssemblyManifest) = m.Locale ) -let z_unsigned_int_size n = - if n <= 0x7F then 1 - elif n <= 0x3FFF then 2 - else 3 - let z_unsigned_int n = if n >= 0 && n <= 0x7F then [| byte n |] @@ -4555,8 +4514,6 @@ let ieee32AsBytes i = i32AsBytes (bitsOfSingle i) let ieee64AsBytes i = i64AsBytes (bitsOfDouble i) -let et_END = 0x00uy -let et_VOID = 0x01uy let et_BOOLEAN = 0x02uy let et_CHAR = 0x03uy let et_I1 = 0x04uy @@ -4570,22 +4527,8 @@ let et_U8 = 0x0Buy let et_R4 = 0x0Cuy let et_R8 = 0x0Duy let et_STRING = 0x0Euy -let et_PTR = 0x0Fuy -let et_BYREF = 0x10uy -let et_VALUETYPE = 0x11uy -let et_CLASS = 0x12uy -let et_VAR = 0x13uy -let et_ARRAY = 0x14uy -let et_WITH = 0x15uy -let et_TYPEDBYREF = 0x16uy -let et_I = 0x18uy -let et_U = 0x19uy -let et_FNPTR = 0x1Buy let et_OBJECT = 0x1Cuy let et_SZARRAY = 0x1Duy -let et_MVAR = 0x1Euy -let et_CMOD_REQD = 0x1Fuy -let et_CMOD_OPT = 0x20uy let formatILVersion (version: ILVersionInfo) = sprintf "%d.%d.%d.%d" (int version.Major) (int version.Minor) (int version.Build) (int version.Revision) diff --git a/src/Compiler/AbstractIL/ilmorph.fs b/src/Compiler/AbstractIL/ilmorph.fs index 2ab4171781a..99fcb9811b2 100644 --- a/src/Compiler/AbstractIL/ilmorph.fs +++ b/src/Compiler/AbstractIL/ilmorph.fs @@ -112,11 +112,6 @@ and callsig_scoref2scoref_tyvar2ty f x = and tys_scoref2scoref_tyvar2ty f i = List.map (ty_scoref2scoref_tyvar2ty f) i -and gparams_scoref2scoref_tyvar2ty f i = - List.map (gparam_scoref2scoref_tyvar2ty f) i - -and gparam_scoref2scoref_tyvar2ty _f i = i - and morphILScopeRefsInILTypeRef fscope (tref: ILTypeRef) = ILTypeRef.Create(scope = fscope tref.Scope, enclosing = tref.Enclosing, name = tref.Name) diff --git a/src/Compiler/AbstractIL/ilnativeres.fs b/src/Compiler/AbstractIL/ilnativeres.fs index 70846577d68..b37ae327c40 100644 --- a/src/Compiler/AbstractIL/ilnativeres.fs +++ b/src/Compiler/AbstractIL/ilnativeres.fs @@ -26,9 +26,6 @@ type WCHAR = Char type WORD = uint16 let inline WORD s = uint16 s -let inline DWORD s = uint32 s -let inline WCHAR s = char s -let inline BYTE s = byte s type ResourceException(name: string, ?inner: Exception MaybeNull) = inherit Exception(name, Option.toObj inner) diff --git a/src/Compiler/AbstractIL/ilprint.fs b/src/Compiler/AbstractIL/ilprint.fs index 0335e28ef22..5ecdd91986c 100644 --- a/src/Compiler/AbstractIL/ilprint.fs +++ b/src/Compiler/AbstractIL/ilprint.fs @@ -13,8 +13,6 @@ open FSharp.Compiler.AbstractIL.ILX.Types open FSharp.Compiler.AbstractIL.IL #if DEBUG -let pretty () = true - // -------------------------------------------------------------------- // Pretty printing // -------------------------------------------------------------------- @@ -53,8 +51,6 @@ let mk_ppenv ilg = ppenvMethodFormals = 0 } -let debug_ppenv = mk_ppenv - let ppenv_enter_modul env = { env with ppenvClassFormals = 0 @@ -135,14 +131,6 @@ let output_seq sep f os (a: seq<_>) = output_string os sep f os e.Current -let output_array sep f os (a: _[]) = - if not (Array.isEmpty a) then - for i in 0 .. a.Length - 2 do - f os a[i] - output_string os sep - - f os a[a.Length - 1] - let output_parens f os a = output_string os "(" f os a @@ -153,19 +141,8 @@ let output_angled f os a = f os a output_string os ">" -let output_bracks f os a = - output_string os "[" - f os a - output_string os "]" - let output_id os n = output_sqstring os n -let output_label os n = output_string os n - -let output_lid os lid = output_seq "." output_string os lid - -let string_of_type_name (_, n) = n - let output_byte os i = output_hex_digit os (i / 16) output_hex_digit os (i % 16) @@ -293,16 +270,6 @@ and output_tyvar os d = output_u16 os d () -and goutput_ldtoken_info env os = - function - | ILToken.ILType x -> goutput_typ env os x - | ILToken.ILMethod x -> - output_string os "method " - goutput_mspec env os x - | ILToken.ILField x -> - output_string os "field " - goutput_fspec env os x - and goutput_typ_with_shortened_class_syntax env os = function | ILType.Boxed tspec when tspec.GenericArgs = [] -> goutput_tref env os tspec.TypeRef @@ -424,12 +391,6 @@ and goutput_dlocref env os (dref: ILType) = goutput_typ_with_shortened_class_syntax env os ty output_string os "::" -and goutput_callsig env os (csig: ILCallingSignature) = - output_callconv os csig.CallingConv - output_string os " " - goutput_typ env os csig.ReturnType - output_parens (output_seq ", " (goutput_typ env)) os csig.ArgTypes - and goutput_mref env os (mref: ILMethodRef) = output_callconv os mref.CallingConv output_string os " " @@ -465,56 +426,6 @@ and goutput_mspec env os (mspec: ILMethodSpec) = goutput_gactuals env os mspec.GenericArgs output_parens (output_seq ", " (goutput_typ fenv)) os mspec.FormalArgTypes -and goutput_vararg_mspec env os (mspec, varargs) = - match varargs with - | None -> goutput_mspec env os mspec - | Some varargs' -> - let fenv = - ppenv_enter_method mspec.GenericArity (ppenv_enter_tdef (mkILFormalTypars mspec.DeclaringType.GenericArgs) env) - - output_callconv os mspec.CallingConv - output_string os " " - goutput_typ fenv os mspec.FormalReturnType - output_string os " " - goutput_dlocref env os mspec.DeclaringType - let name = mspec.Name - - if name = ".ctor" || name = ".cctor" then - output_string os name - else - output_id os name - - goutput_gactuals env os mspec.GenericArgs - output_string os "(" - output_seq ", " (goutput_typ fenv) os mspec.FormalArgTypes - output_string os ", ..., " - output_seq ", " (goutput_typ fenv) os varargs' - output_string os ")" - -and goutput_vararg_sig env os (csig: ILCallingSignature, varargs: ILVarArgs) = - match varargs with - | None -> - goutput_callsig env os csig - () - | Some varargs' -> - goutput_typ env os csig.ReturnType - output_string os " (" - let argTys = csig.ArgTypes - - if argTys.Length <> 0 then - output_seq ", " (goutput_typ env) os argTys - - output_string os ", ..., " - output_seq ", " (goutput_typ env) os varargs' - output_string os ")" - -and goutput_fspec env os (x: ILFieldSpec) = - let fenv = ppenv_enter_tdef (mkILFormalTypars x.DeclaringType.GenericArgs) env - goutput_typ fenv os x.FormalType - output_string os " " - goutput_dlocref env os x.DeclaringType - output_id os x.Name - let output_member_access os access = output_string os @@ -592,41 +503,6 @@ let output_option f os = | None -> () | Some x -> f os x -let goutput_alternative_ref env os (alt: IlxUnionCase) = - output_id os alt.Name - - alt.FieldDefs - |> output_parens (output_array ", " (fun os fdef -> goutput_typ env os fdef.Type)) os - -let goutput_curef env os (IlxUnionRef (_, tref, alts, _, _)) = - output_string os " .classunion import " - goutput_tref env os tref - output_parens (output_array ", " (goutput_alternative_ref env)) os alts - -let goutput_cuspec env os (IlxUnionSpec (IlxUnionRef (_, tref, _, _, _), i)) = - output_string os "class /* classunion */ " - goutput_tref env os tref - goutput_gactuals env os i - -let output_basic_type os x = - output_string - os - (match x with - | DT_I1 -> "i1" - | DT_U1 -> "u1" - | DT_I2 -> "i2" - | DT_U2 -> "u2" - | DT_I4 -> "i4" - | DT_U4 -> "u4" - | DT_I8 -> "i8" - | DT_U8 -> "u8" - | DT_R4 -> "r4" - | DT_R8 -> "r8" - | DT_R -> "r" - | DT_I -> "i" - | DT_U -> "u" - | DT_REF -> "ref") - let output_custom_attr_data os data = output_string os " = " output_parens output_bytes os data @@ -684,28 +560,6 @@ let goutput_fdef _tref env os (fd: ILFieldDef) = output_string os "\n" goutput_custom_attrs env os fd.CustomAttrs -let output_alignment os = - function - | Aligned -> () - | Unaligned1 -> output_string os "unaligned. 1 " - | Unaligned2 -> output_string os "unaligned. 2 " - | Unaligned4 -> output_string os "unaligned. 4 " - -let output_volatility os = - function - | Nonvolatile -> () - | Volatile -> output_string os "volatile. " - -let output_tailness os = - function - | Tailcall -> output_string os "tail. " - | _ -> () - -let output_after_tailcall os = - function - | Tailcall -> output_string os " ret " - | _ -> () - let rec goutput_apps env os = function | Apps_tyapp (actual, cs) -> @@ -722,25 +576,6 @@ let rec goutput_apps env os = output_string os "--> " goutput_typ env os ty -/// Print the short form of instructions -let output_short_u16 os (x: uint16) = - if int x < 256 then - (output_string os ".s " - output_u16 os x) - else - output_string os " " - output_u16 os x - -let output_short_i32 os i32 = - if i32 < 256 && 0 >= i32 then - (output_string os ".s " - output_i32 os i32) - else - output_string os " " - output_i32 os i32 - -let output_code_label os lab = output_string os (formatCodeLabel lab) - let goutput_local env os (l: ILLocal) = goutput_typ env os l.Type @@ -758,287 +593,6 @@ let goutput_param env os (l: ILParameter) = let goutput_params env os ps = output_parens (output_seq ", " (goutput_param env)) os ps -let goutput_freevar env os l = - goutput_typ env os l.fvType - output_string os " " - output_sqstring os l.fvName - -let goutput_freevars env os ps = - output_parens (output_seq ", " (goutput_freevar env)) os ps - -let output_source os (s: ILDebugPoint) = - if s.Document.File <> "" then - output_string os " .line " - output_int os s.Line - - if s.Column <> -1 then - output_string os " : " - output_int os s.Column - - output_string os " /* - " - output_int os s.EndLine - - if s.Column <> -1 then - output_string os " : " - output_int os s.EndColumn - - output_string os "*/ " - output_sqstring os s.Document.File - -let rec goutput_instr env os inst = - match inst with - | si when isNoArgInstr si -> output_lid os (wordsOfNoArgInstr si) - | I_brcmp (cmp, tg1) -> - output_string - os - (match cmp with - | BI_beq -> "beq" - | BI_bgt -> "bgt" - | BI_bgt_un -> "bgt.un" - | BI_bge -> "bge" - | BI_bge_un -> "bge.un" - | BI_ble -> "ble" - | BI_ble_un -> "ble.un" - | BI_blt -> "blt" - | BI_blt_un -> "blt.un" - | BI_bne_un -> "bne.un" - | BI_brfalse -> "brfalse" - | BI_brtrue -> "brtrue") - - output_string os " " - output_code_label os tg1 - | I_br tg -> - output_string os "/* br " - output_code_label os tg - output_string os "*/" - | I_leave tg -> - output_string os "leave " - output_code_label os tg - | I_call (tl, mspec, varargs) -> - output_tailness os tl - output_string os "call " - goutput_vararg_mspec env os (mspec, varargs) - output_after_tailcall os tl - | I_calli (tl, mref, varargs) -> - output_tailness os tl - output_string os "calli " - goutput_vararg_sig env os (mref, varargs) - output_after_tailcall os tl - | I_ldarg u16 -> - output_string os "ldarg" - output_short_u16 os u16 - | I_ldarga u16 -> - output_string os "ldarga " - output_u16 os u16 - | AI_ldc (dt, ILConst.I4 x) -> - output_string os "ldc." - output_basic_type os dt - output_short_i32 os x - | AI_ldc (dt, ILConst.I8 x) -> - output_string os "ldc." - output_basic_type os dt - output_string os " " - output_i64 os x - | AI_ldc (dt, ILConst.R4 x) -> - output_string os "ldc." - output_basic_type os dt - output_string os " " - output_ieee32 os x - | AI_ldc (dt, ILConst.R8 x) -> - output_string os "ldc." - output_basic_type os dt - output_string os " " - output_ieee64 os x - | I_ldftn mspec -> - output_string os "ldftn " - goutput_mspec env os mspec - | I_ldvirtftn mspec -> - output_string os "ldvirtftn " - goutput_mspec env os mspec - | I_ldind (al, vol, dt) -> - output_alignment os al - output_volatility os vol - output_string os "ldind." - output_basic_type os dt - | I_cpblk (al, vol) -> - output_alignment os al - output_volatility os vol - output_string os "cpblk" - | I_initblk (al, vol) -> - output_alignment os al - output_volatility os vol - output_string os "initblk" - | I_ldloc u16 -> - output_string os "ldloc" - output_short_u16 os u16 - | I_ldloca u16 -> - output_string os "ldloca " - output_u16 os u16 - | I_starg u16 -> - output_string os "starg " - output_u16 os u16 - | I_stind (al, vol, dt) -> - output_alignment os al - output_volatility os vol - output_string os "stind." - output_basic_type os dt - | I_stloc u16 -> - output_string os "stloc" - output_short_u16 os u16 - | I_switch l -> - output_string os "switch " - output_parens (output_seq ", " output_code_label) os l - | I_callvirt (tl, mspec, varargs) -> - output_tailness os tl - output_string os "callvirt " - goutput_vararg_mspec env os (mspec, varargs) - output_after_tailcall os tl - | I_callconstraint (callvirt, tl, ty, mspec, varargs) -> - output_tailness os tl - output_string os "constraint. " - goutput_typ env os ty - output_string os (if callvirt then " callvirt " else " call ") - goutput_vararg_mspec env os (mspec, varargs) - output_after_tailcall os tl - | I_castclass ty -> - output_string os "castclass " - goutput_typ env os ty - | I_isinst ty -> - output_string os "isinst " - goutput_typ env os ty - | I_ldfld (al, vol, fspec) -> - output_alignment os al - output_volatility os vol - output_string os "ldfld " - goutput_fspec env os fspec - | I_ldflda fspec -> - output_string os "ldflda " - goutput_fspec env os fspec - | I_ldsfld (vol, fspec) -> - output_volatility os vol - output_string os "ldsfld " - goutput_fspec env os fspec - | I_ldsflda fspec -> - output_string os "ldsflda " - goutput_fspec env os fspec - | I_stfld (al, vol, fspec) -> - output_alignment os al - output_volatility os vol - output_string os "stfld " - goutput_fspec env os fspec - | I_stsfld (vol, fspec) -> - output_volatility os vol - output_string os "stsfld " - goutput_fspec env os fspec - | I_ldtoken tok -> - output_string os "ldtoken " - goutput_ldtoken_info env os tok - | I_refanyval ty -> - output_string os "refanyval " - goutput_typ env os ty - | I_refanytype -> output_string os "refanytype" - | I_mkrefany typ -> - output_string os "mkrefany " - goutput_typ env os typ - | I_ldstr s -> - output_string os "ldstr " - output_string os s - | I_newobj (mspec, varargs) -> - // newobj: IL has a special rule that the CC is always implicitly "instance" and need - // not be mentioned explicitly - output_string os "newobj " - goutput_vararg_mspec env os (mspec, varargs) - | I_stelem dt -> - output_string os "stelem." - output_basic_type os dt - | I_ldelem dt -> - output_string os "ldelem." - output_basic_type os dt - - | I_newarr (shape, typ) -> - if shape = ILArrayShape.SingleDimensional then - output_string os "newarr " - goutput_typ_with_shortened_class_syntax env os typ - else - output_string os "newobj void " - goutput_dlocref env os (mkILArrTy (typ, shape)) - output_string os ".ctor" - let rank = shape.Rank - output_parens (output_array ", " (goutput_typ env)) os (Array.create rank PrimaryAssemblyILGlobals.typ_Int32) - | I_stelem_any (shape, dt) -> - if shape = ILArrayShape.SingleDimensional then - output_string os "stelem.any " - goutput_typ env os dt - else - output_string os "call instance void " - goutput_dlocref env os (mkILArrTy (dt, shape)) - output_string os "Set" - let rank = shape.Rank - let arr = Array.create (rank + 1) PrimaryAssemblyILGlobals.typ_Int32 - arr[rank] <- dt - output_parens (output_array ", " (goutput_typ env)) os arr - | I_ldelem_any (shape, tok) -> - if shape = ILArrayShape.SingleDimensional then - output_string os "ldelem.any " - goutput_typ env os tok - else - output_string os "call instance " - goutput_typ env os tok - output_string os " " - goutput_dlocref env os (mkILArrTy (tok, shape)) - output_string os "Get" - let rank = shape.Rank - output_parens (output_array ", " (goutput_typ env)) os (Array.create rank PrimaryAssemblyILGlobals.typ_Int32) - | I_ldelema (ro, _, shape, tok) -> - if ro = ReadonlyAddress then - output_string os "readonly. " - - if shape = ILArrayShape.SingleDimensional then - output_string os "ldelema " - goutput_typ env os tok - else - output_string os "call instance " - goutput_typ env os (ILType.Byref tok) - output_string os " " - goutput_dlocref env os (mkILArrTy (tok, shape)) - output_string os "Address" - let rank = shape.Rank - output_parens (output_array ", " (goutput_typ env)) os (Array.create rank PrimaryAssemblyILGlobals.typ_Int32) - - | I_box tok -> - output_string os "box " - goutput_typ env os tok - | I_unbox tok -> - output_string os "unbox " - goutput_typ env os tok - | I_unbox_any tok -> - output_string os "unbox.any " - goutput_typ env os tok - | I_initobj tok -> - output_string os "initobj " - goutput_typ env os tok - | I_ldobj (al, vol, tok) -> - output_alignment os al - output_volatility os vol - output_string os "ldobj " - goutput_typ env os tok - | I_stobj (al, vol, tok) -> - output_alignment os al - output_volatility os vol - output_string os "stobj " - goutput_typ env os tok - | I_cpobj tok -> - output_string os "cpobj " - goutput_typ env os tok - | I_sizeof tok -> - output_string os "sizeof " - goutput_typ env os tok - | I_seqpoint s -> output_source os s - | EI_ilzero ty -> - output_string os "ilzero " - goutput_typ env os ty - | _ -> output_string os "" - let goutput_ilmbody env os (il: ILMethodBody) = if il.IsZeroInit then output_string os " .zeroinit\n" @@ -1198,11 +752,6 @@ let goutput_superclass env os = output_string os "extends " (goutput_typ_with_shortened_class_syntax env) os typ -let goutput_superinterfaces env os imp = - if not (List.isEmpty imp) then - output_string os "implements " - output_seq ", " (goutput_typ_with_shortened_class_syntax env) os imp - let goutput_implements env os (imp: ILTypes) = if not (List.isEmpty imp) then output_string os "implements " @@ -1337,48 +886,10 @@ let output_locale os s = output_string os " .Locale " output_qstring os s -let output_hash os x = - output_string os " .hash = " - output_parens output_bytes os x - -let output_publickeytoken os x = - output_string os " .publickeytoken = " - output_parens output_bytes os x - let output_publickey os x = output_string os " .publickey = " output_parens output_bytes os x -let output_publickeyinfo os = - function - | PublicKey k -> output_publickey os k - | PublicKeyToken k -> output_publickeytoken os k - -let output_assemblyRef os (aref: ILAssemblyRef) = - output_string os " .assembly extern " - output_sqstring os aref.Name - - if aref.Retargetable then - output_string os " retargetable " - - output_string os " { " - output_option output_hash os aref.Hash - output_option output_publickeyinfo os aref.PublicKey - output_option output_ver os aref.Version - output_option output_locale os aref.Locale - output_string os " } " - -let output_modref os (modref: ILModuleRef) = - output_string - os - (if modref.HasMetadata then - " .module extern " - else - " .file nometadata ") - - output_sqstring os modref.Name - output_option output_hash os modref.Hash - let goutput_resource env os r = output_string os " .mresource " diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index c323a9eb939..7c7f26a699b 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -73,8 +73,6 @@ let doubleOfBits (x: int64) = BitConverter.Int64BitsToDouble x let align alignment n = ((n + alignment - 0x1) / alignment) * alignment -let uncodedToken (tab: TableName) idx = ((tab.Index <<< 24) ||| idx) - let i32ToUncodedToken tok = let idx = tok &&& 0xffffff let tab = tok >>>& 24 @@ -329,8 +327,6 @@ let seekReadUserString mdv addr = let bytes = seekReadBytes mdv addr (len - 1) Encoding.Unicode.GetString(bytes, 0, bytes.Length) -let seekReadGuid mdv addr = seekReadBytes mdv addr 0x10 - let seekReadUncodedToken mdv addr = i32ToUncodedToken (seekReadInt32 mdv addr) @@ -748,9 +744,6 @@ let rec getTwoByteInstr i = type ImageChunk = { size: int32; addr: int32 } -let chunk sz next = ({ addr = next; size = sz }, next + sz) -let nochunk next = ({ addr = 0x0; size = 0x0 }, next) - type RowElementKind = | UShort | ULong @@ -839,9 +832,6 @@ let kindExportedType = RowKind [ ULong; ULong; SString; SString; Implementation let kindAssembly = RowKind [ ULong; UShort; UShort; UShort; UShort; ULong; Blob; SString; SString ] -let kindGenericParam_v1_1 = - RowKind [ UShort; UShort; TypeOrMethodDef; SString; TypeDefOrRefOrSpec ] - let kindGenericParam_v2_0 = RowKind [ UShort; UShort; TypeOrMethodDef; SString ] let kindMethodSpec = RowKind [ MethodDefOrRef; Blob ] @@ -997,17 +987,6 @@ let mkCacheGeneric lowMem _inbase _nm _sz = // Polymorphic general helpers for searching for particular rows. // ---------------------------------------------------------------------- -let seekFindRow numRows rowChooser = - let mutable i = 1 - - while (i <= numRows && not (rowChooser i)) do - i <- i + 1 - - if i > numRows then - dprintn "warning: seekFindRow: row not found" - - i - // search for rows satisfying predicate let seekReadIndexedRows (numRows, rowReader, keyFunc, keyComparer, binaryChop, rowConverter) = if binaryChop then diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 5cf3ec58222..f22d36e6818 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -417,9 +417,6 @@ let equalTypes (s: Type) (t: Type) = Type.op_Equality (s, t) let equalTypeLists (tys1: Type list) (tys2: Type list) = List.lengthsEqAndForall2 equalTypes tys1 tys2 -let equalTypeArrays (tys1: Type[]) (tys2: Type[]) = - Array.lengthsEqAndForall2 equalTypes tys1 tys2 - let getGenericArgumentsOfType (typT: Type) = if typT.IsGenericType then typT.GetGenericArguments() @@ -626,8 +623,6 @@ let envSetLocals emEnv locs = assert (emEnv.emLocals.Length = 0) // check "locals" is not yet set (scopes once only) { emEnv with emLocals = locs } -let envGetLocal emEnv i = emEnv.emLocals[i] - let envSetLabel emEnv name lab = assert (not (Zmap.mem name emEnv.emLabels)) @@ -1152,10 +1147,6 @@ let convConstructorSpec cenv emEnv (mspec: ILMethodSpec) = ) | NonNull res -> res -let emitLabelMark emEnv (ilG: ILGenerator) (label: ILCodeLabel) = - let lab = envGetLabel emEnv label - ilG.MarkLabelAndLog lab - ///Emit comparison instructions. let emitInstrCompare emEnv (ilG: ILGenerator) comp targ = match comp with @@ -1219,28 +1210,6 @@ let emitInstrCall cenv emEnv (ilG: ILGenerator) opCall tail (mspec: ILMethodSpec | None -> ilG.EmitAndLog(opCall, minfo) | Some varargTys -> ilG.EmitCall(opCall, minfo, convTypesToArray cenv emEnv varargTys)) -let getGenericMethodDefinition q (ty: Type) = - let gminfo = - match q with - | Quotations.Patterns.Call (_, minfo, _) -> minfo.GetGenericMethodDefinition() - | _ -> failwith "unexpected failure decoding quotation at ilreflect startup" - - gminfo.MakeGenericMethod [| ty |] - -let getArrayMethInfo n ty = - match n with - | 2 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.GetArray2D null 0 0 @@> ty - | 3 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.GetArray3D null 0 0 0 @@> ty - | 4 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.GetArray4D null 0 0 0 0 @@> ty - | _ -> invalidArg "n" "not expecting array dimension > 4" - -let setArrayMethInfo n ty = - match n with - | 2 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.SetArray2D null 0 0 0 @@> ty - | 3 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.SetArray3D null 0 0 0 0 @@> ty - | 4 -> getGenericMethodDefinition <@@ LanguagePrimitives.IntrinsicFunctions.SetArray4D null 0 0 0 0 0 @@> ty - | _ -> invalidArg "n" "not expecting array dimension > 4" - //---------------------------------------------------------------------------- // emitInstr cenv //---------------------------------------------------------------------------- @@ -2104,35 +2073,6 @@ let buildMethodImplsPass3 cenv _tref (typB: TypeBuilder) emEnv (mimpl: ILMethodI // typeAttributesOf* //---------------------------------------------------------------------------- -let typeAttributesOfTypeDefKind x = - match x with - // required for a TypeBuilder - | ILTypeDefKind.Class -> TypeAttributes.Class - | ILTypeDefKind.ValueType -> TypeAttributes.Class - | ILTypeDefKind.Interface -> TypeAttributes.Interface - | ILTypeDefKind.Enum -> TypeAttributes.Class - | ILTypeDefKind.Delegate -> TypeAttributes.Class - -let typeAttributesOfTypeAccess x = - match x with - | ILTypeDefAccess.Public -> TypeAttributes.Public - | ILTypeDefAccess.Private -> TypeAttributes.NotPublic - | ILTypeDefAccess.Nested macc -> - match macc with - | ILMemberAccess.Assembly -> TypeAttributes.NestedAssembly - | ILMemberAccess.CompilerControlled -> failwith "Nested compiler controlled." - | ILMemberAccess.FamilyAndAssembly -> TypeAttributes.NestedFamANDAssem - | ILMemberAccess.FamilyOrAssembly -> TypeAttributes.NestedFamORAssem - | ILMemberAccess.Family -> TypeAttributes.NestedFamily - | ILMemberAccess.Private -> TypeAttributes.NestedPrivate - | ILMemberAccess.Public -> TypeAttributes.NestedPublic - -let typeAttributesOfTypeEncoding x = - match x with - | ILDefaultPInvokeEncoding.Ansi -> TypeAttributes.AnsiClass - | ILDefaultPInvokeEncoding.Auto -> TypeAttributes.AutoClass - | ILDefaultPInvokeEncoding.Unicode -> TypeAttributes.UnicodeClass - let typeAttributesOfTypeLayout cenv emEnv x = let attr x p = if p.Size = None && p.Pack = None then diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index c568da7ade6..5d4d37c97fb 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -28,10 +28,6 @@ let CALG_RSA_SIGN = int (ALG_CLASS_SIGNATURE ||| ALG_TYPE_RSA) let ALG_CLASS_HASH = int (4 <<< 13) let ALG_TYPE_ANY = int 0 let CALG_SHA1 = int (ALG_CLASS_HASH ||| ALG_TYPE_ANY ||| 4) -let CALG_SHA_256 = int (ALG_CLASS_HASH ||| ALG_TYPE_ANY ||| 12) -let CALG_SHA_384 = int (ALG_CLASS_HASH ||| ALG_TYPE_ANY ||| 13) -let CALG_SHA_512 = int (ALG_CLASS_HASH ||| ALG_TYPE_ANY ||| 14) - let PUBLICKEYBLOB = int 0x6 let PRIVATEKEYBLOB = int 0x7 let BLOBHEADER_CURRENT_BVERSION = int 0x2 @@ -41,10 +37,6 @@ let RSA_PRIV_MAGIC = int 0x32415352 let getResourceString (_, str) = str -let check _action hresult = - if uint32 hresult >= 0x80000000ul then - Marshal.ThrowExceptionForHR hresult - [] type ByteArrayUnion = [] @@ -325,12 +317,6 @@ type keyPair = byte[] type pubkey = byte[] type pubkeyOptions = byte[] * bool -let signerOpenPublicKeyFile filePath = - FileSystem.OpenFileForReadShim(filePath).ReadAllBytes() - -let signerOpenKeyPairFile filePath = - FileSystem.OpenFileForReadShim(filePath).ReadAllBytes() - let signerGetPublicKeyForKeyPair (kp: keyPair) : pubkey = getPublicKeyForKeyPair kp let signerSignatureSize (pk: pubkey) : int = signatureSize pk diff --git a/src/Compiler/AbstractIL/ilsupp.fs b/src/Compiler/AbstractIL/ilsupp.fs index 272f7b74029..513d14d9f51 100644 --- a/src/Compiler/AbstractIL/ilsupp.fs +++ b/src/Compiler/AbstractIL/ilsupp.fs @@ -16,19 +16,9 @@ let DateTime1970Jan01 = let absilWriteGetTimeStamp () = (DateTime.UtcNow - DateTime1970Jan01).TotalSeconds |> int -// Force inline, so GetLastWin32Error calls are immediately after interop calls as seen by FxCop under Debug build. -let inline ignore _x = () - // Native Resource linking/unlinking type IStream = System.Runtime.InteropServices.ComTypes.IStream -let check _action hresult = - if uint32 hresult >= 0x80000000ul then - Marshal.ThrowExceptionForHR hresult -//printf "action = %s, hresult = 0x%nx \n" action hresult - -let MAX_PATH = 260 - let E_FAIL = 0x80004005 let bytesToWord (b0: byte, b1: byte) = int16 b0 ||| (int16 b1 <<< 8) @@ -36,16 +26,6 @@ let bytesToWord (b0: byte, b1: byte) = int16 b0 ||| (int16 b1 <<< 8) let bytesToDWord (b0: byte, b1: byte, b2: byte, b3: byte) = int b0 ||| (int b1 <<< 8) ||| (int b2 <<< 16) ||| (int b3 <<< 24) -let bytesToQWord (b0: byte, b1: byte, b2: byte, b3: byte, b4: byte, b5: byte, b6: byte, b7: byte) = - int64 b0 - ||| (int64 b1 <<< 8) - ||| (int64 b2 <<< 16) - ||| (int64 b3 <<< 24) - ||| (int64 b4 <<< 32) - ||| (int64 b5 <<< 40) - ||| (int64 b6 <<< 48) - ||| (int64 b7 <<< 56) - let dwToBytes n = [| byte (n &&& 0xff) @@ -110,20 +90,6 @@ type IMAGE_FILE_HEADER(m: int16, secs: int16, tds: int32, ptst: int32, nos: int3 buf.EmitUInt16(uint16 characteristics) buf.AsMemory().ToArray() -let bytesToIFH (buffer: byte[]) (offset: int) = - if (buffer.Length - offset) < IMAGE_FILE_HEADER.Width then - invalidArg "buffer" "buffer too small to fit an IMAGE_FILE_HEADER" - - IMAGE_FILE_HEADER( - bytesToWord (buffer[offset], buffer[offset + 1]), // Machine - bytesToWord (buffer[offset + 2], buffer[offset + 3]), // NumberOfSections - bytesToDWord (buffer[offset + 4], buffer[offset + 5], buffer[offset + 6], buffer[offset + 7]), // TimeDateStamp - bytesToDWord (buffer[offset + 8], buffer[offset + 9], buffer[offset + 10], buffer[offset + 11]), // PointerToSymbolTable - bytesToDWord (buffer[offset + 12], buffer[offset + 13], buffer[offset + 14], buffer[offset + 15]), // NumberOfSymbols - bytesToWord (buffer[offset + 16], buffer[offset + 17]), // SizeOfOptionalHeader - bytesToWord (buffer[offset + 18], buffer[offset + 19]) - ) // Characteristics - type IMAGE_SECTION_HEADER(n: int64, ai: int32, va: int32, srd: int32, prd: int32, pr: int32, pln: int32, nr: int16, nl: int16, c: int32) = let mutable name = n let mutable addressInfo = ai // PhysicalAddress / VirtualSize @@ -196,32 +162,6 @@ type IMAGE_SECTION_HEADER(n: int64, ai: int32, va: int32, srd: int32, prd: int32 buf.EmitInt32 characteristics buf.AsMemory().ToArray() -let bytesToISH (buffer: byte[]) (offset: int) = - if (buffer.Length - offset) < IMAGE_SECTION_HEADER.Width then - invalidArg "buffer" "buffer too small to fit an IMAGE_SECTION_HEADER" - - IMAGE_SECTION_HEADER( - bytesToQWord ( - buffer[offset], - buffer[offset + 1], - buffer[offset + 2], - buffer[offset + 3], - buffer[offset + 4], - buffer[offset + 5], - buffer[offset + 6], - buffer[offset + 7] - ), // Name - bytesToDWord (buffer[offset + 8], buffer[offset + 9], buffer[offset + 10], buffer[offset + 11]), // AddressInfo - bytesToDWord (buffer[offset + 12], buffer[offset + 13], buffer[offset + 14], buffer[offset + 15]), // VirtualAddress - bytesToDWord (buffer[offset + 16], buffer[offset + 17], buffer[offset + 18], buffer[offset + 19]), // SizeOfRawData - bytesToDWord (buffer[offset + 20], buffer[offset + 21], buffer[offset + 22], buffer[offset + 23]), // PointerToRawData - bytesToDWord (buffer[offset + 24], buffer[offset + 25], buffer[offset + 26], buffer[offset + 27]), // PointerToRelocations - bytesToDWord (buffer[offset + 28], buffer[offset + 29], buffer[offset + 30], buffer[offset + 31]), // PointerToLineNumbers - bytesToWord (buffer[offset + 32], buffer[offset + 33]), // NumberOfRelocations - bytesToWord (buffer[offset + 34], buffer[offset + 35]), // NumberOfLineNumbers - bytesToDWord (buffer[offset + 36], buffer[offset + 37], buffer[offset + 38], buffer[offset + 39]) - ) // Characteristics - type IMAGE_SYMBOL(n: int64, v: int32, sn: int16, t: int16, sc: byte, nas: byte) = let mutable name = n let mutable value = v @@ -266,28 +206,6 @@ type IMAGE_SYMBOL(n: int64, v: int32, sn: int16, t: int16, sc: byte, nas: byte) buf.EmitByte numberOfAuxSymbols buf.AsMemory().ToArray() -let bytesToIS (buffer: byte[]) (offset: int) = - if (buffer.Length - offset) < IMAGE_SYMBOL.Width then - invalidArg "buffer" "buffer too small to fit an IMAGE_SYMBOL" - - IMAGE_SYMBOL( - bytesToQWord ( - buffer[offset], - buffer[offset + 1], - buffer[offset + 2], - buffer[offset + 3], - buffer[offset + 4], - buffer[offset + 5], - buffer[offset + 6], - buffer[offset + 7] - ), // Name - bytesToDWord (buffer[offset + 8], buffer[offset + 9], buffer[offset + 10], buffer[offset + 11]), // Value - bytesToWord (buffer[offset + 12], buffer[offset + 13]), // SectionNumber - bytesToWord (buffer[offset + 14], buffer[offset + 15]), // Type - buffer[offset + 16], - buffer[offset + 17] - ) // NumberOfAuxSymbols - type IMAGE_RELOCATION(va: int32, sti: int32, t: int16) = let mutable virtualAddress = va // Also RelocCount let mutable symbolTableIndex = sti @@ -318,16 +236,6 @@ type IMAGE_RELOCATION(va: int32, sti: int32, t: int16) = buf.EmitUInt16(uint16 ty) buf.AsMemory().ToArray() -let bytesToIR (buffer: byte[]) (offset: int) = - if (buffer.Length - offset) < IMAGE_RELOCATION.Width then - invalidArg "buffer" "buffer too small to fit an IMAGE_RELOCATION" - - IMAGE_RELOCATION( - bytesToDWord (buffer[offset], buffer[offset + 1], buffer[offset + 2], buffer[offset + 3]), - bytesToDWord (buffer[offset + 4], buffer[offset + 5], buffer[offset + 6], buffer[offset + 7]), - bytesToWord (buffer[offset + 8], buffer[offset + 9]) - ) - type IMAGE_RESOURCE_DIRECTORY(c: int32, tds: int32, mjv: int16, mnv: int16, nne: int16, nie: int16) = let mutable characteristics = c let mutable timeDateStamp = tds diff --git a/src/Compiler/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs index 33894493f4b..d804ba2fb53 100644 --- a/src/Compiler/AbstractIL/ilwrite.fs +++ b/src/Compiler/AbstractIL/ilwrite.fs @@ -18,10 +18,6 @@ open FSharp.Compiler.DiagnosticsLogger open FSharp.Compiler.IO open FSharp.Compiler.Text.Range -#if DEBUG -let showEntryLookups = false -#endif - //--------------------------------------------------------------------- // Byte, byte array fragments and other concrete representations // manipulations. @@ -1073,18 +1069,6 @@ let GetMemberAccessFlags access = | ILMemberAccess.FamilyOrAssembly -> 0x00000005 | ILMemberAccess.Assembly -> 0x00000003 -let GetTypeAccessFlags access = - match access with - | ILTypeDefAccess.Public -> 0x00000001 - | ILTypeDefAccess.Private -> 0x00000000 - | ILTypeDefAccess.Nested ILMemberAccess.Public -> 0x00000002 - | ILTypeDefAccess.Nested ILMemberAccess.Private -> 0x00000003 - | ILTypeDefAccess.Nested ILMemberAccess.Family -> 0x00000004 - | ILTypeDefAccess.Nested ILMemberAccess.CompilerControlled -> failwith "bad type access" - | ILTypeDefAccess.Nested ILMemberAccess.FamilyAndAssembly -> 0x00000006 - | ILTypeDefAccess.Nested ILMemberAccess.FamilyOrAssembly -> 0x00000007 - | ILTypeDefAccess.Nested ILMemberAccess.Assembly -> 0x00000005 - exception MethodDefNotFound let FindMethodDefIdx cenv mdkey = try cenv.methodDefIdxsByKey.GetTableEntry mdkey diff --git a/src/Compiler/AbstractIL/ilx.fs b/src/Compiler/AbstractIL/ilx.fs index e91ad50d712..75447e06bcb 100644 --- a/src/Compiler/AbstractIL/ilx.fs +++ b/src/Compiler/AbstractIL/ilx.fs @@ -90,8 +90,6 @@ let rec instLambdasAux n inst lambdas = ) | Lambdas_return retTy -> Lambdas_return(instILTypeAux n inst retTy) -let instLambdas i t = instLambdasAux 0 i t - type IlxClosureFreeVar = { fvName: string diff --git a/src/Compiler/Checking/AugmentWithHashCompare.fs b/src/Compiler/Checking/AugmentWithHashCompare.fs index ad2645e1940..63ba529b220 100644 --- a/src/Compiler/Checking/AugmentWithHashCompare.fs +++ b/src/Compiler/Checking/AugmentWithHashCompare.fs @@ -144,10 +144,6 @@ let mkBindThatAddrIfNeeded m thataddrvOpt thatv expr = // let thataddrv = &thatv mkCompGenLet m thataddrv (mkValAddr m false (mkLocalValRef thatv)) expr -let mkDerefThis g m (thisv: Val) thise = - if isByrefTy g thisv.Type then mkAddrGet m (mkLocalValRef thisv) - else thise - let mkCompareTestConjuncts g m exprs = match List.tryFrontAndBack exprs with | None -> mkZero g m diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 1c4ecb97c33..eae384747a3 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -46,8 +46,6 @@ open FSharp.Compiler.TypeProviders type cenv = TcFileState -let TcClassRewriteStackGuardDepth = StackGuard.GetDepthOption "TcClassRewrite" - //------------------------------------------------------------------------- // Mutually recursive shapes //------------------------------------------------------------------------- diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index ef4930408a0..63dc5bcb595 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -46,14 +46,6 @@ open FSharp.Compiler.TypeRelations open FSharp.Compiler.TypeProviders #endif -//------------------------------------------------------------------------- -// Helpers that should be elsewhere -//------------------------------------------------------------------------- - -let mkNilListPat (g: TcGlobals) m ty = TPat_unioncase(g.nil_ucref, [ty], [], m) - -let mkConsListPat (g: TcGlobals) ty ph pt = TPat_unioncase(g.cons_ucref, [ty], [ph;pt], unionRanges ph.Range pt.Range) - //------------------------------------------------------------------------- // Errors. //------------------------------------------------------------------------- @@ -174,8 +166,6 @@ let ExitFamilyRegion env = let AreWithinCtorShape env = match env.eCtorInfo with None -> false | Some ctorInfo -> ctorInfo.ctorShapeCounter > 0 -let AreWithinImplicitCtor env = match env.eCtorInfo with None -> false | Some ctorInfo -> ctorInfo.ctorIsImplicit - let GetCtorShapeCounter env = match env.eCtorInfo with None -> 0 | Some ctorInfo -> ctorInfo.ctorShapeCounter let GetRecdInfo env = match env.eCtorInfo with None -> RecdExpr | Some ctorInfo -> if ctorInfo.ctorShapeCounter = 1 then RecdExprIsObjInit else RecdExpr @@ -471,14 +461,6 @@ let UnifyOverallTypeAndRecover (cenv: cenv) env m overallTy actualTy = with exn -> errorRecovery exn m -// Calls UnifyTypes, but upon error only does the minimal error recovery -// so that IntelliSense information can continue to be collected. -let UnifyTypesAndRecover (cenv: cenv) env m expectedTy actualTy = - try - UnifyTypes cenv env m expectedTy actualTy - with exn -> - errorRecovery exn m - /// Make an environment suitable for a module or namespace. Does not create a new accumulator but uses one we already have/ let MakeInnerEnvWithAcc addOpenToNameEnv env nm moduleTyAcc moduleKind = let path = env.ePath @ [nm] @@ -1890,10 +1872,6 @@ let ApplyUnionCaseOrExnTypes m (cenv: cenv) env overallTy c = ApplyUnionCaseOrExn ((fun (a, b) mArgs args -> mkUnionCaseExpr(a, b, args, unionRanges m mArgs)), (fun a mArgs args -> mkExnExpr (a, args, unionRanges m mArgs))) m cenv env overallTy c -let ApplyUnionCaseOrExnTypesForPat m (cenv: cenv) env overallTy c = - ApplyUnionCaseOrExn ((fun (a, b) mArgs args -> TPat_unioncase(a, b, args, unionRanges m mArgs)), - (fun a mArgs args -> TPat_exnconstr(a, args, unionRanges m mArgs))) m cenv env overallTy c - let UnionCaseOrExnCheck (env: TcEnv) numArgTys numArgs m = if numArgs <> numArgTys then error (UnionCaseWrongArguments(env.DisplayEnv, numArgTys, numArgs, m)) @@ -10720,9 +10698,6 @@ and TcAttributesMaybeFailEx canFail (cenv: cenv) env attrTgt attrEx synAttribs = and TcAttributesWithPossibleTargets canFail cenv env attrTgt synAttribs = TcAttributesWithPossibleTargetsEx canFail cenv env attrTgt (enum 0) synAttribs -and TcAttribute canFail cenv (env: TcEnv) attrTgt (synAttr: SynAttribute) = - TcAttributeEx canFail cenv env attrTgt (enum 0) synAttr - and TcAttributesMaybeFail canFail cenv env attrTgt synAttribs = TcAttributesMaybeFailEx canFail cenv env attrTgt (enum 0) synAttribs diff --git a/src/Compiler/Checking/NameResolution.fs b/src/Compiler/Checking/NameResolution.fs index 586dbe01daf..c5ace8603a6 100644 --- a/src/Compiler/Checking/NameResolution.fs +++ b/src/Compiler/Checking/NameResolution.fs @@ -3916,7 +3916,6 @@ let FakeInstantiationGenerator (_m: range) gps = List.map mkTyparTy gps // note: using local refs is ok since it is only used by VS let ItemForModuleOrNamespaceRef v = Item.ModuleOrNamespaces [v] -let ItemForPropInfo (pinfo: PropInfo) = Item.Property (pinfo.PropertyName, [pinfo]) let IsTyconUnseenObsoleteSpec ad g amap m (x: TyconRef) allowObsolete = not (IsEntityAccessible amap m ad x) || diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index 6f2bcb62f80..6f02548b084 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -62,12 +62,6 @@ module internal PrintUtilities = s + ".0" else s - let layoutsL (ls: Layout list) : Layout = - match ls with - | [] -> emptyL - | [x] -> x - | x :: xs -> List.fold (^^) x xs - // Layout a curried function type. Over multiple lines breaking takes some care, e.g. // // val SampleFunctionTupledAllBreakA: @@ -1387,8 +1381,6 @@ module PrintTastMemberOrVals = let prettyLayoutOfValOrMemberNoInst denv infoReader v = prettyLayoutOfValOrMember denv infoReader emptyTyparInst v |> snd -let layoutTrait denv x = x |> PrintTypes.layoutTrait denv - let layoutTyparConstraint denv x = x |> PrintTypes.layoutTyparConstraint denv let outputType denv os x = x |> PrintTypes.layoutType denv |> bufferL os diff --git a/src/Compiler/Checking/PatternMatchCompilation.fs b/src/Compiler/Checking/PatternMatchCompilation.fs index 8d59e3301dc..1f7a2c29c44 100644 --- a/src/Compiler/Checking/PatternMatchCompilation.fs +++ b/src/Compiler/Checking/PatternMatchCompilation.fs @@ -81,8 +81,6 @@ and MatchClause = member c.Target = let (MatchClause(_, _, tg, _)) = c in tg member c.BoundVals = let (MatchClause(_p, _whenOpt, TTarget(vs, _, _), _m)) = c in vs -let debug = false - //--------------------------------------------------------------------------- // Nasty stuff to permit obscure generic bindings such as // let x, y = [], [] @@ -892,14 +890,6 @@ let rec layoutPat pat = | TPat_tuple (_, pats, _, _) | TPat_array (pats, _, _) -> Layout.bracketL (Layout.tupleL (List.map layoutPat pats)) | _ -> Layout.wordL (TaggedText.tagText "?") - -let layoutPath _p = Layout.wordL (TaggedText.tagText "") - -let layoutActive (Active (path, _subexpr, pat)) = - Layout.(--) (Layout.wordL (TaggedText.tagText "Active")) (Layout.tupleL [layoutPath path; layoutPat pat]) - -let layoutFrontier (Frontier (i, actives, _)) = - Layout.(--) (Layout.wordL (TaggedText.tagText "Frontier ")) (Layout.tupleL [intL i; Layout.listL layoutActive actives]) #endif let mkFrontiers investigations clauseNumber = @@ -988,8 +978,6 @@ let rec isPatternDisjunctive inpPat = // The algorithm //--------------------------------------------------------------------------- -let getDiscrim (EdgeDiscrim(_, discrim, _)) = discrim - let CompilePatternBasic (g: TcGlobals) denv amap tcVal infoReader mExpr mMatch warnOnUnused diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs index 9338abd28f5..b4eb42970a7 100644 --- a/src/Compiler/Checking/PostInferenceChecks.fs +++ b/src/Compiler/Checking/PostInferenceChecks.fs @@ -676,9 +676,6 @@ let CheckTypeNoInnerByrefs cenv env m ty = CheckType PermitByRefType.NoInnerByRe let CheckTypeInstNoByrefs cenv env m tyargs = tyargs |> List.iter (CheckTypeNoByrefs cenv env m) -let CheckTypeInstPermitAllByrefs cenv env m tyargs = - tyargs |> List.iter (CheckTypePermitAllByrefs cenv env m) - let CheckTypeInstNoInnerByrefs cenv env m tyargs = tyargs |> List.iter (CheckTypeNoInnerByrefs cenv env m) @@ -1819,11 +1816,6 @@ and CheckExprsPermitByRefLike cenv env exprs : Limit = |> List.map (CheckExprPermitByRefLike cenv env) |> CombineLimits -and CheckExprsPermitReturnableByRef cenv env exprs : Limit = - exprs - |> List.map (CheckExprPermitReturnableByRef cenv env) - |> CombineLimits - and CheckExprPermitByRefLike cenv env expr : Limit = CheckExpr cenv env expr PermitByRefExpr.Yes @@ -2215,10 +2207,6 @@ let CheckModuleBinding cenv env (TBind(v, e, _) as bind) = CheckBinding cenv { env with returnScope = 1 } true PermitByRefExpr.Yes bind |> ignore -let CheckModuleBindings cenv env binds = - for bind in binds do - CheckModuleBinding cenv env bind - //-------------------------------------------------------------------------- // check tycons //-------------------------------------------------------------------------- diff --git a/src/Compiler/CodeGen/EraseClosures.fs b/src/Compiler/CodeGen/EraseClosures.fs index a0c022a01a8..b53526183b8 100644 --- a/src/Compiler/CodeGen/EraseClosures.fs +++ b/src/Compiler/CodeGen/EraseClosures.fs @@ -103,16 +103,6 @@ let stripSupportedAbstraction lambdas = tys, [], rest | rest -> [], [], rest -// This must correspond to stripSupportedAbstraction -let isSupportedDirectCall apps = - match apps with - | Apps_app (_, Apps_done _) -> true - | Apps_app (_, Apps_app (_, Apps_done _)) -> true - | Apps_app (_, Apps_app (_, Apps_app (_, Apps_done _))) -> true - | Apps_app (_, Apps_app (_, Apps_app (_, Apps_app (_, Apps_done _)))) -> true - | Apps_tyapp _ -> false - | _ -> false - // -------------------------------------------------------------------- // Prelude for function types. Only use System.Func for now, prepare // for more refined types later. @@ -226,17 +216,6 @@ let mkCallBlockForMultiValueApp cenv doTailCall (argTys, retTy) = I_call(doTailCall, mr, None)) ] -let mkMethSpecForClosureCall cenv (clospec: IlxClosureSpec) = - let tyargsl, argTys, rstruct = stripSupportedAbstraction clospec.FormalLambdas - - if not (isNil tyargsl) then - failwith "mkMethSpecForClosureCall: internal error" - - let retTyR = mkTyOfLambdas cenv rstruct - let argTysR = typesOfILParams argTys - let minstR = clospec.GenericArgs - mkILInstanceMethSpecInTy (clospec.ILType, "Invoke", argTysR, retTyR, minstR) - // -------------------------------------------------------------------- // Translate instructions.... // -------------------------------------------------------------------- diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index 626ddd49758..6781518feff 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -235,8 +235,6 @@ let mkTagFieldFormalType (ilg: ILGlobals) _cuspec = ilg.typ_Int32 let mkTagFieldId ilg cuspec = "_tag", mkTagFieldType ilg cuspec -let mkTailOrNullId baseTy = "tail", constFormalFieldTy baseTy - let altOfUnionSpec (cuspec: IlxUnionSpec) cidx = try cuspec.Alternative cidx diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index efb652eb407..584c627b206 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -369,9 +369,6 @@ let mkTypeOfExpr cenv m ilTy = m ) -let mkGetNameExpr cenv (ilt: ILType) m = - mkAsmExpr ([ I_ldstr ilt.BasicQualifiedName ], [], [], [ cenv.g.string_ty ], m) - let useCallVirt (cenv: cenv) boxity (mspec: ILMethodSpec) isBaseCall = cenv.options.alwaysCallVirt && (boxity = AsObject) @@ -488,12 +485,6 @@ let CompLocForInitClass cloc = Namespace = None } -let CompLocForImplicitMainMethod cloc = - { cloc with - Enclosing = [ TypeNameForImplicitMainMethod cloc ] - Namespace = None - } - let CompLocForPrivateImplementationDetails cloc = { cloc with Enclosing = [ TypeNameForPrivateImplementationDetails cloc ] @@ -850,9 +841,6 @@ and GenParamTypes cenv m tyenv isSlotSig tys = and GenTypeArgs cenv m tyenv tyargs = GenTypeArgsAux cenv m tyenv tyargs -and GenTypePermitVoidAux cenv m tyenv ty = - GenTypeAux cenv m tyenv VoidOK PtrTypesNotOK ty - // Static fields generally go in a private InitializationCodeAndBackingFields section. This is to ensure all static // fields are initialized only in their class constructors (we generate one primary // cctor for each file to ensure initialization coherence across the file, regardless @@ -1279,16 +1267,6 @@ let AddSignatureRemapInfo _msg (rpi, mhi) eenv = sigToImplRemapInfo = (mkRepackageRemapping rpi, mhi) :: eenv.sigToImplRemapInfo } -let OutputStorage (pps: TextWriter) s = - match s with - | StaticPropertyWithField _ -> pps.Write "(top)" - | StaticProperty _ -> pps.Write "(top)" - | Method _ -> pps.Write "(top)" - | Local _ -> pps.Write "(local)" - | Arg _ -> pps.Write "(arg)" - | Env _ -> pps.Write "(env)" - | Null -> pps.Write "(null)" - //-------------------------------------------------------------------------- // Augment eenv with values //-------------------------------------------------------------------------- @@ -2840,7 +2818,6 @@ let LocalScope nm cgbuf (f: Mark * Mark -> 'a) : 'a = res let compileSequenceExpressions = true // try (System.Environment.GetEnvironmentVariable("FSHARP_COMPILED_SEQ") <> null) with _ -> false -let compileStateMachineExpressions = true // try (System.Environment.GetEnvironmentVariable("FSHARP_COMPILED_STATEMACHINES") <> null) with _ -> false //------------------------------------------------------------------------- // Sequence Point Logic @@ -8215,19 +8192,6 @@ and GenBinding cenv cgbuf eenv (bind: Binding) (isStateVar: bool) = GenDebugPointForBind cenv cgbuf bind GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar None -and ComputeMemberAccessRestrictedBySig eenv vspec = - let isHidden = - // Anything hidden by a signature gets assembly visibility - IsHiddenVal eenv.sigToImplRemapInfo vspec - || - // Anything that's not a module or member binding gets assembly visibility - not vspec.IsMemberOrModuleBinding - || - // Compiler generated members for class function 'let' bindings get assembly visibility - vspec.IsIncrClassGeneratedMember - - ComputeMemberAccess isHidden - and ComputeMethodAccessRestrictedBySig eenv vspec = let isHidden = // Anything hidden by a signature gets assembly visibility diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 69cb69d4106..4def1237b11 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -106,15 +106,6 @@ let GetResourceNameAndOptimizationDataFunc (r: ILResource) = let IsReflectedDefinitionsResource (r: ILResource) = r.Name.StartsWithOrdinal(QuotationPickler.SerializedReflectedDefinitionsResourceNameBase) -let MakeILResource rName bytes = - { - Name = rName - Location = ILResourceLocation.Local(ByteStorage.FromByteArray(bytes)) - Access = ILResourceAccess.Public - CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs - MetadataIndex = NoMetadataIdx - } - let PickleToResource inMem file (g: TcGlobals) compress scope rName p x = let file = PathMap.apply g.pathMap file diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index e831601fb86..0c48513b6c5 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -508,7 +508,6 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler // Compiler options //-------------------------------------------------------------------------- -let lexFilterVerbose = false let mutable enableConsoleColoring = true // global state let setFlag r n = @@ -709,11 +708,9 @@ let tagModule = "module" let tagFile = "" let tagFileList = "" let tagDirList = "" -let tagPathList = "" let tagResInfo = "" let tagFullPDBOnlyPortable = "{full|pdbonly|portable|embedded}" let tagWarnList = "" -let tagSymbolList = "" let tagAddress = "
" let tagAlgorithm = "{SHA1|SHA256}" let tagInt = "" @@ -769,24 +766,6 @@ let inputFileFlagsBoth (tcConfigB: TcConfigBuilder) = ) ] -let referenceFlagAbbrev (tcConfigB: TcConfigBuilder) = - CompilerOption( - "r", - tagFile, - OptionString(fun s -> tcConfigB.AddReferencedAssemblyByPath(rangeStartup, s)), - None, - Some(FSComp.SR.optsShortFormOf ("--reference")) - ) - -let compilerToolFlagAbbrev (tcConfigB: TcConfigBuilder) = - CompilerOption( - "t", - tagFile, - OptionString(fun s -> tcConfigB.AddCompilerToolsByPath s), - None, - Some(FSComp.SR.optsShortFormOf ("--compilertool")) - ) - let inputFileFlagsFsc tcConfigB = inputFileFlagsBoth tcConfigB let inputFileFlagsFsiBase (_tcConfigB: TcConfigBuilder) = @@ -2336,29 +2315,6 @@ let ApplyCommandLineArgs (tcConfigB: TcConfigBuilder, sourceFiles: string list, errorRecovery e range0 sourceFiles -//---------------------------------------------------------------------------- -// PrintWholeAssemblyImplementation -//---------------------------------------------------------------------------- - -let mutable showTermFileCount = 0 - -let PrintWholeAssemblyImplementation (tcConfig: TcConfig) outfile header expr = - if tcConfig.showTerms then - if tcConfig.writeTermsToFiles then - let fileName = outfile + ".terms" - - use f = - FileSystem - .OpenFileForWriteShim(fileName + "-" + string showTermFileCount + "-" + header, FileMode.Create) - .GetWriter() - - showTermFileCount <- showTermFileCount + 1 - LayoutRender.outL f (Display.squashTo 192 (DebugPrint.implFilesL expr)) - else - dprintf "\n------------------\nshowTerm: %s:\n" header - LayoutRender.outL stderr (Display.squashTo 192 (DebugPrint.implFilesL expr)) - dprintf "\n------------------\n" - //---------------------------------------------------------------------------- // ReportTime //---------------------------------------------------------------------------- diff --git a/src/Compiler/Facilities/CompilerLocation.fs b/src/Compiler/Facilities/CompilerLocation.fs index 24141252ee8..9531acb2cae 100644 --- a/src/Compiler/Facilities/CompilerLocation.fs +++ b/src/Compiler/Facilities/CompilerLocation.fs @@ -48,11 +48,6 @@ module internal FSharpEnvironment = let ofString s = if String.IsNullOrEmpty(s) then None else Some(s) - // MaxPath accounts for the null-terminating character, for example, the maximum path on the D drive is "D:\<256 chars>\0". - // See: ndp\clr\src\BCL\System\IO\Path.cs - let maxPath = 260 - let maxDataLength = (System.Text.UTF32Encoding()).GetMaxByteCount(maxPath) - let internal tryCurrentDomain () = let pathFromCurrentDomain = AppDomain.CurrentDomain.BaseDirectory diff --git a/src/Compiler/Optimize/DetupleArgs.fs b/src/Compiler/Optimize/DetupleArgs.fs index dc2ea60f6e7..4f749a689c1 100644 --- a/src/Compiler/Optimize/DetupleArgs.fs +++ b/src/Compiler/Optimize/DetupleArgs.fs @@ -388,9 +388,7 @@ let rebuildTS g m ts vs = /// - the definition formal projection info suggests a CallPattern type CallPattern = TupleStructure list -let callPatternOrder = (compare : CallPattern -> CallPattern -> int) let argsCP exprs = List.map exprTS exprs -let noArgsCP = [] let inline isTrivialCP xs = isNil xs let rec minimalCallPattern callPattern = @@ -826,25 +824,6 @@ let passBinds penv binds = binds |> List.map (passBind penv) // 3. run pass over following code. //------------------------------------------------------------------------- -let passBindRhs conv (TBind (v, repr, letSeqPtOpt)) = TBind(v, conv repr, letSeqPtOpt) - -let preInterceptExpr (penv: penv) conv expr = - match expr with - | Expr.LetRec (binds, e, m, _) -> - let binds = List.map (passBindRhs conv) binds - let binds = passBinds penv binds - Some (mkLetRecBinds m binds (conv e)) - | Expr.Let (bind, e, m, _) -> - let bind = passBindRhs conv bind - let bind = passBind penv bind - Some (mkLetBind m bind (conv e)) - | TyappAndApp(f, fty, tys, args, m) -> - // match app, and fixup if needed - let args = List.map conv args - let f = conv f - Some (fixupApp penv (f, fty, tys, args, m) ) - | _ -> None - let postTransformExpr (penv: penv) expr = match expr with | Expr.LetRec (binds, e, m, _) -> diff --git a/src/Compiler/Optimize/LowerComputedCollections.fs b/src/Compiler/Optimize/LowerComputedCollections.fs index e3c120d0697..f2f3e4f6245 100644 --- a/src/Compiler/Optimize/LowerComputedCollections.fs +++ b/src/Compiler/Optimize/LowerComputedCollections.fs @@ -15,8 +15,6 @@ open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.TypeHierarchy -let LowerComputedCollectionsStackGuardDepth = StackGuard.GetDepthOption "LowerComputedCollections" - /// Build the 'test and dispose' part of a 'use' statement let BuildDisposableCleanup tcVal (g: TcGlobals) infoReader m (v: Val) = let disposeMethod = diff --git a/src/Compiler/Optimize/LowerSequences.fs b/src/Compiler/Optimize/LowerSequences.fs index 294635559c9..3a7d733ec59 100644 --- a/src/Compiler/Optimize/LowerSequences.fs +++ b/src/Compiler/Optimize/LowerSequences.fs @@ -17,8 +17,6 @@ open FSharp.Compiler.TypedTreeBasics open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.TypeHierarchy -let LowerSequenceExpressionsStackGuardDepth = StackGuard.GetDepthOption "LowerSequenceExpressions" - //---------------------------------------------------------------------------- // General helpers diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 54665570cc5..343d911aa4d 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -36,16 +36,6 @@ open System.Collections.ObjectModel let OptimizerStackGuardDepth = GetEnvInteger "FSHARP_Optimizer" 50 -#if DEBUG -let verboseOptimizationInfo = - try not (System.String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable "FSHARP_verboseOptimizationInfo")) with _ -> false -let verboseOptimizations = - try not (System.String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable "FSHARP_verboseOptimizations")) with _ -> false -#else -let [] verboseOptimizationInfo = false -let [] verboseOptimizations = false -#endif - let i_ldlen = [ I_ldlen; (AI_conv DT_I4) ] /// size of a function call @@ -744,8 +734,6 @@ let mkUInt32Val (g: TcGlobals) n = ConstValue(Const.UInt32 n, g.uint32_ty) let mkUInt64Val (g: TcGlobals) n = ConstValue(Const.UInt64 n, g.uint64_ty) -let (|StripInt32Value|_|) = function StripConstValue(Const.Int32 n) -> Some n | _ -> None - let MakeValueInfoForValue g m vref vinfo = #if DEBUG let rec check x = diff --git a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs index 55ff01779f5..15f01224e78 100644 --- a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs +++ b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs @@ -522,21 +522,6 @@ module InterfaceStubGenerator = | Some ty -> Some ty | None -> None - let internal (|EventFunctionType|_|) (ty: FSharpType) = - match ty with - | MemberFunctionType ty -> - if ty.IsFunctionType && ty.GenericArguments.Count = 2 then - let retType = ty.GenericArguments[0] - let argType = ty.GenericArguments[1] - - if argType.GenericArguments.Count = 2 then - Some(argType.GenericArguments[0], retType) - else - None - else - None - | _ -> None - let internal removeWhitespace (str: string) = str.Replace(" ", "") /// Filter out duplicated interfaces in inheritance chain diff --git a/src/Compiler/Service/ServiceLexing.fs b/src/Compiler/Service/ServiceLexing.fs index c39546e975d..ac28ec245aa 100644 --- a/src/Compiler/Service/ServiceLexing.fs +++ b/src/Compiler/Service/ServiceLexing.fs @@ -27,7 +27,6 @@ module FSharpTokenTag = let String = tagOfToken (STRING("a", SynStringKind.Regular, LexCont.Default)) let IDENT = tagOfToken (IDENT "a") - let HASH_IDENT = tagOfToken (HASH_IDENT "a") let STRING = String let INTERP_STRING_BEGIN_END = diff --git a/src/Compiler/Service/ServiceStructure.fs b/src/Compiler/Service/ServiceStructure.fs index e9468f63357..2a3e60fc7bb 100644 --- a/src/Compiler/Service/ServiceStructure.fs +++ b/src/Compiler/Service/ServiceStructure.fs @@ -64,18 +64,6 @@ module Structure = |> List.map (fun (SynTyparDecl (_, typarg)) -> typarg.Range) |> List.reduce unionRanges - let rangeOfSynPatsElse other (synPats: SynSimplePat list) = - match synPats with - | [] -> other - | ls -> - ls - |> List.map (fun x -> - match x with - | SynSimplePat.Attrib (range = r) - | SynSimplePat.Id (range = r) - | SynSimplePat.Typed (range = r) -> r) - |> List.reduce unionRanges - /// Collapse indicates the way a range/snapshot should be collapsed. `Same` is for a scope inside /// some kind of scope delimiter, e.g. `[| ... |]`, `[ ... ]`, `{ ... }`, etc. `Below` is for expressions /// following a binding or the right hand side of a pattern, e.g. `let x = ...` diff --git a/src/Compiler/Symbols/SymbolHelpers.fs b/src/Compiler/Symbols/SymbolHelpers.fs index a3232c3db39..5f028e020b6 100644 --- a/src/Compiler/Symbols/SymbolHelpers.fs +++ b/src/Compiler/Symbols/SymbolHelpers.fs @@ -229,14 +229,6 @@ module internal SymbolHelpers = | Some dir -> Path.Combine(dir, file) else file - /// Cut long filenames to make them visually appealing - let cutFileName s = if String.length s > 40 then String.sub s 0 10 + "..."+String.sub s (String.length s - 27) 27 else s - - let libFileOfEntityRef x = - match x with - | ERefLocal _ -> None - | ERefNonLocal nlref -> nlref.Ccu.FileName - let ParamNameAndTypesOfUnaryCustomOperation g minfo = match minfo with | FSMeth(_, _, vref, _) -> @@ -517,14 +509,6 @@ module internal SymbolHelpers = | Item.DelegateCtor _ | Item.ModuleOrNamespaces [] -> 0 ) } - - let ItemWithTypeDisplayPartialEquality g = - let itemComparer = ItemDisplayPartialEquality g - - { new IPartialEqualityComparer with - member x.InEqualityRelation ((item, _)) = itemComparer.InEqualityRelation item - member x.Equals((item1, _), (item2, _)) = itemComparer.Equals(item1, item2) - member x.GetHashCode ((item, _)) = itemComparer.GetHashCode item } /// Remove all duplicate items let RemoveDuplicateItems g (items: ItemWithInst list) = diff --git a/src/Compiler/Symbols/SymbolPatterns.fs b/src/Compiler/Symbols/SymbolPatterns.fs index e44375cb97c..44b77965a28 100644 --- a/src/Compiler/Symbols/SymbolPatterns.fs +++ b/src/Compiler/Symbols/SymbolPatterns.fs @@ -29,8 +29,6 @@ module FSharpSymbolPatterns = res))) |> Option.isSome - let UnnamedUnionFieldRegex = Regex("^Item(\d+)?$", RegexOptions.Compiled) - let (|AbbreviatedType|_|) (entity: FSharpEntity) = if entity.IsFSharpAbbreviation then Some entity.AbbreviatedType else None diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index 14a43332424..09f0bafbea0 100644 --- a/src/Compiler/SyntaxTree/LexFilter.fs +++ b/src/Compiler/SyntaxTree/LexFilter.fs @@ -149,11 +149,6 @@ let isInfix token = | QMARK_QMARK -> true | _ -> false -let isNonAssocInfixToken token = - match token with - | EQUALS -> true - | _ -> false - let infixTokenLength token = match token with | COMMA -> 1 @@ -393,16 +388,6 @@ let rec isWithAugmentBlockContinuator token = | ODUMMY token -> isWithAugmentBlockContinuator token | _ -> false -let isLongIdentifier token = - match token with - | IDENT _ | DOT -> true - | _ -> false - -let isLongIdentifierOrGlobal token = - match token with - | GLOBAL | IDENT _ | DOT -> true - | _ -> false - let isAtomicExprEndToken token = match token with | IDENT _ diff --git a/src/Compiler/SyntaxTree/LexHelpers.fs b/src/Compiler/SyntaxTree/LexHelpers.fs index ee6b39a5a93..f5c83752477 100644 --- a/src/Compiler/SyntaxTree/LexHelpers.fs +++ b/src/Compiler/SyntaxTree/LexHelpers.fs @@ -429,8 +429,6 @@ module Keywords = tab - let KeywordToken s = keywordTable[s] - let IdentifierToken args (lexbuf: Lexbuf) (s: string) = if IsCompilerGeneratedName s then warning (Error(FSComp.SR.lexhlpIdentifiersContainingAtSymbolReserved (), lexbuf.LexemeRange)) diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 20171928a41..b87db718b3a 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -141,22 +141,6 @@ let rec instTyparRef tpinst ty tp = if typarEq tp tpR then tyR else instTyparRef t ty tp -let instMeasureTyparRef tpinst unt (tp: Typar) = - match tp.Kind with - | TyparKind.Measure -> - let rec loop tpinst = - match tpinst with - | [] -> unt - | (tpR, tyR) :: t -> - if typarEq tp tpR then - match tyR with - | TType_measure unt -> unt - | _ -> failwith "instMeasureTyparRef incorrect kind" - else - loop t - loop tpinst - | _ -> failwith "instMeasureTyparRef: kind=Type" - let remapTyconRef (tcmap: TyconRefMap<_>) tcref = match tcmap.TryFind tcref with | Some tcref -> tcref @@ -270,12 +254,6 @@ and remapTyparConstraintsAux tyenv cs = | TyparConstraint.IsReferenceType _ | TyparConstraint.RequiresDefaultConstructor _ -> Some x) -and remapTraitWitnessInfo tyenv (TraitWitnessInfo(tys, nm, flags, argTys, retTy)) = - let tysR = remapTypesAux tyenv tys - let argTysR = remapTypesAux tyenv argTys - let rtyR = Option.map (remapTypeAux tyenv) retTy - TraitWitnessInfo(tysR, nm, flags, argTysR, rtyR) - and remapTraitInfo tyenv (TTrait(tys, nm, flags, argTys, retTy, slnCell)) = let slnCell = match slnCell.Value with @@ -1253,8 +1231,6 @@ let isRefTupleExpr e = match e with Expr.Op (TOp.Tuple tupInfo, _, _, _) -> not let tryDestRefTupleExpr e = match e with Expr.Op (TOp.Tuple tupInfo, _, es, _) when not (evalTupInfoIsStruct tupInfo) -> es | _ -> [e] -let rangeOfExpr (x: Expr) = x.Range - //--------------------------------------------------------------------------- // Build nodes in decision graphs //--------------------------------------------------------------------------- @@ -1356,10 +1332,6 @@ let mkCompGenBinds (vs: Val list) (es: Expr list) = List.map2 mkCompGenBind vs e let mkCompGenLet m v x body = mkLetBind m (mkCompGenBind v x) body -let mkCompGenLets m vs xs body = mkLetsBind m (mkCompGenBinds vs xs) body - -let mkCompGenLetsFromBindings m vs xs body = mkLetsFromBindings m (mkCompGenBinds vs xs) body - let mkInvisibleBind v e = TBind(v, e, DebugPointAtBinding.NoneAtInvisible) let mkInvisibleBinds (vs: Val list) (es: Expr list) = List.map2 mkInvisibleBind vs es @@ -2270,11 +2242,6 @@ and accFreeInTrait opts (TTrait(tys, _, _, argTys, retTy, sln)) acc = (accFreeInTypes opts argTys (Option.foldBack (accFreeInType opts) retTy acc))) -and accFreeInWitnessArg opts (TraitWitnessInfo(tys, _nm, _mf, argTys, retTy)) acc = - accFreeInTypes opts tys - (accFreeInTypes opts argTys - (Option.foldBack (accFreeInType opts) retTy acc)) - and accFreeInTraitSln opts sln acc = match sln with | ILMethSln(ty, _, _, minst, staticTyOpt) -> @@ -2785,7 +2752,6 @@ let generalizedTyconRef (g: TcGlobals) tcref = let tinst = generalTyconRefInst tcref TType_app(tcref, tinst, g.knownWithoutNull) -let isTTyparSupportsStaticMethod = function TyparConstraint.MayResolveMember _ -> true | _ -> false let isTTyparCoercesToType = function TyparConstraint.CoercesTo _ -> true | _ -> false //-------------------------------------------------------------------------- @@ -2919,8 +2885,6 @@ module PrettyTypes = let safeDestAnyParTy orig g ty = match tryAnyParTy g ty with ValueNone -> orig | ValueSome x -> x let foldUnurriedArgInfos f z (x: UncurriedArgInfos) = List.fold (fold1Of2 f) z x - let mapUnurriedArgInfos f (x: UncurriedArgInfos) = List.map (map1Of2 f) x - let foldTypar f z (x: Typar) = foldOn mkTyparTy f z x let mapTypar g f (x: Typar) : Typar = (mkTyparTy >> f >> safeDestAnyParTy x g) x @@ -3394,7 +3358,6 @@ let TryDecodeILAttribute tref (attrs: ILAttributes) = // F# view of attributes (these get converted to AbsIL attributes in ilxgen) let IsMatchingFSharpAttribute g (AttribInfo(_, tcref)) (Attrib(tcref2, _, _, _, _, _, _)) = tyconRefEq g tcref tcref2 let HasFSharpAttribute g tref attrs = List.exists (IsMatchingFSharpAttribute g tref) attrs -let findAttrib g tref attrs = List.find (IsMatchingFSharpAttribute g tref) attrs let TryFindFSharpAttribute g tref attrs = List.tryFind (IsMatchingFSharpAttribute g tref) attrs let TryFindFSharpAttributeOpt g tref attrs = match tref with None -> None | Some tref -> List.tryFind (IsMatchingFSharpAttribute g tref) attrs @@ -3851,20 +3814,10 @@ module DebugPrint = let mutable layoutStamps = false let mutable layoutValReprInfo = false - let squareAngleL l = LeftL.leftBracketAngle ^^ l ^^ RightL.rightBracketAngle - - let angleL l = sepL leftAngle ^^ l ^^ rightL rightAngle - - let braceL l = leftL leftBrace ^^ l ^^ rightL rightBrace - let braceBarL l = leftL leftBraceBar ^^ l ^^ rightL rightBraceBar - let boolL b = if b then WordL.keywordTrue else WordL.keywordFalse - let intL (n: int) = wordL (tagNumericLiteral (string n)) - let int64L (n: int64) = wordL (tagNumericLiteral (string n)) - let qlistL f xmap = QueueList.foldBack (fun x z -> z @@ f x) xmap emptyL let bracketIfL b lyt = if b then bracketL lyt else lyt @@ -3881,6 +3834,7 @@ module DebugPrint = let angleBracketListL l = angleBracketL (sepListL (sepL (tagText ",")) l) +#if DEBUG let layoutMemberFlags (memFlags: SynMemberFlags) = let stat = if memFlags.IsInstance || (memFlags.MemberKind = SynMemberKind.Constructor) then emptyL @@ -3890,6 +3844,7 @@ module DebugPrint = elif memFlags.IsOverrideOrExplicitImpl then stat ++ wordL (tagText "override") else stat stat +#endif let stampL (n: Stamp) w = if layoutStamps then w ^^ wordL (tagText ("#" + string n)) else w @@ -3998,8 +3953,6 @@ module DebugPrint = and auxTypar2L env typar = auxTyparWrapL env false typar - and auxTyparAtomL env typar = auxTyparWrapL env true typar - and auxTyparConstraintTypL env ty = auxTypeL env ty and auxTraitL env (ttrait: TraitConstraintInfo) = @@ -4056,8 +4009,6 @@ module DebugPrint = and typarL tp = auxTypar2L SimplifyTypes.typeSimplificationInfo0 tp - and typarAtomL tp = auxTyparAtomL SimplifyTypes.typeSimplificationInfo0 tp - and typeAtomL tau = let tau, cxs = tau, [] let env = SimplifyTypes.CollectInfo false [tau] cxs @@ -4120,6 +4071,7 @@ module DebugPrint = ^^ (if v.IsMutable then wordL(tagText "mutable ") else emptyL) ^^ (if layoutTypes then wordL (tagText ":") ^^ typeL v.Type else emptyL) +#if DEBUG let tslotparamL (TSlotParam(nmOpt, ty, inFlag, outFlag, _, _)) = (optionL (tagText >> wordL) nmOpt) ^^ wordL(tagText ":") ^^ @@ -4127,6 +4079,7 @@ module DebugPrint = (if inFlag then wordL(tagText "[in]") else emptyL) ^^ (if outFlag then wordL(tagText "[out]") else emptyL) ^^ (if inFlag then wordL(tagText "[opt]") else emptyL) +#endif let slotSigL (slotsig: SlotSig) = #if DEBUG @@ -4144,12 +4097,7 @@ module DebugPrint = wordL(tagText "slotsig") #endif - let rec memberL (g:TcGlobals) (v: Val) (membInfo: ValMemberInfo) = - aboveListL - [ wordL(tagText "compiled_name! = ") ^^ wordL (tagText (v.CompiledName g.CompilerGlobalState)) - wordL(tagText "membInfo-slotsig! = ") ^^ listL slotSigL membInfo.ImplementedSlotSigs ] - - and valAtBindL v = + let valAtBindL v = let vL = valL v let vL = (if v.IsMutable then wordL(tagText "mutable") ++ vL else vL) let vL = @@ -4167,8 +4115,6 @@ module DebugPrint = let recdFieldRefL (rfref: RecdFieldRef) = wordL (tagText rfref.FieldName) - let identL (id: Ident) = wordL (tagText id.idText) - // Note: We need nice printing of constants in order to print literals and attributes let constL c = let str = @@ -4612,9 +4558,6 @@ module DebugPrint = and implFileL (CheckedImplFile (signature=implFileTy; contents=implFileContents)) = aboveListL [(wordL(tagText "top implementation ")) @@-- mexprL implFileTy implFileContents] - and ccuL (ccu: CcuThunk) = - entityL ccu.Contents - let showType x = showL (typeL x) let showExpr x = showL (exprL x) @@ -5655,9 +5598,6 @@ let bindLocalVal (v: Val) (v': Val) tmenv = let bindLocalVals vs vs' tmenv = { tmenv with valRemap= (vs, vs', tmenv.valRemap) |||> List.foldBack2 (fun v v' acc -> acc.Add v (mkLocalValRef v') ) } -let bindTycon (tc: Tycon) (tc': Tycon) tyenv = - { tyenv with tyconRefRemap=tyenv.tyconRefRemap.Add (mkLocalTyconRef tc) (mkLocalTyconRef tc') } - let bindTycons tcs tcs' tyenv = { tyenv with tyconRefRemap= (tcs, tcs', tyenv.tyconRefRemap) |||> List.foldBack2 (fun tc tc' acc -> acc.Add (mkLocalTyconRef tc) (mkLocalTyconRef tc')) } @@ -8029,8 +7969,6 @@ let TryDecodeTypeProviderAssemblyAttr (cattr: ILAttribute) : string MaybeNull op let tname_SignatureDataVersionAttr = FSharpLib.Core + ".FSharpInterfaceDataVersionAttribute" -let tnames_SignatureDataVersionAttr = splitILTypeName tname_SignatureDataVersionAttr - let tref_SignatureDataVersionAttr fsharpCoreAssemblyScopeRef = mkILTyRef(fsharpCoreAssemblyScopeRef, tname_SignatureDataVersionAttr) let mkSignatureDataVersionAttr (g: TcGlobals) (version: ILVersionInfo) = @@ -8281,13 +8219,6 @@ let AdjustValForExpectedValReprInfo g m (vref: ValRef) flags valReprInfo = // Build a type-lambda expression for the toplevel value if needed... mkTypeLambda m tpsR (tauexpr, tauty), tpsR +-> tauty -let IsSubsumptionExpr g expr = - match expr with - | Expr.Op (TOp.Coerce, [inputTy;actualTy], [_], _) -> - isFunTy g actualTy && isFunTy g inputTy - | _ -> - false - let stripTupledFunTy g ty = let argTys, retTy = stripFunTy g ty let curriedArgTys = argTys |> List.map (tryDestRefTupleTy g) @@ -8854,7 +8785,6 @@ let XmlDocSigOfEntity (eref: EntityRef) = let enum_CompilationRepresentationAttribute_Static = 0b0000000000000001 let enum_CompilationRepresentationAttribute_Instance = 0b0000000000000010 -let enum_CompilationRepresentationAttribute_StaticInstanceMask = 0b0000000000000011 let enum_CompilationRepresentationAttribute_ModuleSuffix = 0b0000000000000100 let enum_CompilationRepresentationAttribute_PermitNull = 0b0000000000001000 @@ -10322,14 +10252,6 @@ let (|ResumableEntryMatchExpr|_|) g expr = | _ -> None | _ -> None -let (|PossiblyCompiledTypeOfExpr|_|) g expr = - match expr with - | TypeOfExpr g ty -> Some ty - | Expr.Op(TOp.ILCall (_, _, _, _, _, _, _, ilMethRef, _, _, _), [],[Expr.Op (TOp.ILAsm ([ I_ldtoken (ILToken.ILType _) ], _), [ty], _, _)], _) - when ilMethRef.DeclaringTypeRef.Name = "System.Type" && ilMethRef.Name = "GetTypeFromHandle" -> - Some ty - | _ -> None - let (|StructStateMachineExpr|_|) g expr = match expr with | ValApp g g.cgh__stateMachine_vref ([dataTy; _resultTy], [moveNext; setStateMachine; afterCode], _m) -> diff --git a/src/Compiler/TypedTree/TypedTreePickle.fs b/src/Compiler/TypedTree/TypedTreePickle.fs index 90fd15fa1e2..f19ca1caaa1 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fs +++ b/src/Compiler/TypedTree/TypedTreePickle.fs @@ -240,8 +240,6 @@ let bits_of_float32 (x: float32) = System.BitConverter.ToInt32(System.BitConvert let bits_of_float (x: float) = System.BitConverter.DoubleToInt64Bits x let p_single i st = p_int32 (bits_of_float32 i) st -let p_double i st = p_int64 (bits_of_float i) st -let p_ieee64 i st = p_int64 (bits_of_float i) st let p_char i st = p_uint16 (uint16 (int32 i)) st let inline p_tup2 p1 p2 (a, b) (st: WriterState) = @@ -259,18 +257,9 @@ let inline p_tup5 p1 p2 p3 p4 p5 (a, b, c, d, e) (st: WriterState) = let inline p_tup6 p1 p2 p3 p4 p5 p6 (a, b, c, d, e, f) (st: WriterState) = (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit) -let inline p_tup7 p1 p2 p3 p4 p5 p6 p7 (a, b, c, d, e, f, x7) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit) - -let inline p_tup8 p1 p2 p3 p4 p5 p6 p7 p8 (a, b, c, d, e, f, x7, x8) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit); (p8 x8 st : unit) - let inline p_tup9 p1 p2 p3 p4 p5 p6 p7 p8 p9 (a, b, c, d, e, f, x7, x8, x9) (st: WriterState) = (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit); (p8 x8 st : unit); (p9 x9 st : unit) -let inline p_tup10 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 (a, b, c, d, e, f, x7, x8, x9, x10) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit); (p8 x8 st : unit); (p9 x9 st : unit); (p10 x10 st : unit) - let inline p_tup11 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 (a, b, c, d, e, f, x7, x8, x9, x10, x11) (st: WriterState) = (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit); (p8 x8 st : unit); (p9 x9 st : unit); (p10 x10 st : unit); (p11 x11 st : unit) @@ -327,10 +316,6 @@ let float32_of_bits (x: int32) = System.BitConverter.ToSingle(System.BitConverte let float_of_bits (x: int64) = System.BitConverter.Int64BitsToDouble x let u_single st = float32_of_bits (u_int32 st) -let u_double st = float_of_bits (u_int64 st) - -let u_ieee64 st = float_of_bits (u_int64 st) - let u_char st = char (int32 (u_uint16 st)) let u_space n st = for i = 0 to n - 1 do @@ -370,57 +355,18 @@ let inline u_tup5 p1 p2 p3 p4 p5 (st: ReaderState) = let inline u_tup6 p1 p2 p3 p4 p5 p6 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in (a, b, c, d, e, f) -let inline u_tup7 p1 p2 p3 p4 p5 p6 p7 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in (a, b, c, d, e, f, x7) - let inline u_tup8 p1 p2 p3 p4 p5 p6 p7 p8 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in (a, b, c, d, e, f, x7, x8) let inline u_tup9 p1 p2 p3 p4 p5 p6 p7 p8 p9 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in let x9 = p9 st in (a, b, c, d, e, f, x7, x8, x9) -let inline u_tup10 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in (a, b, c, d, e, f, x7, x8, x9, x10) - -let inline u_tup11 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in (a, b, c, d, e, f, x7, x8, x9, x10, x11) - -let inline u_tup12 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12) - let inline u_tup13 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13) -let inline u_tup14 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in - let x14 = p14 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14) -let inline u_tup15 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in - let x14 = p14 st in let x15 = p15 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14, x15) - -let inline u_tup16 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in - let x14 = p14 st in let x15 = p15 st in let x16 = p16 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) - let inline u_tup17 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in @@ -489,17 +435,6 @@ let p_array f (x: 'T[]) st = p_int x.Length st p_array_core f x st -// Optionally encode an extra item using a marker bit. -// When extraf is None, the marker bit is not set, and this is identical to p_array. -let p_array_ext extraf f (x: 'T[]) st = - let n = x.Length - let n = if Option.isSome extraf then n ||| 0x80000000 else n - p_int n st - match extraf with - | None -> () - | Some f -> f st - p_array_core f x st - let p_list_core f (xs: 'T list) st = for x in xs do f x st @@ -587,18 +522,6 @@ let u_array f st = let n = u_int st u_array_core f n st -// Optionally decode an extra item if a marker bit is present. -// When the marker bit is not set this is identical to u_array, and extraf is not called -let u_array_ext extraf f st = - let n = u_int st - let extraItem = - if n &&& 0x80000000 = 0x80000000 then - Some (extraf st) - else - None - let arr = u_array_core f (n &&& 0x7FFFFFFF) st - extraItem, arr - let u_list_core f n st = List.init n (fun _ -> f st) @@ -628,13 +551,6 @@ let u_List f st = List(u_array f st) let u_List f st = u_array f st #endif -let u_array_revi f st = - let n = u_int st - let res = Array.zeroCreate n - for i = 0 to n-1 do - res[i] <- f st (n-1-i) - res - // Mark up default constraints with a priority in reverse order: last gets 0 etc. See comment on TyparConstraint.DefaultsTo let u_list_revi f st = let n = u_int st @@ -706,18 +622,13 @@ let lookup_string st stringTab x = lookup_uniq st stringTab x let u_encoded_string = u_prim_string let u_string st = lookup_uniq st st.istrings (u_int st) let u_strings = u_list u_string -let u_ints = u_list u_int - - let p_encoded_string = p_prim_string let p_string s st = p_int (encode_string st.ostrings s) st let p_strings = p_list p_string -let p_ints = p_list p_int // CCU References // A huge number of these occur in pickled F# data, so make them unique let encode_ccuref ccuTab (x: CcuThunk) = encode_uniq ccuTab x.AssemblyName -let decode_ccuref x = x let lookup_ccuref st ccuTab x = lookup_uniq st ccuTab x let u_encoded_ccuref st = match u_byte st with @@ -734,7 +645,6 @@ let p_ccuref s st = p_int (encode_ccuref st.occus s) st // References to public items in this module // A huge number of these occur in pickled F# data, so make them unique let decode_pubpath st stringTab a = PubPath(Array.map (lookup_string st stringTab) a) -let lookup_pubpath st pubpathTab x = lookup_uniq st pubpathTab x let u_encoded_pubpath = u_array u_int let u_pubpath st = lookup_uniq st st.ipubpaths (u_int st) @@ -771,13 +681,10 @@ let p_nleref x st = p_int (encode_nleref st.occus st.ostrings st.onlerefs st.osc // Simple types are types like "int", represented as TType(Ref_nonlocal(..., "int"), []). // A huge number of these occur in pickled F# data, so make them unique. let decode_simpletyp st _ccuTab _stringTab nlerefTab a = TType_app(ERefNonLocal (lookup_nleref st nlerefTab a), [], 0uy) -let lookup_simpletyp st simpleTyTab x = lookup_uniq st simpleTyTab x let u_encoded_simpletyp st = u_int st -let u_encoded_anoninfo st = u_int st let u_simpletyp st = lookup_uniq st st.isimpletys (u_int st) let encode_simpletyp ccuTab stringTab nlerefTab simpleTyTab thisCcu a = encode_uniq simpleTyTab (encode_nleref ccuTab stringTab nlerefTab thisCcu a) let p_encoded_simpletyp x st = p_int x st -let p_encoded_anoninfo x st = p_int x st let p_simpletyp x st = p_int (encode_simpletyp st.occus st.ostrings st.onlerefs st.osimpletys st.oscope x) st /// Arbitrary value @@ -1152,7 +1059,6 @@ let [] itag_shr_un = 17 let [] itag_neg = 18 let [] itag_not = 19 let [] itag_conv = 20 -let [] itag_conv_un = 21 let [] itag_conv_ovf = 22 let [] itag_conv_ovf_un = 23 let [] itag_callvirt = 24 @@ -1881,9 +1787,7 @@ let u_istype st = let u_cpath st = let a, b = u_tup2 u_ILScopeRef (u_list (u_tup2 u_string u_istype)) st in (CompPath(a, b)) - -let rec dummy x = x -and p_tycon_repr x st = +let rec p_tycon_repr x st = // The leading "p_byte 1" and "p_byte 0" come from the F# 2.0 format, which used an option value at this point. match x with | TFSharpRecdRepr fs -> p_byte 1 st; p_byte 0 st; p_rfield_table fs st; false @@ -1922,8 +1826,6 @@ and p_unioncase_spec x st = p_string x.XmlDocSig st p_access x.Accessibility st -and p_exnc_spec_data x st = p_entity_spec_data x st - and p_exnc_repr x st = match x with | TExnAbbrevRepr x -> p_byte 0 st; (p_tcref "exn abbrev") x st @@ -1931,8 +1833,6 @@ and p_exnc_repr x st = | TExnFresh x -> p_byte 2 st; p_rfield_table x st | TExnNone -> p_byte 3 st -and p_exnc_spec x st = p_entity_spec x st - and p_access (TAccess n) st = p_list p_cpath n st and p_recdfield_spec x st = @@ -2149,8 +2049,6 @@ and u_unioncase_spec st = Accessibility=i OtherRangeOpt=None } -and u_exnc_spec_data st = u_entity_spec_data st - and u_exnc_repr st = let tag = u_byte st match tag with @@ -2160,8 +2058,6 @@ and u_exnc_repr st = | 3 -> TExnNone | _ -> ufailwith st "u_exnc_repr" -and u_exnc_spec st = u_entity_spec st - and u_access st = match u_list u_cpath st with | [] -> taccessPublic // save unnecessary allocations diff --git a/src/Compiler/Utilities/FileSystem.fs b/src/Compiler/Utilities/FileSystem.fs index 722978e8513..1614400bb48 100644 --- a/src/Compiler/Utilities/FileSystem.fs +++ b/src/Compiler/Utilities/FileSystem.fs @@ -35,8 +35,6 @@ module internal Bytes = let zeroCreate n : byte[] = Array.zeroCreate n - let sub (b: byte[]) s l = Array.sub b s l - let blit (a: byte[]) b c d e = Array.blit a b c d e let ofInt32Array (arr: int[]) = diff --git a/src/Compiler/Utilities/ImmutableArray.fs b/src/Compiler/Utilities/ImmutableArray.fs index 985799856c0..87774061fb1 100644 --- a/src/Compiler/Utilities/ImmutableArray.fs +++ b/src/Compiler/Utilities/ImmutableArray.fs @@ -74,36 +74,6 @@ module ImmutableArray = builder.MoveToImmutable() - let map2 (mapper: 'T1 -> 'T2 -> 'T) (arr1: ImmutableArray<'T1>) (arr2: ImmutableArray<'T2>) : ImmutableArray<_> = - if arr1.Length <> arr2.Length then - invalidOp "Block lengths do not match." - - match arr1.Length with - | 0 -> ImmutableArray.Empty - | 1 -> ImmutableArray.Create(mapper arr1[0] arr2[0]) - | n -> - let builder = ImmutableArray.CreateBuilder(n) - - for i = 0 to n - 1 do - builder.Add(mapper arr1[i] arr2[i]) - - builder.MoveToImmutable() - - let mapi2 (mapper: int -> 'T1 -> 'T2 -> 'T) (arr1: ImmutableArray<'T1>) (arr2: ImmutableArray<'T2>) : ImmutableArray<_> = - if arr1.Length <> arr2.Length then - invalidOp "Block lengths do not match." - - match arr1.Length with - | 0 -> ImmutableArray.Empty - | 1 -> ImmutableArray.Create(mapper 0 arr1[0] arr2[0]) - | n -> - let builder = ImmutableArray.CreateBuilder(n) - - for i = 0 to n - 1 do - builder.Add(mapper i arr1[i] arr2[i]) - - builder.MoveToImmutable() - let concat (arrs: ImmutableArray>) : ImmutableArray<'T> = match arrs.Length with | 0 -> ImmutableArray.Empty diff --git a/src/Compiler/Utilities/illib.fs b/src/Compiler/Utilities/illib.fs index 8b066b3f489..0161ac65167 100644 --- a/src/Compiler/Utilities/illib.fs +++ b/src/Compiler/Utilities/illib.fs @@ -908,10 +908,6 @@ module Cancellable = let token () = Cancellable(fun ct -> ValueOrCancelled.Value ct) - /// Represents a canceled computation - let canceled () = - Cancellable(fun ct -> ValueOrCancelled.Cancelled(OperationCanceledException ct)) - type CancellableBuilder() = member inline _.Delay([] f) = diff --git a/src/Compiler/Utilities/sformat.fs b/src/Compiler/Utilities/sformat.fs index d3c1edc8ba2..5d42dae0b45 100644 --- a/src/Compiler/Utilities/sformat.fs +++ b/src/Compiler/Utilities/sformat.fs @@ -119,7 +119,6 @@ type IEnvironment = [] module TaggedText = let mkTag tag text = TaggedText(tag, text) - let length (tt: TaggedText) = tt.Text.Length let toText (tt: TaggedText) = tt.Text let tagClass name = mkTag TextTag.Class name @@ -135,8 +134,6 @@ module TaggedText = let tagMethod t = mkTag TextTag.Method t let tagPunctuation t = mkTag TextTag.Punctuation t let tagOperator t = mkTag TextTag.Operator t - let tagSpace t = mkTag TextTag.Space t - let leftParen = tagPunctuation "(" let rightParen = tagPunctuation ")" let comma = tagPunctuation "," @@ -146,7 +143,6 @@ module TaggedText = let rightBracket = tagPunctuation "]" let leftBrace = tagPunctuation "{" let rightBrace = tagPunctuation "}" - let space = tagSpace " " let equals = tagOperator "=" #if COMPILER @@ -201,6 +197,7 @@ module TaggedText = let tagFunction t = mkTag TextTag.Function t let tagNamespace t = mkTag TextTag.Namespace t let tagParameter t = mkTag TextTag.Parameter t + let tagSpace t = mkTag TextTag.Space t let tagStruct t = mkTag TextTag.Struct t let tagTypeParameter t = mkTag TextTag.TypeParameter t let tagActivePatternCase t = mkTag TextTag.ActivePatternCase t @@ -212,6 +209,7 @@ module TaggedText = // common tagged literals let lineBreak = tagLineBreak "\n" + let space = tagSpace " " let leftBraceBar = tagPunctuation "{|" let rightBraceBar = tagPunctuation "|}" let arrow = tagPunctuation "->" @@ -784,6 +782,7 @@ module Display = let rstrs, _ = addL z0 0 layout extract rstrs +#if COMPILER let outL outAttribute leafFormatter (chan: TaggedTextWriter) layout = // write layout to output chan directly let write s = chan.Write(s) @@ -828,6 +827,7 @@ module Display = let _ = addL z0 0 layout () +#endif let unpackCons recd = match recd with @@ -923,6 +923,7 @@ module Display = "\"" + s + "\"" +#if COMPILER // Return a truncated version of the string, e.g. // "This is the initial text, which has been truncated"+[12 chars] // @@ -943,6 +944,7 @@ module Display = + "+[" + (str.Length - prefixLength).ToString() + " chars]" +#endif type Precedence = | BracketIfTupleOrNotAtomic = 2 @@ -1584,12 +1586,14 @@ module Display = tagText t +#if COMPILER let any_to_layout options (value, typValue) = let formatter = ObjectGraphFormatter(options, BindingFlags.Public) formatter.Format(ShowAll, value, typValue) let squashTo width layout = layout |> squashToAux (width, leafFormatter FormatOptions.Default) +#endif let squash_layout options layout = // Print width = 0 implies 1D layout, no squash @@ -1598,6 +1602,7 @@ module Display = else layout |> squashToAux (options.PrintWidth, leafFormatter options) +#if COMPILER let asTaggedTextWriter (writer: TextWriter) = { new TaggedTextWriter with member _.Write(t) = writer.Write t.Text @@ -1608,27 +1613,13 @@ module Display = layout |> squash_layout options |> outL options.AttributeProcessor (leafFormatter options) writer - - let output_layout options writer layout = - output_layout_tagged options (asTaggedTextWriter writer) layout +#endif let layout_to_string options layout = layout |> squash_layout options |> showL options ((leafFormatter options) >> toText) - let output_any_ex opts oc x = - x |> any_to_layout opts |> output_layout opts oc - - let output_any writer x = - output_any_ex FormatOptions.Default writer x - - let layout_as_string options x = - x |> any_to_layout options |> layout_to_string options - - let any_to_string x = - layout_as_string FormatOptions.Default x - #if COMPILER let fsi_any_to_layout options (value, typValue) = let formatter = ObjectGraphFormatter(options, BindingFlags.Public) diff --git a/src/Compiler/Utilities/sformat.fsi b/src/Compiler/Utilities/sformat.fsi index 72afa8361d3..2707838552e 100644 --- a/src/Compiler/Utilities/sformat.fsi +++ b/src/Compiler/Utilities/sformat.fsi @@ -388,10 +388,6 @@ module internal Display = val squash_layout: options: FormatOptions -> layout: Layout -> Layout val output_layout_tagged: options: FormatOptions -> writer: TaggedTextWriter -> layout: Layout -> unit - - val output_layout: options: FormatOptions -> writer: TextWriter -> layout: Layout -> unit - - val layout_as_string: options: FormatOptions -> value: 'T * typValue: Type -> string #else // Most functions aren't needed in FSharp.Core.dll, but we add one inernal entry for printf diff --git a/src/Compiler/Utilities/sr.fs b/src/Compiler/Utilities/sr.fs index 77552a03b90..76b374aa311 100644 --- a/src/Compiler/Utilities/sr.fs +++ b/src/Compiler/Utilities/sr.fs @@ -29,7 +29,6 @@ module internal DiagnosticMessage = FSharpValue.MakeFunction(FSharpType.MakeFunctionType(tys[0], tys[1]), impl) let funTyC = typeof obj>.GetGenericTypeDefinition () - let mkFunTy a b = funTyC.MakeGenericType([| a; b |]) let isNamedType (ty: System.Type) = not (ty.IsArray || ty.IsByRef || ty.IsPointer) diff --git a/src/FSharp.Core/Linq.fs b/src/FSharp.Core/Linq.fs index 6b62eccb93e..040ccebfa91 100644 --- a/src/FSharp.Core/Linq.fs +++ b/src/FSharp.Core/Linq.fs @@ -36,7 +36,6 @@ module LeafExpressionConverter = { varEnv : Map } let asExpr x = (x :> Expression) - let bindingFlags = BindingFlags.Public ||| BindingFlags.NonPublic let instanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPointer) @@ -55,9 +54,6 @@ module LeafExpressionConverter = let tyargs = typ.GetGenericArguments() tyargs.[0], tyargs.[1] - let GetGenericMethodDefinition (methInfo:MethodInfo) = - if methInfo.IsGenericMethod then methInfo.GetGenericMethodDefinition() else methInfo - let StringConcat = methodhandleof (fun (x:obj, y:obj) -> String.Concat (x, y)) |> System.Reflection.MethodInfo.GetMethodFromHandle @@ -72,9 +68,6 @@ module LeafExpressionConverter = let showAll = BindingFlags.Public ||| BindingFlags.NonPublic - - let NullableConstructor = - typedefof>.GetConstructors().[0] let getNonNullableType typ = match Nullable.GetUnderlyingType typ with null -> typ | t -> t diff --git a/src/FSharp.Core/eventmodule.fs b/src/FSharp.Core/eventmodule.fs index fc3c2eabd64..00ab9d069b2 100644 --- a/src/FSharp.Core/eventmodule.fs +++ b/src/FSharp.Core/eventmodule.fs @@ -8,10 +8,6 @@ open Microsoft.FSharp.Control [] [] module Event = - [] - let create<'T> () = - let ev = new Event<'T>() - ev.Trigger, ev.Publish [] let map mapping (sourceEvent: IEvent<'Delegate, 'T>) = diff --git a/src/FSharp.Core/fslib-extra-pervasives.fs b/src/FSharp.Core/fslib-extra-pervasives.fs index c04d02721f4..234b4fdb8fe 100644 --- a/src/FSharp.Core/fslib-extra-pervasives.fs +++ b/src/FSharp.Core/fslib-extra-pervasives.fs @@ -283,10 +283,6 @@ module ExtraTopLevelOperators = let eprintfn format = Printf.eprintfn format - [] - let failwith s = - raise (Failure s) - [] let async = AsyncBuilder() diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs index 675f6d5221c..6f01684de09 100644 --- a/src/FSharp.Core/prim-types.fs +++ b/src/FSharp.Core/prim-types.fs @@ -1601,11 +1601,6 @@ namespace Microsoft.FSharp.Core when 'T : string = System.String.Equals((# "" x : string #),(# "" y : string #)) when 'T : decimal = System.Decimal.op_Equality((# "" x:decimal #), (# "" y:decimal #)) when 'T : DateTime = DateTime.Equals((# "" x : DateTime #), (# "" y : DateTime #)) - - - let inline GenericInequalityFast (x:'T) (y:'T) = (not(GenericEqualityFast x y) : bool) - let inline GenericInequalityERFast (x:'T) (y:'T) = (not(GenericEqualityERFast x y) : bool) - //------------------------------------------------------------------------- // LanguagePrimitives.HashCompare: HASHING. diff --git a/src/FSharp.Core/quotations.fs b/src/FSharp.Core/quotations.fs index 20f2e8ca06b..0115811553a 100644 --- a/src/FSharp.Core/quotations.fs +++ b/src/FSharp.Core/quotations.fs @@ -489,15 +489,9 @@ module Patterns = let EA (t, attribs) = new Expr(t, attribs) - let ES ts = - List.map E ts - let (|E|) (e: Expr) = e.Tree - let (|ES|) (es: Expr list) = - es |> List.map (fun e -> e.Tree) - let (|FrontAndBack|_|) es = let rec loop acc xs = match xs with @@ -515,9 +509,6 @@ module Patterns = let removeVoid a = if a = voidTy then unitTy else a - let addVoid a = - if a = unitTy then voidTy else a - let mkFunTy a b = let (a, b) = removeVoid a, removeVoid b funTyC.MakeGenericType([| a; b |]) @@ -964,9 +955,6 @@ module Patterns = let mkFE3 op (x, y, z) = E(CombTerm(op, [ (x :> Expr); (y :> Expr); (z :> Expr) ])) - let mkOp v () = - v - //-------------------------------------------------------------------------- // Type-checked constructors for building Raw quotations //-------------------------------------------------------------------------- @@ -994,10 +982,6 @@ module Patterns = args // todo: shouldn't this be "strong" type check? sometimes? - let checkAssignableFrom ty1 ty2 = - if not (assignableFrom ty1 ty2) then - invalidArg "ty2" (SR.GetString(SR.QincorrectType)) - let checkObj (membInfo: MemberInfo) (obj: Expr) = // The MemberInfo may be a property associated with a union // find the actual related union type @@ -1029,14 +1013,6 @@ module Patterns = | [| a; _ |] -> checkTypesSR vty a "f" (SR.GetString(SR.QtmmFunctionArgTypeMismatch)) | _ -> invalidArg "f" (SR.GetString(SR.QinvalidFuncType)) - // Returns option (by name) of a NewUnionCase type - let getUnionCaseFields ty str = - let cases = FSharpType.GetUnionCases(ty, publicOrPrivateBindingFlags) - - match cases |> Array.tryFind (fun ucase -> ucase.Name = str) with - | Some case -> case.GetFields() - | _ -> invalidArg "ty" (String.Format(SR.GetString(SR.notAUnionType), ty.FullName)) - let checkBind (v: Var, e) = let ety = typeOf e checkTypesSR v.Type ety "let" (SR.GetString(SR.QtmmVarTypeNotMatchRHS)) @@ -1057,9 +1033,6 @@ module Patterns = let mkValueWithDefn (v, ty, defn) = mkFE1 (WithValueOp(v, ty)) defn - let mkValueG (v: 'T) = - mkValue (box v, typeof<'T>) - let mkLiftedValueOpG (v, ty: System.Type) = let obj = if ty.IsEnum then @@ -1099,9 +1072,6 @@ module Patterns = let mkCoerce (ty, x) = mkFE1 (CoerceOp ty) x - let mkNull (ty) = - mkFE0 (ValueOp(null, ty, None)) - let mkApplication v = checkAppliedLambda v mkFE2 AppOp v @@ -1619,40 +1589,6 @@ module Patterns = let inst (tyargs: Type list) (i: Instantiable<'T>) = i (fun idx -> tyargs.[idx]) // Note, O n looks, but #tyargs is always small - let bindPropBySearchIfCandidateIsNull (ty: Type) propName retType argTypes candidate = - match candidate with - | null -> - let props = - ty.GetProperties staticOrInstanceBindingFlags - |> Array.filter (fun pi -> - let paramTypes = getTypesFromParamInfos (pi.GetIndexParameters()) - - pi.Name = propName - && pi.PropertyType = retType - && Array.length argTypes = paramTypes.Length - && Array.forall2 (=) argTypes paramTypes) - - match props with - | [| pi |] -> pi - | _ -> null - | pi -> pi - - let bindCtorBySearchIfCandidateIsNull (ty: Type) argTypes candidate = - match candidate with - | null -> - let ctors = - ty.GetConstructors instanceBindingFlags - |> Array.filter (fun ci -> - let paramTypes = getTypesFromParamInfos (ci.GetParameters()) - - Array.length argTypes = paramTypes.Length - && Array.forall2 (=) argTypes paramTypes) - - match ctors with - | [| ctor |] -> ctor - | _ -> null - | ctor -> ctor - let bindProp (genericType, propName, retType, argTypes, tyargs) = // We search in the instantiated type, rather than searching the generic type. let typ = mkNamedType (genericType, tyargs) @@ -2347,21 +2283,6 @@ module Patterns = and freeInExpr e = freeInExprAcc Set.empty Set.empty e - // utility for folding - let foldWhile f st (ie: seq<'T>) = - use e = ie.GetEnumerator() - let mutable res = Some st - - while (res.IsSome && e.MoveNext()) do - res <- - f - (match res with - | Some a -> a - | _ -> failwith "internal error") - e.Current - - res - [] exception Clash of Var diff --git a/src/FSharp.Core/result.fs b/src/FSharp.Core/result.fs index 00ec26d05d8..63a63435653 100644 --- a/src/FSharp.Core/result.fs +++ b/src/FSharp.Core/result.fs @@ -101,12 +101,6 @@ module Result = | Error _ -> [] | Ok x -> [ x ] - [] - let toSeq result = - match result with - | Error _ -> [] - | Ok x -> [ x ] - [] let toOption result = match result with diff --git a/src/FSharp.Core/resumable.fs b/src/FSharp.Core/resumable.fs index 7e79af69aee..e63e79f92dd 100644 --- a/src/FSharp.Core/resumable.fs +++ b/src/FSharp.Core/resumable.fs @@ -116,9 +116,6 @@ module StateMachineHelpers = module ResumableCode = - let inline SetResumptionFunc (sm: byref>) f = - sm.ResumptionDynamicInfo.ResumptionFunc <- f - let inline GetResumptionFunc (sm: byref>) = sm.ResumptionDynamicInfo.ResumptionFunc diff --git a/src/FSharp.Core/seqcore.fs b/src/FSharp.Core/seqcore.fs index 2b2b3b9e55b..dcfda570ba9 100644 --- a/src/FSharp.Core/seqcore.fs +++ b/src/FSharp.Core/seqcore.fs @@ -210,9 +210,6 @@ module RuntimeHelpers = let Generate openf compute closef = mkSeq (fun () -> new IEnumerator.GeneratedEnumerable<_,_>(openf, compute, closef) :> IEnumerator<'T>) - let GenerateUsing (openf : unit -> ('U :> System.IDisposable)) compute = - Generate openf compute (fun (s:'U) -> s.Dispose()) - let EnumerateFromFunctions create moveNext current = Generate create diff --git a/src/LegacyMSBuildResolver/LegacyMSBuildReferenceResolver.fs b/src/LegacyMSBuildResolver/LegacyMSBuildReferenceResolver.fs index 977372d675a..80ee208263c 100644 --- a/src/LegacyMSBuildResolver/LegacyMSBuildReferenceResolver.fs +++ b/src/LegacyMSBuildResolver/LegacyMSBuildReferenceResolver.fs @@ -34,19 +34,6 @@ let DotNetFrameworkReferenceAssembliesRootDirectory = PF + @"\Reference Assemblies\Microsoft\Framework\.NETFramework" -/// When targeting .NET 2.0-3.5 on Windows, we expand the {WindowsFramework} and {ReferenceAssemblies} paths manually -let internal ReplaceVariablesForLegacyFxOnWindows (dirs: string list) = - let windowsFramework = - Environment.GetEnvironmentVariable("windir") + @"\Microsoft.NET\Framework" - - let referenceAssemblies = DotNetFrameworkReferenceAssembliesRootDirectory - - dirs - |> List.map (fun d -> - d - .Replace("{WindowsFramework}", windowsFramework) - .Replace("{ReferenceAssemblies}", referenceAssemblies)) - // ATTENTION!: the following code needs to be updated every time we are switching to the new MSBuild version because new .NET framework version was released // 1. List of frameworks // 2. DeriveTargetFrameworkDirectoriesFor45Plus