diff --git a/src/absil/illib.fs b/src/absil/illib.fs index 7f2cb63dd4f..ae7d81e0652 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -465,6 +465,7 @@ module Dictionary = // FUTURE CLEANUP: remove this adhoc collection type Hashset<'T> = Dictionary<'T,int> + [] module Hashset = let create (n:int) = new Hashset<'T>(n, HashIdentity.Structural) @@ -498,6 +499,28 @@ type ResultOrException<'TResult> = | Result of 'TResult | Exception of System.Exception +[] +module ResultOrException = + + let success a = Result a + let raze (b:exn) = Exception b + + // map + let (|?>) res f = + match res with + | Result x -> Result(f x ) + | Exception err -> Exception err + + let ForceRaise res = + match res with + | Result x -> x + | Exception err -> raise err + + let otherwise f x = + match x with + | Result x -> success x + | Exception _err -> f() + //------------------------------------------------------------------------- // Library: extensions to flat list (immutable arrays) diff --git a/src/fsharp/augment.fs b/src/fsharp/AugmentWithHashCompare.fs similarity index 99% rename from src/fsharp/augment.fs rename to src/fsharp/AugmentWithHashCompare.fs index bff1b0d38d7..8477abc83cb 100644 --- a/src/fsharp/augment.fs +++ b/src/fsharp/AugmentWithHashCompare.fs @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. /// Generate the hash/compare functions we add to user-defined types by default. -module internal Microsoft.FSharp.Compiler.Augment +module internal Microsoft.FSharp.Compiler.AugmentWithHashCompare + open Internal.Utilities open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.AbstractIL @@ -14,7 +15,7 @@ open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.PrettyNaming open Microsoft.FSharp.Compiler.Lib -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Infos let mkIComparableCompareToSlotSig g = diff --git a/src/fsharp/augment.fsi b/src/fsharp/AugmentWithHashCompare.fsi similarity index 94% rename from src/fsharp/augment.fsi rename to src/fsharp/AugmentWithHashCompare.fsi index 602c0cc2bc0..5d0e7220be1 100644 --- a/src/fsharp/augment.fsi +++ b/src/fsharp/AugmentWithHashCompare.fsi @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. /// Generate the hash/compare functions we add to user-defined types by default. -module internal Microsoft.FSharp.Compiler.Augment +module internal Microsoft.FSharp.Compiler.AugmentWithHashCompare open Internal.Utilities open Microsoft.FSharp.Compiler.AbstractIL @@ -9,7 +9,7 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Tast -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals val CheckAugmentationAttribs : bool -> TcGlobals -> Import.ImportMap -> Tycon -> unit val TyconIsCandidateForAugmentationWithCompare : TcGlobals -> Tycon -> bool diff --git a/src/fsharp/formats.fs b/src/fsharp/CheckFormatStrings.fs similarity index 98% rename from src/fsharp/formats.fs rename to src/fsharp/CheckFormatStrings.fs index 12e79af2674..b5bc537745c 100644 --- a/src/fsharp/formats.fs +++ b/src/fsharp/CheckFormatStrings.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Formats +module internal Microsoft.FSharp.Compiler.CheckFormatStrings open Internal.Utilities open Microsoft.FSharp.Compiler @@ -11,7 +11,7 @@ open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.ConstraintSolver type FormatItem = Simple of TType | FuncAndVal diff --git a/src/fsharp/formats.fsi b/src/fsharp/CheckFormatStrings.fsi similarity index 72% rename from src/fsharp/formats.fsi rename to src/fsharp/CheckFormatStrings.fsi index 1016ef34cc4..0773039671a 100644 --- a/src/fsharp/formats.fsi +++ b/src/fsharp/CheckFormatStrings.fsi @@ -5,11 +5,12 @@ /// /// Must be updated if the Printf runtime component is updated. -module internal Microsoft.FSharp.Compiler.Formats +module internal Microsoft.FSharp.Compiler.CheckFormatStrings open Internal.Utilities open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Tast +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.AbstractIL.Internal -val ParseFormatString : Range.range -> Env.TcGlobals -> string -> TType -> TType -> TType -> TType * TType +val ParseFormatString : Range.range -> TcGlobals -> string -> TType -> TType -> TType -> TType * TType diff --git a/src/fsharp/csolve.fs b/src/fsharp/ConstraintSolver.fs similarity index 99% rename from src/fsharp/csolve.fs rename to src/fsharp/ConstraintSolver.fs index b1424c212bf..488598ac0f8 100644 --- a/src/fsharp/csolve.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -44,12 +44,12 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tastops.DebugPrint -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.Infos.AccessibilityLogic open Microsoft.FSharp.Compiler.Infos.AttributeChecking -open Microsoft.FSharp.Compiler.Typrelns +open Microsoft.FSharp.Compiler.TypeRelations open Microsoft.FSharp.Compiler.PrettyNaming //------------------------------------------------------------------------- @@ -120,9 +120,9 @@ exception ConstraintSolverMissingConstraint of DisplayEnv * Tast.Typar * Tast.Ty exception ConstraintSolverError of string * range * range exception ConstraintSolverRelatedInformation of string option * range * exn -exception ErrorFromApplyingDefault of Env.TcGlobals * DisplayEnv * Tast.Typar * TType * exn * range -exception ErrorFromAddingTypeEquation of Env.TcGlobals * DisplayEnv * TType * TType * exn * range -exception ErrorsFromAddingSubsumptionConstraint of Env.TcGlobals * DisplayEnv * TType * TType * exn * range +exception ErrorFromApplyingDefault of TcGlobals * DisplayEnv * Tast.Typar * TType * exn * range +exception ErrorFromAddingTypeEquation of TcGlobals * DisplayEnv * TType * TType * exn * range +exception ErrorsFromAddingSubsumptionConstraint of TcGlobals * DisplayEnv * TType * TType * exn * range exception ErrorFromAddingConstraint of DisplayEnv * exn * range exception PossibleOverload of DisplayEnv * string * exn * range exception UnresolvedOverloading of DisplayEnv * exn list * string * range @@ -135,7 +135,7 @@ type TcValF = (ValRef -> ValUseFlag -> TType list -> range -> Expr * TType) type ConstraintSolverState = { - g: Env.TcGlobals; + g: TcGlobals; amap: Import.ImportMap; InfoReader : InfoReader; TcVal : TcValF @@ -1273,7 +1273,7 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst = let minst = [] // GENERIC TYPE PROVIDERS: for generics, we would have an minst here let allArgVars, allArgs = minfo.GetParamTypes(amap, m, minst) |> List.concat |> List.mapi (fun i ty -> mkLocal m ("arg"+string i) ty) |> List.unzip let objArgVars, objArgs = (if minfo.IsInstance then [mkLocal m "this" minfo.EnclosingType] else []) |> List.unzip - let callMethInfoOpt, callExpr,callExprTy = Typrelns.ProvidedMethodCalls.BuildInvokerExpressionForProvidedMethodCall css.TcVal (g, amap, mi, objArgs, NeverMutates, false, ValUseFlag.NormalValUse, allArgs, m) + let callMethInfoOpt, callExpr,callExprTy = TypeRelations.ProvidedMethodCalls.BuildInvokerExpressionForProvidedMethodCall css.TcVal (g, amap, mi, objArgs, NeverMutates, false, ValUseFlag.NormalValUse, allArgs, m) let closedExprSln = ClosedExprSln (mkLambdas m [] (objArgVars@allArgVars) (callExpr, callExprTy) ) // If the call is a simple call to an IL method with all the arguments in the natural order, then revert to use ILMethSln. // This is important for calls to operators on generated provided types. There is an (unchecked) condition @@ -1627,7 +1627,7 @@ and SolveTypeSupportsComparison (csenv:ConstraintSolverEnv) ndeep m2 trace ty = // Give a good error for structural types excluded from the comparison relation because of their fields elif (isAppTy g ty && let tcref = tcrefOfAppTy g ty - Augment.TyconIsCandidateForAugmentationWithCompare g tcref.Deref && + AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare g tcref.Deref && isNone tcref.GeneratedCompareToWithComparerValues) then ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportComparison3(NicePrint.minimalStringOfType denv ty),m,m2)) @@ -1655,7 +1655,7 @@ and SolveTypSupportsEquality (csenv:ConstraintSolverEnv) ndeep m2 trace ty = let tcref,tinst = destAppTy g ty // Give a good error for structural types excluded from the equality relation because of their fields - if (Augment.TyconIsCandidateForAugmentationWithEquals g tcref.Deref && + if (AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tcref.Deref && isNone tcref.GeneratedHashAndEqualsWithComparerValues) then ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportEquality3(NicePrint.minimalStringOfType denv ty),m,m2)) diff --git a/src/fsharp/csolve.fsi b/src/fsharp/ConstraintSolver.fsi similarity index 85% rename from src/fsharp/csolve.fsi rename to src/fsharp/ConstraintSolver.fsi index f1a600f1002..6d9b2b7bc9f 100644 --- a/src/fsharp/csolve.fsi +++ b/src/fsharp/ConstraintSolver.fsi @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +/// Solves constraints using a mutable constraint-solver state module internal Microsoft.FSharp.Compiler.ConstraintSolver open Internal.Utilities @@ -15,18 +16,32 @@ open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Import open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tast -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Infos +/// Create a type variable representing the use of a "_" in F# code val NewAnonTypar : TyparKind * range * TyparRigidity * TyparStaticReq * TyparDynamicReq -> Typar + +/// Create an inference type variable val NewInferenceType : unit -> TType + +/// Create an inference type variable representing an error condition when checking an expression val NewErrorType : unit -> TType + +/// Create an inference type variable representing an error condition when checking a measure val NewErrorMeasure : unit -> MeasureExpr + +/// Create a list of inference type variables, one for each element in the input list val NewInferenceTypes : 'a list -> TType list +/// Given a set of formal type parameters and their constraints, make new inference type variables for +/// each and ensure that the constraints on the new type variables are adjusted to refer to these. val FreshenAndFixupTypars : range -> TyparRigidity -> Typars -> TType list -> Typars -> Typars * TyparInst * TType list + val FreshenTypeInst : range -> Typars -> Typars * TyparInst * TType list + val FreshenTypars : range -> Typars -> TType list + val FreshenMethInfo : range -> MethInfo -> TType list exception ConstraintSolverTupleDiffLengths of DisplayEnv * TType list * TType list * range * range @@ -42,16 +57,15 @@ exception ErrorsFromAddingSubsumptionConstraint of TcGlobals * DisplayEn exception ErrorFromAddingConstraint of DisplayEnv * exn * range exception UnresolvedConversionOperator of DisplayEnv * TType * TType * range exception PossibleOverload of DisplayEnv * string * exn * range -exception UnresolvedOverloading of DisplayEnv * exn list (* PossibleOverload list *) * string * range -//exception PossibleBestOverload of DisplayEnv * string * range +exception UnresolvedOverloading of DisplayEnv * exn list * string * range exception NonRigidTypar of DisplayEnv * string option * range * TType * TType * range -/// function type that denotes captured tcVal used in constraint solver +/// A function that denotes captured tcVal, Used in constraint solver and elsewhere to get appropriate expressions for a ValRef. type TcValF = (ValRef -> ValUseFlag -> TType list -> range -> Expr * TType) [] type ConstraintSolverState = - static member New: TcGlobals * Import.ImportMap * InfoReader * TcValF-> ConstraintSolverState + static member New: TcGlobals * Import.ImportMap * InfoReader * TcValF -> ConstraintSolverState type ConstraintSolverEnv @@ -69,10 +83,9 @@ val SimplifyMeasuresInTypeScheme : TcGlobals -> bool -> Typars -> TT val SolveTyparEqualsTyp : ConstraintSolverEnv -> int -> range -> OptionalTrace -> TType -> TType -> OperationResult val SolveTypEqualsTypKeepAbbrevs : ConstraintSolverEnv -> int -> range -> OptionalTrace -> TType -> TType -> OperationResult val CanonicalizeRelevantMemberConstraints : ConstraintSolverEnv -> int -> OptionalTrace -> Typars -> OperationResult -val ResolveOverloading : ConstraintSolverEnv -> OptionalTrace -> string -> ndeep: int -> bool -> int * int -> AccessorDomain -> Typrelns.CalledMeth list -> bool -> TType option -> Typrelns.CalledMeth option * OperationResult -val UnifyUniqueOverloading : ConstraintSolverEnv -> int * int -> string -> AccessorDomain -> Typrelns.CalledMeth list -> TType -> OperationResult +val ResolveOverloading : ConstraintSolverEnv -> OptionalTrace -> string -> ndeep: int -> bool -> int * int -> AccessorDomain -> TypeRelations.CalledMeth list -> bool -> TType option -> TypeRelations.CalledMeth option * OperationResult +val UnifyUniqueOverloading : ConstraintSolverEnv -> int * int -> string -> AccessorDomain -> TypeRelations.CalledMeth list -> TType -> OperationResult val EliminateConstraintsForGeneralizedTypars : ConstraintSolverEnv -> OptionalTrace -> Typars -> unit -//val AdjustCalledArgType : TcGlobals -> InfoReader -> bool -> Typrelns.CalledArg -> Typrelns.CallerArg<'T> -> TType val CheckDeclaredTypars : DisplayEnv -> ConstraintSolverState -> range -> Typars -> Typars -> unit diff --git a/src/fsharp/detuple.fs b/src/fsharp/DetupleArgs.fs similarity index 81% rename from src/fsharp/detuple.fs rename to src/fsharp/DetupleArgs.fs index 77d0d037dc0..ba2de24c29d 100644 --- a/src/fsharp/detuple.fs +++ b/src/fsharp/DetupleArgs.fs @@ -3,18 +3,17 @@ module internal Microsoft.FSharp.Compiler.Detuple open Internal.Utilities +open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library -open Microsoft.FSharp.Compiler - open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tastops.DebugPrint -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Layout open Microsoft.FSharp.Compiler.PrettyNaming open Microsoft.FSharp.Compiler.Lib @@ -168,7 +167,7 @@ let (|TyappAndApp|_|) e = // GetValsBoundInExpr //------------------------------------------------------------------------- -module GlobalUsageAnalysis = begin +module GlobalUsageAnalysis = let bindAccBounds vals (_isInDTree,v) = Zset.add v vals let GetValsBoundInExpr expr = @@ -184,59 +183,60 @@ module GlobalUsageAnalysis = begin type accessor = TupleGet of int * TType list + /// Expr information. + /// For each v, + /// (a) log it's usage site context = accessors // APP type-inst args + /// where first accessor in list applies first to the v/app. + /// (b) log it's binding site representation. type Results = - (* Expr information. - * For each v, - * (a) log it's usage site context = accessors // APP type-inst args - * where first accessor in list applies first to the v/app. - * (b) log it's binding site representation. - *------ - * Future, could generalise to be graph representation of expr. (partly there). - * This type used to be called "usage". - *) - { Uses : Zmap; (* v -> context / APP inst args *) - Defns : Zmap; (* v -> binding repr *) - DecisionTreeBindings : Zset; (* bound in a decision tree? *) - RecursiveBindings : Zmap; (* v -> v list * recursive? -- the others in the mutual binding *) - TopLevelBindings : Zset; - IterationIsAtTopLevel : bool - } + { /// v -> context / APP inst args + Uses : Zmap + /// v -> binding repr + Defns : Zmap + /// bound in a decision tree? + DecisionTreeBindings : Zset + /// v -> v list * recursive? -- the others in the mutual binding + RecursiveBindings : Zmap + TopLevelBindings : Zset + IterationIsAtTopLevel : bool } let z0 = - { Uses = Zmap.empty valOrder; - Defns = Zmap.empty valOrder; - RecursiveBindings = Zmap.empty valOrder; - DecisionTreeBindings = Zset.empty valOrder; - TopLevelBindings = Zset.empty valOrder; - IterationIsAtTopLevel = true - } - - // Note: this routine is called very frequently + { Uses = Zmap.empty valOrder + Defns = Zmap.empty valOrder + RecursiveBindings = Zmap.empty valOrder + DecisionTreeBindings = Zset.empty valOrder + TopLevelBindings = Zset.empty valOrder + IterationIsAtTopLevel = true } + + /// Log the use of a value with a particular tuple chape at a callsite + /// Note: this routine is called very frequently let logUse (f:Val) tup z = {z with Uses = match Zmap.tryFind f z.Uses with | Some sites -> Zmap.add f (tup::sites) z.Uses | None -> Zmap.add f [tup] z.Uses } + /// Log the definition of a binding let logBinding z (isInDTree,v) = let z = if isInDTree then {z with DecisionTreeBindings = Zset.add v z.DecisionTreeBindings} else z let z = if z.IterationIsAtTopLevel then {z with TopLevelBindings = Zset.add v z.TopLevelBindings} else z z + /// Log the definition of a non-recursive binding let logNonRecBinding z (bind:Binding) = - (* log mubind v -> vs *) let v = bind.Var let vs = FlatList.one v {z with RecursiveBindings = Zmap.add v (false,vs) z.RecursiveBindings; Defns = Zmap.add v bind.Expr z.Defns } + /// Log the definition of a recursive binding let logRecBindings z binds = - (* log mubind v -> vs *) let vs = valsOfBinds binds {z with RecursiveBindings = (z.RecursiveBindings,vs) ||> FlatList.fold (fun mubinds v -> Zmap.add v (true,vs) mubinds); Defns = (z.Defns,binds) ||> FlatList.fold (fun eqns bind -> Zmap.add bind.Var bind.Expr eqns) } + /// Work locally under a lambda of some kind let foldUnderLambda f z x = let saved = z.IterationIsAtTopLevel let z = {z with IterationIsAtTopLevel=false} @@ -244,49 +244,24 @@ module GlobalUsageAnalysis = begin let z = {z with IterationIsAtTopLevel=saved} z -#if DEBUG - let dumpXInfo z = - let soAccessor (TupleGet (n,_ts)) = "#" ^ string n - let dumpSite v (accessors,inst,args) = - dprintf "- use %s%s %s %s\n" - (showL (valL v)) - (match inst with - [] -> "" - | _ -> "@[" ^ showL (commaListL (List.map typeL inst)) ^ "]") - (showL (spaceListL (List.map exprL args))) - (match accessors with - [] -> "" - | _ -> "|> " ^ String.concat " " (List.map soAccessor accessors)) - let dumpUse v sites = List.iter (dumpSite v) sites - let dumpTop (v:Val) = dprintf "- toplevel: %s\n" v.LogicalName - if false then - ( dprintf "usage:\n"; - Zmap.iter dumpUse z.Uses; - Zset.iter dumpTop z.TopLevelBindings - ) - else - () -#endif - - //------------------------------------------------------------------------- // GlobalUsageAnalysis - FoldExpr, foldBind collectors //------------------------------------------------------------------------- + // Fold expr, intercepts selected exprs. + // "val v" - count [] callpattern of v + // "app (f,args)" - count callpattern of f + //--- + // On intercepted nodes, must continue exprF fold over any subexpressions, e.g. args. + //------ + // Also, noting top-level bindings, + // so must cancel top-level "foldUnderLambda" whenever step under loop/lambda: + // - lambdas + // - try/with and try/finally + // - for body + // - match targets + // - tmethods let UsageFolders g = - // Fold expr, intercepts selected exprs. - // "val v" - count [] callpattern of v - // "app (f,args)" - count callpattern of f - //--- - // On intercepted nodes, must continue exprF fold over any subexpressions, e.g. args. - //------ - // Also, noting top-level bindings, - // so must cancel top-level "foldUnderLambda" whenever step under loop/lambda: - // - lambdas - // - try/with and try/finally - // - for body - // - match targets - // - tmethods let foldLocalVal f z (vref: ValRef) = if valRefInThisAssembly g.compilingFslib vref then f z vref.Deref else z @@ -331,12 +306,12 @@ module GlobalUsageAnalysis = begin let tmethodIntercept exprF z = function TObjExprMethod(_,_,_,_,e,_m) -> Some (foldUnderLambda exprF z e) {ExprFolder0 with - exprIntercept = exprUsageIntercept; - nonRecBindingsIntercept = logNonRecBinding; - recBindingsIntercept = logRecBindings; - valBindingSiteIntercept = logBinding; - targetIntercept = targetIntercept; - tmethodIntercept = tmethodIntercept; + exprIntercept = exprUsageIntercept + nonRecBindingsIntercept = logNonRecBinding + recBindingsIntercept = logRecBindings + valBindingSiteIntercept = logBinding + targetIntercept = targetIntercept + tmethodIntercept = tmethodIntercept } @@ -349,8 +324,6 @@ module GlobalUsageAnalysis = begin let z = FoldImplFile folder z0 expr z -end - open GlobalUsageAnalysis @@ -364,23 +337,17 @@ let mkLocalVal m name ty topValInfo = let compgen = false in (* REVIEW: review: should this be true? *) NewVal(name,m,None,ty,Immutable,compgen,topValInfo,taccessPublic,ValNotInRecScope,None,NormalVal,[],ValInline.Optional,XmlDoc.Empty,false,false,false,false,false,false,None,ParentNone) -let dprintTerm header expr = - if false then - let str = Layout.showL (Layout.squashTo 192 (implFileL expr)) (* improve cxty! *) - dprintf "\n\n\n%s:\n%s\n" header str - else - () - //------------------------------------------------------------------------- // TupleStructure = tuple structure //------------------------------------------------------------------------- -type TupleStructure = (* tuple structure *) +type TupleStructure = | UnknownTS | TupleTS of TupleStructure list -let rec ValReprInfoForTS = function +let rec ValReprInfoForTS ts = + match ts with | UnknownTS -> [ValReprInfo.unnamedTopArg] | TupleTS ts -> ts |> List.collect ValReprInfoForTS @@ -396,7 +363,9 @@ let checkTS = function | TupleTS [_] -> internalError "exprTS: Tuple[x] not expected. (singleton tuples should not exist." | ts -> ts -let rec uncheckedExprTS = function (* explicit tuple-structure in expr *) +/// explicit tuple-structure in expr +let rec uncheckedExprTS expr = + match expr with | Expr.Op(TOp.Tuple,_tys,args,_) -> TupleTS (List.map uncheckedExprTS args) | _ -> UnknownTS @@ -415,35 +384,28 @@ let rebuildTS g m ts vs = match vs,ts with | [] ,UnknownTS -> internalError "rebuildTS: not enough fringe to build tuple" | v::vs,UnknownTS -> vs,(exprForVal m v,v.Type) - | vs ,TupleTS tss -> let vs,xtys = List.foldMap rebuild vs tss - let xs,tys = List.unzip xtys - let x = mkTupled g m xs tys - let ty = mkTupledTy g tys - vs,(x,ty) + | vs ,TupleTS tss -> + let vs,xtys = List.foldMap rebuild vs tss + let xs,tys = List.unzip xtys + let x = mkTupled g m xs tys + let ty = mkTupledTy g tys + vs,(x,ty) let vs,(x,_ty) = rebuild vs ts if vs.Length <> 0 then internalError "rebuildTS: had move fringe vars than fringe. REPORT BUG" else (); x -(* naive string concats, just for testing *) - /// CallPattern is tuple-structure for each argument position. /// - callsites have a CallPattern (possibly instancing fOrig at tuple types...). /// - the definition lambdas may imply a one-level CallPattern /// - the definition formal projection info suggests a CallPattern -type CallPattern = - TupleStructure list (* equality/ordering ok on this type *) +type CallPattern = TupleStructure list let callPatternOrder = (compare : CallPattern -> CallPattern -> int) let argsCP exprs = List.map exprTS exprs let noArgsCP = [] let isTrivialCP xs = (isNil xs) -#if DEBUG -let rec soTS = function (UnknownTS) -> "_" | TupleTS ss -> "(" ^ String.concat "," (List.map soTS ss) ^ ")" -let soCP tss = String.concat ";" (List.map soTS tss) -#endif - let rec minimalCallPattern callPattern = match callPattern with | [] -> [] @@ -453,7 +415,6 @@ let rec minimalCallPattern callPattern = | tss -> UnknownTS::tss (* non triv tss tail *) | (TupleTS ts)::tss -> TupleTS ts :: minimalCallPattern tss -/// INTERSECTION. /// Combines a list of callpatterns into one common callpattern. let commonCallPattern callPatterns = let rec andCPs cpA cpB = @@ -487,10 +448,9 @@ type TransformedFormal = /// - yb1..ybp - replacement formal choices for x1...xp. /// - transformedVal - replaces f. type Transform = - { transformCallPattern : CallPattern; - transformedFormals : TransformedFormal list; (* REVIEW: could push these to fixup binding site *) - transformedVal : Val; - } + { transformCallPattern : CallPattern + transformedFormals : TransformedFormal list + transformedVal : Val } //------------------------------------------------------------------------- @@ -530,26 +490,10 @@ let mkTransform g (f:Val) m tps x1Ntys rty (callPattern,tyfringes: (TType list * let argtys = tys1r @ tysrN let fCty = mkLambdaTy tps argtys rty let transformedVal = mkLocalVal f.Range (globalNng.FreshCompilerGeneratedName (f.LogicalName,f.Range)) fCty topValInfo - (*dprintf "mkTransform: f=%s\n" (showL (valL f)); - dprintf "mkTransform: tps=%s\n" (showL (commaListL (List.map typarL tps))); - dprintf "mkTransform: callPattern=%s\n" (soCP callPattern); - dprintf "mkTransform: tyfringes=%s\n" (showL (commaListL (List.map (fun fr -> tupleL (List.map typeL fr)) tyfringes))); - dprintf "mkTransform: tys1r=%s\n" (showL (commaListL (List.map typeL tys1r))); - dprintf "mkTransform: tysrN=%s\n" (showL (commaListL (List.map typeL tysrN))); - dprintf "mkTransform: rty =%s\n" ((showType rty)); - *) - { transformCallPattern = callPattern; - transformedFormals = transformedFormals; - transformedVal = transformedVal; - } - -#if DEBUG -open Microsoft.FSharp.Compiler.Layout -let dumpTransform trans = - dprintf " - cp : %s\n - transformedVal : %s\n\n" - (soCP trans.transformCallPattern) - (showL (valL trans.transformedVal)) -#endif + { transformCallPattern = callPattern + transformedFormals = transformedFormals + transformedVal = transformedVal } + //------------------------------------------------------------------------- // transform - vTransforms - support @@ -618,34 +562,23 @@ let decideFormalSuggestedCP g z tys vss = // transform - decideTransform //------------------------------------------------------------------------- -let decideTransform g z v callPatterns (m,tps,vss:Val list list,rty) (* tys are types of outer args *) = +let decideTransform g z v callPatterns (m,tps,vss:Val list list,rty) = let tys = List.map (typeOfLambdaArg m) vss (* arg types *) (* NOTE: 'a in arg types may have been instanced at different tuples... *) (* commonCallPattern has to handle those cases. *) let callPattern = commonCallPattern callPatterns // common CallPattern let callPattern = List.take vss.Length callPattern // restricted to max nArgs - (* NOW: get formal callPattern by defn usage of formals *) + // Get formal callPattern by defn usage of formals let formalCallPattern = decideFormalSuggestedCP g z tys vss let callPattern = List.take callPattern.Length formalCallPattern - // zip with information about known args + // Zip with information about known args let callPattern,tyfringes = zipCallPatternArgTys m g callPattern vss - // drop trivial tail AND + // Drop trivial tail AND let callPattern = minimalCallPattern callPattern - // shorten tyfringes (zippable) + // Shorten tyfringes (zippable) let tyfringes = List.take callPattern.Length tyfringes - (*dprintf "decideTransform: for v=%s\n" (showL (valL v)); - List.iter (fun cp -> dprintf "- site cp = %s\n" (soCP cp)) callPatterns; - dprintf "- common cp = %s\n" (soCP cp); - dprintf "- front cp = %s\n" (soCP cp); - dprintf "- arg tys = %s\n" (showL (commaListL (List.map typeL tys))); - dprintf "- formalCallPattern = %s\n" (soCP formalCallPattern); - dprintf "- front formalCallPattern = %s\n" (soCP cp); - dprintf "- zipped cp = %s\n" (soCP cp); - dprintf "- tyfringes = %s\n" (showL (commaListL (List.map (List.length >> intL) tyfringes))); - dprintf "- minimal cp = %s\n\n" (soCP cp); - *) if isTrivialCP callPattern then - None (* no transform *) + None // no transform else Some (v,mkTransform g v m tps tys rty (callPattern,tyfringes)) @@ -670,9 +603,9 @@ let eligibleVal g (v:Val) = let determineTransforms g (z : GlobalUsageAnalysis.Results) = let selectTransform f sites = if not (eligibleVal g f) then None else - (* consider f, if it has top-level lambda (meaning has term args) *) + // Consider f, if it has top-level lambda (meaning has term args) match Zmap.tryFind f z.Defns with - | None -> None (* no binding site, so no transform *) + | None -> None // no binding site, so no transform | Some e -> let tps,vss,_b,rty = stripTopLambda (e,f.Type) match List.concat vss with @@ -686,12 +619,6 @@ let determineTransforms g (z : GlobalUsageAnalysis.Results) = let vtransforms = Zmap.ofList valOrder vtransforms vtransforms -#if DEBUG -let dumpVTransform v tr = - dprintf "Transform for %s\n" (showL (valL v)); - dumpTransform tr; - stdout.Flush() -#endif //------------------------------------------------------------------------- @@ -699,10 +626,10 @@ let dumpVTransform v tr = //------------------------------------------------------------------------- type penv = - { transforms : Zmap; (* planned transforms *) - ccu : CcuThunk; - g : Env.TcGlobals; - } + { // The planned transforms + transforms : Zmap + ccu : CcuThunk + g : TcGlobals } let hasTransfrom penv f = Zmap.tryFind f penv.transforms @@ -716,9 +643,11 @@ let hasTransfrom penv f = Zmap.tryFind f penv.transforms - also factor buildProjections, so they share common tmps. *) -type env = {eg : TcGlobals; - prefix : string; - m : Range.range; } +type env = + { eg : TcGlobals + prefix : string + m : Range.range } + let suffixE env s = {env with prefix = env.prefix ^ s} let rangeE env m = {env with m = m} @@ -892,15 +821,16 @@ let passBinds penv binds = binds |> FlatList.map (passBind penv) // 3. run pass over following code. //------------------------------------------------------------------------- -let passBindRhs _penv conv (TBind (v,repr,letSeqPtOpt)) = TBind(v,conv repr,letSeqPtOpt) +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 = FlatList.map (passBindRhs penv conv) binds + let binds = FlatList.map (passBindRhs conv) binds let binds = passBinds penv binds Some (mkLetRecBinds m binds (conv e)) | Expr.Let (bind,e,m,_) -> - let bind = passBindRhs penv conv bind + let bind = passBindRhs conv bind let bind = passBind penv bind Some (mkLetBind m bind (conv e)) | TyappAndApp(f,fty,tys,args,m) -> @@ -926,8 +856,8 @@ let postTransformExpr (penv:penv) expr = let passImplFile penv ass = - ass |> RewriteImplFile {PreIntercept =None (* Some (preInterceptExpr penv) *); - PostTransform= postTransformExpr penv (* (fun _ -> None) *); + ass |> RewriteImplFile {PreIntercept =None ; + PostTransform= postTransformExpr penv; IsUnderQuotations=false } @@ -941,17 +871,7 @@ let DetupleImplFile ccu g expr = // For each Val, decide Some "transform", or None if not changing let vtrans = determineTransforms g z -#if DEBUG - // Diagnostics - summary of planned transforms - if verbose then dprintf "note: detuple - %d functions transformed\n" (List.length (Zmap.keys vtrans)); - if verbose then Zmap.iter dumpVTransform vtrans; -#endif - - (* Pass over term, rewriting bindings and fixing up call sites, under penv *) + // Pass over term, rewriting bindings and fixing up call sites, under penv let penv = {g=g; transforms = vtrans; ccu = ccu} - if verbose then dprintTerm "DetupleAssembly before:" expr; - if verbose then dprintf "DetupleAssembly: pass\n"; let expr = passImplFile penv expr - if verbose then dprintTerm "DetupleAssembly after:" expr; - if verbose then dprintf "DetupleAssembly: done\n"; expr diff --git a/src/fsharp/detuple.fsi b/src/fsharp/DetupleArgs.fsi similarity index 89% rename from src/fsharp/detuple.fsi rename to src/fsharp/DetupleArgs.fsi index 254e887bcf5..efdaacf7f1f 100644 --- a/src/fsharp/detuple.fsi +++ b/src/fsharp/DetupleArgs.fsi @@ -7,11 +7,12 @@ open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Tast +open Microsoft.FSharp.Compiler.TcGlobals (* detuple pass: *) -val DetupleImplFile : CcuThunk -> Env.TcGlobals -> TypedImplFile -> TypedImplFile +val DetupleImplFile : CcuThunk -> TcGlobals -> TypedImplFile -> TypedImplFile module GlobalUsageAnalysis = val GetValsBoundInExpr : Expr -> Zset @@ -35,4 +36,4 @@ module GlobalUsageAnalysis = /// top of expr toplevel? (true) IterationIsAtTopLevel : bool; } - val GetUsageInfoOfImplFile : Env.TcGlobals -> TypedImplFile -> Results + val GetUsageInfoOfImplFile : TcGlobals -> TypedImplFile -> Results diff --git a/src/fsharp/ExtensibleDumper.fs b/src/fsharp/ExtensibleDumper.fs deleted file mode 100644 index 8415ad4596c..00000000000 --- a/src/fsharp/ExtensibleDumper.fs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Internal.Utilities.Diagnostic -open System -open System.Diagnostics -open System.Reflection -open System.Collections.Generic - -#if EXTENSIBLE_DUMPER -#if DEBUG - -type internal ExtensibleDumper(x:obj) = - static let mutable dumpers = new Dictionary() - - [] - member self.Debug = ExtensibleDumper.Dump(x) - - static member Dump(o:obj) : string = - if o = null then "null" - else - let dumpeeType = o.GetType() - - let DeriveDumperName(dumpeeType:Type) = - "Internal.Utilities.Diagnostic." + dumpeeType.Name + "Dumper" - - match dumpers.TryGetValue(dumpeeType) with - | true, Some(dumperType, methodInfo) -> - try - let dumper = Activator.CreateInstance(dumperType,[| o |]) - let result = methodInfo.Invoke(dumper, [||]) - downcast result - with e -> "Exception during dump: "+e.Message - | true, None -> - "There is no dumper named "+(DeriveDumperName dumpeeType)+" with single constructor that takes "+dumpeeType.Name+" and property named Dump." - | false, _ -> - let TryAdd(dumpeeType:Type) = - let dumperDerivedName = DeriveDumperName(dumpeeType) - let dumperAssembly = dumpeeType.Assembly // Dumper must live in the same assembly as dumpee - let dumperType = dumperAssembly.GetType(dumperDerivedName, (*throwOnError*)false) - if dumperType <> null then - let dumpMethod = dumperType.GetMethod("ToString") - if dumpMethod <> null then - let constructors = dumperType.GetConstructors() - if constructors.Length = 1 then - let constr = constructors.[0] - let parameters = constr.GetParameters() - if parameters.Length = 1 then - dumpers.[o.GetType()] <- Some(dumperType,dumpMethod) - dumpers.ContainsKey(o.GetType()) - - if (not(TryAdd(o.GetType()))) then - if (not(TryAdd(o.GetType().BaseType))) then - dumpers.[dumpeeType] <- None - ExtensibleDumper.Dump(o) // Show the message - - - - -#endif -#endif diff --git a/src/fsharp/ExtensibleDumper.fsi b/src/fsharp/ExtensibleDumper.fsi deleted file mode 100644 index be32bd56542..00000000000 --- a/src/fsharp/ExtensibleDumper.fsi +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Internal.Utilities.Diagnostic -open System -open System.Diagnostics -open System.Reflection -open System.Collections.Generic - -#if EXTENSIBLE_DUMPER -#if DEBUG - -type internal ExtensibleDumper = - class - new : x:obj -> ExtensibleDumper - member Debug : string - static member Dump : o:obj -> string - end - -#endif -#endif diff --git a/src/fsharp/est.fs b/src/fsharp/ExtensionTyping.fs similarity index 100% rename from src/fsharp/est.fs rename to src/fsharp/ExtensionTyping.fs diff --git a/src/fsharp/est.fsi b/src/fsharp/ExtensionTyping.fsi similarity index 100% rename from src/fsharp/est.fsi rename to src/fsharp/ExtensionTyping.fsi diff --git a/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj b/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj index ceeb15b2dfb..cd12b4ef9d7 100644 --- a/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj +++ b/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj @@ -214,14 +214,14 @@ ilxsettings.fs - - pubclo.fsi + + EraseClosures.fsi - - pubclo.fs + + EraseClosures.fs - - cu_erase.fs + + EraseUnions.fs InternalFileSystemUtils.fsi @@ -229,11 +229,11 @@ InternalFileSystemUtils.fs - - unilex.fsi + + UnicodeLexing.fsi - - unilex.fs + + UnicodeLexing.fs layout.fsi @@ -252,11 +252,11 @@ lexhelp.fs - - sreflect.fsi + + QuotationPickler.fsi - - sreflect.fs + + QuotationPickler.fs QueueList.fs @@ -264,23 +264,23 @@ tast.fs - - env.fs + + TcGlobals.fs - - tastops.fsi + + TastOps.fsi - - tastops.fs + + TastOps.fs - - pickle.fsi + + TastPickle.fsi - - pickle.fs + + TastPickle.fs - - lexfilter.fs + + LexFilter.fs import.fsi @@ -295,92 +295,86 @@ NicePrint.fs - - augment.fsi + + AugmentWithHashCompare.fsi - - augment.fs + + AugmentWithHashCompare.fs - - typrelns.fs + + TypeRelations.fs - - patcompile.fsi + + PatternMatchCompilation.fsi - - patcompile.fs + + PatternMatchCompilation.fs - - outcome.fsi - - - outcome.fs - - - csolve.fsi + + ConstraintSolver.fsi - - csolve.fs + + ConstraintSolver.fs - - formats.fsi + + CheckFormatStrings.fsi - - formats.fs + + CheckFormatStrings.fs - - nameres.fsi + + NameResolution.fsi - - nameres.fs + + NameResolution.fs - - unsolved.fs + + FindUnsolved.fs - - creflect.fsi + + QuotationTranslator.fsi - - creflect.fs + + QuotationTranslator.fs - - check.fsi + + PostInferenceChecks.fsi - - check.fs + + PostInferenceChecks.fs - - tc.fsi + + TypeChecker.fsi - - tc.fs + + TypeChecker.fs - - opt.fsi + + Optimizer.fsi - - opt.fs + + Optimizer.fs - - detuple.fsi + + DetupleArgs.fsi - - detuple.fs + + DetupleArgs.fs - - tlr.fsi + + InnerLambdasToTopLevelFuncs.fsi - - tlr.fs + + InnerLambdasToTopLevelFuncs.fs - - lowertop.fs + + LowerCallsAndSeqs.fs - - ilxgen.fsi + + IlxGen.fsi - - ilxgen.fs + + IlxGen.fs TraceCall.fsi @@ -394,11 +388,11 @@ build.fs - - fscopts.fsi + + FscOptions.fsi - - fscopts.fs + + FscOptions.fs IncrementalBuild.fsi diff --git a/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj b/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj index e643e3f53fe..c6168fc642f 100644 --- a/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj +++ b/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj @@ -51,17 +51,11 @@ LexYaccRuntime\prim-parsing.fs - - Utilities\ExtensibleDumper.fsi + + Utilities\ResizeArray.fsi - - Utilities\ExtensibleDumper.fs - - - Utilities\resizearray.fsi - - - Utilities\resizearray.fs + + Utilities\ResizeArray.fs Utilities\HashMultiMap.fsi @@ -229,17 +223,17 @@ ILXErase\ilxsettings.fs - - ILXErase\pubclo.fsi + + ILXErase\EraseClosures.fsi - - ILXErase\pubclo.fs + + ILXErase\EraseClosures.fs - - ILXErase\cu_erase.fsi + + ILXErase\EraseUnions.fsi - - ILXErase\cu_erase.fs + + ILXErase\EraseUnions.fs --lexlib Internal.Utilities.Text.Lexing @@ -251,11 +245,11 @@ --internal --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing ParserAndUntypedAST\pars.fsy - - ParserAndUntypedAST\unilex.fsi + + ParserAndUntypedAST\UnicodeLexing.fsi - - ParserAndUntypedAST\unilex.fs + + ParserAndUntypedAST\UnicodeLexing.fs ParserAndUntypedAST\layout.fsi @@ -278,7 +272,7 @@ ParserAndUntypedAST\lex.fs - + ParserAndUntypedAST\lexfilter.fs @@ -287,35 +281,35 @@ TypedAST\tainted.fs - - TypedAST\est.fsi + + TypedAST\ExtensionTyping.fsi - - TypedAST\est.fs + + TypedAST\ExtensionTyping.fs - - TypedAST\sreflect.fsi + + TypedAST\QuotationPickler.fsi - - TypedAST\sreflect.fs + + TypedAST\QuotationPickler.fs TypedAST\tast.fs - - TypedAST\env.fs + + TypedAST\TcGlobals.fs - - TypedAST\tastops.fsi + + TypedAST\TastOps.fsi - - TypedAST\tastops.fs + + TypedAST\TastOps.fs - - TypedAST\pickle.fsi + + TypedAST\TastPickle.fsi - - TypedAST\pickle.fs + + TypedAST\TastPickle.fs Logic\import.fsi @@ -329,92 +323,86 @@ Logic\NicePrint.fs - - Logic\augment.fsi - - - Logic\augment.fs - - - Logic\outcome.fsi + + Logic\AugmentWithHashCompare.fsi - - Logic\outcome.fs + + Logic\AugmentWithHashCompare.fs - - Logic\nameres.fsi + + Logic\NameResolution.fsi - - Logic\nameres.fs + + Logic\NameResolution.fs - - Logic\typrelns.fs + + Logic\TypeRelations.fs - - Logic\patcompile.fsi + + Logic\PatternMatchCompilation.fsi - - Logic\patcompile.fs + + Logic\PatternMatchCompilation.fs - - Logic\csolve.fsi + + Logic\ConstraintSolver.fsi - - Logic\csolve.fs + + Logic\ConstraintSolver.fs - - Logic\formats.fsi + + Logic\CheckFormatStrings.fsi - - Logic\formats.fs + + Logic\CheckFormatStrings.fs - - Logic\unsolved.fs + + Logic\FindUnsolved.fs - - Logic\creflect.fsi + + Logic\QuotationTranslator.fsi - - Logic\creflect.fs + + Logic\QuotationTranslator.fs - - Logic\check.fsi + + Logic\PostInferenceChecks.fsi - - Logic\check.fs + + Logic\PostInferenceChecks.fs - - Logic\tc.fsi + + Logic\TypeChecker.fsi - - Logic\tc.fs + + Logic\TypeChecker.fs - - Optimize\opt.fsi + + Optimize\Optimizer.fsi - - Optimize\opt.fs + + Optimize\Optimizer.fs - - Optimize\detuple.fsi + + Optimize\DetupleArgs.fsi - - Optimize\detuple.fs + + Optimize\DetupleArgs.fs - - Optimize\tlr.fsi + + Optimize\InnerLambdasToTopLevelFuncs.fsi - - Optimize\tlr.fs + + Optimize\InnerLambdasToTopLevelFuncs.fs - - Optimize\lowertop.fs + + Optimize\LowerCallsAndSeqs.fs - - CodeGen\ilxgen.fsi + + CodeGen\IlxGen.fsi - - CodeGen\ilxgen.fs + + CodeGen\IlxGen.fs Driver\build.fsi @@ -422,11 +410,11 @@ Driver\build.fs - - Driver\fscopts.fsi + + Driver\FscOptions.fsi - - Driver\fscopts.fs + + Driver\FscOptions.fs Driver\IncrementalBuild.fsi diff --git a/src/fsharp/unsolved.fs b/src/fsharp/FindUnsolved.fs similarity index 99% rename from src/fsharp/unsolved.fs rename to src/fsharp/FindUnsolved.fs index 221cff97a0b..b1032468908 100644 --- a/src/fsharp/unsolved.fs +++ b/src/fsharp/FindUnsolved.fs @@ -19,11 +19,11 @@ open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Layout open Microsoft.FSharp.Compiler.AbstractIL.IL -open Microsoft.FSharp.Compiler.Typrelns +open Microsoft.FSharp.Compiler.TypeRelations open Microsoft.FSharp.Compiler.Infos type env = Nix diff --git a/src/fsharp/fscopts.fs b/src/fsharp/FscOptions.fs similarity index 97% rename from src/fsharp/fscopts.fs rename to src/fsharp/FscOptions.fs index b2e11765e66..2af8b59247b 100644 --- a/src/fsharp/fscopts.fs +++ b/src/fsharp/FscOptions.fs @@ -2,7 +2,7 @@ // # FSComp.SR.opts -module internal Microsoft.FSharp.Compiler.Fscopts +module internal Microsoft.FSharp.Compiler.FscOptions open Internal.Utilities open System @@ -15,7 +15,7 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Microsoft.FSharp.Compiler.Build -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.TypeChecker open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops @@ -28,7 +28,7 @@ open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Lexhelp #if NO_COMPILER_BACKEND #else -open Microsoft.FSharp.Compiler.Ilxgen +open Microsoft.FSharp.Compiler.IlxGen #endif @@ -427,7 +427,7 @@ let testFlag tcConfigB = CompilerOption("test", tagString, OptionString (fun s -> match s with | "ErrorRanges" -> tcConfigB.errorStyle <- ErrorStyle.TestErrors - | "MemberBodyRanges" -> PostTypecheckSemanticChecks.testFlagMemberBody := true + | "MemberBodyRanges" -> PostTypeCheckSemanticChecks.testFlagMemberBody := true | "Tracking" -> Lib.tracking := true (* general purpose on/off diagnostics flag *) | "NoNeedToTailcall" -> tcConfigB.optSettings <- { tcConfigB.optSettings with reportNoNeedToTailcall = true } | "FunctionSizes" -> tcConfigB.optSettings <- { tcConfigB.optSettings with reportFunctionSizes = true } @@ -476,7 +476,7 @@ let internalFlags (tcConfigB:TcConfigBuilder) = CompilerOption("tlr", tagInt, OptionInt (setFlag (fun v -> tcConfigB.doTLR <- v)), Some(InternalCommandLineOption("--tlr", rangeCmdArgs)), None); CompilerOption("finalSimplify", tagInt, OptionInt (setFlag (fun v -> tcConfigB.doFinalSimplify <- v)), Some(InternalCommandLineOption("--finalSimplify", rangeCmdArgs)), None); #if TLR_LIFT - CompilerOption("tlrlift", tagNone, OptionInt (setFlag (fun v -> Tlr.liftTLR := v)), Some(InternalCommandLineOption("--tlrlift", rangeCmdArgs)), None); + CompilerOption("tlrlift", tagNone, OptionInt (setFlag (fun v -> InnerLambdasToTopLevelFuncs.liftTLR := v)), Some(InternalCommandLineOption("--tlrlift", rangeCmdArgs)), None); #endif CompilerOption("parseonly", tagNone, OptionUnit (fun () -> tcConfigB.parseOnly <- true), Some(InternalCommandLineOption("--parseonly", rangeCmdArgs)), None); CompilerOption("typecheckonly", tagNone, OptionUnit (fun () -> tcConfigB.typeCheckOnly <- true), Some(InternalCommandLineOption("--typecheckonly", rangeCmdArgs)), None); @@ -822,7 +822,7 @@ let ReportTime (tcConfig:TcConfig) descr = let AddExternalCcuToOpimizationEnv tcGlobals optEnv ccuinfo = match ccuinfo.FSharpOptimizationData.Force() with | None -> optEnv - | Some(data) -> Opt.BindCcu ccuinfo.FSharpViewOfMetadata data optEnv tcGlobals + | Some(data) -> Optimizer.BindCcu ccuinfo.FSharpViewOfMetadata data optEnv tcGlobals //---------------------------------------------------------------------------- // OPTIMIZATION - support - optimize @@ -830,7 +830,7 @@ let AddExternalCcuToOpimizationEnv tcGlobals optEnv ccuinfo = let InitialOptimizationEnv (tcImports:TcImports) (tcGlobals:TcGlobals) = let ccuinfos = tcImports.GetImportedAssemblies() - let optEnv = Opt.IncrementalOptimizationEnv.Empty + let optEnv = Optimizer.IncrementalOptimizationEnv.Empty let optEnv = List.fold (AddExternalCcuToOpimizationEnv tcGlobals) optEnv ccuinfos optEnv @@ -859,19 +859,19 @@ let ApplyAllOptimizations (tcConfig:TcConfig, tcGlobals, tcVal, outfile, importM //ReportTime tcConfig ("Initial simplify"); let optEnvFirstLoop,implFile,implFileOptData = - Opt.OptimizeImplFile(optSettings,ccu,tcGlobals,tcVal, importMap,optEnvFirstLoop,isIncrementalFragment,tcConfig.emitTailcalls,implFile) + Optimizer.OptimizeImplFile(optSettings,ccu,tcGlobals,tcVal, importMap,optEnvFirstLoop,isIncrementalFragment,tcConfig.emitTailcalls,implFile) // Only do this on the first pass! let optSettings = { optSettings with abstractBigTargets = false } let optSettings = { optSettings with reportingPhase = false } #if DEBUG - if tcConfig.showOptimizationData then dprintf "Optimization implFileOptData:\n%s\n" (Layout.showL (Layout.squashTo 192 (Opt.moduleInfoL tcGlobals implFileOptData))); + if tcConfig.showOptimizationData then dprintf "Optimization implFileOptData:\n%s\n" (Layout.showL (Layout.squashTo 192 (Optimizer.moduleInfoL tcGlobals implFileOptData))); #endif let implFile,optEnvExtraLoop = if tcConfig.extraOptimizationIterations > 0 then //ReportTime tcConfig ("Extra simplification loop"); - let optEnvExtraLoop,implFile, _ = Opt.OptimizeImplFile(optSettings,ccu,tcGlobals,tcVal, importMap,optEnvExtraLoop,isIncrementalFragment,tcConfig.emitTailcalls,implFile) + let optEnvExtraLoop,implFile, _ = Optimizer.OptimizeImplFile(optSettings,ccu,tcGlobals,tcVal, importMap,optEnvExtraLoop,isIncrementalFragment,tcConfig.emitTailcalls,implFile) //PrintWholeAssemblyImplementation tcConfig outfile (sprintf "extra-loop-%d" n) implFile; implFile,optEnvExtraLoop else @@ -887,16 +887,16 @@ let ApplyAllOptimizations (tcConfig:TcConfig, tcGlobals, tcVal, outfile, importM let implFile = if tcConfig.doTLR then - implFile |> Tlr.MakeTLRDecisions ccu tcGlobals + implFile |> InnerLambdasToTopLevelFuncs.MakeTLRDecisions ccu tcGlobals else implFile let implFile = - Lowertop.LowerImplFile tcGlobals implFile + LowerCallsAndSeqs.LowerImplFile tcGlobals implFile let implFile,optEnvFinalSimplify = if tcConfig.doFinalSimplify then //ReportTime tcConfig ("Final simplify pass"); - let optEnvFinalSimplify,implFile, _ = Opt.OptimizeImplFile(optSettings,ccu,tcGlobals,tcVal, importMap,optEnvFinalSimplify,isIncrementalFragment,tcConfig.emitTailcalls,implFile) + let optEnvFinalSimplify,implFile, _ = Optimizer.OptimizeImplFile(optSettings,ccu,tcGlobals,tcVal, importMap,optEnvFinalSimplify,isIncrementalFragment,tcConfig.emitTailcalls,implFile) //PrintWholeAssemblyImplementation tcConfig outfile "post-rec-opt" implFile; implFile,optEnvFinalSimplify else @@ -904,7 +904,7 @@ let ApplyAllOptimizations (tcConfig:TcConfig, tcGlobals, tcVal, outfile, importM (implFile,implFileOptData),(optEnvFirstLoop,optEnvExtraLoop,optEnvFinalSimplify)) let implFiles,implFileOptDatas = List.unzip results - let assemblyOptData = Opt.UnionModuleInfos implFileOptDatas + let assemblyOptData = Optimizer.UnionOptimizationInfos implFileOptDatas let tassembly = TAssembly(implFiles) PrintWholeAssemblyImplementation tcConfig outfile "pass-end" tassembly; ReportTime tcConfig ("Ending Optimizations"); @@ -917,7 +917,7 @@ let ApplyAllOptimizations (tcConfig:TcConfig, tcGlobals, tcVal, outfile, importM //---------------------------------------------------------------------------- let CreateIlxAssemblyGenerator (_tcConfig:TcConfig,tcImports:TcImports,tcGlobals, tcVal, generatedCcu) = - let ilxGenerator = new Ilxgen.IlxAssemblyGenerator (tcImports.GetImportMap(), tcGlobals, tcVal, generatedCcu) + let ilxGenerator = new IlxGen.IlxAssemblyGenerator (tcImports.GetImportMap(), tcGlobals, tcVal, generatedCcu) let ccus = tcImports.GetCcusInDeclOrder() ilxGenerator.AddExternalCcus ccus ilxGenerator diff --git a/src/fsharp/fscopts.fsi b/src/fsharp/FscOptions.fsi similarity index 90% rename from src/fsharp/fscopts.fsi rename to src/fsharp/FscOptions.fsi index 676a129756f..bd9e916ce19 100644 --- a/src/fsharp/fscopts.fsi +++ b/src/fsharp/FscOptions.fsi @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Fscopts +module internal Microsoft.FSharp.Compiler.FscOptions open Internal.Utilities open Microsoft.FSharp.Compiler.AbstractIL @@ -13,11 +13,11 @@ open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.Tast #if NO_COMPILER_BACKEND #else -open Microsoft.FSharp.Compiler.Ilxgen +open Microsoft.FSharp.Compiler.IlxGen #endif open Microsoft.FSharp.Compiler.Import -open Microsoft.FSharp.Compiler.Opt -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.Optimizer +open Microsoft.FSharp.Compiler.TcGlobals val DisplayBannerText : TcConfigBuilder -> unit @@ -38,7 +38,7 @@ val fsharpModuleName : CompilerTarget -> string -> string #else val InitialOptimizationEnv : TcImports -> TcGlobals -> IncrementalOptimizationEnv val AddExternalCcuToOpimizationEnv : TcGlobals -> IncrementalOptimizationEnv -> ImportedAssembly -> IncrementalOptimizationEnv -val ApplyAllOptimizations : TcConfig * TcGlobals * ConstraintSolver.TcValF * string * ImportMap * bool * IncrementalOptimizationEnv * CcuThunk * TypedAssembly -> TypedAssembly * Opt.LazyModuleInfo * IncrementalOptimizationEnv +val ApplyAllOptimizations : TcConfig * TcGlobals * ConstraintSolver.TcValF * string * ImportMap * bool * IncrementalOptimizationEnv * CcuThunk * TypedAssembly -> TypedAssembly * Optimizer.LazyModuleInfo * IncrementalOptimizationEnv val CreateIlxAssemblyGenerator : TcConfig * TcImports * TcGlobals * ConstraintSolver.TcValF * CcuThunk -> IlxAssemblyGenerator diff --git a/src/fsharp/ilxgen.fs b/src/fsharp/IlxGen.fs similarity index 99% rename from src/fsharp/ilxgen.fs rename to src/fsharp/IlxGen.fs index a14f39593fb..a493d03b3d1 100644 --- a/src/fsharp/ilxgen.fs +++ b/src/fsharp/IlxGen.fs @@ -4,7 +4,7 @@ // The ILX generator. //-------------------------------------------------------------------------- -module internal Microsoft.FSharp.Compiler.Ilxgen +module internal Microsoft.FSharp.Compiler.IlxGen open System.IO open System.Collections.Generic @@ -27,10 +27,10 @@ open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.PrettyNaming -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Layout open Microsoft.FSharp.Compiler.Lib -open Microsoft.FSharp.Compiler.Typrelns +open Microsoft.FSharp.Compiler.TypeRelations open Microsoft.FSharp.Compiler.TypeChecker open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types @@ -192,7 +192,7 @@ type IlxGenOptions = /// Compilation environment for compiling a fragment of an assembly [] type cenv = - { g: Env.TcGlobals + { g: TcGlobals TcVal : ConstraintSolver.TcValF viewCcu: CcuThunk opts: IlxGenOptions @@ -430,16 +430,16 @@ and GenTypeAux amap m g (tyenv: TypeReprEnv) voidOK ptrsOK ty = match stripTyEqnsAndMeasureEqns g ty with | TType_app (tcref, tinst) -> GenNamedTyAppAux amap m g tyenv ptrsOK tcref tinst | TType_tuple args -> GenTypeAux amap m g tyenv VoidNotOK ptrsOK (mkCompiledTupleTy g args) - | TType_fun (dty, returnTy) -> EraseIlxFuncs.mkILFuncTy g.ilxPubCloEnv (GenTypeArgAux amap m g tyenv dty) (GenTypeArgAux amap m g tyenv returnTy) + | TType_fun (dty, returnTy) -> EraseClosures.mkILFuncTy g.ilxPubCloEnv (GenTypeArgAux amap m g tyenv dty) (GenTypeArgAux amap m g tyenv returnTy) | TType_ucase (ucref, args) -> let cuspec,idx = GenUnionCaseSpec amap m g tyenv ucref args - EraseIlxUnions.GetILTypeForAlternative cuspec idx + EraseUnions.GetILTypeForAlternative cuspec idx | TType_forall (tps, tau) -> let tps = DropErasedTypars tps if tps.IsEmpty then GenTypeAux amap m g tyenv VoidNotOK ptrsOK tau - else EraseIlxFuncs.mkILTyFuncTy g.ilxPubCloEnv + else EraseClosures.mkILTyFuncTy g.ilxPubCloEnv | TType_var tp -> mkILTyvarTy tyenv.[tp,m] | TType_measure _ -> g.ilg.typ_int32 @@ -1670,7 +1670,7 @@ let rec GenExpr cenv (cgbuf:CodeGenBuffer) eenv sp expr sequel = if not (WillGenerateSequencePoint sp expr) && not (AlwaysSuppressSequencePoint sp expr) then CG.EmitSeqPoint cgbuf expr.Range; - match (if compileSequenceExpressions then Lowertop.LowerSeqExpr cenv.g cenv.amap expr else None) with + match (if compileSequenceExpressions then LowerCallsAndSeqs.LowerSeqExpr cenv.g cenv.amap expr else None) with | Some info -> GenSequenceExpr cenv cgbuf eenv info sequel | None -> @@ -2094,9 +2094,9 @@ and GenNewArray cenv cgbuf eenv (elems: Expr list,elemTy,m) sequel = and GenCoerce cenv cgbuf eenv (e,tgty,m,srcty) sequel = // Is this an upcast? - if Typrelns.TypeDefinitelySubsumesTypeNoCoercion 0 cenv.g cenv.amap m tgty srcty && + if TypeRelations.TypeDefinitelySubsumesTypeNoCoercion 0 cenv.g cenv.amap m tgty srcty && // Do an extra check - should not be needed - Typrelns.TypeFeasiblySubsumesType 0 cenv.g cenv.amap m tgty Typrelns.NoCoerce srcty then + TypeRelations.TypeFeasiblySubsumesType 0 cenv.g cenv.amap m tgty TypeRelations.NoCoerce srcty then begin // The .NET IL doesn't always support implict subsumption for interface types, e.g. at stack merge points // Hence be conservative here and always cast explicitly. @@ -2158,7 +2158,7 @@ and GenSetExnField cenv cgbuf eenv (e,ecref,fieldNum,e2,m) sequel = and GenUnionCaseProof cenv cgbuf eenv (e,ucref,tyargs,m) sequel = GenExpr cenv cgbuf eenv SPSuppress e Continue; let cuspec,idx = GenUnionCaseSpec cenv.amap m cenv.g eenv.tyenv ucref tyargs - let fty = EraseIlxUnions.GetILTypeForAlternative cuspec idx + let fty = EraseUnions.GetILTypeForAlternative cuspec idx CG.EmitInstrs cgbuf (pop 1) (Push [fty]) [ mkIlxInstr (EI_castdata(false,cuspec,idx)); ]; GenSequel cenv eenv.cloc cgbuf sequel @@ -2676,7 +2676,7 @@ and GenApp cenv cgbuf eenv (f,fty,tyargs,args,m) sequel = let whereSaved,eenv = (eenv,laterArgs) ||> List.mapFold (fun eenv laterArg -> // Only save arguments that have effects - if Opt.ExprHasEffect cenv.g laterArg then + if Optimizer.ExprHasEffect cenv.g laterArg then let ilTy = laterArg |> tyOfExpr cenv.g |> GenType cenv.amap m cenv.g eenv.tyenv let loc,eenv = AllocLocal cenv cgbuf eenv true (ilxgenGlobalNng.FreshCompilerGeneratedName ("arg",m), ilTy) scopeMarks GenExpr cenv cgbuf eenv SPSuppress laterArg Continue @@ -3632,7 +3632,7 @@ and GenObjectExpr cenv cgbuf eenvouter expr (baseType,baseValOpt,basecall,overri cgbuf.mgbuf.AddTypeDef(ilCloTypeRef, cloTypeDef, false, false); CountClosure(); GenGetLocalVals cenv cgbuf eenvouter m cloFreeVars; - CG.EmitInstr cgbuf (pop ilCloFreeVars.Length) (Push [ EraseIlxFuncs.mkTyOfLambdas cenv.g.ilxPubCloEnv ilCloLambdas]) (I_newobj (ilxCloSpec.Constructor,None)); + CG.EmitInstr cgbuf (pop ilCloFreeVars.Length) (Push [ EraseClosures.mkTyOfLambdas cenv.g.ilxPubCloEnv ilCloLambdas]) (I_newobj (ilxCloSpec.Constructor,None)); GenSequel cenv eenvouter.cloc cgbuf sequel and GenSequenceExpr cenv (cgbuf:CodeGenBuffer) eenvouter (nextEnumeratorValRef:ValRef,pcvref:ValRef,currvref:ValRef,stateVars,generateNextExpr,closeExpr,checkCloseExpr:Expr,seqElemTy, m) sequel = @@ -3827,7 +3827,7 @@ and GenLambdaVal cenv (cgbuf:CodeGenBuffer) eenv (cloinfo,m) = GenGetLocalVals cenv cgbuf eenv m cloinfo.cloFreeVars; CG.EmitInstr cgbuf (pop cloinfo.cloILFreeVars.Length) - (Push [EraseIlxFuncs.mkTyOfLambdas cenv.g.ilxPubCloEnv cloinfo.ilCloLambdas]) + (Push [EraseClosures.mkTyOfLambdas cenv.g.ilxPubCloEnv cloinfo.ilCloLambdas]) (I_newobj (cloinfo.cloSpec.Constructor,None)) and GenLambda cenv cgbuf eenv isLocalTypeFunc selfv expr sequel = @@ -4160,7 +4160,7 @@ and GenDelegateExpr cenv cgbuf eenvouter expr (TObjExprMethod((TSlotSig(_,delega let ctxtGenericArgsForDelegee = GenGenericArgs m eenvouter.tyenv cloFreeTyvars let ilxCloSpec = IlxClosureSpec.Create(IlxClosureRef(ilDelegeeTypeRef, ilCloLambdas, ilCloFreeVars), mkILGenericArgs ctxtGenericArgsForDelegee) GenGetLocalVals cenv cgbuf eenvouter m cloFreeVars; - CG.EmitInstr cgbuf (pop ilCloFreeVars.Length) (Push [EraseIlxFuncs.mkTyOfLambdas cenv.g.ilxPubCloEnv ilCloLambdas]) (I_newobj (ilxCloSpec.Constructor,None)); + CG.EmitInstr cgbuf (pop ilCloFreeVars.Length) (Push [EraseClosures.mkTyOfLambdas cenv.g.ilxPubCloEnv ilCloLambdas]) (I_newobj (ilxCloSpec.Constructor,None)); let ilDelegeeTyOuter = mkILBoxedTy ilDelegeeTypeRef ctxtGenericArgsForDelegee let ilDelegeeInvokeMethOuter = mkILNonGenericInstanceMethSpecInTy (ilDelegeeTyOuter,"Invoke",typesOfILParamsList ilDelegeeParams, ilDelegeeRet.Type) @@ -6428,7 +6428,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) = eenv.valsInScope.TryFind cenv.g.new_format_vref.Deref) with | Some(Lazy(Method(_,_,sprintfMethSpec,_,_,_))), Some(Lazy(Method(_,_,newFormatMethSpec,_,_,_))) -> // The type returned by the 'sprintf' call - let funcTy = EraseIlxFuncs.mkILFuncTy cenv.g.ilxPubCloEnv ilThisTy cenv.g.ilg.typ_String + let funcTy = EraseClosures.mkILFuncTy cenv.g.ilxPubCloEnv ilThisTy cenv.g.ilg.typ_String // Give the instantiation of the printf format object, i.e. a Format`5 object compatible with StringFormat let newFormatMethSpec = mkILMethSpec(newFormatMethSpec.MethodRef,AsObject, [// 'T -> string' @@ -6924,8 +6924,8 @@ let defaultOf = /// Top-level val bindings are stored (for example) in static fields. /// In the FSI case, these fields are be created and initialised, so we can recover the object. -/// Ilxgen knows how v was stored, and then ilreflect knows how this storage was generated. -/// Ilxgen converts (v:Tast.Val) to AbsIL datatstructures. +/// IlxGen knows how v was stored, and then ilreflect knows how this storage was generated. +/// IlxGen converts (v:Tast.Val) to AbsIL datatstructures. /// Ilreflect converts from AbsIL datatstructures to emitted Type, FieldInfo, MethodInfo etc. let LookupGeneratedValue (amap:Import.ImportMap) (ctxt: ExecutionContext) g eenv (v:Val) = try @@ -7021,7 +7021,7 @@ let LookupGeneratedInfo (ctxt: ExecutionContext) (g:TcGlobals) eenv (v:Val) = /// The published API from the ILX code generator -type IlxAssemblyGenerator(amap: Import.ImportMap, tcGlobals: Env.TcGlobals, tcVal : ConstraintSolver.TcValF, ccu: Tast.CcuThunk) = +type IlxAssemblyGenerator(amap: Import.ImportMap, tcGlobals: TcGlobals, tcVal : ConstraintSolver.TcValF, ccu: Tast.CcuThunk) = // The incremental state held by the ILX code generator let mutable ilxGenEnv = GetEmptyIlxGenEnv tcGlobals.ilg ccu diff --git a/src/fsharp/ilxgen.fsi b/src/fsharp/IlxGen.fsi similarity index 95% rename from src/fsharp/ilxgen.fsi rename to src/fsharp/IlxGen.fsi index b37df4dee6f..8172cc23b67 100644 --- a/src/fsharp/ilxgen.fsi +++ b/src/fsharp/IlxGen.fsi @@ -1,14 +1,15 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Ilxgen +module internal Microsoft.FSharp.Compiler.IlxGen +open System +open System.IO +open System.Reflection open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.Tast -open System -open System.IO -open System.Reflection +open Microsoft.FSharp.Compiler.TcGlobals /// Indicates how the generated IL code is ultimately emitted type IlxGenBackend = @@ -60,7 +61,7 @@ type ExecutionContext = /// An incremental ILX code generator for a single assembly type public IlxAssemblyGenerator = /// Create an incremental ILX code generator for a single assembly - new : Import.ImportMap * Env.TcGlobals * ConstraintSolver.TcValF * CcuThunk -> IlxAssemblyGenerator + new : Import.ImportMap * TcGlobals * ConstraintSolver.TcValF * CcuThunk -> IlxAssemblyGenerator /// Register a set of referenced assemblies with the ILX code generator member AddExternalCcus : CcuThunk list -> unit diff --git a/src/fsharp/tlr.fs b/src/fsharp/InnerLambdasToTopLevelFuncs.fs similarity index 99% rename from src/fsharp/tlr.fs rename to src/fsharp/InnerLambdasToTopLevelFuncs.fs index 7d9a952dd2c..6dd04788411 100644 --- a/src/fsharp/tlr.fs +++ b/src/fsharp/InnerLambdasToTopLevelFuncs.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Tlr +module internal Microsoft.FSharp.Compiler.InnerLambdasToTopLevelFuncs open Internal.Utilities open Microsoft.FSharp.Compiler.AbstractIL @@ -14,7 +14,7 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tastops.DebugPrint -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Layout open Microsoft.FSharp.Compiler.Detuple.GlobalUsageAnalysis open Microsoft.FSharp.Compiler.Lib @@ -868,7 +868,7 @@ module Pass4_RewriteAssembly = [] type RewriteContext = { ccu : CcuThunk; - g : Env.TcGlobals; + g : TcGlobals; tlrS : Zset ; topValS : Zset ; arityM : Zmap ; @@ -1048,9 +1048,9 @@ module Pass4_RewriteAssembly = let newTlrBinds,tlrRebinds = TransTLRBindings penv tlrBs let aenvBinds = GetAEnvBindings penv fclass // lower nonTlrBs if they are GTL - // QUERY: we repeat this logic in Lowertop. Do we really need to do this here? + // QUERY: we repeat this logic in LowerCallsAndSeqs. Do we really need to do this here? // QUERY: yes and no - if we don't, we have an unrealizable term, and many decisions must - // QUERY: correlate with Lowertop. + // QUERY: correlate with LowerCallsAndSeqs. let forceTopBindToHaveArity (bind:Binding) = if penv.topValS.Contains(bind.Var) then ConvertBind penv.g bind else bind diff --git a/src/fsharp/tlr.fsi b/src/fsharp/InnerLambdasToTopLevelFuncs.fsi similarity index 55% rename from src/fsharp/tlr.fsi rename to src/fsharp/InnerLambdasToTopLevelFuncs.fsi index c0b16fcaeea..1c6225cb119 100644 --- a/src/fsharp/tlr.fsi +++ b/src/fsharp/InnerLambdasToTopLevelFuncs.fsi @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Tlr +module internal Microsoft.FSharp.Compiler.InnerLambdasToTopLevelFuncs open Microsoft.FSharp.Compiler +open Microsoft.FSharp.Compiler.TcGlobals -val MakeTLRDecisions : Tast.CcuThunk -> Env.TcGlobals -> Tast.TypedImplFile -> Tast.TypedImplFile +val MakeTLRDecisions : Tast.CcuThunk -> TcGlobals -> Tast.TypedImplFile -> Tast.TypedImplFile #if TLR_LIFT val liftTLR : bool ref #endif diff --git a/src/fsharp/lexfilter.fs b/src/fsharp/LexFilter.fs similarity index 99% rename from src/fsharp/lexfilter.fs rename to src/fsharp/LexFilter.fs index 81cf6a0ed5b..d7183777f5d 100644 --- a/src/fsharp/lexfilter.fs +++ b/src/fsharp/LexFilter.fs @@ -2,7 +2,7 @@ /// LexFilter - process the token stream prior to parsing. /// Implements the offside rule and a copule of other lexical transformations. -module internal Microsoft.FSharp.Compiler.Lexfilter +module internal Microsoft.FSharp.Compiler.LexFilter open Internal.Utilities open Internal.Utilities.Text.Lexing diff --git a/src/fsharp/lowertop.fs b/src/fsharp/LowerCallsAndSeqs.fs similarity index 99% rename from src/fsharp/lowertop.fs rename to src/fsharp/LowerCallsAndSeqs.fs index e2fbe7702f0..7c5e78fbe11 100644 --- a/src/fsharp/lowertop.fs +++ b/src/fsharp/LowerCallsAndSeqs.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Lowertop +module internal Microsoft.FSharp.Compiler.LowerCallsAndSeqs open Internal.Utilities open Microsoft.FSharp.Compiler.AbstractIL @@ -17,7 +17,7 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Lib -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.PrettyNaming //---------------------------------------------------------------------------- diff --git a/src/fsharp/nameres.fs b/src/fsharp/NameResolution.fs similarity index 99% rename from src/fsharp/nameres.fs rename to src/fsharp/NameResolution.fs index 710c4b8f1b3..5259249b3f7 100644 --- a/src/fsharp/nameres.fs +++ b/src/fsharp/NameResolution.fs @@ -5,7 +5,7 @@ //------------------------------------------------------------------------- -module internal Microsoft.FSharp.Compiler.Nameres +module internal Microsoft.FSharp.Compiler.NameResolution open Internal.Utilities open Microsoft.FSharp.Compiler @@ -15,14 +15,14 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Import -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library +open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.ResultOrException open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Microsoft.FSharp.Compiler.AbstractIL.IL // Abstract IL -open Microsoft.FSharp.Compiler.Outcome open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.Infos.AccessibilityLogic open Microsoft.FSharp.Compiler.Infos.AttributeChecking @@ -2529,7 +2529,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv isApplicableMeth m ad st not minfo.IsExtensionMember && match minfo.LogicalName with | "GetType" -> false - | "GetHashCode" -> isObjTy g minfo.EnclosingType && not (Augment.TypeDefinitelyHasEquality g typ) + | "GetHashCode" -> isObjTy g minfo.EnclosingType && not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ) | "ToString" -> false | "Equals" -> if not (isObjTy g minfo.EnclosingType) then @@ -2537,7 +2537,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv isApplicableMeth m ad st false elif minfo.IsInstance then // System.Object has only one instance Equals method and we want to suppress it unless Augment.TypeDefinitelyHasEquality is true - not (Augment.TypeDefinitelyHasEquality g typ) + not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ) else // System.Object has only one static Equals method and we always want to suppress it true diff --git a/src/fsharp/nameres.fsi b/src/fsharp/NameResolution.fsi similarity index 99% rename from src/fsharp/nameres.fsi rename to src/fsharp/NameResolution.fsi index 61cba72b298..1f24dd30a77 100644 --- a/src/fsharp/nameres.fsi +++ b/src/fsharp/NameResolution.fsi @@ -1,16 +1,15 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Nameres +module internal Microsoft.FSharp.Compiler.NameResolution open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Import -open Microsoft.FSharp.Compiler.Outcome open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library open Microsoft.FSharp.Compiler.PrettyNaming diff --git a/src/fsharp/NicePrint.fs b/src/fsharp/NicePrint.fs index 04d2a828c95..2fd98f114f9 100644 --- a/src/fsharp/NicePrint.fs +++ b/src/fsharp/NicePrint.fs @@ -19,7 +19,7 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tastops.DebugPrint -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.AbstractIL.IL (* Abstract IL *) open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Infos diff --git a/src/fsharp/opt.fs b/src/fsharp/Optimizer.fs similarity index 99% rename from src/fsharp/opt.fs rename to src/fsharp/Optimizer.fs index 96342bcbf21..c88de173a62 100644 --- a/src/fsharp/opt.fs +++ b/src/fsharp/Optimizer.fs @@ -7,7 +7,7 @@ //------------------------------------------------------------------------- -module internal Microsoft.FSharp.Compiler.Opt +module internal Microsoft.FSharp.Compiler.Optimizer open Internal.Utilities open Microsoft.FSharp.Compiler.AbstractIL @@ -19,7 +19,7 @@ open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics -open Microsoft.FSharp.Compiler.Pickle +open Microsoft.FSharp.Compiler.TastPickle open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger @@ -28,10 +28,10 @@ open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tastops.DebugPrint open Microsoft.FSharp.Compiler.TypeChecker -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Layout -open Microsoft.FSharp.Compiler.Typrelns +open Microsoft.FSharp.Compiler.TypeRelations open Microsoft.FSharp.Compiler.Infos open System.Collections.Generic @@ -145,7 +145,10 @@ type ModuleInfo = ModuleOrNamespaceInfos: NameMap } and LazyModuleInfo = Lazy +type ImplFileOptimizationInfo = LazyModuleInfo +type CcuOptimizationInfo = LazyModuleInfo +#if DEBUG let braceL x = leftL "{" ^^ x ^^ rightL "}" let seqL xL xs = Seq.fold (fun z x -> z @@ xL x) emptyL xs let namemapL xL xmap = NameMap.foldBack (fun nm x z -> xL nm x @@ z) xmap emptyL @@ -169,6 +172,7 @@ and moduleInfoL g (x:LazyModuleInfo) = and valInfoL g (x:ValInfo) = braceL ((wordL "ValExprInfo: " @@ exprValueInfoL g x.ValExprInfo) @@ (wordL "ValMakesNoCriticalTailcalls:" @@ wordL (if x.ValMakesNoCriticalTailcalls then "true" else "false"))) +#endif type Summary<'Info> = { Info: 'Info; @@ -306,7 +310,7 @@ type OptimizationSettings = #else type cenv = - { g: Env.TcGlobals; + { g: TcGlobals; TcVal : ConstraintSolver.TcValF amap: Import.ImportMap; optimizing: bool; @@ -374,10 +378,10 @@ let check (vref: ValRef) (res:ValInfo) = let EmptyModuleInfo = notlazy { ValInfos = ValInfos([]); ModuleOrNamespaceInfos = Map.empty } -let rec UnionModuleInfos (minfos : seq) = +let rec UnionOptimizationInfos (minfos : seq) = notlazy { ValInfos = ValInfos(seq { for minfo in minfos do yield! minfo.Force().ValInfos.Entries }) - ModuleOrNamespaceInfos = minfos |> Seq.map (fun m -> m.Force().ModuleOrNamespaceInfos) |> NameMap.union UnionModuleInfos } + ModuleOrNamespaceInfos = minfos |> Seq.map (fun m -> m.Force().ModuleOrNamespaceInfos) |> NameMap.union UnionOptimizationInfos } let FindOrCreateModuleInfo n (ss: Map<_,_>) = match ss.TryFind n with @@ -491,8 +495,10 @@ let BindTypeVarsToUnknown (tps:Typar list) env = List.fold (fun sofar arg -> BindTypeVar arg UnknownTypeValue sofar) env tps let BindCcu (ccu:Tast.CcuThunk) mval env cenv = +#if DEBUG if verboseOptimizationInfo then dprintf "*** Reloading optimization data for assembly %s, info = \n%s\n" ccu.AssemblyName (showL (Layout.squashTo 192 (moduleInfoL cenv mval))); +#endif { env with globalModuleInfos=env.globalModuleInfos.Add(ccu.AssemblyName,mval) } @@ -1061,7 +1067,7 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary mhi = abstractLazyModulInfo /// Hide all information except what we need for "must inline". We always save this optimization information -let AbstractLazyModulInfoToEssentials = +let AbstractOptimizationInfoToEssentials = let rec abstractModulInfo (ss:ModuleInfo) = { ModuleOrNamespaceInfos = NameMap.map (Lazy.force >> abstractModulInfo >> notlazy) ss.ModuleOrNamespaceInfos; @@ -1155,7 +1161,7 @@ let AbstractExprInfoByVars (boundVars:Val list,boundTyVars) ivalue = // Remap optimization information, e.g. to use public stable references so we can pickle it // to disk. //------------------------------------------------------------------------- -let RemapLazyModulInfo g tmenv = +let RemapOptimizationInfo g tmenv = let rec remapExprInfo ivalue = if verboseOptimizationInfo then dprintf "remapExprInfo\n"; @@ -1173,7 +1179,7 @@ let RemapLazyModulInfo g tmenv = let remapValInfo v = { ValExprInfo=remapExprInfo v.ValExprInfo; ValMakesNoCriticalTailcalls=v.ValMakesNoCriticalTailcalls } let rec remapModulInfo ss = if verboseOptimizationInfo then dprintf "remapModulInfo\n"; - { ModuleOrNamespaceInfos = ss.ModuleOrNamespaceInfos |> NameMap.map RemapLazyModulInfo; + { ModuleOrNamespaceInfos = ss.ModuleOrNamespaceInfos |> NameMap.map remapLazyModulInfo; ValInfos = ss.ValInfos.Map (fun (vref,vinfo) -> let vref' = remapValRef tmenv vref let vinfo = remapValInfo vinfo @@ -1181,10 +1187,10 @@ let RemapLazyModulInfo g tmenv = if vinfo.ValMakesNoCriticalTailcalls then vref'.Deref.SetMakesNoCriticalTailcalls() (vref',vinfo)) } - and RemapLazyModulInfo ss = + and remapLazyModulInfo ss = ss |> Lazy.force |> remapModulInfo |> notlazy - RemapLazyModulInfo + remapLazyModulInfo //------------------------------------------------------------------------- // Hide information when a value is no longer visible @@ -1192,11 +1198,17 @@ let RemapLazyModulInfo g tmenv = let AbstractAndRemapModulInfo msg g m (repackage,hidden) info = let mrpi = mkRepackageRemapping repackage +#if DEBUG if verboseOptimizationInfo then dprintf "%s - %a - Optimization data prior to trim: \n%s\n" msg outputRange m (Layout.showL (Layout.squashTo 192 (moduleInfoL g info))); +#endif let info = info |> AbstractLazyModulInfoByHiding false hidden +#if DEBUG if verboseOptimizationInfo then dprintf "%s - %a - Optimization data after trim:\n%s\n" msg outputRange m (Layout.showL (Layout.squashTo 192 (moduleInfoL g info))); - let info = info |> RemapLazyModulInfo g mrpi +#endif + let info = info |> RemapOptimizationInfo g mrpi +#if DEBUG if verboseOptimizationInfo then dprintf "%s - %a - Optimization data after remap:\n%s\n" msg outputRange m (Layout.showL (Layout.squashTo 192 (moduleInfoL g info))); +#endif info //------------------------------------------------------------------------- @@ -1703,7 +1715,7 @@ let rec OptimizeExpr cenv (env:IncrementalOptimizationEnv) expr = let topValInfo = ValReprInfo (ValReprInfo.InferTyparInfo tps,[],ValReprInfo.unnamedRetVal) let ty = tryMkForallTy tps rty OptimizeLambdas None cenv env topValInfo expr ty - | Expr.TyChoose _ -> OptimizeExpr cenv env (Typrelns.ChooseTyparSolutionsForFreeChoiceTypars cenv.g cenv.amap expr) + | Expr.TyChoose _ -> OptimizeExpr cenv env (TypeRelations.ChooseTyparSolutionsForFreeChoiceTypars cenv.g cenv.amap expr) | Expr.Match(spMatch,exprm,dtree,targets,m,ty) -> OptimizeMatch cenv env (spMatch,exprm,dtree,targets,m,ty) | Expr.LetRec (binds,e,m,_) -> OptimizeLetRec cenv env (binds,e,m) | Expr.StaticOptimization (constraints,e2,e3,m) -> @@ -3137,7 +3149,7 @@ and OptimizeModuleDefs cenv (env,bindInfosColl) defs = if verboseOptimizations then dprintf "OptimizeModuleDefs\n"; let defs,(env,bindInfosColl) = List.mapFold (OptimizeModuleDef cenv) (env,bindInfosColl) defs let defs,minfos = List.unzip defs - (defs,UnionModuleInfos minfos),(env,bindInfosColl) + (defs,UnionOptimizationInfos minfos),(env,bindInfosColl) and OptimizeImplFileInternal cenv env isIncrementalFragment (TImplFile(qname, pragmas, (ModuleOrNamespaceExprWithSig(mty,_,_) as mexpr), hasExplicitEntryPoint,isScript)) = let env,mexpr',minfo = @@ -3235,3 +3247,5 @@ and u_ModuleInfo st = and u_LazyModuleInfo st = u_lazy u_ModuleInfo st +let p_CcuOptimizationInfo x st = p_LazyModuleInfo x st +let u_CcuOptimizationInfo st = u_LazyModuleInfo st diff --git a/src/fsharp/opt.fsi b/src/fsharp/Optimizer.fsi similarity index 59% rename from src/fsharp/opt.fsi rename to src/fsharp/Optimizer.fsi index ab33a344e59..27bfdf2f7d3 100644 --- a/src/fsharp/opt.fsi +++ b/src/fsharp/Optimizer.fsi @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Opt +module internal Microsoft.FSharp.Compiler.Optimizer open Internal.Utilities open Microsoft.FSharp.Compiler -open Microsoft.FSharp.Compiler.Env open Microsoft.FSharp.Compiler.Tast +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.Internal @@ -30,6 +30,8 @@ type OptimizationSettings = /// Optimization information type ModuleInfo type LazyModuleInfo = Lazy +type ImplFileOptimizationInfo = LazyModuleInfo +type CcuOptimizationInfo = LazyModuleInfo #if NO_COMPILER_BACKEND #else @@ -38,22 +40,24 @@ type IncrementalOptimizationEnv = static member Empty : IncrementalOptimizationEnv /// For building optimization environments incrementally -val internal BindCcu : CcuThunk -> LazyModuleInfo -> IncrementalOptimizationEnv -> TcGlobals -> IncrementalOptimizationEnv +val internal BindCcu : CcuThunk -> CcuOptimizationInfo -> IncrementalOptimizationEnv -> TcGlobals -> IncrementalOptimizationEnv /// The entry point. Boolean indicates 'incremental extension' in FSI -val internal OptimizeImplFile : OptimizationSettings * CcuThunk (* scope *) * Env.TcGlobals * ConstraintSolver.TcValF * Import.ImportMap * IncrementalOptimizationEnv * isIncrementalFragment: bool * emitTaicalls: bool * TypedImplFile -> IncrementalOptimizationEnv * TypedImplFile * LazyModuleInfo +val internal OptimizeImplFile : OptimizationSettings * CcuThunk * TcGlobals * ConstraintSolver.TcValF * Import.ImportMap * IncrementalOptimizationEnv * isIncrementalFragment: bool * emitTaicalls: bool * TypedImplFile -> IncrementalOptimizationEnv * TypedImplFile * ImplFileOptimizationInfo +#if DEBUG /// Displaying optimization data val internal moduleInfoL : TcGlobals -> LazyModuleInfo -> Layout.layout +#endif /// Saving and re-reading optimization information -val p_LazyModuleInfo : LazyModuleInfo -> Pickle.WriterState -> unit +val p_CcuOptimizationInfo : CcuOptimizationInfo -> TastPickle.WriterState -> unit /// Rewrite the modul info using the export remapping -val RemapLazyModulInfo : Env.TcGlobals -> Tastops.Remap -> (LazyModuleInfo -> LazyModuleInfo) -val AbstractLazyModulInfoToEssentials : (LazyModuleInfo -> LazyModuleInfo) -val UnionModuleInfos: seq -> LazyModuleInfo -val ExprHasEffect: Env.TcGlobals -> Expr -> bool +val RemapOptimizationInfo : TcGlobals -> Tastops.Remap -> (CcuOptimizationInfo -> CcuOptimizationInfo) +val AbstractOptimizationInfoToEssentials : (CcuOptimizationInfo -> CcuOptimizationInfo) +val UnionOptimizationInfos: seq -> CcuOptimizationInfo +val ExprHasEffect: TcGlobals -> Expr -> bool #endif -val internal u_LazyModuleInfo : Pickle.ReaderState -> LazyModuleInfo +val internal u_CcuOptimizationInfo : TastPickle.ReaderState -> CcuOptimizationInfo diff --git a/src/fsharp/patcompile.fs b/src/fsharp/PatternMatchCompilation.fs similarity index 99% rename from src/fsharp/patcompile.fs rename to src/fsharp/PatternMatchCompilation.fs index 3b18175425f..d44033ad8d3 100644 --- a/src/fsharp/patcompile.fs +++ b/src/fsharp/PatternMatchCompilation.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Patcompile +module internal Microsoft.FSharp.Compiler.PatternMatchCompilation open System.Collections.Generic open Internal.Utilities @@ -17,8 +17,8 @@ open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.Tastops.DebugPrint open Microsoft.FSharp.Compiler.PrettyNaming -open Microsoft.FSharp.Compiler.Typrelns -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TypeRelations +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Lib exception MatchIncomplete of bool * (string * bool) option * range @@ -112,11 +112,11 @@ let BindSubExprOfInput g amap gtps (PBind(v,tyscheme)) m (SubExpr(accessf,(ve2,v mkTyparTy gtp else someSolved := true - Typrelns.ChooseTyparSolution g amap gtp + TypeRelations.ChooseTyparSolution g amap gtp let solutions = List.map freezeVar gtps if !someSolved then - Typrelns.IterativelySubstituteTyparSolutions g gtps solutions + TypeRelations.IterativelySubstituteTyparSolutions g gtps solutions else solutions diff --git a/src/fsharp/patcompile.fsi b/src/fsharp/PatternMatchCompilation.fsi similarity index 94% rename from src/fsharp/patcompile.fsi rename to src/fsharp/PatternMatchCompilation.fsi index cb82196756b..169b7201113 100644 --- a/src/fsharp/patcompile.fsi +++ b/src/fsharp/PatternMatchCompilation.fsi @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Patcompile +module internal Microsoft.FSharp.Compiler.PatternMatchCompilation open Internal.Utilities open Microsoft.FSharp.Compiler @@ -8,6 +8,7 @@ open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Range @@ -47,8 +48,8 @@ and TypedMatchClause = /// Compile a pattern into a decision tree and a set of targets. val internal CompilePattern : - Env.TcGlobals -> - Tastops.DisplayEnv -> + TcGlobals -> + DisplayEnv -> Import.ImportMap -> // range of the expression we are matching on range -> diff --git a/src/fsharp/check.fs b/src/fsharp/PostInferenceChecks.fs similarity index 99% rename from src/fsharp/check.fs rename to src/fsharp/PostInferenceChecks.fs index 4caaa250311..646b08267bd 100644 --- a/src/fsharp/check.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -1,26 +1,28 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.PostTypecheckSemanticChecks +/// Implements a set of checks on the TAST for a file that can only be performed after type inference +/// is complete. +module internal Microsoft.FSharp.Compiler.PostTypeCheckSemanticChecks open System.Collections.Generic open Internal.Utilities + +open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library -open Microsoft.FSharp.Compiler - open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Layout open Microsoft.FSharp.Compiler.AbstractIL.IL -open Microsoft.FSharp.Compiler.Typrelns +open Microsoft.FSharp.Compiler.TypeRelations open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.PrettyNaming @@ -187,7 +189,7 @@ let BindVals cenv vs = List.iter (BindVal cenv) vs let rec CheckTypeDeep ((visitTyp,visitTyconRef,visitByrefsOfByrefs,visitTraitSolution) as f) typ = // We iterate the _solved_ constraints as well, to pick up any record of trait constraint solutions // This means we walk _all_ the constraints _everywhere_ in a type, including - // those attached to _solved_ type variables. This is used by PostTypecheckSemanticChecks to detect uses of + // those attached to _solved_ type variables. This is used by PostTypeCheckSemanticChecks to detect uses of // values as solutions to trait constraints and determine if inference has caused the value to escape its scope. // The only record of these solutions is in the _solved_ constraints of types. // In an ideal world we would, instead, record the solutions to these constraints as "witness variables" in expressions, diff --git a/src/fsharp/PostInferenceChecks.fsi b/src/fsharp/PostInferenceChecks.fsi new file mode 100644 index 00000000000..b2665479fc0 --- /dev/null +++ b/src/fsharp/PostInferenceChecks.fsi @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +/// Implements a set of checks on the TAST for a file that can only be performed after type inference +/// is complete. +module internal Microsoft.FSharp.Compiler.PostTypeCheckSemanticChecks + +open Microsoft.FSharp.Compiler +open Microsoft.FSharp.Compiler.TcGlobals + +val testFlagMemberBody : bool ref +val CheckTopImpl : TcGlobals * Import.ImportMap * bool * Infos.InfoReader * Tast.CompilationPath list * Tast.CcuThunk * Tastops.DisplayEnv * Tast.ModuleOrNamespaceExprWithSig * Tast.Attribs * bool -> bool diff --git a/src/fsharp/sreflect.fs b/src/fsharp/QuotationPickler.fs similarity index 100% rename from src/fsharp/sreflect.fs rename to src/fsharp/QuotationPickler.fs diff --git a/src/fsharp/sreflect.fsi b/src/fsharp/QuotationPickler.fsi similarity index 100% rename from src/fsharp/sreflect.fsi rename to src/fsharp/QuotationPickler.fsi diff --git a/src/fsharp/creflect.fs b/src/fsharp/QuotationTranslator.fs similarity index 99% rename from src/fsharp/creflect.fs rename to src/fsharp/QuotationTranslator.fs index ae60038107b..5a972e41180 100644 --- a/src/fsharp/creflect.fs +++ b/src/fsharp/QuotationTranslator.fs @@ -15,8 +15,8 @@ open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.PrettyNaming open Microsoft.FSharp.Compiler.ErrorLogger -open Microsoft.FSharp.Compiler.Env -open Microsoft.FSharp.Compiler.Typrelns +open Microsoft.FSharp.Compiler.TcGlobals +open Microsoft.FSharp.Compiler.TypeRelations open Microsoft.FSharp.Compiler.Range module QP = Microsoft.FSharp.Compiler.QuotationPickler @@ -33,7 +33,7 @@ type IsReflectedDefinition = | No type cenv = - { g: Env.TcGlobals; + { g: TcGlobals; amap: Import.ImportMap; scope: CcuThunk; // Accumulate the type splices (i.e. captured type parameters) into here @@ -376,7 +376,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. QP.mkDelegate(tyargR, fR) | Expr.StaticOptimization (_,_,x,_) -> ConvExpr cenv env x - | Expr.TyChoose _ -> ConvExpr cenv env (Typrelns.ChooseTyparSolutionsForFreeChoiceTypars cenv.g cenv.amap expr) + | Expr.TyChoose _ -> ConvExpr cenv env (TypeRelations.ChooseTyparSolutionsForFreeChoiceTypars cenv.g cenv.amap expr) | Expr.Sequential (x0,x1,ThenDoSeq,_,_) -> QP.mkSequential(ConvExpr cenv env x0, ConvExpr cenv env x1) | Expr.Obj (_lambdaId,_typ,_basev,_basecall,_overrides,_iimpls,m) -> wfail(Error(FSComp.SR.crefQuotationsCantContainObjExprs(),m)) diff --git a/src/fsharp/creflect.fsi b/src/fsharp/QuotationTranslator.fsi similarity index 61% rename from src/fsharp/creflect.fsi rename to src/fsharp/QuotationTranslator.fsi index 178c2e497a4..b8eabccf1a2 100644 --- a/src/fsharp/creflect.fsi +++ b/src/fsharp/QuotationTranslator.fsi @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +/// Convert quoted TAST data structures to structures ready for pickling module internal Microsoft.FSharp.Compiler.QuotationTranslator -open Microsoft.FSharp.Compiler - -// Convert quoted TAST data structures to structures ready for pickling +open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Tast +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Tastops [] @@ -20,7 +20,7 @@ exception IgnoringPartOfQuotedTermWarning of string * Range.range type IsReflectedDefinition = | Yes | No -val ConvExprPublic : Env.TcGlobals * Import.ImportMap * CcuThunk * IsReflectedDefinition -> QuotationTranslationEnv -> Expr -> TType list * Expr list * QuotationPickler.ExprData -val ConvMethodBase : Env.TcGlobals * Import.ImportMap * CcuThunk -> QuotationTranslationEnv -> string * Val -> QuotationPickler.MethodBaseData +val ConvExprPublic : TcGlobals * Import.ImportMap * CcuThunk * IsReflectedDefinition -> QuotationTranslationEnv -> Expr -> TType list * Expr list * QuotationPickler.ExprData +val ConvMethodBase : TcGlobals * Import.ImportMap * CcuThunk -> QuotationTranslationEnv -> string * Val -> QuotationPickler.MethodBaseData diff --git a/src/fsharp/tastops.fs b/src/fsharp/TastOps.fs similarity index 99% rename from src/fsharp/tastops.fs rename to src/fsharp/TastOps.fs index 1a05079cd7f..09b1d63aec7 100644 --- a/src/fsharp/tastops.fs +++ b/src/fsharp/TastOps.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -/// Derived expression manipulation and construction functions. +/// Defines derived expression manipulation and construction functions. module internal Microsoft.FSharp.Compiler.Tastops open System.Collections.Generic @@ -17,7 +17,7 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Microsoft.FSharp.Compiler.Lib -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Layout open Microsoft.FSharp.Compiler.PrettyNaming #if EXTENSIONTYPING @@ -7479,7 +7479,7 @@ let EvalArithBinOp (opInt8, opInt16, opInt32, opInt64, opUInt8, opUInt16, opUInt | _ -> error (Error ( FSComp.SR.tastNotAConstantExpression(),m)) with :? System.OverflowException -> error (Error ( FSComp.SR.tastConstantExpressionOverflow(),m)) -// See also PostTypecheckSemanticChecks.CheckAttribArgExpr, which must match this precisely +// See also PostTypeCheckSemanticChecks.CheckAttribArgExpr, which must match this precisely let rec EvalAttribArgExpr g x = match x with diff --git a/src/fsharp/tastops.fsi b/src/fsharp/TastOps.fsi similarity index 97% rename from src/fsharp/tastops.fsi rename to src/fsharp/TastOps.fsi index ecbe9fc0dd3..01ca087b74d 100644 --- a/src/fsharp/tastops.fsi +++ b/src/fsharp/TastOps.fsi @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -/// Derived expression manipulation and construction functions. +/// Defines derived expression manipulation and construction functions. module internal Microsoft.FSharp.Compiler.Tastops open System.Text @@ -14,7 +14,7 @@ open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Layout open Microsoft.FSharp.Compiler.Lib @@ -1183,18 +1183,18 @@ val mkLdelem : TcGlobals -> range -> TType -> Expr -> Expr -> Expr //------------------------------------------------------------------------- val TryDecodeILAttribute : TcGlobals -> ILTypeRef -> ILScopeRef option -> ILAttributes -> (ILAttribElem list * ILAttributeNamedArg list) option -val TryFindILAttribute : Env.BuiltinAttribInfo -> ILAttributes -> bool -val TryFindILAttributeOpt : Env.BuiltinAttribInfo option -> ILAttributes -> bool - -val IsMatchingFSharpAttribute : TcGlobals -> Env.BuiltinAttribInfo -> Attrib -> bool -val IsMatchingFSharpAttributeOpt : TcGlobals -> Env.BuiltinAttribInfo option -> Attrib -> bool -val HasFSharpAttribute : TcGlobals -> Env.BuiltinAttribInfo -> Attribs -> bool -val HasFSharpAttributeOpt : TcGlobals -> Env.BuiltinAttribInfo option -> Attribs -> bool -val TryFindFSharpAttribute : TcGlobals -> Env.BuiltinAttribInfo -> Attribs -> Attrib option -val TryFindFSharpAttributeOpt : TcGlobals -> Env.BuiltinAttribInfo option -> Attribs -> Attrib option -val TryFindFSharpBoolAttribute : TcGlobals -> Env.BuiltinAttribInfo -> Attribs -> bool option -val TryFindFSharpStringAttribute : TcGlobals -> Env.BuiltinAttribInfo -> Attribs -> string option -val TryFindFSharpInt32Attribute : TcGlobals -> Env.BuiltinAttribInfo -> Attribs -> int32 option +val TryFindILAttribute : BuiltinAttribInfo -> ILAttributes -> bool +val TryFindILAttributeOpt : BuiltinAttribInfo option -> ILAttributes -> bool + +val IsMatchingFSharpAttribute : TcGlobals -> BuiltinAttribInfo -> Attrib -> bool +val IsMatchingFSharpAttributeOpt : TcGlobals -> BuiltinAttribInfo option -> Attrib -> bool +val HasFSharpAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> bool +val HasFSharpAttributeOpt : TcGlobals -> BuiltinAttribInfo option -> Attribs -> bool +val TryFindFSharpAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> Attrib option +val TryFindFSharpAttributeOpt : TcGlobals -> BuiltinAttribInfo option -> Attribs -> Attrib option +val TryFindFSharpBoolAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> bool option +val TryFindFSharpStringAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> string option +val TryFindFSharpInt32Attribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> int32 option #if EXTENSIONTYPING /// returns Some(assemblyName) for success @@ -1270,14 +1270,14 @@ type StaticOptimizationAnswer = | Yes = 1y | No = -1y | Unknown = 0y -val DecideStaticOptimizations : Env.TcGlobals -> StaticOptimization list -> StaticOptimizationAnswer -val mkStaticOptimizationExpr : Env.TcGlobals -> StaticOptimization list * Expr * Expr * range -> Expr +val DecideStaticOptimizations : TcGlobals -> StaticOptimization list -> StaticOptimizationAnswer +val mkStaticOptimizationExpr : TcGlobals -> StaticOptimization list * Expr * Expr * range -> Expr //--------------------------------------------------------------------------- // Build for loops //------------------------------------------------------------------------- -val mkFastForLoop : Env.TcGlobals -> SequencePointInfoForForLoop * range * Val * Expr * bool * Expr * Expr -> Expr +val mkFastForLoop : TcGlobals -> SequencePointInfoForForLoop * range * Val * Expr * bool * Expr * Expr -> Expr //--------------------------------------------------------------------------- // Active pattern helpers @@ -1287,16 +1287,16 @@ type ActivePatternElemRef with member Name : string val TryGetActivePatternInfo : ValRef -> PrettyNaming.ActivePatternInfo option -val mkChoiceCaseRef : Env.TcGlobals -> range -> int -> int -> UnionCaseRef +val mkChoiceCaseRef : TcGlobals -> range -> int -> int -> UnionCaseRef type PrettyNaming.ActivePatternInfo with member Names : string list member IsTotal: bool - member ResultType : Env.TcGlobals -> range -> TType list -> TType - member OverallType : Env.TcGlobals -> range -> TType -> TType list -> TType + member ResultType : TcGlobals -> range -> TType list -> TType + member OverallType : TcGlobals -> range -> TType -> TType list -> TType -val doesActivePatternHaveFreeTypars : Env.TcGlobals -> ValRef -> bool +val doesActivePatternHaveFreeTypars : TcGlobals -> ValRef -> bool //--------------------------------------------------------------------------- // Structural rewrites diff --git a/src/fsharp/pickle.fs b/src/fsharp/TastPickle.fs similarity index 99% rename from src/fsharp/pickle.fs rename to src/fsharp/TastPickle.fs index c80d4aab636..134e6801924 100644 --- a/src/fsharp/pickle.fs +++ b/src/fsharp/TastPickle.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module internal Microsoft.FSharp.Compiler.Pickle +module internal Microsoft.FSharp.Compiler.TastPickle open System.Collections.Generic open System.Text @@ -18,6 +18,7 @@ open Microsoft.FSharp.Compiler.Lib.Bits open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.Tast +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.ErrorLogger @@ -120,7 +121,7 @@ type WriterState = opubpaths: Table; onlerefs: Table; osimpletyps: Table; - oglobals : Env.TcGlobals; + oglobals : TcGlobals; ofile : string; } let pfailwith st str = ffailwith st.ofile str @@ -2462,12 +2463,12 @@ let _ = fill_u_FlatVals (u_FlatList u_Val) #if INCLUDE_METADATA_WRITER let pickleModuleOrNamespace mspec st = p_tycon_spec mspec st -let pickleModuleInfo minfo st = +let pickleCcuInfo minfo st = p_tup4 pickleModuleOrNamespace p_string p_bool (p_space 3) (minfo.mspec, minfo.compileTimeWorkingDir, minfo.usesQuotations,()) st #endif let unpickleModuleOrNamespace st = u_tycon_spec st -let unpickleModuleInfo st = +let unpickleCcuInfo st = let a,b,c,_space = u_tup4 unpickleModuleOrNamespace u_string u_bool (u_space 3) st { mspec=a; compileTimeWorkingDir=b; usesQuotations=c } diff --git a/src/fsharp/TastPickle.fsi b/src/fsharp/TastPickle.fsi new file mode 100644 index 00000000000..b70f2bd493b --- /dev/null +++ b/src/fsharp/TastPickle.fsi @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +/// Defines the framework for serializing and de-serializing TAST data structures as binary blobs for the F# metadata format. +module internal Microsoft.FSharp.Compiler.TastPickle + +open Internal.Utilities +open Microsoft.FSharp.Compiler +open Microsoft.FSharp.Compiler.AbstractIL +open Microsoft.FSharp.Compiler.AbstractIL.IL +open Microsoft.FSharp.Compiler.AbstractIL.Internal +open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library +open Microsoft.FSharp.Compiler.Tast +open Microsoft.FSharp.Compiler.TcGlobals + +/// Represents desereialized data with a dangling set of CCU fixup thunks indexed by name +[] +type PickledDataWithReferences<'RawData> = + { /// The data that uses a collection of CcuThunks internally + RawData: 'RawData; + /// The assumptions that need to be fixed up + FixupThunks: list } + + member Fixup : (CcuReference -> CcuThunk) -> 'RawData + /// Like Fixup but loader may return None, in which case there is no fixup. + member OptionalFixup: (CcuReference -> CcuThunk option) -> 'RawData + +#if INCLUDE_METADATA_WRITER +/// The type of state written to by picklers +type WriterState + +/// A function to pickle a value into a given stateful writer +type pickler<'T> = 'T -> WriterState -> unit + +/// Serialize a byte +val internal p_byte : int -> WriterState -> unit + +/// Serialize a boolean value +val internal p_bool : bool -> WriterState -> unit + +/// Serialize an integer +val internal p_int : int -> WriterState -> unit + +/// Serialize a string +val internal p_string : string -> WriterState -> unit + +/// Serialize a lazy value (eagerly) +val internal p_lazy : pickler<'T> -> Lazy<'T> pickler + +/// Serialize a tuple of data +val inline internal p_tup2 : pickler<'T1> -> pickler<'T2> -> pickler<'T1 * 'T2> + +/// Serialize a tuple of data +val inline internal p_tup3 : pickler<'T1> -> pickler<'T2> -> pickler<'T3> -> pickler<'T1 * 'T2 * 'T3> + +/// Serialize a tuple of data +val inline internal p_tup4 : pickler<'T1> -> pickler<'T2> -> pickler<'T3> -> pickler<'T4> -> pickler<'T1 * 'T2 * 'T3 * 'T4> + +/// Serialize an array of data +val internal p_array : pickler<'T> -> pickler<'T[]> + +/// Serialize a namemap of data +val internal p_namemap : pickler<'T> -> pickler> + +/// Serialize a TAST constant +val internal p_const : pickler + +/// Serialize a TAST value reference +val internal p_vref : string -> pickler + +/// Serialize a TAST type or entity reference +val internal p_tcref : string -> pickler + +/// Serialize a TAST union case reference +val internal p_ucref : pickler + +/// Serialize a TAST expresion +val internal p_expr : pickler + +/// Serialize a TAST type +val internal p_typ : pickler + +/// Serialize a TAST description of a compilation unit +val internal pickleCcuInfo : pickler + +/// Serialize an arbitrary object using the given pickler +val pickleObjWithDanglingCcus : string -> TcGlobals -> scope:CcuThunk -> pickler<'T> -> 'T -> byte[] +#else +#endif + +/// The type of state unpicklers read from +type ReaderState + +/// A function to read a value from a given state +type unpickler<'T> = ReaderState -> 'T + +/// Deserialize a byte +val internal u_byte : ReaderState -> int + +/// Deserialize a bool +val internal u_bool : ReaderState -> bool + +/// Deserialize an integer +val internal u_int : ReaderState -> int + +/// Deserialize a string +val internal u_string : ReaderState -> string + +/// Deserialize a lazy value (eagerly) +val internal u_lazy : unpickler<'T> -> unpickler> + +/// Deserialize a tuple +val inline internal u_tup2 : unpickler<'T2> -> unpickler<'T3> -> unpickler<'T2 * 'T3> + +/// Deserialize a tuple +val inline internal u_tup3 : unpickler<'T2> -> unpickler<'T3> -> unpickler<'T4> -> unpickler<'T2 * 'T3 * 'T4> + +/// Deserialize a tuple +val inline internal u_tup4 : unpickler<'T2> -> unpickler<'T3> -> unpickler<'T4> -> unpickler<'T5> -> unpickler<'T2 * 'T3 * 'T4 * 'T5> + +/// Deserialize an array of values +val internal u_array : unpickler<'T> -> unpickler<'T[]> + +/// Deserialize a namemap +val internal u_namemap : unpickler<'T> -> unpickler> + +/// Deserialize a TAST constant +val internal u_const : unpickler + +/// Deserialize a TAST value reference +val internal u_vref : unpickler + +/// Deserialize a TAST type reference +val internal u_tcref : unpickler + +/// Deserialize a TAST union case reference +val internal u_ucref : unpickler + +/// Deserialize a TAST expression +val internal u_expr : unpickler + +/// Deserialize a TAST type +val internal u_typ : unpickler + +/// Deserialize a TAST description of a compilation unit +val internal unpickleCcuInfo : ReaderState -> PickledCcuInfo + +/// Deserialize an arbitrary object which may have holes referring to other compilation units +val internal unpickleObjWithDanglingCcus : string -> viewedScope:ILScopeRef -> ilModule:ILModuleDef -> ('T unpickler) -> byte[] -> PickledDataWithReferences<'T> + + + diff --git a/src/fsharp/env.fs b/src/fsharp/TcGlobals.fs similarity index 72% rename from src/fsharp/env.fs rename to src/fsharp/TcGlobals.fs index cb9fecc2794..1151ff1299e 100644 --- a/src/fsharp/env.fs +++ b/src/fsharp/TcGlobals.fs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -//------------------------------------------------------------------------- -// Define Initial Environment. A bunch of types and values are hard-wired -// into the compiler. This lets the compiler perform particular optimizations -// for these types and values, for example emitting optimized calls for -// comparison and hashing functions. The compiler generates the compiled code -// for these types and values when the the --compiling-fslib switch is -// provided when linking the FSharp.Core.dll assembly. -//------------------------------------------------------------------------- - -module internal Microsoft.FSharp.Compiler.Env +/// Defines the global environment for all type checking. +/// +/// The environment (TcGlobals) are well-known types and values are hard-wired +/// into the compiler. This lets the compiler perform particular optimizations +/// for these types and values, for example emitting optimized calls for +/// comparison and hashing functions. +module internal Microsoft.FSharp.Compiler.TcGlobals open Internal.Utilities open Microsoft.FSharp.Compiler @@ -118,429 +115,429 @@ type public BuiltinAttribInfo = [] type public TcGlobals = - { ilg : ILGlobals; + { ilg : ILGlobals #if NO_COMPILER_BACKEND #else - ilxPubCloEnv : EraseIlxFuncs.cenv; + ilxPubCloEnv : EraseClosures.cenv #endif emitDebugInfoInQuotations : bool - compilingFslib: bool; - mlCompatibility : bool; - directoryToResolveRelativePaths : string; - fslibCcu: CcuThunk; - sysCcu: CcuThunk; - using40environment: bool; - indirectCallArrayMethods: bool; - better_tcref_map: TyconRef -> TypeInst -> TType option; - refcell_tcr_canon: TyconRef; - option_tcr_canon : TyconRef; - choice2_tcr : TyconRef; - choice3_tcr : TyconRef; - choice4_tcr : TyconRef; - choice5_tcr : TyconRef; - choice6_tcr : TyconRef; - choice7_tcr : TyconRef; - list_tcr_canon : TyconRef; - set_tcr_canon : TyconRef; - map_tcr_canon : TyconRef; - lazy_tcr_canon : TyconRef; + compilingFslib: bool + mlCompatibility : bool + directoryToResolveRelativePaths : string + fslibCcu: CcuThunk + sysCcu: CcuThunk + using40environment: bool + indirectCallArrayMethods: bool + better_tcref_map: TyconRef -> TypeInst -> TType option + refcell_tcr_canon: TyconRef + option_tcr_canon : TyconRef + choice2_tcr : TyconRef + choice3_tcr : TyconRef + choice4_tcr : TyconRef + choice5_tcr : TyconRef + choice6_tcr : TyconRef + choice7_tcr : TyconRef + list_tcr_canon : TyconRef + set_tcr_canon : TyconRef + map_tcr_canon : TyconRef + lazy_tcr_canon : TyconRef // These have a slightly different behaviour when compiling GetFSharpCoreLibraryName // hence they are 'methods' on the TcGlobals structure. - unionCaseRefEq : UnionCaseRef -> UnionCaseRef -> bool; - valRefEq : ValRef -> ValRef -> bool; - - refcell_tcr_nice: TyconRef; - option_tcr_nice : TyconRef; - list_tcr_nice : TyconRef; - lazy_tcr_nice : TyconRef; - - format_tcr : TyconRef; - expr_tcr : TyconRef; - raw_expr_tcr : TyconRef; - nativeint_tcr : TyconRef; - int32_tcr : TyconRef; - int16_tcr : TyconRef; - int64_tcr : TyconRef; - uint16_tcr : TyconRef; - uint32_tcr : TyconRef; - uint64_tcr : TyconRef; - sbyte_tcr : TyconRef; - decimal_tcr : TyconRef; - date_tcr : TyconRef; - pdecimal_tcr : TyconRef; - byte_tcr : TyconRef; - bool_tcr : TyconRef; - unit_tcr_canon : TyconRef; - unit_tcr_nice : TyconRef; - exn_tcr : TyconRef; - char_tcr : TyconRef; - float_tcr : TyconRef; - float32_tcr : TyconRef; - pfloat_tcr : TyconRef; - pfloat32_tcr : TyconRef; - pint_tcr : TyconRef; - pint8_tcr : TyconRef; - pint16_tcr : TyconRef; - pint64_tcr : TyconRef; - byref_tcr : TyconRef; - nativeptr_tcr : TyconRef; - ilsigptr_tcr : TyconRef; - fastFunc_tcr : TyconRef; - array_tcr_nice : TyconRef; - seq_tcr : TyconRef; - seq_base_tcr : TyconRef; + unionCaseRefEq : UnionCaseRef -> UnionCaseRef -> bool + valRefEq : ValRef -> ValRef -> bool + + refcell_tcr_nice: TyconRef + option_tcr_nice : TyconRef + list_tcr_nice : TyconRef + lazy_tcr_nice : TyconRef + + format_tcr : TyconRef + expr_tcr : TyconRef + raw_expr_tcr : TyconRef + nativeint_tcr : TyconRef + int32_tcr : TyconRef + int16_tcr : TyconRef + int64_tcr : TyconRef + uint16_tcr : TyconRef + uint32_tcr : TyconRef + uint64_tcr : TyconRef + sbyte_tcr : TyconRef + decimal_tcr : TyconRef + date_tcr : TyconRef + pdecimal_tcr : TyconRef + byte_tcr : TyconRef + bool_tcr : TyconRef + unit_tcr_canon : TyconRef + unit_tcr_nice : TyconRef + exn_tcr : TyconRef + char_tcr : TyconRef + float_tcr : TyconRef + float32_tcr : TyconRef + pfloat_tcr : TyconRef + pfloat32_tcr : TyconRef + pint_tcr : TyconRef + pint8_tcr : TyconRef + pint16_tcr : TyconRef + pint64_tcr : TyconRef + byref_tcr : TyconRef + nativeptr_tcr : TyconRef + ilsigptr_tcr : TyconRef + fastFunc_tcr : TyconRef + array_tcr_nice : TyconRef + seq_tcr : TyconRef + seq_base_tcr : TyconRef measureproduct_tcr : TyconRef measureinverse_tcr : TyconRef measureone_tcr : TyconRef - il_arr_tcr_map : TyconRef[]; - tuple1_tcr : TyconRef; - tuple2_tcr : TyconRef; - tuple3_tcr : TyconRef; - tuple4_tcr : TyconRef; - tuple5_tcr : TyconRef; - tuple6_tcr : TyconRef; - tuple7_tcr : TyconRef; - tuple8_tcr : TyconRef; - - tcref_IQueryable : TyconRef; - tcref_IObservable : TyconRef; - tcref_IObserver : TyconRef; - fslib_IEvent2_tcr : TyconRef; - fslib_IDelegateEvent_tcr: TyconRef; - system_Nullable_tcref : TyconRef; - system_GenericIComparable_tcref : TyconRef; - system_GenericIEquatable_tcref : TyconRef; - system_IndexOutOfRangeException_tcref : TyconRef; - int_ty : TType; - nativeint_ty : TType; - unativeint_ty : TType; - int32_ty : TType; - int16_ty : TType; - int64_ty : TType; - uint16_ty : TType; - uint32_ty : TType; - uint64_ty : TType; - sbyte_ty : TType; - byte_ty : TType; - bool_ty : TType; - string_ty : TType; - obj_ty : TType; - unit_ty : TType; - exn_ty : TType; - char_ty : TType; - decimal_ty : TType; - float_ty : TType; - float32_ty : TType; - system_Array_typ : TType; - system_Object_typ : TType; - system_IDisposable_typ : TType; - system_Value_typ : TType; - system_Delegate_typ : TType; - system_MulticastDelegate_typ : TType; - system_Enum_typ : TType; - system_Exception_typ : TType; - system_Int32_typ : TType; - system_String_typ : TType; - system_Type_typ : TType; - system_TypedReference_tcref : TyconRef option; - system_ArgIterator_tcref : TyconRef option; - system_Decimal_tcref : TyconRef; - system_SByte_tcref : TyconRef; - system_Int16_tcref : TyconRef; - system_Int32_tcref : TyconRef; - system_Int64_tcref : TyconRef; - system_IntPtr_tcref : TyconRef; - system_Bool_tcref : TyconRef; - system_Char_tcref : TyconRef; - system_Byte_tcref : TyconRef; - system_UInt16_tcref : TyconRef; - system_UInt32_tcref : TyconRef; - system_UInt64_tcref : TyconRef; - system_UIntPtr_tcref : TyconRef; - system_Single_tcref : TyconRef; - system_Double_tcref : TyconRef; - system_RuntimeArgumentHandle_tcref : TyconRef option; - system_RuntimeTypeHandle_typ : TType; - system_RuntimeMethodHandle_typ : TType; - system_MarshalByRefObject_tcref : TyconRef option; - system_MarshalByRefObject_typ : TType option; - system_Reflection_MethodInfo_typ : TType; - system_Array_tcref : TyconRef; - system_Object_tcref : TyconRef; - system_Void_tcref : TyconRef; - system_LinqExpression_tcref : TyconRef; - mk_IComparable_ty : TType; - mk_IStructuralComparable_ty : TType; - mk_IStructuralEquatable_ty : TType; - mk_IComparer_ty : TType; - mk_IEqualityComparer_ty : TType; - tcref_System_Collections_IComparer : TyconRef; - tcref_System_Collections_IEqualityComparer : TyconRef; - tcref_System_Collections_Generic_IEqualityComparer : TyconRef; - tcref_System_Collections_Generic_Dictionary : TyconRef; - tcref_System_IComparable : TyconRef; - tcref_System_IStructuralComparable : TyconRef; - tcref_System_IStructuralEquatable : TyconRef; - tcref_LanguagePrimitives : TyconRef; - attrib_CustomOperationAttribute : BuiltinAttribInfo; - attrib_ProjectionParameterAttribute : BuiltinAttribInfo; - attrib_AttributeUsageAttribute : BuiltinAttribInfo; - attrib_ParamArrayAttribute : BuiltinAttribInfo; - attrib_IDispatchConstantAttribute : BuiltinAttribInfo option; - attrib_IUnknownConstantAttribute : BuiltinAttribInfo option; - attrib_SystemObsolete : BuiltinAttribInfo; - attrib_DllImportAttribute : BuiltinAttribInfo option; - attrib_CompiledNameAttribute : BuiltinAttribInfo; - attrib_NonSerializedAttribute : BuiltinAttribInfo option; - attrib_AutoSerializableAttribute : BuiltinAttribInfo; - attrib_StructLayoutAttribute : BuiltinAttribInfo; - attrib_TypeForwardedToAttribute : BuiltinAttribInfo; - attrib_ComVisibleAttribute : BuiltinAttribInfo; - attrib_ComImportAttribute : BuiltinAttribInfo option; - attrib_FieldOffsetAttribute : BuiltinAttribInfo; - attrib_MarshalAsAttribute : BuiltinAttribInfo option; - attrib_InAttribute : BuiltinAttribInfo option; - attrib_OutAttribute : BuiltinAttribInfo; - attrib_OptionalAttribute : BuiltinAttribInfo option; - attrib_ThreadStaticAttribute : BuiltinAttribInfo option; - attrib_SpecialNameAttribute : BuiltinAttribInfo option; - attrib_VolatileFieldAttribute : BuiltinAttribInfo; - attrib_ContextStaticAttribute : BuiltinAttribInfo option; - attrib_FlagsAttribute : BuiltinAttribInfo; - attrib_DefaultMemberAttribute : BuiltinAttribInfo; - attrib_DebuggerDisplayAttribute : BuiltinAttribInfo; - attrib_DebuggerTypeProxyAttribute : BuiltinAttribInfo; - attrib_PreserveSigAttribute : BuiltinAttribInfo option; - attrib_MethodImplAttribute : BuiltinAttribInfo; - attrib_ExtensionAttribute : BuiltinAttribInfo; - tcref_System_Collections_Generic_IList : TyconRef; - tcref_System_Collections_Generic_IReadOnlyList : TyconRef; - tcref_System_Collections_Generic_ICollection : TyconRef; - tcref_System_Collections_Generic_IReadOnlyCollection : TyconRef; - tcref_System_Collections_Generic_IEnumerable : TyconRef; - tcref_System_Collections_IEnumerable : TyconRef; - tcref_System_Collections_Generic_IEnumerator : TyconRef; - tcref_System_Attribute : TyconRef; - - attrib_RequireQualifiedAccessAttribute : BuiltinAttribInfo; - attrib_EntryPointAttribute : BuiltinAttribInfo; - attrib_DefaultAugmentationAttribute : BuiltinAttribInfo; - attrib_CompilerMessageAttribute : BuiltinAttribInfo; - attrib_ExperimentalAttribute : BuiltinAttribInfo; - attrib_UnverifiableAttribute : BuiltinAttribInfo; - attrib_LiteralAttribute : BuiltinAttribInfo; - attrib_ConditionalAttribute : BuiltinAttribInfo; - attrib_OptionalArgumentAttribute : BuiltinAttribInfo; - attrib_RequiresExplicitTypeArgumentsAttribute : BuiltinAttribInfo; - attrib_DefaultValueAttribute : BuiltinAttribInfo; - attrib_ClassAttribute : BuiltinAttribInfo; - attrib_InterfaceAttribute : BuiltinAttribInfo; - attrib_StructAttribute : BuiltinAttribInfo; - attrib_ReflectedDefinitionAttribute : BuiltinAttribInfo; - attrib_AutoOpenAttribute : BuiltinAttribInfo; - attrib_CompilationRepresentationAttribute : BuiltinAttribInfo; - attrib_CompilationArgumentCountsAttribute : BuiltinAttribInfo; - attrib_CompilationMappingAttribute : BuiltinAttribInfo; - - attrib_CLIEventAttribute : BuiltinAttribInfo; - attrib_AllowNullLiteralAttribute : BuiltinAttribInfo; - attrib_CLIMutableAttribute : BuiltinAttribInfo; - attrib_NoComparisonAttribute : BuiltinAttribInfo; - attrib_NoEqualityAttribute : BuiltinAttribInfo; - attrib_CustomComparisonAttribute : BuiltinAttribInfo; - attrib_CustomEqualityAttribute : BuiltinAttribInfo; - attrib_EqualityConditionalOnAttribute : BuiltinAttribInfo; - attrib_ComparisonConditionalOnAttribute : BuiltinAttribInfo; - attrib_ReferenceEqualityAttribute : BuiltinAttribInfo; - attrib_StructuralEqualityAttribute : BuiltinAttribInfo; - attrib_StructuralComparisonAttribute : BuiltinAttribInfo; - attrib_SealedAttribute : BuiltinAttribInfo; - attrib_AbstractClassAttribute : BuiltinAttribInfo; - attrib_GeneralizableValueAttribute : BuiltinAttribInfo; - attrib_MeasureAttribute : BuiltinAttribInfo; - attrib_MeasureableAttribute : BuiltinAttribInfo; - attrib_NoDynamicInvocationAttribute : BuiltinAttribInfo; + il_arr_tcr_map : TyconRef[] + tuple1_tcr : TyconRef + tuple2_tcr : TyconRef + tuple3_tcr : TyconRef + tuple4_tcr : TyconRef + tuple5_tcr : TyconRef + tuple6_tcr : TyconRef + tuple7_tcr : TyconRef + tuple8_tcr : TyconRef + + tcref_IQueryable : TyconRef + tcref_IObservable : TyconRef + tcref_IObserver : TyconRef + fslib_IEvent2_tcr : TyconRef + fslib_IDelegateEvent_tcr: TyconRef + system_Nullable_tcref : TyconRef + system_GenericIComparable_tcref : TyconRef + system_GenericIEquatable_tcref : TyconRef + system_IndexOutOfRangeException_tcref : TyconRef + int_ty : TType + nativeint_ty : TType + unativeint_ty : TType + int32_ty : TType + int16_ty : TType + int64_ty : TType + uint16_ty : TType + uint32_ty : TType + uint64_ty : TType + sbyte_ty : TType + byte_ty : TType + bool_ty : TType + string_ty : TType + obj_ty : TType + unit_ty : TType + exn_ty : TType + char_ty : TType + decimal_ty : TType + float_ty : TType + float32_ty : TType + system_Array_typ : TType + system_Object_typ : TType + system_IDisposable_typ : TType + system_Value_typ : TType + system_Delegate_typ : TType + system_MulticastDelegate_typ : TType + system_Enum_typ : TType + system_Exception_typ : TType + system_Int32_typ : TType + system_String_typ : TType + system_Type_typ : TType + system_TypedReference_tcref : TyconRef option + system_ArgIterator_tcref : TyconRef option + system_Decimal_tcref : TyconRef + system_SByte_tcref : TyconRef + system_Int16_tcref : TyconRef + system_Int32_tcref : TyconRef + system_Int64_tcref : TyconRef + system_IntPtr_tcref : TyconRef + system_Bool_tcref : TyconRef + system_Char_tcref : TyconRef + system_Byte_tcref : TyconRef + system_UInt16_tcref : TyconRef + system_UInt32_tcref : TyconRef + system_UInt64_tcref : TyconRef + system_UIntPtr_tcref : TyconRef + system_Single_tcref : TyconRef + system_Double_tcref : TyconRef + system_RuntimeArgumentHandle_tcref : TyconRef option + system_RuntimeTypeHandle_typ : TType + system_RuntimeMethodHandle_typ : TType + system_MarshalByRefObject_tcref : TyconRef option + system_MarshalByRefObject_typ : TType option + system_Reflection_MethodInfo_typ : TType + system_Array_tcref : TyconRef + system_Object_tcref : TyconRef + system_Void_tcref : TyconRef + system_LinqExpression_tcref : TyconRef + mk_IComparable_ty : TType + mk_IStructuralComparable_ty : TType + mk_IStructuralEquatable_ty : TType + mk_IComparer_ty : TType + mk_IEqualityComparer_ty : TType + tcref_System_Collections_IComparer : TyconRef + tcref_System_Collections_IEqualityComparer : TyconRef + tcref_System_Collections_Generic_IEqualityComparer : TyconRef + tcref_System_Collections_Generic_Dictionary : TyconRef + tcref_System_IComparable : TyconRef + tcref_System_IStructuralComparable : TyconRef + tcref_System_IStructuralEquatable : TyconRef + tcref_LanguagePrimitives : TyconRef + attrib_CustomOperationAttribute : BuiltinAttribInfo + attrib_ProjectionParameterAttribute : BuiltinAttribInfo + attrib_AttributeUsageAttribute : BuiltinAttribInfo + attrib_ParamArrayAttribute : BuiltinAttribInfo + attrib_IDispatchConstantAttribute : BuiltinAttribInfo option + attrib_IUnknownConstantAttribute : BuiltinAttribInfo option + attrib_SystemObsolete : BuiltinAttribInfo + attrib_DllImportAttribute : BuiltinAttribInfo option + attrib_CompiledNameAttribute : BuiltinAttribInfo + attrib_NonSerializedAttribute : BuiltinAttribInfo option + attrib_AutoSerializableAttribute : BuiltinAttribInfo + attrib_StructLayoutAttribute : BuiltinAttribInfo + attrib_TypeForwardedToAttribute : BuiltinAttribInfo + attrib_ComVisibleAttribute : BuiltinAttribInfo + attrib_ComImportAttribute : BuiltinAttribInfo option + attrib_FieldOffsetAttribute : BuiltinAttribInfo + attrib_MarshalAsAttribute : BuiltinAttribInfo option + attrib_InAttribute : BuiltinAttribInfo option + attrib_OutAttribute : BuiltinAttribInfo + attrib_OptionalAttribute : BuiltinAttribInfo option + attrib_ThreadStaticAttribute : BuiltinAttribInfo option + attrib_SpecialNameAttribute : BuiltinAttribInfo option + attrib_VolatileFieldAttribute : BuiltinAttribInfo + attrib_ContextStaticAttribute : BuiltinAttribInfo option + attrib_FlagsAttribute : BuiltinAttribInfo + attrib_DefaultMemberAttribute : BuiltinAttribInfo + attrib_DebuggerDisplayAttribute : BuiltinAttribInfo + attrib_DebuggerTypeProxyAttribute : BuiltinAttribInfo + attrib_PreserveSigAttribute : BuiltinAttribInfo option + attrib_MethodImplAttribute : BuiltinAttribInfo + attrib_ExtensionAttribute : BuiltinAttribInfo + tcref_System_Collections_Generic_IList : TyconRef + tcref_System_Collections_Generic_IReadOnlyList : TyconRef + tcref_System_Collections_Generic_ICollection : TyconRef + tcref_System_Collections_Generic_IReadOnlyCollection : TyconRef + tcref_System_Collections_Generic_IEnumerable : TyconRef + tcref_System_Collections_IEnumerable : TyconRef + tcref_System_Collections_Generic_IEnumerator : TyconRef + tcref_System_Attribute : TyconRef + + attrib_RequireQualifiedAccessAttribute : BuiltinAttribInfo + attrib_EntryPointAttribute : BuiltinAttribInfo + attrib_DefaultAugmentationAttribute : BuiltinAttribInfo + attrib_CompilerMessageAttribute : BuiltinAttribInfo + attrib_ExperimentalAttribute : BuiltinAttribInfo + attrib_UnverifiableAttribute : BuiltinAttribInfo + attrib_LiteralAttribute : BuiltinAttribInfo + attrib_ConditionalAttribute : BuiltinAttribInfo + attrib_OptionalArgumentAttribute : BuiltinAttribInfo + attrib_RequiresExplicitTypeArgumentsAttribute : BuiltinAttribInfo + attrib_DefaultValueAttribute : BuiltinAttribInfo + attrib_ClassAttribute : BuiltinAttribInfo + attrib_InterfaceAttribute : BuiltinAttribInfo + attrib_StructAttribute : BuiltinAttribInfo + attrib_ReflectedDefinitionAttribute : BuiltinAttribInfo + attrib_AutoOpenAttribute : BuiltinAttribInfo + attrib_CompilationRepresentationAttribute : BuiltinAttribInfo + attrib_CompilationArgumentCountsAttribute : BuiltinAttribInfo + attrib_CompilationMappingAttribute : BuiltinAttribInfo + + attrib_CLIEventAttribute : BuiltinAttribInfo + attrib_AllowNullLiteralAttribute : BuiltinAttribInfo + attrib_CLIMutableAttribute : BuiltinAttribInfo + attrib_NoComparisonAttribute : BuiltinAttribInfo + attrib_NoEqualityAttribute : BuiltinAttribInfo + attrib_CustomComparisonAttribute : BuiltinAttribInfo + attrib_CustomEqualityAttribute : BuiltinAttribInfo + attrib_EqualityConditionalOnAttribute : BuiltinAttribInfo + attrib_ComparisonConditionalOnAttribute : BuiltinAttribInfo + attrib_ReferenceEqualityAttribute : BuiltinAttribInfo + attrib_StructuralEqualityAttribute : BuiltinAttribInfo + attrib_StructuralComparisonAttribute : BuiltinAttribInfo + attrib_SealedAttribute : BuiltinAttribInfo + attrib_AbstractClassAttribute : BuiltinAttribInfo + attrib_GeneralizableValueAttribute : BuiltinAttribInfo + attrib_MeasureAttribute : BuiltinAttribInfo + attrib_MeasureableAttribute : BuiltinAttribInfo + attrib_NoDynamicInvocationAttribute : BuiltinAttribInfo - attrib_SecurityAttribute : BuiltinAttribInfo option; - attrib_SecurityCriticalAttribute : BuiltinAttribInfo; - attrib_SecuritySafeCriticalAttribute : BuiltinAttribInfo; + attrib_SecurityAttribute : BuiltinAttribInfo option + attrib_SecurityCriticalAttribute : BuiltinAttribInfo + attrib_SecuritySafeCriticalAttribute : BuiltinAttribInfo - cons_ucref : UnionCaseRef; - nil_ucref : UnionCaseRef; + cons_ucref : UnionCaseRef + nil_ucref : UnionCaseRef (* These are the library values the compiler needs to know about *) - seq_vref : ValRef; - and_vref : ValRef; - and2_vref : ValRef; - addrof_vref : ValRef; - addrof2_vref : ValRef; - or_vref : ValRef; - or2_vref : ValRef; + seq_vref : ValRef + and_vref : ValRef + and2_vref : ValRef + addrof_vref : ValRef + addrof2_vref : ValRef + or_vref : ValRef + or2_vref : ValRef // 'inner' refers to "after optimization boils away inlined functions" - generic_equality_er_inner_vref : ValRef; - generic_equality_per_inner_vref : ValRef; - generic_equality_withc_inner_vref : ValRef; - generic_comparison_inner_vref : ValRef; - generic_comparison_withc_inner_vref : ValRef; - generic_hash_inner_vref : ValRef; - generic_hash_withc_inner_vref : ValRef; - reference_equality_inner_vref : ValRef; - - compare_operator_vref : ValRef; - equals_operator_vref : ValRef; - equals_nullable_operator_vref : ValRef; - nullable_equals_nullable_operator_vref : ValRef; - nullable_equals_operator_vref : ValRef; - not_equals_operator_vref : ValRef; - less_than_operator_vref : ValRef; - less_than_or_equals_operator_vref : ValRef; - greater_than_operator_vref : ValRef; - greater_than_or_equals_operator_vref : ValRef; + generic_equality_er_inner_vref : ValRef + generic_equality_per_inner_vref : ValRef + generic_equality_withc_inner_vref : ValRef + generic_comparison_inner_vref : ValRef + generic_comparison_withc_inner_vref : ValRef + generic_hash_inner_vref : ValRef + generic_hash_withc_inner_vref : ValRef + reference_equality_inner_vref : ValRef + + compare_operator_vref : ValRef + equals_operator_vref : ValRef + equals_nullable_operator_vref : ValRef + nullable_equals_nullable_operator_vref : ValRef + nullable_equals_operator_vref : ValRef + not_equals_operator_vref : ValRef + less_than_operator_vref : ValRef + less_than_or_equals_operator_vref : ValRef + greater_than_operator_vref : ValRef + greater_than_or_equals_operator_vref : ValRef - bitwise_or_vref : ValRef; - bitwise_and_vref : ValRef; - bitwise_xor_vref : ValRef; - bitwise_unary_not_vref : ValRef; - bitwise_shift_left_vref : ValRef; - bitwise_shift_right_vref : ValRef; - unchecked_addition_vref : ValRef; - unchecked_unary_plus_vref : ValRef; - unchecked_unary_minus_vref : ValRef; - unchecked_unary_not_vref : ValRef; - unchecked_subtraction_vref : ValRef; - unchecked_multiply_vref : ValRef; - unchecked_defaultof_vref : ValRef; + bitwise_or_vref : ValRef + bitwise_and_vref : ValRef + bitwise_xor_vref : ValRef + bitwise_unary_not_vref : ValRef + bitwise_shift_left_vref : ValRef + bitwise_shift_right_vref : ValRef + unchecked_addition_vref : ValRef + unchecked_unary_plus_vref : ValRef + unchecked_unary_minus_vref : ValRef + unchecked_unary_not_vref : ValRef + unchecked_subtraction_vref : ValRef + unchecked_multiply_vref : ValRef + unchecked_defaultof_vref : ValRef unchecked_subtraction_info : IntrinsicValRef - seq_info : IntrinsicValRef; - reraise_info : IntrinsicValRef; - reraise_vref : ValRef; - typeof_info : IntrinsicValRef; - typeof_vref : ValRef; - methodhandleof_info : IntrinsicValRef; - methodhandleof_vref : ValRef; - sizeof_vref : ValRef; - typedefof_info : IntrinsicValRef; - typedefof_vref : ValRef; - enum_vref : ValRef; + seq_info : IntrinsicValRef + reraise_info : IntrinsicValRef + reraise_vref : ValRef + typeof_info : IntrinsicValRef + typeof_vref : ValRef + methodhandleof_info : IntrinsicValRef + methodhandleof_vref : ValRef + sizeof_vref : ValRef + typedefof_info : IntrinsicValRef + typedefof_vref : ValRef + enum_vref : ValRef enumOfValue_vref : ValRef - new_decimal_info : IntrinsicValRef; + new_decimal_info : IntrinsicValRef // 'outer' refers to 'before optimization has boiled away inlined functions' // Augmentation generation generates calls to these functions // Optimization generates calls to these functions - generic_comparison_withc_outer_info : IntrinsicValRef; - generic_equality_er_outer_info : IntrinsicValRef; - generic_equality_withc_outer_info : IntrinsicValRef; - generic_hash_withc_outer_info : IntrinsicValRef; + generic_comparison_withc_outer_info : IntrinsicValRef + generic_equality_er_outer_info : IntrinsicValRef + generic_equality_withc_outer_info : IntrinsicValRef + generic_hash_withc_outer_info : IntrinsicValRef // Augmentation generation and pattern match compilation generates calls to this function - equals_operator_info : IntrinsicValRef; + equals_operator_info : IntrinsicValRef - query_source_vref : ValRef; - query_value_vref : ValRef; - query_run_value_vref : ValRef; - query_run_enumerable_vref : ValRef; - query_for_vref : ValRef; - query_yield_vref : ValRef; - query_yield_from_vref : ValRef; - query_select_vref : ValRef; - query_where_vref : ValRef; - query_zero_vref : ValRef; - query_builder_tcref : TyconRef; - generic_hash_withc_tuple2_vref : ValRef; - generic_hash_withc_tuple3_vref : ValRef; - generic_hash_withc_tuple4_vref : ValRef; - generic_hash_withc_tuple5_vref : ValRef; - generic_equals_withc_tuple2_vref : ValRef; - generic_equals_withc_tuple3_vref : ValRef; - generic_equals_withc_tuple4_vref : ValRef; - generic_equals_withc_tuple5_vref : ValRef; - generic_compare_withc_tuple2_vref : ValRef; - generic_compare_withc_tuple3_vref : ValRef; - generic_compare_withc_tuple4_vref : ValRef; - generic_compare_withc_tuple5_vref : ValRef; - generic_equality_withc_outer_vref : ValRef; - - create_instance_info : IntrinsicValRef; - create_event_info : IntrinsicValRef; - unbox_vref : ValRef; - unbox_fast_vref : ValRef; - istype_vref : ValRef; - istype_fast_vref : ValRef; - get_generic_comparer_info : IntrinsicValRef; - get_generic_er_equality_comparer_info : IntrinsicValRef; - get_generic_per_equality_comparer_info : IntrinsicValRef; - unbox_info : IntrinsicValRef; - unbox_fast_info : IntrinsicValRef; - istype_info : IntrinsicValRef; - istype_fast_info : IntrinsicValRef; - - dispose_info : IntrinsicValRef; - - range_op_vref : ValRef; - range_int32_op_vref : ValRef; - //range_step_op_vref : ValRef; - array_get_vref : ValRef; - array2D_get_vref : ValRef; - array3D_get_vref : ValRef; - array4D_get_vref : ValRef; - seq_collect_vref : ValRef; - seq_collect_info : IntrinsicValRef; - seq_using_info : IntrinsicValRef; - seq_using_vref : ValRef; - seq_delay_info : IntrinsicValRef; - seq_delay_vref : ValRef; - seq_append_info : IntrinsicValRef; - seq_append_vref : ValRef; - seq_generated_info : IntrinsicValRef; - seq_generated_vref : ValRef; - seq_finally_info : IntrinsicValRef; - seq_finally_vref : ValRef; - seq_of_functions_info : IntrinsicValRef; - seq_of_functions_vref : ValRef; - seq_to_array_info : IntrinsicValRef; - seq_to_list_info : IntrinsicValRef; - seq_map_info : IntrinsicValRef; - seq_map_vref : ValRef; - seq_singleton_info : IntrinsicValRef; - seq_singleton_vref : ValRef; - seq_empty_info : IntrinsicValRef; - seq_empty_vref : ValRef; - new_format_info : IntrinsicValRef; - raise_info : IntrinsicValRef; - lazy_force_info : IntrinsicValRef; - lazy_create_info : IntrinsicValRef; - - array_get_info : IntrinsicValRef; - array_length_info : IntrinsicValRef; - array2D_get_info : IntrinsicValRef; - array3D_get_info : IntrinsicValRef; - array4D_get_info : IntrinsicValRef; - unpickle_quoted_info : IntrinsicValRef; - cast_quotation_info : IntrinsicValRef; - lift_value_info : IntrinsicValRef; - query_source_as_enum_info : IntrinsicValRef; - new_query_source_info : IntrinsicValRef; - fail_init_info : IntrinsicValRef; - fail_static_init_info : IntrinsicValRef; - check_this_info : IntrinsicValRef; - quote_to_linq_lambda_info : IntrinsicValRef; - sprintf_vref : ValRef; - splice_expr_vref : ValRef; - splice_raw_expr_vref : ValRef; - new_format_vref : ValRef; - mkSysTyconRef : string list -> string -> TyconRef; + query_source_vref : ValRef + query_value_vref : ValRef + query_run_value_vref : ValRef + query_run_enumerable_vref : ValRef + query_for_vref : ValRef + query_yield_vref : ValRef + query_yield_from_vref : ValRef + query_select_vref : ValRef + query_where_vref : ValRef + query_zero_vref : ValRef + query_builder_tcref : TyconRef + generic_hash_withc_tuple2_vref : ValRef + generic_hash_withc_tuple3_vref : ValRef + generic_hash_withc_tuple4_vref : ValRef + generic_hash_withc_tuple5_vref : ValRef + generic_equals_withc_tuple2_vref : ValRef + generic_equals_withc_tuple3_vref : ValRef + generic_equals_withc_tuple4_vref : ValRef + generic_equals_withc_tuple5_vref : ValRef + generic_compare_withc_tuple2_vref : ValRef + generic_compare_withc_tuple3_vref : ValRef + generic_compare_withc_tuple4_vref : ValRef + generic_compare_withc_tuple5_vref : ValRef + generic_equality_withc_outer_vref : ValRef + + create_instance_info : IntrinsicValRef + create_event_info : IntrinsicValRef + unbox_vref : ValRef + unbox_fast_vref : ValRef + istype_vref : ValRef + istype_fast_vref : ValRef + get_generic_comparer_info : IntrinsicValRef + get_generic_er_equality_comparer_info : IntrinsicValRef + get_generic_per_equality_comparer_info : IntrinsicValRef + unbox_info : IntrinsicValRef + unbox_fast_info : IntrinsicValRef + istype_info : IntrinsicValRef + istype_fast_info : IntrinsicValRef + + dispose_info : IntrinsicValRef + + range_op_vref : ValRef + range_int32_op_vref : ValRef + //range_step_op_vref : ValRef + array_get_vref : ValRef + array2D_get_vref : ValRef + array3D_get_vref : ValRef + array4D_get_vref : ValRef + seq_collect_vref : ValRef + seq_collect_info : IntrinsicValRef + seq_using_info : IntrinsicValRef + seq_using_vref : ValRef + seq_delay_info : IntrinsicValRef + seq_delay_vref : ValRef + seq_append_info : IntrinsicValRef + seq_append_vref : ValRef + seq_generated_info : IntrinsicValRef + seq_generated_vref : ValRef + seq_finally_info : IntrinsicValRef + seq_finally_vref : ValRef + seq_of_functions_info : IntrinsicValRef + seq_of_functions_vref : ValRef + seq_to_array_info : IntrinsicValRef + seq_to_list_info : IntrinsicValRef + seq_map_info : IntrinsicValRef + seq_map_vref : ValRef + seq_singleton_info : IntrinsicValRef + seq_singleton_vref : ValRef + seq_empty_info : IntrinsicValRef + seq_empty_vref : ValRef + new_format_info : IntrinsicValRef + raise_info : IntrinsicValRef + lazy_force_info : IntrinsicValRef + lazy_create_info : IntrinsicValRef + + array_get_info : IntrinsicValRef + array_length_info : IntrinsicValRef + array2D_get_info : IntrinsicValRef + array3D_get_info : IntrinsicValRef + array4D_get_info : IntrinsicValRef + unpickle_quoted_info : IntrinsicValRef + cast_quotation_info : IntrinsicValRef + lift_value_info : IntrinsicValRef + query_source_as_enum_info : IntrinsicValRef + new_query_source_info : IntrinsicValRef + fail_init_info : IntrinsicValRef + fail_static_init_info : IntrinsicValRef + check_this_info : IntrinsicValRef + quote_to_linq_lambda_info : IntrinsicValRef + sprintf_vref : ValRef + splice_expr_vref : ValRef + splice_raw_expr_vref : ValRef + new_format_vref : ValRef + mkSysTyconRef : string list -> string -> TyconRef // A list of types that are explicitly suppressed from the F# intellisense // Note that the suppression checks for the precise name of the type // so the lowercase versions are visible - suppressed_types : TyconRef list; + suppressed_types : TyconRef list /// Memoization table to help minimize the number of ILSourceDocument objects we create - memoize_file : int -> IL.ILSourceDocument; + memoize_file : int -> IL.ILSourceDocument // Are we assuming all code gen is for F# interactive, with no static linking isInteractive : bool // A table of all intrinsics that the compiler cares about @@ -677,13 +674,13 @@ let mkTcGlobals (compilingFslib,sysCcu,ilg,fslibCcu,directoryToResolveRelativePa let system_RuntimeMethodHandle_typ = mkSysNonGenericTy sys "RuntimeMethodHandle" - let mk_unop_ty ty = [[ty]], ty - let mk_binop_ty ty = [[ty]; [ty]], ty - let mk_shiftop_ty ty = [[ty]; [int_ty]], ty - let mk_binop_ty3 ty1 ty2 ty3 = [[ty1]; [ty2]], ty3 - let mk_rel_sig ty = [[ty];[ty]],bool_ty - let mk_compare_sig ty = [[ty];[ty]],int_ty - let mk_hash_sig ty = [[ty]], int_ty + let mk_unop_ty ty = [[ty]], ty + let mk_binop_ty ty = [[ty]; [ty]], ty + let mk_shiftop_ty ty = [[ty]; [int_ty]], ty + let mk_binop_ty3 ty1 ty2 ty3 = [[ty1]; [ty2]], ty3 + let mk_rel_sig ty = [[ty];[ty]],bool_ty + let mk_compare_sig ty = [[ty];[ty]],int_ty + let mk_hash_sig ty = [[ty]], int_ty let mk_compare_withc_sig ty = [[mk_IComparer_ty];[ty]; [ty]], int_ty let mk_equality_withc_sig ty = [[mk_IEqualityComparer_ty];[ty];[ty]], bool_ty let mk_hash_withc_sig ty = [[mk_IEqualityComparer_ty]; [ty]], int_ty @@ -962,259 +959,259 @@ let mkTcGlobals (compilingFslib,sysCcu,ilg,fslibCcu,directoryToResolveRelativePa let check_this_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "CheckThis" ,None ,None ,[vara], ([[varaTy]], varaTy)) let quote_to_linq_lambda_info = makeIntrinsicValRef(fslib_MFLinqRuntimeHelpersQuotationConverter_nleref, "QuotationToLambdaExpression" ,None ,None ,[vara], ([[mkQuotedExprTy varaTy]], mkLinqExpressionTy varaTy)) - { ilg=ilg; + { ilg=ilg #if NO_COMPILER_BACKEND #else - ilxPubCloEnv=EraseIlxFuncs.new_cenv(ilg) + ilxPubCloEnv=EraseClosures.new_cenv(ilg) #endif knownIntrinsics = knownIntrinsics knownFSharpCoreModules = knownFSharpCoreModules - compilingFslib = compilingFslib; - mlCompatibility = mlCompatibility; + compilingFslib = compilingFslib + mlCompatibility = mlCompatibility emitDebugInfoInQuotations = emitDebugInfoInQuotations - directoryToResolveRelativePaths= directoryToResolveRelativePaths; - unionCaseRefEq = unionCaseRefEq; - valRefEq = valRefEq; - fslibCcu = fslibCcu; - using40environment = using40environment; - indirectCallArrayMethods = indirectCallArrayMethods; - sysCcu = sysCcu; - refcell_tcr_canon = mk_MFCore_tcref fslibCcu "Ref`1"; - option_tcr_canon = mk_MFCore_tcref fslibCcu "Option`1"; - list_tcr_canon = mk_MFCollections_tcref fslibCcu "List`1"; - set_tcr_canon = mk_MFCollections_tcref fslibCcu "Set`1"; - map_tcr_canon = mk_MFCollections_tcref fslibCcu "Map`2"; - lazy_tcr_canon = lazy_tcr; - refcell_tcr_nice = mk_MFCore_tcref fslibCcu "ref`1"; - array_tcr_nice = il_arr_tcr_map.[0]; - option_tcr_nice = option_tcr_nice; - list_tcr_nice = list_tcr_nice; - lazy_tcr_nice = lazy_tcr_nice; - format_tcr = format_tcr; - expr_tcr = expr_tcr; - raw_expr_tcr = raw_expr_tcr; - nativeint_tcr = nativeint_tcr; - int32_tcr = int32_tcr; - int16_tcr = int16_tcr; - int64_tcr = int64_tcr; - uint16_tcr = uint16_tcr; - uint32_tcr = uint32_tcr; - uint64_tcr = uint64_tcr; - sbyte_tcr = sbyte_tcr; - decimal_tcr = decimal_tcr; - date_tcr = date_tcr; - pdecimal_tcr = pdecimal_tcr; - byte_tcr = byte_tcr; - bool_tcr = bool_tcr; - unit_tcr_canon = unit_tcr_canon; - unit_tcr_nice = unit_tcr_nice; - exn_tcr = exn_tcr; - char_tcr = char_tcr; - float_tcr = float_tcr; - float32_tcr = float32_tcr; - pfloat_tcr = pfloat_tcr; - pfloat32_tcr = pfloat32_tcr; - pint_tcr = pint_tcr; - pint8_tcr = pint8_tcr; - pint16_tcr = pint16_tcr; - pint64_tcr = pint64_tcr; - byref_tcr = byref_tcr; - nativeptr_tcr = nativeptr_tcr; - ilsigptr_tcr = ilsigptr_tcr; - fastFunc_tcr = fastFunc_tcr; + directoryToResolveRelativePaths= directoryToResolveRelativePaths + unionCaseRefEq = unionCaseRefEq + valRefEq = valRefEq + fslibCcu = fslibCcu + using40environment = using40environment + indirectCallArrayMethods = indirectCallArrayMethods + sysCcu = sysCcu + refcell_tcr_canon = mk_MFCore_tcref fslibCcu "Ref`1" + option_tcr_canon = mk_MFCore_tcref fslibCcu "Option`1" + list_tcr_canon = mk_MFCollections_tcref fslibCcu "List`1" + set_tcr_canon = mk_MFCollections_tcref fslibCcu "Set`1" + map_tcr_canon = mk_MFCollections_tcref fslibCcu "Map`2" + lazy_tcr_canon = lazy_tcr + refcell_tcr_nice = mk_MFCore_tcref fslibCcu "ref`1" + array_tcr_nice = il_arr_tcr_map.[0] + option_tcr_nice = option_tcr_nice + list_tcr_nice = list_tcr_nice + lazy_tcr_nice = lazy_tcr_nice + format_tcr = format_tcr + expr_tcr = expr_tcr + raw_expr_tcr = raw_expr_tcr + nativeint_tcr = nativeint_tcr + int32_tcr = int32_tcr + int16_tcr = int16_tcr + int64_tcr = int64_tcr + uint16_tcr = uint16_tcr + uint32_tcr = uint32_tcr + uint64_tcr = uint64_tcr + sbyte_tcr = sbyte_tcr + decimal_tcr = decimal_tcr + date_tcr = date_tcr + pdecimal_tcr = pdecimal_tcr + byte_tcr = byte_tcr + bool_tcr = bool_tcr + unit_tcr_canon = unit_tcr_canon + unit_tcr_nice = unit_tcr_nice + exn_tcr = exn_tcr + char_tcr = char_tcr + float_tcr = float_tcr + float32_tcr = float32_tcr + pfloat_tcr = pfloat_tcr + pfloat32_tcr = pfloat32_tcr + pint_tcr = pint_tcr + pint8_tcr = pint8_tcr + pint16_tcr = pint16_tcr + pint64_tcr = pint64_tcr + byref_tcr = byref_tcr + nativeptr_tcr = nativeptr_tcr + ilsigptr_tcr = ilsigptr_tcr + fastFunc_tcr = fastFunc_tcr tcref_IQueryable = tcref_IQueryable - tcref_IObservable = tcref_IObservable; - tcref_IObserver = tcref_IObserver; - fslib_IEvent2_tcr = fslib_IEvent2_tcr; - fslib_IDelegateEvent_tcr = fslib_IDelegateEvent_tcr; - seq_tcr = seq_tcr; - seq_base_tcr = mk_MFCompilerServices_tcref fslibCcu "GeneratedSequenceBase`1"; - measureproduct_tcr = mk_MFCompilerServices_tcref fslibCcu "MeasureProduct`2"; - measureinverse_tcr = mk_MFCompilerServices_tcref fslibCcu "MeasureInverse`1"; - measureone_tcr = mk_MFCompilerServices_tcref fslibCcu "MeasureOne"; - il_arr_tcr_map = il_arr_tcr_map; - tuple1_tcr = tuple1_tcr; - tuple2_tcr = tuple2_tcr; - tuple3_tcr = tuple3_tcr; - tuple4_tcr = tuple4_tcr; - tuple5_tcr = tuple5_tcr; - tuple6_tcr = tuple6_tcr; - tuple7_tcr = tuple7_tcr; - tuple8_tcr = tuple8_tcr; - choice2_tcr = choice2_tcr; - choice3_tcr = choice3_tcr; - choice4_tcr = choice4_tcr; - choice5_tcr = choice5_tcr; - choice6_tcr = choice6_tcr; - choice7_tcr = choice7_tcr; - nativeint_ty = mkNonGenericTy nativeint_tcr; - unativeint_ty = mkNonGenericTy unativeint_tcr; - int32_ty = mkNonGenericTy int32_tcr; - int16_ty = mkNonGenericTy int16_tcr; - int64_ty = mkNonGenericTy int64_tcr; - uint16_ty = mkNonGenericTy uint16_tcr; - uint32_ty = mkNonGenericTy uint32_tcr; - uint64_ty = mkNonGenericTy uint64_tcr; - sbyte_ty = mkNonGenericTy sbyte_tcr; - byte_ty = byte_ty; - bool_ty = bool_ty; - int_ty = int_ty; - string_ty = string_ty; - obj_ty = mkNonGenericTy obj_tcr; - unit_ty = unit_ty; - exn_ty = mkNonGenericTy exn_tcr; - char_ty = mkNonGenericTy char_tcr; - decimal_ty = mkNonGenericTy decimal_tcr; - float_ty = mkNonGenericTy float_tcr; - float32_ty = mkNonGenericTy float32_tcr; - memoize_file = memoize_file.Apply; - - system_Array_typ = mkSysNonGenericTy sys "Array"; - system_Object_typ = mkSysNonGenericTy sys "Object"; - system_IDisposable_typ = mkSysNonGenericTy sys "IDisposable"; - system_Value_typ = mkSysNonGenericTy sys "ValueType"; - system_Delegate_typ = mkSysNonGenericTy sys "Delegate"; - system_MulticastDelegate_typ = mkSysNonGenericTy sys "MulticastDelegate"; - system_Enum_typ = mkSysNonGenericTy sys "Enum"; - system_Exception_typ = mkSysNonGenericTy sys "Exception"; - system_String_typ = mkSysNonGenericTy sys "String"; - system_Int32_typ = mkSysNonGenericTy sys "Int32"; - system_Type_typ = system_Type_typ; + tcref_IObservable = tcref_IObservable + tcref_IObserver = tcref_IObserver + fslib_IEvent2_tcr = fslib_IEvent2_tcr + fslib_IDelegateEvent_tcr = fslib_IDelegateEvent_tcr + seq_tcr = seq_tcr + seq_base_tcr = mk_MFCompilerServices_tcref fslibCcu "GeneratedSequenceBase`1" + measureproduct_tcr = mk_MFCompilerServices_tcref fslibCcu "MeasureProduct`2" + measureinverse_tcr = mk_MFCompilerServices_tcref fslibCcu "MeasureInverse`1" + measureone_tcr = mk_MFCompilerServices_tcref fslibCcu "MeasureOne" + il_arr_tcr_map = il_arr_tcr_map + tuple1_tcr = tuple1_tcr + tuple2_tcr = tuple2_tcr + tuple3_tcr = tuple3_tcr + tuple4_tcr = tuple4_tcr + tuple5_tcr = tuple5_tcr + tuple6_tcr = tuple6_tcr + tuple7_tcr = tuple7_tcr + tuple8_tcr = tuple8_tcr + choice2_tcr = choice2_tcr + choice3_tcr = choice3_tcr + choice4_tcr = choice4_tcr + choice5_tcr = choice5_tcr + choice6_tcr = choice6_tcr + choice7_tcr = choice7_tcr + nativeint_ty = mkNonGenericTy nativeint_tcr + unativeint_ty = mkNonGenericTy unativeint_tcr + int32_ty = mkNonGenericTy int32_tcr + int16_ty = mkNonGenericTy int16_tcr + int64_ty = mkNonGenericTy int64_tcr + uint16_ty = mkNonGenericTy uint16_tcr + uint32_ty = mkNonGenericTy uint32_tcr + uint64_ty = mkNonGenericTy uint64_tcr + sbyte_ty = mkNonGenericTy sbyte_tcr + byte_ty = byte_ty + bool_ty = bool_ty + int_ty = int_ty + string_ty = string_ty + obj_ty = mkNonGenericTy obj_tcr + unit_ty = unit_ty + exn_ty = mkNonGenericTy exn_tcr + char_ty = mkNonGenericTy char_tcr + decimal_ty = mkNonGenericTy decimal_tcr + float_ty = mkNonGenericTy float_tcr + float32_ty = mkNonGenericTy float32_tcr + memoize_file = memoize_file.Apply + + system_Array_typ = mkSysNonGenericTy sys "Array" + system_Object_typ = mkSysNonGenericTy sys "Object" + system_IDisposable_typ = mkSysNonGenericTy sys "IDisposable" + system_Value_typ = mkSysNonGenericTy sys "ValueType" + system_Delegate_typ = mkSysNonGenericTy sys "Delegate" + system_MulticastDelegate_typ = mkSysNonGenericTy sys "MulticastDelegate" + system_Enum_typ = mkSysNonGenericTy sys "Enum" + system_Exception_typ = mkSysNonGenericTy sys "Exception" + system_String_typ = mkSysNonGenericTy sys "String" + system_Int32_typ = mkSysNonGenericTy sys "Int32" + system_Type_typ = system_Type_typ system_TypedReference_tcref = if ilg.traits.TypedReferenceTypeScopeRef.IsSome then Some(mkSysTyconRef sys "TypedReference") else None system_ArgIterator_tcref = if ilg.traits.ArgIteratorTypeScopeRef.IsSome then Some(mkSysTyconRef sys "ArgIterator") else None - system_RuntimeArgumentHandle_tcref = if ilg.traits.RuntimeArgumentHandleTypeScopeRef.IsSome then Some (mkSysTyconRef sys "RuntimeArgumentHandle") else None; - system_SByte_tcref = mkSysTyconRef sys "SByte"; - system_Decimal_tcref = mkSysTyconRef sys "Decimal"; - system_Int16_tcref = mkSysTyconRef sys "Int16"; - system_Int32_tcref = mkSysTyconRef sys "Int32"; - system_Int64_tcref = mkSysTyconRef sys "Int64"; - system_IntPtr_tcref = mkSysTyconRef sys "IntPtr"; - system_Bool_tcref = mkSysTyconRef sys "Boolean"; - system_Byte_tcref = mkSysTyconRef sys "Byte"; - system_UInt16_tcref = mkSysTyconRef sys "UInt16"; - system_Char_tcref = mkSysTyconRef sys "Char"; - system_UInt32_tcref = mkSysTyconRef sys "UInt32"; - system_UInt64_tcref = mkSysTyconRef sys "UInt64"; - system_UIntPtr_tcref = mkSysTyconRef sys "UIntPtr"; - system_Single_tcref = mkSysTyconRef sys "Single"; - system_Double_tcref = mkSysTyconRef sys "Double"; - system_RuntimeTypeHandle_typ = mkSysNonGenericTy sys "RuntimeTypeHandle"; - system_RuntimeMethodHandle_typ = system_RuntimeMethodHandle_typ; + system_RuntimeArgumentHandle_tcref = if ilg.traits.RuntimeArgumentHandleTypeScopeRef.IsSome then Some (mkSysTyconRef sys "RuntimeArgumentHandle") else None + system_SByte_tcref = mkSysTyconRef sys "SByte" + system_Decimal_tcref = mkSysTyconRef sys "Decimal" + system_Int16_tcref = mkSysTyconRef sys "Int16" + system_Int32_tcref = mkSysTyconRef sys "Int32" + system_Int64_tcref = mkSysTyconRef sys "Int64" + system_IntPtr_tcref = mkSysTyconRef sys "IntPtr" + system_Bool_tcref = mkSysTyconRef sys "Boolean" + system_Byte_tcref = mkSysTyconRef sys "Byte" + system_UInt16_tcref = mkSysTyconRef sys "UInt16" + system_Char_tcref = mkSysTyconRef sys "Char" + system_UInt32_tcref = mkSysTyconRef sys "UInt32" + system_UInt64_tcref = mkSysTyconRef sys "UInt64" + system_UIntPtr_tcref = mkSysTyconRef sys "UIntPtr" + system_Single_tcref = mkSysTyconRef sys "Single" + system_Double_tcref = mkSysTyconRef sys "Double" + system_RuntimeTypeHandle_typ = mkSysNonGenericTy sys "RuntimeTypeHandle" + system_RuntimeMethodHandle_typ = system_RuntimeMethodHandle_typ system_MarshalByRefObject_tcref = if ilg.traits.MarshalByRefObjectScopeRef.IsSome then Some(mkSysTyconRef sys "MarshalByRefObject") else None system_MarshalByRefObject_typ = if ilg.traits.MarshalByRefObjectScopeRef.IsSome then Some(mkSysNonGenericTy sys "MarshalByRefObject") else None - system_Reflection_MethodInfo_typ = system_Reflection_MethodInfo_typ; + system_Reflection_MethodInfo_typ = system_Reflection_MethodInfo_typ - system_Array_tcref = mkSysTyconRef sys "Array"; - system_Object_tcref = mkSysTyconRef sys "Object"; - system_Void_tcref = mkSysTyconRef sys "Void"; - system_IndexOutOfRangeException_tcref = mkSysTyconRef sys "IndexOutOfRangeException"; - system_Nullable_tcref = nullable_tcr; - system_GenericIComparable_tcref = mkSysTyconRef sys "IComparable`1"; - system_GenericIEquatable_tcref = mkSysTyconRef sys "IEquatable`1"; - mk_IComparable_ty = mkSysNonGenericTy sys "IComparable"; - system_LinqExpression_tcref = linqExpression_tcr; - - mk_IStructuralComparable_ty = mkSysNonGenericTy sysCollections "IStructuralComparable"; + system_Array_tcref = mkSysTyconRef sys "Array" + system_Object_tcref = mkSysTyconRef sys "Object" + system_Void_tcref = mkSysTyconRef sys "Void" + system_IndexOutOfRangeException_tcref = mkSysTyconRef sys "IndexOutOfRangeException" + system_Nullable_tcref = nullable_tcr + system_GenericIComparable_tcref = mkSysTyconRef sys "IComparable`1" + system_GenericIEquatable_tcref = mkSysTyconRef sys "IEquatable`1" + mk_IComparable_ty = mkSysNonGenericTy sys "IComparable" + system_LinqExpression_tcref = linqExpression_tcr + + mk_IStructuralComparable_ty = mkSysNonGenericTy sysCollections "IStructuralComparable" - mk_IStructuralEquatable_ty = mkSysNonGenericTy sysCollections "IStructuralEquatable"; - - mk_IComparer_ty = mk_IComparer_ty; - mk_IEqualityComparer_ty = mk_IEqualityComparer_ty; - tcref_System_Collections_IComparer = mkSysTyconRef sysCollections "IComparer"; - tcref_System_Collections_IEqualityComparer = mkSysTyconRef sysCollections "IEqualityComparer"; - tcref_System_Collections_Generic_IEqualityComparer = mkSysTyconRef sysGenerics "IEqualityComparer`1"; - tcref_System_Collections_Generic_Dictionary = mkSysTyconRef sysGenerics "Dictionary`2"; + mk_IStructuralEquatable_ty = mkSysNonGenericTy sysCollections "IStructuralEquatable" + + mk_IComparer_ty = mk_IComparer_ty + mk_IEqualityComparer_ty = mk_IEqualityComparer_ty + tcref_System_Collections_IComparer = mkSysTyconRef sysCollections "IComparer" + tcref_System_Collections_IEqualityComparer = mkSysTyconRef sysCollections "IEqualityComparer" + tcref_System_Collections_Generic_IEqualityComparer = mkSysTyconRef sysGenerics "IEqualityComparer`1" + tcref_System_Collections_Generic_Dictionary = mkSysTyconRef sysGenerics "Dictionary`2" tcref_System_IComparable = mkSysTyconRef sys "IComparable" tcref_System_IStructuralComparable = mkSysTyconRef sysCollections "IStructuralComparable" - tcref_System_IStructuralEquatable = mkSysTyconRef sysCollections "IStructuralEquatable"; + tcref_System_IStructuralEquatable = mkSysTyconRef sysCollections "IStructuralEquatable" - tcref_LanguagePrimitives = mk_MFCore_tcref fslibCcu "LanguagePrimitives"; + tcref_LanguagePrimitives = mk_MFCore_tcref fslibCcu "LanguagePrimitives" - tcref_System_Collections_Generic_IList = mkSysTyconRef sysGenerics "IList`1"; - tcref_System_Collections_Generic_IReadOnlyList = mkSysTyconRef sysGenerics "IReadOnlyList`1"; - tcref_System_Collections_Generic_ICollection = mkSysTyconRef sysGenerics "ICollection`1"; - tcref_System_Collections_Generic_IReadOnlyCollection = mkSysTyconRef sysGenerics "IReadOnlyCollection`1"; + tcref_System_Collections_Generic_IList = mkSysTyconRef sysGenerics "IList`1" + tcref_System_Collections_Generic_IReadOnlyList = mkSysTyconRef sysGenerics "IReadOnlyList`1" + tcref_System_Collections_Generic_ICollection = mkSysTyconRef sysGenerics "ICollection`1" + tcref_System_Collections_Generic_IReadOnlyCollection = mkSysTyconRef sysGenerics "IReadOnlyCollection`1" tcref_System_Collections_IEnumerable = tcref_System_Collections_IEnumerable - tcref_System_Collections_Generic_IEnumerable = IEnumerable_tcr; - tcref_System_Collections_Generic_IEnumerator = IEnumerator_tcr; + tcref_System_Collections_Generic_IEnumerable = IEnumerable_tcr + tcref_System_Collections_Generic_IEnumerator = IEnumerator_tcr - tcref_System_Attribute = System_Attribute_tcr; + tcref_System_Attribute = System_Attribute_tcr - attrib_AttributeUsageAttribute = mkSystemRuntimeAttrib "System.AttributeUsageAttribute"; - attrib_ParamArrayAttribute = mkSystemRuntimeAttrib "System.ParamArrayAttribute"; + attrib_AttributeUsageAttribute = mkSystemRuntimeAttrib "System.AttributeUsageAttribute" + attrib_ParamArrayAttribute = mkSystemRuntimeAttrib "System.ParamArrayAttribute" attrib_IDispatchConstantAttribute = if ilg.traits.IDispatchConstantAttributeScopeRef.IsSome then Some(mkSystemRuntimeAttrib "System.Runtime.CompilerServices.IDispatchConstantAttribute") else None attrib_IUnknownConstantAttribute = if ilg.traits.IUnknownConstantAttributeScopeRef.IsSome then Some (mkSystemRuntimeAttrib "System.Runtime.CompilerServices.IUnknownConstantAttribute") else None - attrib_SystemObsolete = mkSystemRuntimeAttrib "System.ObsoleteAttribute"; - attrib_DllImportAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.DllImportAttribute"; - attrib_StructLayoutAttribute = mkSystemRuntimeAttrib "System.Runtime.InteropServices.StructLayoutAttribute"; - attrib_TypeForwardedToAttribute = mkSystemRuntimeAttrib "System.Runtime.CompilerServices.TypeForwardedToAttribute"; - attrib_ComVisibleAttribute = mkSystemRuntimeAttrib "System.Runtime.InteropServices.ComVisibleAttribute"; - attrib_ComImportAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.ComImportAttribute"; - attrib_FieldOffsetAttribute = mkSystemRuntimeAttrib "System.Runtime.InteropServices.FieldOffsetAttribute" ; - attrib_MarshalAsAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.MarshalAsAttribute"; - attrib_InAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.InAttribute" ; - attrib_OutAttribute = mkSystemRuntimeAttrib "System.Runtime.InteropServices.OutAttribute" ; - attrib_OptionalAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.OptionalAttribute" ; + attrib_SystemObsolete = mkSystemRuntimeAttrib "System.ObsoleteAttribute" + attrib_DllImportAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.DllImportAttribute" + attrib_StructLayoutAttribute = mkSystemRuntimeAttrib "System.Runtime.InteropServices.StructLayoutAttribute" + attrib_TypeForwardedToAttribute = mkSystemRuntimeAttrib "System.Runtime.CompilerServices.TypeForwardedToAttribute" + attrib_ComVisibleAttribute = mkSystemRuntimeAttrib "System.Runtime.InteropServices.ComVisibleAttribute" + attrib_ComImportAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.ComImportAttribute" + attrib_FieldOffsetAttribute = mkSystemRuntimeAttrib "System.Runtime.InteropServices.FieldOffsetAttribute" + attrib_MarshalAsAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.MarshalAsAttribute" + attrib_InAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.InAttribute" + attrib_OutAttribute = mkSystemRuntimeAttrib "System.Runtime.InteropServices.OutAttribute" + attrib_OptionalAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.OptionalAttribute" attrib_ThreadStaticAttribute = if ilg.traits.ThreadStaticAttributeScopeRef.IsSome then Some(mkSystemRuntimeAttrib "System.ThreadStaticAttribute") else None attrib_SpecialNameAttribute = if ilg.traits.SpecialNameAttributeScopeRef.IsSome then Some(mkSystemRuntimeAttrib "System.Runtime.CompilerServices.SpecialNameAttribute") else None - attrib_VolatileFieldAttribute = mk_MFCore_attrib "VolatileFieldAttribute"; - attrib_ContextStaticAttribute = if ilg.traits.ContextStaticAttributeScopeRef.IsSome then Some (mkSystemRuntimeAttrib "System.ContextStaticAttribute") else None; - attrib_FlagsAttribute = mkSystemRuntimeAttrib "System.FlagsAttribute"; - attrib_DefaultMemberAttribute = mkSystemRuntimeAttrib "System.Reflection.DefaultMemberAttribute"; - attrib_DebuggerDisplayAttribute = mkSystemDiagnosticsDebugAttribute "System.Diagnostics.DebuggerDisplayAttribute"; - attrib_DebuggerTypeProxyAttribute = mkSystemDiagnosticsDebugAttribute "System.Diagnostics.DebuggerTypeProxyAttribute"; - attrib_PreserveSigAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.PreserveSigAttribute"; - attrib_MethodImplAttribute = mkSystemRuntimeAttrib "System.Runtime.CompilerServices.MethodImplAttribute"; - attrib_ExtensionAttribute = mkSystemRuntimeAttrib "System.Runtime.CompilerServices.ExtensionAttribute"; + attrib_VolatileFieldAttribute = mk_MFCore_attrib "VolatileFieldAttribute" + attrib_ContextStaticAttribute = if ilg.traits.ContextStaticAttributeScopeRef.IsSome then Some (mkSystemRuntimeAttrib "System.ContextStaticAttribute") else None + attrib_FlagsAttribute = mkSystemRuntimeAttrib "System.FlagsAttribute" + attrib_DefaultMemberAttribute = mkSystemRuntimeAttrib "System.Reflection.DefaultMemberAttribute" + attrib_DebuggerDisplayAttribute = mkSystemDiagnosticsDebugAttribute "System.Diagnostics.DebuggerDisplayAttribute" + attrib_DebuggerTypeProxyAttribute = mkSystemDiagnosticsDebugAttribute "System.Diagnostics.DebuggerTypeProxyAttribute" + attrib_PreserveSigAttribute = mkSystemRuntimeInteropServicesAttribute "System.Runtime.InteropServices.PreserveSigAttribute" + attrib_MethodImplAttribute = mkSystemRuntimeAttrib "System.Runtime.CompilerServices.MethodImplAttribute" + attrib_ExtensionAttribute = mkSystemRuntimeAttrib "System.Runtime.CompilerServices.ExtensionAttribute" - attrib_ProjectionParameterAttribute = mk_MFCore_attrib "ProjectionParameterAttribute"; - attrib_CustomOperationAttribute = mk_MFCore_attrib "CustomOperationAttribute"; - attrib_NonSerializedAttribute = if ilg.traits.NonSerializedAttributeScopeRef.IsSome then Some(mkSystemRuntimeAttrib "System.NonSerializedAttribute") else None; - attrib_AutoSerializableAttribute = mk_MFCore_attrib "AutoSerializableAttribute"; - attrib_RequireQualifiedAccessAttribute = mk_MFCore_attrib "RequireQualifiedAccessAttribute"; - attrib_EntryPointAttribute = mk_MFCore_attrib "EntryPointAttribute"; - attrib_DefaultAugmentationAttribute = mk_MFCore_attrib "DefaultAugmentationAttribute"; - attrib_CompilerMessageAttribute = mk_MFCore_attrib "CompilerMessageAttribute"; - attrib_ExperimentalAttribute = mk_MFCore_attrib "ExperimentalAttribute"; - attrib_UnverifiableAttribute = mk_MFCore_attrib "UnverifiableAttribute"; - attrib_LiteralAttribute = mk_MFCore_attrib "LiteralAttribute"; - attrib_ConditionalAttribute = mkSystemRuntimeAttrib "System.Diagnostics.ConditionalAttribute"; - attrib_OptionalArgumentAttribute = mk_MFCore_attrib "OptionalArgumentAttribute"; - attrib_RequiresExplicitTypeArgumentsAttribute = mk_MFCore_attrib "RequiresExplicitTypeArgumentsAttribute"; - attrib_DefaultValueAttribute = mk_MFCore_attrib "DefaultValueAttribute"; - attrib_ClassAttribute = mk_MFCore_attrib "ClassAttribute"; - attrib_InterfaceAttribute = mk_MFCore_attrib "InterfaceAttribute"; - attrib_StructAttribute = mk_MFCore_attrib "StructAttribute"; - attrib_ReflectedDefinitionAttribute = mk_MFCore_attrib "ReflectedDefinitionAttribute"; - attrib_CompiledNameAttribute = mk_MFCore_attrib "CompiledNameAttribute"; - attrib_AutoOpenAttribute = mk_MFCore_attrib "AutoOpenAttribute"; - attrib_CompilationRepresentationAttribute = mk_MFCore_attrib "CompilationRepresentationAttribute"; - attrib_CompilationArgumentCountsAttribute = mk_MFCore_attrib "CompilationArgumentCountsAttribute"; - attrib_CompilationMappingAttribute = mk_MFCore_attrib "CompilationMappingAttribute"; - attrib_CLIEventAttribute = mk_MFCore_attrib "CLIEventAttribute"; - attrib_CLIMutableAttribute = mk_MFCore_attrib "CLIMutableAttribute"; - attrib_AllowNullLiteralAttribute = mk_MFCore_attrib "AllowNullLiteralAttribute"; - attrib_NoEqualityAttribute = mk_MFCore_attrib "NoEqualityAttribute"; - attrib_NoComparisonAttribute = mk_MFCore_attrib "NoComparisonAttribute"; - attrib_CustomEqualityAttribute = mk_MFCore_attrib "CustomEqualityAttribute"; - attrib_CustomComparisonAttribute = mk_MFCore_attrib "CustomComparisonAttribute"; - attrib_EqualityConditionalOnAttribute = mk_MFCore_attrib "EqualityConditionalOnAttribute"; - attrib_ComparisonConditionalOnAttribute = mk_MFCore_attrib "ComparisonConditionalOnAttribute"; - attrib_ReferenceEqualityAttribute = mk_MFCore_attrib "ReferenceEqualityAttribute"; - attrib_StructuralEqualityAttribute = mk_MFCore_attrib "StructuralEqualityAttribute"; - attrib_StructuralComparisonAttribute = mk_MFCore_attrib "StructuralComparisonAttribute"; - attrib_SealedAttribute = mk_MFCore_attrib "SealedAttribute"; - attrib_AbstractClassAttribute = mk_MFCore_attrib "AbstractClassAttribute"; - attrib_GeneralizableValueAttribute = mk_MFCore_attrib "GeneralizableValueAttribute"; - attrib_MeasureAttribute = mk_MFCore_attrib "MeasureAttribute"; - attrib_MeasureableAttribute = mk_MFCore_attrib "MeasureAnnotatedAbbreviationAttribute"; - attrib_NoDynamicInvocationAttribute = mk_MFCore_attrib "NoDynamicInvocationAttribute"; + attrib_ProjectionParameterAttribute = mk_MFCore_attrib "ProjectionParameterAttribute" + attrib_CustomOperationAttribute = mk_MFCore_attrib "CustomOperationAttribute" + attrib_NonSerializedAttribute = if ilg.traits.NonSerializedAttributeScopeRef.IsSome then Some(mkSystemRuntimeAttrib "System.NonSerializedAttribute") else None + attrib_AutoSerializableAttribute = mk_MFCore_attrib "AutoSerializableAttribute" + attrib_RequireQualifiedAccessAttribute = mk_MFCore_attrib "RequireQualifiedAccessAttribute" + attrib_EntryPointAttribute = mk_MFCore_attrib "EntryPointAttribute" + attrib_DefaultAugmentationAttribute = mk_MFCore_attrib "DefaultAugmentationAttribute" + attrib_CompilerMessageAttribute = mk_MFCore_attrib "CompilerMessageAttribute" + attrib_ExperimentalAttribute = mk_MFCore_attrib "ExperimentalAttribute" + attrib_UnverifiableAttribute = mk_MFCore_attrib "UnverifiableAttribute" + attrib_LiteralAttribute = mk_MFCore_attrib "LiteralAttribute" + attrib_ConditionalAttribute = mkSystemRuntimeAttrib "System.Diagnostics.ConditionalAttribute" + attrib_OptionalArgumentAttribute = mk_MFCore_attrib "OptionalArgumentAttribute" + attrib_RequiresExplicitTypeArgumentsAttribute = mk_MFCore_attrib "RequiresExplicitTypeArgumentsAttribute" + attrib_DefaultValueAttribute = mk_MFCore_attrib "DefaultValueAttribute" + attrib_ClassAttribute = mk_MFCore_attrib "ClassAttribute" + attrib_InterfaceAttribute = mk_MFCore_attrib "InterfaceAttribute" + attrib_StructAttribute = mk_MFCore_attrib "StructAttribute" + attrib_ReflectedDefinitionAttribute = mk_MFCore_attrib "ReflectedDefinitionAttribute" + attrib_CompiledNameAttribute = mk_MFCore_attrib "CompiledNameAttribute" + attrib_AutoOpenAttribute = mk_MFCore_attrib "AutoOpenAttribute" + attrib_CompilationRepresentationAttribute = mk_MFCore_attrib "CompilationRepresentationAttribute" + attrib_CompilationArgumentCountsAttribute = mk_MFCore_attrib "CompilationArgumentCountsAttribute" + attrib_CompilationMappingAttribute = mk_MFCore_attrib "CompilationMappingAttribute" + attrib_CLIEventAttribute = mk_MFCore_attrib "CLIEventAttribute" + attrib_CLIMutableAttribute = mk_MFCore_attrib "CLIMutableAttribute" + attrib_AllowNullLiteralAttribute = mk_MFCore_attrib "AllowNullLiteralAttribute" + attrib_NoEqualityAttribute = mk_MFCore_attrib "NoEqualityAttribute" + attrib_NoComparisonAttribute = mk_MFCore_attrib "NoComparisonAttribute" + attrib_CustomEqualityAttribute = mk_MFCore_attrib "CustomEqualityAttribute" + attrib_CustomComparisonAttribute = mk_MFCore_attrib "CustomComparisonAttribute" + attrib_EqualityConditionalOnAttribute = mk_MFCore_attrib "EqualityConditionalOnAttribute" + attrib_ComparisonConditionalOnAttribute = mk_MFCore_attrib "ComparisonConditionalOnAttribute" + attrib_ReferenceEqualityAttribute = mk_MFCore_attrib "ReferenceEqualityAttribute" + attrib_StructuralEqualityAttribute = mk_MFCore_attrib "StructuralEqualityAttribute" + attrib_StructuralComparisonAttribute = mk_MFCore_attrib "StructuralComparisonAttribute" + attrib_SealedAttribute = mk_MFCore_attrib "SealedAttribute" + attrib_AbstractClassAttribute = mk_MFCore_attrib "AbstractClassAttribute" + attrib_GeneralizableValueAttribute = mk_MFCore_attrib "GeneralizableValueAttribute" + attrib_MeasureAttribute = mk_MFCore_attrib "MeasureAttribute" + attrib_MeasureableAttribute = mk_MFCore_attrib "MeasureAnnotatedAbbreviationAttribute" + attrib_NoDynamicInvocationAttribute = mk_MFCore_attrib "NoDynamicInvocationAttribute" attrib_SecurityAttribute = if ilg.traits.SecurityPermissionAttributeTypeScopeRef.IsSome then Some(mkSystemRuntimeAttrib"System.Security.Permissions.SecurityAttribute") else None attrib_SecurityCriticalAttribute = mkSystemRuntimeAttrib "System.Security.SecurityCriticalAttribute" attrib_SecuritySafeCriticalAttribute = mkSystemRuntimeAttrib "System.Security.SecuritySafeCriticalAttribute" @@ -1226,36 +1223,36 @@ let mkTcGlobals (compilingFslib,sysCcu,ilg,fslibCcu,directoryToResolveRelativePa better_tcref_map = begin let entries1 = - [ "Int32", int_tcr; - "IntPtr", nativeint_tcr; - "UIntPtr", unativeint_tcr; - "Int16",int16_tcr; - "Int64",int64_tcr; - "UInt16",uint16_tcr; - "UInt32",uint32_tcr; - "UInt64",uint64_tcr; - "SByte",sbyte_tcr; - "Decimal",decimal_tcr; - "Byte",byte_tcr; - "Boolean",bool_tcr; - "String",string_tcr; - "Object",obj_tcr; - "Exception",exn_tcr; - "Char",char_tcr; - "Double",float_tcr; - "Single",float32_tcr;] + [ "Int32", int_tcr + "IntPtr", nativeint_tcr + "UIntPtr", unativeint_tcr + "Int16",int16_tcr + "Int64",int64_tcr + "UInt16",uint16_tcr + "UInt32",uint32_tcr + "UInt64",uint64_tcr + "SByte",sbyte_tcr + "Decimal",decimal_tcr + "Byte",byte_tcr + "Boolean",bool_tcr + "String",string_tcr + "Object",obj_tcr + "Exception",exn_tcr + "Char",char_tcr + "Double",float_tcr + "Single",float32_tcr] |> List.map (fun (nm,tcr) -> let ty = mkNonGenericTy tcr nm, mkSysTyconRef sys nm, (fun _ -> ty)) let entries2 = - [ "FSharpFunc`2", fastFunc_tcr, (fun tinst -> mkFunTy (List.nth tinst 0) (List.nth tinst 1)); - "Tuple`2", tuple2_tcr, decodeTupleTy; - "Tuple`3", tuple3_tcr, decodeTupleTy; - "Tuple`4", tuple4_tcr, decodeTupleTy; - "Tuple`5", tuple5_tcr, decodeTupleTy; - "Tuple`6", tuple6_tcr, decodeTupleTy; - "Tuple`7", tuple7_tcr, decodeTupleTy; - "Tuple`8", tuple8_tcr, decodeTupleTy;] + [ "FSharpFunc`2", fastFunc_tcr, (fun tinst -> mkFunTy (List.nth tinst 0) (List.nth tinst 1)) + "Tuple`2", tuple2_tcr, decodeTupleTy + "Tuple`3", tuple3_tcr, decodeTupleTy + "Tuple`4", tuple4_tcr, decodeTupleTy + "Tuple`5", tuple5_tcr, decodeTupleTy + "Tuple`6", tuple6_tcr, decodeTupleTy + "Tuple`7", tuple7_tcr, decodeTupleTy + "Tuple`8", tuple8_tcr, decodeTupleTy] let entries = (entries1 @ entries2) if compilingFslib then @@ -1282,172 +1279,172 @@ let mkTcGlobals (compilingFslib,sysCcu,ilg,fslibCcu,directoryToResolveRelativePa (fun tcref2 tinst -> if dict.ContainsKey tcref2.Stamp then Some(dict.[tcref2.Stamp] tinst) else None) - end; + end - new_decimal_info = new_decimal_info; - seq_info = seq_info; - seq_vref = (ValRefForIntrinsic seq_info) ; - and_vref = (ValRefForIntrinsic and_info) ; - and2_vref = (ValRefForIntrinsic and2_info); - addrof_vref = (ValRefForIntrinsic addrof_info); - addrof2_vref = (ValRefForIntrinsic addrof2_info); - or_vref = (ValRefForIntrinsic or_info); - //splice_vref = (ValRefForIntrinsic splice_info); - splice_expr_vref = (ValRefForIntrinsic splice_expr_info); - splice_raw_expr_vref = (ValRefForIntrinsic splice_raw_expr_info); - or2_vref = (ValRefForIntrinsic or2_info); - generic_equality_er_inner_vref = ValRefForIntrinsic generic_equality_er_inner_info; - generic_equality_per_inner_vref = ValRefForIntrinsic generic_equality_per_inner_info; - generic_equality_withc_inner_vref = ValRefForIntrinsic generic_equality_withc_inner_info; - generic_comparison_inner_vref = ValRefForIntrinsic generic_comparison_inner_info; - generic_comparison_withc_inner_vref = ValRefForIntrinsic generic_comparison_withc_inner_info; - generic_comparison_withc_outer_info = generic_comparison_withc_outer_info; - generic_equality_er_outer_info = generic_equality_er_outer_info; - generic_equality_withc_outer_info = generic_equality_withc_outer_info; - generic_hash_withc_outer_info = generic_hash_withc_outer_info; - generic_hash_inner_vref = ValRefForIntrinsic generic_hash_inner_info; - generic_hash_withc_inner_vref = ValRefForIntrinsic generic_hash_withc_inner_info; - - reference_equality_inner_vref = ValRefForIntrinsic reference_equality_inner_info; - - bitwise_or_vref = ValRefForIntrinsic bitwise_or_info; - bitwise_and_vref = ValRefForIntrinsic bitwise_and_info; - bitwise_xor_vref = ValRefForIntrinsic bitwise_xor_info; - bitwise_unary_not_vref = ValRefForIntrinsic bitwise_unary_not_info; - bitwise_shift_left_vref = ValRefForIntrinsic bitwise_shift_left_info; - bitwise_shift_right_vref = ValRefForIntrinsic bitwise_shift_right_info; - unchecked_addition_vref = ValRefForIntrinsic unchecked_addition_info; - unchecked_unary_plus_vref = ValRefForIntrinsic unchecked_unary_plus_info; - unchecked_unary_minus_vref = ValRefForIntrinsic unchecked_unary_minus_info; - unchecked_unary_not_vref = ValRefForIntrinsic unchecked_unary_not_info; - unchecked_subtraction_vref = ValRefForIntrinsic unchecked_subtraction_info; - unchecked_multiply_vref = ValRefForIntrinsic unchecked_multiply_info; - unchecked_defaultof_vref = ValRefForIntrinsic unchecked_defaultof_info; + new_decimal_info = new_decimal_info + seq_info = seq_info + seq_vref = (ValRefForIntrinsic seq_info) + and_vref = (ValRefForIntrinsic and_info) + and2_vref = (ValRefForIntrinsic and2_info) + addrof_vref = (ValRefForIntrinsic addrof_info) + addrof2_vref = (ValRefForIntrinsic addrof2_info) + or_vref = (ValRefForIntrinsic or_info) + //splice_vref = (ValRefForIntrinsic splice_info) + splice_expr_vref = (ValRefForIntrinsic splice_expr_info) + splice_raw_expr_vref = (ValRefForIntrinsic splice_raw_expr_info) + or2_vref = (ValRefForIntrinsic or2_info) + generic_equality_er_inner_vref = ValRefForIntrinsic generic_equality_er_inner_info + generic_equality_per_inner_vref = ValRefForIntrinsic generic_equality_per_inner_info + generic_equality_withc_inner_vref = ValRefForIntrinsic generic_equality_withc_inner_info + generic_comparison_inner_vref = ValRefForIntrinsic generic_comparison_inner_info + generic_comparison_withc_inner_vref = ValRefForIntrinsic generic_comparison_withc_inner_info + generic_comparison_withc_outer_info = generic_comparison_withc_outer_info + generic_equality_er_outer_info = generic_equality_er_outer_info + generic_equality_withc_outer_info = generic_equality_withc_outer_info + generic_hash_withc_outer_info = generic_hash_withc_outer_info + generic_hash_inner_vref = ValRefForIntrinsic generic_hash_inner_info + generic_hash_withc_inner_vref = ValRefForIntrinsic generic_hash_withc_inner_info + + reference_equality_inner_vref = ValRefForIntrinsic reference_equality_inner_info + + bitwise_or_vref = ValRefForIntrinsic bitwise_or_info + bitwise_and_vref = ValRefForIntrinsic bitwise_and_info + bitwise_xor_vref = ValRefForIntrinsic bitwise_xor_info + bitwise_unary_not_vref = ValRefForIntrinsic bitwise_unary_not_info + bitwise_shift_left_vref = ValRefForIntrinsic bitwise_shift_left_info + bitwise_shift_right_vref = ValRefForIntrinsic bitwise_shift_right_info + unchecked_addition_vref = ValRefForIntrinsic unchecked_addition_info + unchecked_unary_plus_vref = ValRefForIntrinsic unchecked_unary_plus_info + unchecked_unary_minus_vref = ValRefForIntrinsic unchecked_unary_minus_info + unchecked_unary_not_vref = ValRefForIntrinsic unchecked_unary_not_info + unchecked_subtraction_vref = ValRefForIntrinsic unchecked_subtraction_info + unchecked_multiply_vref = ValRefForIntrinsic unchecked_multiply_info + unchecked_defaultof_vref = ValRefForIntrinsic unchecked_defaultof_info unchecked_subtraction_info = unchecked_subtraction_info - compare_operator_vref = ValRefForIntrinsic compare_operator_info; - equals_operator_vref = ValRefForIntrinsic equals_operator_info; - equals_nullable_operator_vref = ValRefForIntrinsic equals_nullable_operator_info; - nullable_equals_nullable_operator_vref = ValRefForIntrinsic nullable_equals_nullable_operator_info; - nullable_equals_operator_vref = ValRefForIntrinsic nullable_equals_operator_info; - not_equals_operator_vref = ValRefForIntrinsic not_equals_operator_info; - less_than_operator_vref = ValRefForIntrinsic less_than_operator_info; - less_than_or_equals_operator_vref = ValRefForIntrinsic less_than_or_equals_operator_info; - greater_than_operator_vref = ValRefForIntrinsic greater_than_operator_info; - greater_than_or_equals_operator_vref = ValRefForIntrinsic greater_than_or_equals_operator_info; - - equals_operator_info = equals_operator_info; - - raise_info = raise_info; - reraise_info = reraise_info; - reraise_vref = ValRefForIntrinsic reraise_info; - methodhandleof_info = methodhandleof_info; - methodhandleof_vref = ValRefForIntrinsic methodhandleof_info; - typeof_info = typeof_info; - typeof_vref = ValRefForIntrinsic typeof_info; - sizeof_vref = ValRefForIntrinsic sizeof_info; - typedefof_info = typedefof_info; - typedefof_vref = ValRefForIntrinsic typedefof_info; - enum_vref = ValRefForIntrinsic enum_info; - enumOfValue_vref = ValRefForIntrinsic enumOfValue_info; - range_op_vref = ValRefForIntrinsic range_op_info; - range_int32_op_vref = ValRefForIntrinsic range_int32_op_info; - //range_step_op_vref = ValRefForIntrinsic range_step_op_info; + compare_operator_vref = ValRefForIntrinsic compare_operator_info + equals_operator_vref = ValRefForIntrinsic equals_operator_info + equals_nullable_operator_vref = ValRefForIntrinsic equals_nullable_operator_info + nullable_equals_nullable_operator_vref = ValRefForIntrinsic nullable_equals_nullable_operator_info + nullable_equals_operator_vref = ValRefForIntrinsic nullable_equals_operator_info + not_equals_operator_vref = ValRefForIntrinsic not_equals_operator_info + less_than_operator_vref = ValRefForIntrinsic less_than_operator_info + less_than_or_equals_operator_vref = ValRefForIntrinsic less_than_or_equals_operator_info + greater_than_operator_vref = ValRefForIntrinsic greater_than_operator_info + greater_than_or_equals_operator_vref = ValRefForIntrinsic greater_than_or_equals_operator_info + + equals_operator_info = equals_operator_info + + raise_info = raise_info + reraise_info = reraise_info + reraise_vref = ValRefForIntrinsic reraise_info + methodhandleof_info = methodhandleof_info + methodhandleof_vref = ValRefForIntrinsic methodhandleof_info + typeof_info = typeof_info + typeof_vref = ValRefForIntrinsic typeof_info + sizeof_vref = ValRefForIntrinsic sizeof_info + typedefof_info = typedefof_info + typedefof_vref = ValRefForIntrinsic typedefof_info + enum_vref = ValRefForIntrinsic enum_info + enumOfValue_vref = ValRefForIntrinsic enumOfValue_info + range_op_vref = ValRefForIntrinsic range_op_info + range_int32_op_vref = ValRefForIntrinsic range_int32_op_info + //range_step_op_vref = ValRefForIntrinsic range_step_op_info array_length_info = array_length_info - array_get_vref = ValRefForIntrinsic array_get_info; - array2D_get_vref = ValRefForIntrinsic array2D_get_info; - array3D_get_vref = ValRefForIntrinsic array3D_get_info; - array4D_get_vref = ValRefForIntrinsic array4D_get_info; - seq_singleton_vref = ValRefForIntrinsic seq_singleton_info; - seq_collect_vref = ValRefForIntrinsic seq_collect_info; - seq_collect_info = seq_collect_info; - seq_using_info = seq_using_info; - seq_using_vref = ValRefForIntrinsic seq_using_info; - seq_delay_info = seq_delay_info; - seq_delay_vref = ValRefForIntrinsic seq_delay_info; - seq_append_info = seq_append_info; - seq_append_vref = ValRefForIntrinsic seq_append_info; - seq_generated_info = seq_generated_info; - seq_generated_vref = ValRefForIntrinsic seq_generated_info; - seq_finally_info = seq_finally_info; - seq_finally_vref = ValRefForIntrinsic seq_finally_info; - seq_of_functions_info = seq_of_functions_info; - seq_of_functions_vref = ValRefForIntrinsic seq_of_functions_info; - seq_map_info = seq_map_info; - seq_map_vref = ValRefForIntrinsic seq_map_info; - seq_singleton_info = seq_singleton_info; - seq_empty_info = seq_empty_info; - seq_empty_vref = ValRefForIntrinsic seq_empty_info; - new_format_info = new_format_info; - new_format_vref = ValRefForIntrinsic new_format_info; - sprintf_vref = ValRefForIntrinsic sprintf_info; - unbox_vref = ValRefForIntrinsic unbox_info; - unbox_fast_vref = ValRefForIntrinsic unbox_fast_info; - istype_vref = ValRefForIntrinsic istype_info; - istype_fast_vref = ValRefForIntrinsic istype_fast_info; - unbox_info = unbox_info; - get_generic_comparer_info = get_generic_comparer_info; - get_generic_er_equality_comparer_info = get_generic_er_equality_comparer_info; - get_generic_per_equality_comparer_info = get_generic_per_equality_comparer_info; - dispose_info = dispose_info; - unbox_fast_info = unbox_fast_info; - istype_info = istype_info; - istype_fast_info = istype_fast_info; - lazy_force_info = lazy_force_info; - lazy_create_info = lazy_create_info; - create_instance_info = create_instance_info; - create_event_info = create_event_info; - seq_to_list_info = seq_to_list_info; - seq_to_array_info = seq_to_array_info; - array_get_info = array_get_info; - array2D_get_info = array2D_get_info; - array3D_get_info = array3D_get_info; - array4D_get_info = array4D_get_info; - unpickle_quoted_info = unpickle_quoted_info; - cast_quotation_info = cast_quotation_info; - lift_value_info = lift_value_info; - query_source_as_enum_info = query_source_as_enum_info; - new_query_source_info = new_query_source_info; - query_source_vref = ValRefForIntrinsic query_source_info; - query_value_vref = ValRefForIntrinsic query_value_info; - query_run_value_vref = ValRefForIntrinsic query_run_value_info; - query_run_enumerable_vref = ValRefForIntrinsic query_run_enumerable_info; - query_for_vref = ValRefForIntrinsic query_for_value_info; - query_yield_vref = ValRefForIntrinsic query_yield_value_info; - query_yield_from_vref = ValRefForIntrinsic query_yield_from_value_info; - query_select_vref = ValRefForIntrinsic query_select_value_info; - query_where_vref = ValRefForIntrinsic query_where_value_info; - query_zero_vref = ValRefForIntrinsic query_zero_value_info; - query_builder_tcref = query_builder_tcref; - fail_init_info = fail_init_info; - fail_static_init_info = fail_static_init_info; - check_this_info = check_this_info; - quote_to_linq_lambda_info = quote_to_linq_lambda_info; - - - generic_hash_withc_tuple2_vref = ValRefForIntrinsic generic_hash_withc_tuple2_info; - generic_hash_withc_tuple3_vref = ValRefForIntrinsic generic_hash_withc_tuple3_info; - generic_hash_withc_tuple4_vref = ValRefForIntrinsic generic_hash_withc_tuple4_info; - generic_hash_withc_tuple5_vref = ValRefForIntrinsic generic_hash_withc_tuple5_info; - generic_equals_withc_tuple2_vref = ValRefForIntrinsic generic_equals_withc_tuple2_info; - generic_equals_withc_tuple3_vref = ValRefForIntrinsic generic_equals_withc_tuple3_info; - generic_equals_withc_tuple4_vref = ValRefForIntrinsic generic_equals_withc_tuple4_info; - generic_equals_withc_tuple5_vref = ValRefForIntrinsic generic_equals_withc_tuple5_info; - generic_compare_withc_tuple2_vref = ValRefForIntrinsic generic_compare_withc_tuple2_info; - generic_compare_withc_tuple3_vref = ValRefForIntrinsic generic_compare_withc_tuple3_info; - generic_compare_withc_tuple4_vref = ValRefForIntrinsic generic_compare_withc_tuple4_info; - generic_compare_withc_tuple5_vref = ValRefForIntrinsic generic_compare_withc_tuple5_info; - generic_equality_withc_outer_vref = ValRefForIntrinsic generic_equality_withc_outer_info; - - - cons_ucref = cons_ucref; - nil_ucref = nil_ucref; + array_get_vref = ValRefForIntrinsic array_get_info + array2D_get_vref = ValRefForIntrinsic array2D_get_info + array3D_get_vref = ValRefForIntrinsic array3D_get_info + array4D_get_vref = ValRefForIntrinsic array4D_get_info + seq_singleton_vref = ValRefForIntrinsic seq_singleton_info + seq_collect_vref = ValRefForIntrinsic seq_collect_info + seq_collect_info = seq_collect_info + seq_using_info = seq_using_info + seq_using_vref = ValRefForIntrinsic seq_using_info + seq_delay_info = seq_delay_info + seq_delay_vref = ValRefForIntrinsic seq_delay_info + seq_append_info = seq_append_info + seq_append_vref = ValRefForIntrinsic seq_append_info + seq_generated_info = seq_generated_info + seq_generated_vref = ValRefForIntrinsic seq_generated_info + seq_finally_info = seq_finally_info + seq_finally_vref = ValRefForIntrinsic seq_finally_info + seq_of_functions_info = seq_of_functions_info + seq_of_functions_vref = ValRefForIntrinsic seq_of_functions_info + seq_map_info = seq_map_info + seq_map_vref = ValRefForIntrinsic seq_map_info + seq_singleton_info = seq_singleton_info + seq_empty_info = seq_empty_info + seq_empty_vref = ValRefForIntrinsic seq_empty_info + new_format_info = new_format_info + new_format_vref = ValRefForIntrinsic new_format_info + sprintf_vref = ValRefForIntrinsic sprintf_info + unbox_vref = ValRefForIntrinsic unbox_info + unbox_fast_vref = ValRefForIntrinsic unbox_fast_info + istype_vref = ValRefForIntrinsic istype_info + istype_fast_vref = ValRefForIntrinsic istype_fast_info + unbox_info = unbox_info + get_generic_comparer_info = get_generic_comparer_info + get_generic_er_equality_comparer_info = get_generic_er_equality_comparer_info + get_generic_per_equality_comparer_info = get_generic_per_equality_comparer_info + dispose_info = dispose_info + unbox_fast_info = unbox_fast_info + istype_info = istype_info + istype_fast_info = istype_fast_info + lazy_force_info = lazy_force_info + lazy_create_info = lazy_create_info + create_instance_info = create_instance_info + create_event_info = create_event_info + seq_to_list_info = seq_to_list_info + seq_to_array_info = seq_to_array_info + array_get_info = array_get_info + array2D_get_info = array2D_get_info + array3D_get_info = array3D_get_info + array4D_get_info = array4D_get_info + unpickle_quoted_info = unpickle_quoted_info + cast_quotation_info = cast_quotation_info + lift_value_info = lift_value_info + query_source_as_enum_info = query_source_as_enum_info + new_query_source_info = new_query_source_info + query_source_vref = ValRefForIntrinsic query_source_info + query_value_vref = ValRefForIntrinsic query_value_info + query_run_value_vref = ValRefForIntrinsic query_run_value_info + query_run_enumerable_vref = ValRefForIntrinsic query_run_enumerable_info + query_for_vref = ValRefForIntrinsic query_for_value_info + query_yield_vref = ValRefForIntrinsic query_yield_value_info + query_yield_from_vref = ValRefForIntrinsic query_yield_from_value_info + query_select_vref = ValRefForIntrinsic query_select_value_info + query_where_vref = ValRefForIntrinsic query_where_value_info + query_zero_vref = ValRefForIntrinsic query_zero_value_info + query_builder_tcref = query_builder_tcref + fail_init_info = fail_init_info + fail_static_init_info = fail_static_init_info + check_this_info = check_this_info + quote_to_linq_lambda_info = quote_to_linq_lambda_info + + + generic_hash_withc_tuple2_vref = ValRefForIntrinsic generic_hash_withc_tuple2_info + generic_hash_withc_tuple3_vref = ValRefForIntrinsic generic_hash_withc_tuple3_info + generic_hash_withc_tuple4_vref = ValRefForIntrinsic generic_hash_withc_tuple4_info + generic_hash_withc_tuple5_vref = ValRefForIntrinsic generic_hash_withc_tuple5_info + generic_equals_withc_tuple2_vref = ValRefForIntrinsic generic_equals_withc_tuple2_info + generic_equals_withc_tuple3_vref = ValRefForIntrinsic generic_equals_withc_tuple3_info + generic_equals_withc_tuple4_vref = ValRefForIntrinsic generic_equals_withc_tuple4_info + generic_equals_withc_tuple5_vref = ValRefForIntrinsic generic_equals_withc_tuple5_info + generic_compare_withc_tuple2_vref = ValRefForIntrinsic generic_compare_withc_tuple2_info + generic_compare_withc_tuple3_vref = ValRefForIntrinsic generic_compare_withc_tuple3_info + generic_compare_withc_tuple4_vref = ValRefForIntrinsic generic_compare_withc_tuple4_info + generic_compare_withc_tuple5_vref = ValRefForIntrinsic generic_compare_withc_tuple5_info + generic_equality_withc_outer_vref = ValRefForIntrinsic generic_equality_withc_outer_info + + + cons_ucref = cons_ucref + nil_ucref = nil_ucref - suppressed_types = suppressed_types; + suppressed_types = suppressed_types isInteractive=isInteractive mkSysTyconRef=mkSysTyconRef } -let public mkMscorlibAttrib g nm : BuiltinAttribInfo = +let public mkMscorlibAttrib g nm = let path, typeName = splitILTypeName nm AttribInfo(mkILTyRef (g.ilg.traits.ScopeRef,nm), g.mkSysTyconRef path typeName) diff --git a/src/fsharp/tc.fs b/src/fsharp/TypeChecker.fs similarity index 99% rename from src/fsharp/tc.fs rename to src/fsharp/TypeChecker.fs index f7ce39f9caf..0c8bcef3762 100644 --- a/src/fsharp/tc.fs +++ b/src/fsharp/TypeChecker.fs @@ -10,6 +10,7 @@ open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library +open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.ResultOrException open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Microsoft.FSharp.Compiler @@ -19,18 +20,17 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tastops.DebugPrint -open Microsoft.FSharp.Compiler.Patcompile -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.PatternMatchCompilation +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Layout -open Microsoft.FSharp.Compiler.Outcome open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.Infos.AccessibilityLogic open Microsoft.FSharp.Compiler.Infos.AttributeChecking -open Microsoft.FSharp.Compiler.Typrelns +open Microsoft.FSharp.Compiler.TypeRelations open Microsoft.FSharp.Compiler.ConstraintSolver -open Microsoft.FSharp.Compiler.Nameres +open Microsoft.FSharp.Compiler.NameResolution open Microsoft.FSharp.Compiler.PrettyNaming open System open System.Collections.Generic @@ -468,7 +468,7 @@ let AddDeclaredTypars check typars env = /// - the set of active fixups for "letrec" type inference [] type cenv = - { g: Env.TcGlobals + { g: TcGlobals /// Push an entry every time a recursive value binding is used, /// in order to be able to fix up recursive type applications as @@ -1141,7 +1141,7 @@ type CheckedBindingInfo = bool * (* immutable? *) Tast.Attribs * XmlDoc * - (TcPatPhase2Input -> Patcompile.Pattern) * + (TcPatPhase2Input -> PatternMatchCompilation.Pattern) * ExplicitTyparInfo * NameMap * Expr * @@ -2894,7 +2894,7 @@ let BuildILFieldGet g amap m objExpr (finfo:ILFieldInfo) = | _ -> #endif let wrap,objExpr = mkExprAddrOfExpr g isValueType false NeverMutates objExpr None m - // The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in Ilxgen.GenAsm + // The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in IlxGen.GenAsm // This ensures we always get the type instantiation right when doing this from // polymorphic code, after inlining etc. * let fspec = mkILFieldSpec(fref,mkILNamedTy valu fref.EnclosingTypeRef []) @@ -2906,7 +2906,7 @@ let BuildILFieldSet g m objExpr (finfo:ILFieldInfo) argExpr = let isValueType = finfo.IsValueType let valu = if isValueType then AsValue else AsObject let tinst = finfo.TypeInst - // The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in Ilxgen.gen_asm + // The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in IlxGen.GenAsm // This ensures we always get the type instantiation right when doing this from // polymorphic code, after inlining etc. * let fspec = mkILFieldSpec(fref,mkILNamedTy valu fref.EnclosingTypeRef []) @@ -2919,7 +2919,7 @@ let BuildILStaticFieldSet m (finfo:ILFieldInfo) argExpr = let isValueType = finfo.IsValueType let valu = if isValueType then AsValue else AsObject let tinst = finfo.TypeInst - // The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in Ilxgen.gen_asm + // The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in IlxGen.GenAsm // This ensures we always get the type instantiation right when doing this from // polymorphic code, after inlining etc. let fspec = mkILFieldSpec(fref,mkILNamedTy valu fref.EnclosingTypeRef []) @@ -6186,7 +6186,7 @@ and TcConstStringExpr cenv overallTy env m tpenv s = let ty' = mkPrintfFormatTy cenv.g aty bty cty dty ety if (not (isObjTy cenv.g overallTy) && AddCxTypeMustSubsumeTypeUndoIfFailed env.DisplayEnv cenv.css m overallTy ty') then // Parse the format string to work out the phantom types - let aty',ety' = (try Formats.ParseFormatString m cenv.g s bty cty dty with Failure s -> error (Error(FSComp.SR.tcUnableToParseFormatString(s),m))) + let aty',ety' = (try CheckFormatStrings.ParseFormatString m cenv.g s bty cty dty with Failure s -> error (Error(FSComp.SR.tcUnableToParseFormatString(s),m))) UnifyTypes cenv env m aty aty' UnifyTypes cenv env m ety ety' mkCallNewFormat cenv.g m aty bty cty dty ety (mkString cenv.g m s),tpenv @@ -6453,7 +6453,7 @@ and TcQuotationExpr cenv overallTy env tpenv (_oper,raw,ast,isFromQueryExpressio // Coerce it if needed let expr = if raw then mkCoerceExpr(expr,(mkRawQuotedExprTy cenv.g),m,(tyOfExpr cenv.g expr)) else expr - // We serialize the quoted expression to bytes in Ilxgen after type inference etc. is complete. + // We serialize the quoted expression to bytes in IlxGen after type inference etc. is complete. expr,tpenv //------------------------------------------------------------------------- @@ -8169,7 +8169,7 @@ and TcItemThen cenv overallTy env tpenv (item,mItem,rest,afterOverloadResolution let isValueType = finfo.IsValueType let valu = if isValueType then AsValue else AsObject - // The empty instantiation on the fspec is OK, since we make the correct fspec in Ilxgen.gen_asm + // The empty instantiation on the fspec is OK, since we make the correct fspec in IlxGen.GenAsm // This ensures we always get the type instantiation right when doing this from // polymorphic code, after inlining etc. let fspec = mkILFieldSpec(fref,mkILNamedTy valu fref.EnclosingTypeRef []) @@ -9544,7 +9544,7 @@ and TcAttribute cenv (env: TcEnv) attrTgt (synAttr: SynAttribute) = match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInAttribute OpenQualified env.eNameResEnv ad tycon TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.No with | Exception err -> raze(err) | _ -> success(TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurence.UseInAttribute env tpenv (SynType.App(SynType.LongIdent(LongIdentWithDots(tycon,[])),None,[],[],None,false,mAttr)) ) - ForceRaise ((try1 (tyid.idText + "Attribute")) |> Outcome.otherwise (fun () -> (try1 tyid.idText))) + ForceRaise ((try1 (tyid.idText + "Attribute")) |> ResultOrException.otherwise (fun () -> (try1 tyid.idText))) let ad = env.eAccessRights @@ -12685,7 +12685,7 @@ module AddAugmentationDeclarations = begin let AddGenericCompareDeclarations cenv (env: TcEnv) (scSet:Set) (tycon:Tycon) = - if Augment.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && scSet.Contains tycon.Stamp then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && scSet.Contains tycon.Stamp then let tcref = mkLocalTyconRef tycon let tcaug = tycon.TypeContents let _,typ = if tcref.Deref.IsExceptionDecl then [],cenv.g.exn_ty else generalizeTyconRef tcref @@ -12706,8 +12706,8 @@ module AddAugmentationDeclarations = begin errorR(Error(FSComp.SR.tcImplementsIStructuralComparableExplicitly(tycon.DisplayName),m)) else let hasExplicitGenericIComparable = tycon.HasInterface cenv.g genericIComparableTy - let cvspec1,cvspec2 = Augment.MakeValsForCompareAugmentation cenv.g tcref - let cvspec3 = Augment.MakeValsForCompareWithComparerAugmentation cenv.g tcref + let cvspec1,cvspec2 = AugmentWithHashCompare.MakeValsForCompareAugmentation cenv.g tcref + let cvspec3 = AugmentWithHashCompare.MakeValsForCompareWithComparerAugmentation cenv.g tcref PublishInterface cenv env.DisplayEnv tcref m true cenv.g.mk_IStructuralComparable_ty PublishInterface cenv env.DisplayEnv tcref m true cenv.g.mk_IComparable_ty @@ -12722,7 +12722,7 @@ module AddAugmentationDeclarations = begin let AddGenericEqualityWithComparerDeclarations cenv (env: TcEnv) (seSet:Set) (tycon:Tycon) = - if Augment.TyconIsCandidateForAugmentationWithEquals cenv.g tycon && seSet.Contains tycon.Stamp then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon && seSet.Contains tycon.Stamp then let tcref = mkLocalTyconRef tycon let tcaug = tycon.TypeContents let m = tycon.Range @@ -12732,7 +12732,7 @@ module AddAugmentationDeclarations = begin if hasExplicitIStructuralEquatable then errorR(Error(FSComp.SR.tcImplementsIStructuralEquatableExplicitly(tycon.DisplayName),m)) else - let evspec1,evspec2,evspec3 = Augment.MakeValsForEqualityWithComparerAugmentation cenv.g tcref + let evspec1,evspec2,evspec3 = AugmentWithHashCompare.MakeValsForEqualityWithComparerAugmentation cenv.g tcref PublishInterface cenv env.DisplayEnv tcref m true cenv.g.mk_IStructuralEquatable_ty tcaug.SetHashAndEqualsWith (mkLocalValRef evspec1, mkLocalValRef evspec2, mkLocalValRef evspec3) PublishValueDefn cenv env ModuleOrMemberBinding evspec1 @@ -12741,20 +12741,20 @@ module AddAugmentationDeclarations = begin let AddGenericCompareBindings cenv (tycon:Tycon) = - if (* Augment.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && *) isSome tycon.GeneratedCompareToValues then - Augment.MakeBindingsForCompareAugmentation cenv.g tycon + if (* AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && *) isSome tycon.GeneratedCompareToValues then + AugmentWithHashCompare.MakeBindingsForCompareAugmentation cenv.g tycon else [] let AddGenericCompareWithComparerBindings cenv (tycon:Tycon) = - if (* Augment.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && *) isSome tycon.GeneratedCompareToWithComparerValues then - (Augment.MakeBindingsForCompareWithComparerAugmentation cenv.g tycon) + if (* AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && *) isSome tycon.GeneratedCompareToWithComparerValues then + (AugmentWithHashCompare.MakeBindingsForCompareWithComparerAugmentation cenv.g tycon) else [] let AddGenericEqualityWithComparerBindings cenv (tycon:Tycon) = - if Augment.TyconIsCandidateForAugmentationWithEquals cenv.g tycon && isSome tycon.GeneratedHashAndEqualsWithComparerValues then - (Augment.MakeBindingsForEqualityWithComparerAugmentation cenv.g tycon) + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon && isSome tycon.GeneratedHashAndEqualsWithComparerValues then + (AugmentWithHashCompare.MakeBindingsForEqualityWithComparerAugmentation cenv.g tycon) else [] @@ -12770,7 +12770,7 @@ module AddAugmentationDeclarations = begin // We can only add the Equals override after we've done the augmentation becuase we have to wait until // tycon.HasOverride can give correct results let AddGenericEqualityBindings cenv (env: TcEnv) tycon = - if Augment.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then let tcref = mkLocalTyconRef tycon let tcaug = tycon.TypeContents let _,typ = if tcref.Deref.IsExceptionDecl then [],cenv.g.exn_ty else generalizeTyconRef tcref @@ -12788,13 +12788,13 @@ module AddAugmentationDeclarations = begin if not hasExplicitObjectEqualsOverride && isSome tycon.GeneratedHashAndEqualsWithComparerValues then - let vspec1,vspec2 = Augment.MakeValsForEqualsAugmentation cenv.g tcref + let vspec1,vspec2 = AugmentWithHashCompare.MakeValsForEqualsAugmentation cenv.g tcref tcaug.SetEquals (mkLocalValRef vspec1, mkLocalValRef vspec2) if not tycon.IsExceptionDecl then PublishInterface cenv env.DisplayEnv tcref m true (mkAppTy cenv.g.system_GenericIEquatable_tcref [typ]) PublishValueDefn cenv env ModuleOrMemberBinding vspec1 PublishValueDefn cenv env ModuleOrMemberBinding vspec2 - Augment.MakeBindingsForEqualsAugmentation cenv.g tycon + AugmentWithHashCompare.MakeBindingsForEqualsAugmentation cenv.g tycon else [] else [] @@ -12810,7 +12810,7 @@ module TyconConstraintInference = begin // Initially, assume the equality relation is available for all structural type definitions let initialAssumedTycons = set [ for tycon in tycons do - if Augment.TyconIsCandidateForAugmentationWithCompare cenv.g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare cenv.g tycon then yield tycon.Stamp ] // Initially, don't assume that the equality relation is dependent on any type varaibles @@ -12875,7 +12875,7 @@ module TyconConstraintInference = begin let newSet = assumedTycons |> Set.filter (fun tyconStamp -> let (tycon,structuralTypes) = tab.[tyconStamp] - if cenv.g.compilingFslib && Augment.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && not (HasFSharpAttribute g g.attrib_StructuralComparisonAttribute tycon.Attribs) && not (HasFSharpAttribute g g.attrib_NoComparisonAttribute tycon.Attribs) then + if cenv.g.compilingFslib && AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && not (HasFSharpAttribute g g.attrib_StructuralComparisonAttribute tycon.Attribs) && not (HasFSharpAttribute g g.attrib_NoComparisonAttribute tycon.Attribs) then errorR(Error(FSComp.SR.tcFSharpCoreRequiresExplicit(),tycon.Range)) let res = (structuralTypes |> List.forall (fst >> checkIfFieldTypeSupportsComparison tycon)) @@ -12938,7 +12938,7 @@ module TyconConstraintInference = begin // Initially, assume the equality relation is available for all structural type definitions let initialAssumedTycons = set [ for tycon in tycons do - if Augment.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then yield tycon.Stamp ] // Initially, don't assume that the equality relation is dependent on any type varaibles @@ -12979,7 +12979,7 @@ module TyconConstraintInference = begin let tcref,tinst = destAppTy g ty (if initialAssumedTycons.Contains tcref.Stamp then assumedTycons.Contains tcref.Stamp - elif Augment.TyconIsCandidateForAugmentationWithEquals g tcref.Deref then + elif AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tcref.Deref then isSome tcref.GeneratedHashAndEqualsWithComparerValues else true) @@ -12999,7 +12999,7 @@ module TyconConstraintInference = begin let newSet = assumedTycons |> Set.filter (fun tyconStamp -> let (tycon,structuralTypes) = tab.[tyconStamp] - if cenv.g.compilingFslib && Augment.TyconIsCandidateForAugmentationWithEquals cenv.g tycon && not (HasFSharpAttribute g g.attrib_StructuralEqualityAttribute tycon.Attribs) && not (HasFSharpAttribute g g.attrib_NoEqualityAttribute tycon.Attribs) then + if cenv.g.compilingFslib && AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon && not (HasFSharpAttribute g g.attrib_StructuralEqualityAttribute tycon.Attribs) && not (HasFSharpAttribute g g.attrib_NoEqualityAttribute tycon.Attribs) then errorR(Error(FSComp.SR.tcFSharpCoreRequiresExplicit(),tycon.Range)) // Remove structural types with incomparable elements from the assumedTycons @@ -13009,7 +13009,7 @@ module TyconConstraintInference = begin if not res then match TryFindFSharpBoolAttribute g g.attrib_StructuralEqualityAttribute tycon.Attribs with | Some(true) -> - if Augment.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then match structuralTypes |> List.tryFind (fst >> checkIfFieldTypeSupportsEquality tycon >> not) with | None -> assert false @@ -13024,7 +13024,7 @@ module TyconConstraintInference = begin | Some(false) -> () | None -> - if Augment.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals cenv.g tycon then match structuralTypes |> List.tryFind (fst >> checkIfFieldTypeSupportsEquality tycon >> not) with | None -> assert false @@ -15428,14 +15428,14 @@ let TypecheckOneImplFile with e -> errorRecovery e m) - // We ALWAYS run the PostTypecheckSemanticChecks phase, though we if we have already encountered some + // We ALWAYS run the PostTypeCheckSemanticChecks phase, though we if we have already encountered some // errors we turn off error reporting. THis is because it performs various fixups over the TAST, e.g. // assigning nice names for inference variables. let hasExplicitEntryPoint = conditionallySuppressErrorReporting (checkForErrors()) (fun () -> try let reportErrors = not (checkForErrors()) - Microsoft.FSharp.Compiler.PostTypecheckSemanticChecks.CheckTopImpl (g,cenv.amap,reportErrors,cenv.infoReader,env.eInternalsVisibleCompPaths,cenv.topCcu,envAtEnd.DisplayEnv, implFileExprAfterSig,extraAttribs,isLastCompiland) + Microsoft.FSharp.Compiler.PostTypeCheckSemanticChecks.CheckTopImpl (g,cenv.amap,reportErrors,cenv.infoReader,env.eInternalsVisibleCompPaths,cenv.topCcu,envAtEnd.DisplayEnv, implFileExprAfterSig,extraAttribs,isLastCompiland) with e -> errorRecovery e m false) diff --git a/src/fsharp/tc.fsi b/src/fsharp/TypeChecker.fsi similarity index 91% rename from src/fsharp/tc.fsi rename to src/fsharp/TypeChecker.fsi index ce46550bcb2..587cc094d17 100644 --- a/src/fsharp/tc.fsi +++ b/src/fsharp/TypeChecker.fsi @@ -17,20 +17,20 @@ open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.Import -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open System.Collections.Generic [] type TcEnv = member DisplayEnv : DisplayEnv - member NameEnv : Nameres.NameResolutionEnv + member NameEnv : NameResolution.NameResolutionEnv (* Incremental construction of environments, e.g. for F# Interactive *) val internal CreateInitialTcEnv : TcGlobals * ImportMap * range * (CcuThunk * string list * bool) list -> TcEnv val internal AddCcuToTcEnv : TcGlobals * ImportMap * range * TcEnv * CcuThunk * autoOpens: string list * bool -> TcEnv -val internal AddLocalRootModuleOrNamespace : Nameres.TcResultsSink -> TcGlobals -> ImportMap -> range -> TcEnv -> ModuleOrNamespaceType -> TcEnv -val internal TcOpenDecl : Nameres.TcResultsSink -> TcGlobals -> ImportMap -> range -> range -> TcEnv -> Ast.LongIdent -> TcEnv +val internal AddLocalRootModuleOrNamespace : NameResolution.TcResultsSink -> TcGlobals -> ImportMap -> range -> TcEnv -> ModuleOrNamespaceType -> TcEnv +val internal TcOpenDecl : NameResolution.TcResultsSink -> TcGlobals -> ImportMap -> range -> range -> TcEnv -> Ast.LongIdent -> TcEnv type TopAttribs = { mainMethodAttrs : Attribs; @@ -44,14 +44,14 @@ val internal EmptyTopAttrs : TopAttribs val internal CombineTopAttrs : TopAttribs -> TopAttribs -> TopAttribs val internal TypecheckOneImplFile : - TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines * Nameres.TcResultsSink + TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines * NameResolution.TcResultsSink -> TcEnv -> Tast.ModuleOrNamespaceType option -> ParsedImplFileInput -> Eventually val internal TypecheckOneSigFile : - TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines * Nameres.TcResultsSink + TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines * NameResolution.TcResultsSink -> TcEnv -> ParsedSigFileInput -> Eventually diff --git a/src/fsharp/typrelns.fs b/src/fsharp/TypeRelations.fs similarity index 99% rename from src/fsharp/typrelns.fs rename to src/fsharp/TypeRelations.fs index 9584dc2a5fb..1f4e58fe906 100644 --- a/src/fsharp/typrelns.fs +++ b/src/fsharp/TypeRelations.fs @@ -2,7 +2,7 @@ /// Primary relations on types and signatures, with the exception of /// constraint solving and method overload resolution. -module internal Microsoft.FSharp.Compiler.Typrelns +module internal Microsoft.FSharp.Compiler.TypeRelations open Internal.Utilities open System.Text @@ -19,7 +19,7 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tastops.DebugPrint -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Infos @@ -236,7 +236,7 @@ let ChooseTyparSolutionsForFreeChoiceTypars g amap e = /// Break apart lambdas. Needs ChooseTyparSolutionsForFreeChoiceTypars because it's used in -/// PostTypecheckSemanticChecks before we've eliminated these nodes. +/// PostTypeCheckSemanticChecks before we've eliminated these nodes. let tryDestTopLambda g amap (ValReprInfo (tpNames,_,_) as tvd) (e,ty) = let rec stripLambdaUpto n (e,ty) = match e with @@ -1908,12 +1908,12 @@ let FinalTypeDefinitionChecksAtEndOfInferenceScope (infoReader:InfoReader) isImp not tycon.IsFSharpInterfaceTycon then (* Warn when we're doing this for class types *) - if Augment.TyconIsCandidateForAugmentationWithEquals g tycon then + if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tycon then warning(Error(FSComp.SR.typrelTypeImplementsIComparableShouldOverrideObjectEquals(tycon.DisplayName),tycon.Range)) else warning(Error(FSComp.SR.typrelTypeImplementsIComparableDefaultObjectEqualsProvided(tycon.DisplayName),tycon.Range)) - Augment.CheckAugmentationAttribs isImplementation g amap tycon + AugmentWithHashCompare.CheckAugmentationAttribs isImplementation g amap tycon // Check some conditions about generic comparison and hashing. We can only check this condition after we've done the augmentation if isImplementation #if EXTENSIONTYPING diff --git a/src/fsharp/unilex.fs b/src/fsharp/UnicodeLexing.fs similarity index 100% rename from src/fsharp/unilex.fs rename to src/fsharp/UnicodeLexing.fs diff --git a/src/fsharp/unilex.fsi b/src/fsharp/UnicodeLexing.fsi similarity index 100% rename from src/fsharp/unilex.fsi rename to src/fsharp/UnicodeLexing.fsi diff --git a/src/fsharp/build.fs b/src/fsharp/build.fs index 2b02ce639e0..67749ffed68 100644 --- a/src/fsharp/build.fs +++ b/src/fsharp/build.fs @@ -8,15 +8,15 @@ open System.IO open System.Collections.Generic open Internal.Utilities open Internal.Utilities.Text +open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics -open Microsoft.FSharp.Compiler.Pickle +open Microsoft.FSharp.Compiler.TastPickle open Microsoft.FSharp.Compiler.Range -open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.TypeChecker open Microsoft.FSharp.Compiler.SR open Microsoft.FSharp.Compiler.DiagnosticMessage @@ -31,14 +31,14 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tastops.DebugPrint -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Lexhelp open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.ConstraintSolver open Microsoft.FSharp.Compiler.MSBuildResolver -open Microsoft.FSharp.Compiler.Typrelns -open Microsoft.FSharp.Compiler.Nameres +open Microsoft.FSharp.Compiler.TypeRelations +open Microsoft.FSharp.Compiler.NameResolution open Microsoft.FSharp.Compiler.PrettyNaming open Internal.Utilities.FileSystem open Internal.Utilities.Collections @@ -154,8 +154,8 @@ let RangeOfError(err:PhasedError) = | FullAbstraction(_,m) | InterfaceNotRevealed(_,_,m) | WrappedError (_,m) - | Patcompile.MatchIncomplete (_,_,m) - | Patcompile.RuleNeverMatched m + | PatternMatchCompilation.MatchIncomplete (_,_,m) + | PatternMatchCompilation.RuleNeverMatched m | ValNotMutable(_,_,m) | ValNotLocal(_,_,m) | MissingFields(_,m) @@ -191,7 +191,6 @@ let RangeOfError(err:PhasedError) = | UnresolvedOverloading(_,_,_,m) | UnresolvedConversionOperator (_,_,_,m) | PossibleOverload(_,_,_, m) - //| PossibleBestOverload(_,_,m) | VirtualAugmentationOnNullValuedType(m) | NonVirtualAugmentationOnNullValuedType(m) | NonRigidTypar(_,_,_,_,_,m) @@ -266,8 +265,8 @@ let GetErrorNumber(err:PhasedError) = | LetRecEvaluatedOutOfOrder _ -> 22 | NameClash _ -> 23 // 24 cannot be reused - | Patcompile.MatchIncomplete _ -> 25 - | Patcompile.RuleNeverMatched _ -> 26 + | PatternMatchCompilation.MatchIncomplete _ -> 25 + | PatternMatchCompilation.RuleNeverMatched _ -> 26 | ValNotMutable _ -> 27 | ValNotLocal _ -> 28 | MissingFields _ -> 29 @@ -1202,7 +1201,7 @@ let OutputPhasedErrorR (os:System.Text.StringBuilder) (err:PhasedError) = #endif | FullAbstraction(s,_) -> os.Append(FullAbstractionE().Format s) |> ignore | WrappedError (exn,_) -> OutputExceptionR os exn - | Patcompile.MatchIncomplete (isComp,cexOpt,_) -> + | PatternMatchCompilation.MatchIncomplete (isComp,cexOpt,_) -> os.Append(MatchIncomplete1E().Format) |> ignore match cexOpt with | None -> () @@ -1210,7 +1209,7 @@ let OutputPhasedErrorR (os:System.Text.StringBuilder) (err:PhasedError) = | Some (cex,true) -> os.Append(MatchIncomplete3E().Format cex) |> ignore if isComp then os.Append(MatchIncomplete4E().Format) |> ignore - | Patcompile.RuleNeverMatched _ -> os.Append(RuleNeverMatchedE().Format) |> ignore + | PatternMatchCompilation.RuleNeverMatched _ -> os.Append(RuleNeverMatchedE().Format) |> ignore | ValNotMutable _ -> os.Append(ValNotMutableE().Format) |> ignore | ValNotLocal _ -> os.Append(ValNotLocalE().Format) |> ignore | ObsoleteError (s, _) @@ -1676,6 +1675,7 @@ type CompilerTarget = type ResolveAssemblyReferenceMode = Speculative | ReportErrors +/// Represents the file or string used for the --version flag type VersionFlag = | VersionString of string | VersionFile of string @@ -1736,7 +1736,7 @@ type ImportedAssembly = IsProviderGenerated: bool mutable TypeProviders: Tainted list; #endif - FSharpOptimizationData : Microsoft.FSharp.Control.Lazy> } + FSharpOptimizationData : Microsoft.FSharp.Control.Lazy> } type AvailableImportedAssembly = | ResolvedImportedAssembly of ImportedAssembly @@ -1953,7 +1953,7 @@ type TcConfigBuilder = mutable doTLR : bool (* run TLR pass? *) mutable doFinalSimplify : bool (* do final simplification pass *) mutable optsOn : bool (* optimizations are turned on *) - mutable optSettings : Opt.OptimizationSettings + mutable optSettings : Optimizer.OptimizationSettings mutable emitTailcalls : bool mutable lcid : int option @@ -2116,7 +2116,7 @@ type TcConfigBuilder = doTLR = false doFinalSimplify = false optsOn = false - optSettings = Opt.OptimizationSettings.Defaults + optSettings = Optimizer.OptimizationSettings.Defaults emitTailcalls = true lcid = None // See bug 6071 for product banner spec @@ -3024,7 +3024,7 @@ let QualFileNameOfModuleName m filename modname = QualifiedNameOfFile(mkSynId m let QualFileNameOfFilename m filename = QualifiedNameOfFile(mkSynId m (CanonicalizeFilename filename + (if IsScript filename then "$fsx" else ""))) // Interactive fragments -let QualFileNameOfUniquePath (m, p: string list) = QualifiedNameOfFile(mkSynId m (String.concat "_" p)) +let ComputeQualifiedNameOfFileFromUniquePath (m, p: string list) = QualifiedNameOfFile(mkSynId m (String.concat "_" p)) let QualFileNameOfSpecs filename specs = match specs with @@ -3036,7 +3036,7 @@ let QualFileNameOfImpls filename specs = | [SynModuleOrNamespace(modname,true,_,_,_,_,m)] -> QualFileNameOfModuleName m filename modname | _ -> QualFileNameOfFilename (rangeN filename 1) filename -let PrepandPathToQualFileName x (QualifiedNameOfFile(q)) = QualFileNameOfUniquePath (q.idRange,pathOfLid x@[q.idText]) +let PrepandPathToQualFileName x (QualifiedNameOfFile(q)) = ComputeQualifiedNameOfFileFromUniquePath (q.idRange,pathOfLid x@[q.idText]) let PrepandPathToImpl x (SynModuleOrNamespace(p,c,d,e,f,g,h)) = SynModuleOrNamespace(x@p,c,d,e,f,g,h) let PrepandPathToSpec x (SynModuleOrNamespaceSig(p,c,d,e,f,g,h)) = SynModuleOrNamespaceSig(x@p,c,d,e,f,g,h) @@ -3196,7 +3196,7 @@ let ParseOneInputLexbuf (tcConfig:TcConfig,lexResourceManager,conditionalCompila let input = Lexhelp.usingLexbufForParsing (lexbuf,filename) (fun lexbuf -> if verbose then dprintn ("Parsing... "+shortFilename); - let tokenizer = Lexfilter.LexFilter(lightSyntaxStatus, tcConfig.compilingFslib, Lexer.token lexargs skip, lexbuf) + let tokenizer = LexFilter.LexFilter(lightSyntaxStatus, tcConfig.compilingFslib, Lexer.token lexargs skip, lexbuf) if tcConfig.tokenizeOnly then while true do @@ -3346,7 +3346,6 @@ type TcAssemblyResolutions(results : AssemblyResolution list, unresolved : Unres //---------------------------------------------------------------------------- // Typecheck and optimization environments on disk //-------------------------------------------------------------------------- -open Pickle let IsSignatureDataResource (r: ILResource) = String.hasPrefix r.Name FSharpSignatureDataResourceName let IsOptimizationDataResource (r: ILResource) = String.hasPrefix r.Name FSharpOptimizationDataResourceName @@ -3376,8 +3375,8 @@ let PickleToResource file g scope rname p x = CustomAttrs = emptyILCustomAttrs } #endif -let GetSignatureData (file, ilScopeRef, ilModule, byteReader) : PickledDataWithReferences = - unpickleObjWithDanglingCcus file ilScopeRef ilModule unpickleModuleInfo (byteReader()) +let GetSignatureData (file, ilScopeRef, ilModule, byteReader) : PickledDataWithReferences = + unpickleObjWithDanglingCcus file ilScopeRef ilModule unpickleCcuInfo (byteReader()) #if NO_COMPILER_BACKEND #else @@ -3394,20 +3393,22 @@ let WriteSignatureData (tcConfig:TcConfig,tcGlobals,exportRemapping,ccu:CcuThunk dprintf "---------------------- END OF APPLYING EXPORT REMAPPING TO SIGNATURE DATA------------\n"; dprintf "Signature data after remap:\n%s\n" (Layout.showL (Layout.squashTo 192 (entityL mspec))); #endif - PickleToResource file tcGlobals ccu (FSharpSignatureDataResourceName+"."+ccu.AssemblyName) pickleModuleInfo + PickleToResource file tcGlobals ccu (FSharpSignatureDataResourceName+"."+ccu.AssemblyName) pickleCcuInfo { mspec=mspec; compileTimeWorkingDir=tcConfig.implicitIncludeDir; usesQuotations = ccu.UsesQuotations } #endif // NO_COMPILER_BACKEND let GetOptimizationData (file, ilScopeRef, ilModule, byteReader) = - unpickleObjWithDanglingCcus file ilScopeRef ilModule Opt.u_LazyModuleInfo (byteReader()) + unpickleObjWithDanglingCcus file ilScopeRef ilModule Optimizer.u_CcuOptimizationInfo (byteReader()) #if NO_COMPILER_BACKEND #else let WriteOptimizationData (tcGlobals, file, ccu,modulInfo) = - if verbose then dprintf "Optimization data after remap:\n%s\n" (Layout.showL (Layout.squashTo 192 (Opt.moduleInfoL tcGlobals modulInfo))); - PickleToResource file tcGlobals ccu (FSharpOptimizationDataResourceName+"."+ccu.AssemblyName) Opt.p_LazyModuleInfo modulInfo +#if DEBUG + if verbose then dprintf "Optimization data after remap:\n%s\n" (Layout.showL (Layout.squashTo 192 (Optimizer.moduleInfoL tcGlobals modulInfo))); +#endif + PickleToResource file tcGlobals ccu (FSharpOptimizationDataResourceName+"."+ccu.AssemblyName) Optimizer.p_CcuOptimizationInfo modulInfo #endif //---------------------------------------------------------------------------- @@ -3423,10 +3424,17 @@ let availableToOptionalCcu = function // TcConfigProvider //-------------------------------------------------------------------------- +/// Represents a computation to return a TcConfig. Normally this is just a constant immutable TcConfig, +/// but for F# Interactive it may be based on an underlying mutable TcConfigBuilder. type TcConfigProvider = | TcConfigProvider of (unit -> TcConfig) member x.Get() = (let (TcConfigProvider(f)) = x in f()) + + /// Get a TcConfigProvider which will return only the exact TcConfig. static member Constant(tcConfig) = TcConfigProvider(fun () -> tcConfig) + + /// Get a TcConfigProvider which will continue to respect changes in the underlying + /// TcConfigBuilder rather than delivering snapshots. static member BasedOnMutableBuilder(tcConfigB) = TcConfigProvider(fun () -> TcConfig.Create(tcConfigB,validate=false)) @@ -3435,7 +3443,7 @@ type TcConfigProvider = //-------------------------------------------------------------------------- -/// Tables of imported assemblies. +/// Repreesnts a table of imported assemblies with their resolutions. [] type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResolutions, importsBase:TcImports option, ilGlobalsOpt) = @@ -4010,7 +4018,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti let optDatas = Map.ofList optDataReaders - let minfo : PickledModuleInfo = data.RawData + let minfo : PickledCcuInfo = data.RawData let mspec = minfo.mspec #if EXTENSIONTYPING @@ -4396,11 +4404,8 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti disposeActions <- [] for action in actions do action() -//---------------------------------------------------------------------------- -// Add "#r" and "#I" declarations to the tcConfig -//-------------------------------------------------------------------------- - -// Add the reference and add the ccu to the type checking environment . Only used by F# Interactive +/// Process #r in F# Interactive. +/// Adds the reference to the tcImports and add the ccu to the type checking environment. let RequireDLL (tcImports:TcImports) tcEnv m file = let RequireResolved = function | ResolvedImportedAssembly(ccuinfo) -> ccuinfo @@ -4804,11 +4809,11 @@ type LoadClosure with // Build the initial type checking environment //-------------------------------------------------------------------------- -let implicitOpen tcGlobals amap m tcEnv p = +let ApplyImplicitOpen tcGlobals amap m tcEnv p = if verbose then dprintf "opening %s\n" p Tc.TcOpenDecl TcResultsSink.NoSink tcGlobals amap m m tcEnv (pathToSynLid m (splitNamespace p)) -let GetInitialTypecheckerEnv (assemblyName:string option) (initm:range) (tcConfig:TcConfig) (tcImports:TcImports) tcGlobals = +let GetInitialTcEnv (assemblyName:string option) (initm:range) (tcConfig:TcConfig) (tcImports:TcImports) tcGlobals = let initm = initm.StartRange if verbose then dprintf "--- building initial tcEnv\n" let internalsAreVisibleHere (ccuinfo:ImportedAssembly) = @@ -4827,23 +4832,18 @@ let GetInitialTypecheckerEnv (assemblyName:string option) (initm:range) (tcConfi ccuinfo.AssemblyAutoOpenAttributes, ccuinfo |> internalsAreVisibleHere) let amap = tcImports.GetImportMap() - let tcEnv = Tc.CreateInitialTcEnv(tcGlobals,amap,initm,ccus) |> (fun tce -> - if tcConfig.checkOverflow then - List.fold (implicitOpen tcGlobals amap initm) tce [FSharpLib.CoreOperatorsCheckedName] - else - tce) - if verbose then dprintf "--- opening implicit paths\n" - if verbose then dprintf "--- GetInitialTypecheckerEnv, top modules = %s\n" (String.concat ";" (NameMap.domainL tcEnv.NameEnv.eModulesAndNamespaces)) - if verbose then dprintf "<-- GetInitialTypecheckerEnv\n" + let tcEnv = Tc.CreateInitialTcEnv(tcGlobals,amap,initm,ccus) + let tcEnv = + if tcConfig.checkOverflow then + ApplyImplicitOpen tcGlobals amap initm tcEnv FSharpLib.CoreOperatorsCheckedName + else + tcEnv tcEnv //---------------------------------------------------------------------------- // TYPECHECK //-------------------------------------------------------------------------- -(* The incremental state of type checking files *) -(* REVIEW: clean this up *) - type RootSigs = Zmap type RootImpls = Zset type TypecheckerSigsAndImpls = RootSigsAndImpls of RootSigs * RootImpls * ModuleOrNamespaceType * ModuleOrNamespaceType @@ -4856,7 +4856,7 @@ type TcState = tcsNiceNameGen: NiceNameGenerator tcsTcSigEnv: TcEnv tcsTcImplEnv: TcEnv - (* The accumulated results of type checking for this assembly *) + /// The accumulated results of type checking for this assembly tcsRootSigsAndImpls : TypecheckerSigsAndImpls } member x.NiceNameGenerator = x.tcsNiceNameGen member x.TcEnvFromSignatures = x.tcsTcSigEnv @@ -4868,7 +4868,7 @@ type TcState = tcsTcImplEnv = tcEnvAtEndOfLastInput } -let TypecheckInitialState(m,ccuName,tcConfig:TcConfig,tcGlobals,tcImports:TcImports,niceNameGen,tcEnv0) = +let GetInitialTcState(m,ccuName,tcConfig:TcConfig,tcGlobals,tcImports:TcImports,niceNameGen,tcEnv0) = ignore tcImports if verbose then dprintf "Typecheck (constructing initial state)....\n" // Create a ccu to hold all the results of compilation @@ -4930,7 +4930,7 @@ let CheckSimulateException(tcConfig:TcConfig) = (* Typecheck a single file or interactive entry into F# Interactive *) -let TypecheckOneInputEventually +let TypeCheckOneInputEventually (checkForErrors , tcConfig:TcConfig, tcImports:TcImports, tcGlobals, prefixPathOpt, tcSink, tcState: TcState, inp: ParsedInput) = eventually { @@ -5036,7 +5036,7 @@ let TypecheckOneInputEventually // [CHECK: Why? This seriously degraded performance] NewCcuContents ILScopeRef.Local m tcState.tcsCcu.AssemblyName allImplementedSigModulTyp - if verbose then dprintf "done TypecheckOneInputEventually...\n" + if verbose then dprintf "done TypeCheckOneInputEventually...\n" let topSigsAndImpls = RootSigsAndImpls(rootSigs,rootImpls,allSigModulTyp,allImplementedSigModulTyp) let res = (topAttrs,[implFile], tcEnvAtEnd, tcSigEnv, tcImplEnv,topSigsAndImpls,ccuType) @@ -5057,9 +5057,9 @@ let TypecheckOneInput (checkForErrors, tcConfig, tcImports, tcGlobals, prefixPat // 'use' ensures that the warning handler is restored at the end use unwindEL = PushErrorLoggerPhaseUntilUnwind(fun oldLogger -> GetErrorLoggerFilteringByScopedPragmas(false,GetScopedPragmasForInput(inp),oldLogger) ) use unwindBP = PushThreadBuildPhaseUntilUnwind (BuildPhase.TypeCheck) - TypecheckOneInputEventually (checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, TcResultsSink.NoSink, tcState, inp) |> Eventually.force + TypeCheckOneInputEventually (checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, TcResultsSink.NoSink, tcState, inp) |> Eventually.force -let TypecheckMultipleInputsFinish(results,tcState: TcState) = +let TypeCheckMultipleInputsFinish(results,tcState: TcState) = let tcEnvsAtEndFile,topAttrs,mimpls = List.unzip3 results let topAttrs = List.foldBack CombineTopAttrs topAttrs EmptyTopAttrs @@ -5072,15 +5072,15 @@ let TypecheckMultipleInputsFinish(results,tcState: TcState) = let TypecheckMultipleInputs(checkForErrors,tcConfig:TcConfig,tcImports,tcGlobals,prefixPathOpt,tcState,inputs) = let results,tcState = List.mapFold (TypecheckOneInput (checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt)) tcState inputs - TypecheckMultipleInputsFinish(results,tcState) + TypeCheckMultipleInputsFinish(results,tcState) -let TypecheckSingleInputAndFinishEventually(checkForErrors,tcConfig:TcConfig,tcImports,tcGlobals,prefixPathOpt,tcSink,tcState,input) = +let TypeCheckSingleInputAndFinishEventually(checkForErrors,tcConfig:TcConfig,tcImports,tcGlobals,prefixPathOpt,tcSink,tcState,input) = eventually { - let! results,tcState = TypecheckOneInputEventually(checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcSink, tcState, input) - return TypecheckMultipleInputsFinish([results],tcState) + let! results,tcState = TypeCheckOneInputEventually(checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcSink, tcState, input) + return TypeCheckMultipleInputsFinish([results],tcState) } -let TypecheckClosedInputSetFinish(mimpls,tcState) = +let TypeCheckClosedInputSetFinish(mimpls,tcState) = // Publish the latest contents to the CCU tcState.tcsCcu.Deref.Contents <- tcState.tcsCcuType @@ -5089,14 +5089,14 @@ let TypecheckClosedInputSetFinish(mimpls,tcState) = rootSigs |> Zmap.iter (fun qualNameOfFile _ -> if not (Zset.contains qualNameOfFile rootImpls) then errorR(Error(FSComp.SR.buildSignatureWithoutImplementation(qualNameOfFile.Text), qualNameOfFile.Range))) - if verbose then dprintf "done TypecheckClosedInputSet...\n" + if verbose then dprintf "done TypeCheckClosedInputSet...\n" let tassembly = TAssembly(mimpls) tcState, tassembly -let TypecheckClosedInputSet(checkForErrors,tcConfig,tcImports,tcGlobals,prefixPathOpt,tcState,inputs) = +let TypeCheckClosedInputSet(checkForErrors,tcConfig,tcImports,tcGlobals,prefixPathOpt,tcState,inputs) = // tcEnvAtEndOfLastFile is the environment required by fsi.exe when incrementally adding definitions let (tcEnvAtEndOfLastFile,topAttrs,mimpls),tcState = TypecheckMultipleInputs (checkForErrors,tcConfig,tcImports,tcGlobals,prefixPathOpt,tcState,inputs) - let tcState,tassembly = TypecheckClosedInputSetFinish (mimpls, tcState) + let tcState,tassembly = TypeCheckClosedInputSetFinish (mimpls, tcState) tcState, topAttrs, tassembly, tcEnvAtEndOfLastFile type OptionSwitch = diff --git a/src/fsharp/build.fsi b/src/fsharp/build.fsi index cbdfe10e5ce..1660a1ba8b4 100644 --- a/src/fsharp/build.fsi +++ b/src/fsharp/build.fsi @@ -19,7 +19,7 @@ open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.MSBuildResolver -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Core.CompilerServices #if EXTENSIONTYPING open Microsoft.FSharp.Compiler.ExtensionTyping @@ -55,7 +55,7 @@ val lightSyntaxDefaultExtensions : string list // Parsing inputs //-------------------------------------------------------------------------- -val QualFileNameOfUniquePath : range * string list -> Ast.QualifiedNameOfFile +val ComputeQualifiedNameOfFileFromUniquePath : range * string list -> Ast.QualifiedNameOfFile val PrependPathToInput : Ast.Ident list -> Ast.ParsedInput -> Ast.ParsedInput @@ -67,6 +67,7 @@ val ParseInput : (UnicodeLexing.Lexbuf -> Parser.token) * ErrorLogger * UnicodeL // Errors //-------------------------------------------------------------------------- +/// Represents the style being used to format errros type ErrorStyle = | DefaultErrors | EmacsErrors @@ -74,35 +75,39 @@ type ErrorStyle = | VSErrors +/// Get the location associated with an error val RangeOfError : PhasedError -> range option + +/// Get the number associated with an error val GetErrorNumber : PhasedError -> int + +/// Split errors into a "main" error and a set of associated errors val SplitRelatedErrors : PhasedError -> PhasedError * PhasedError list + +/// Output an error to a buffer val OutputPhasedError : StringBuilder -> PhasedError -> bool -> unit -val SanitizeFileName : filename:string -> implicitIncludeDir:string -> string + +/// Output an error or warning to a buffer val OutputErrorOrWarning : implicitIncludeDir:string * showFullPaths: bool * flattenErrors: bool * errorStyle: ErrorStyle * warning:bool -> StringBuilder -> PhasedError -> unit + +/// Output extra context information for an error or warning to a buffer val OutputErrorOrWarningContext : prefix:string -> fileLineFunction:(string -> int -> string) -> StringBuilder -> PhasedError -> unit type ErrorLocation = - { - Range : range - File : string - TextRepresentation : string - IsEmpty : bool - } + { Range : range + File : string + TextRepresentation : string + IsEmpty : bool } type CanonicalInformation = - { - ErrorNumber : int - Subcategory : string - TextRepresentation : string - } + { ErrorNumber : int + Subcategory : string + TextRepresentation : string } type DetailedIssueInfo = - { - Location : ErrorLocation option - Canonical : CanonicalInformation - Message : string - } + { Location : ErrorLocation option + Canonical : CanonicalInformation + Message : string } type ErrorOrWarning = | Short of bool * string @@ -136,10 +141,14 @@ type OptionSpec = | OptionUnit of (unit -> unit) | OptionHelp of (CompilerOptionBlock list -> unit) // like OptionUnit, but given the "options" | OptionGeneral of (string list -> bool) * (string list -> string list) // Applies? * (ApplyReturningResidualArgs) + and CompilerOption = /// CompilerOption(name, argumentDescriptionString, actionSpec, exceptionOpt, helpTextOpt - CompilerOption of string * string * OptionSpec * Option * string option -and CompilerOptionBlock = PublicOptions of string * CompilerOption list | PrivateOptions of CompilerOption list + | CompilerOption of string * string * OptionSpec * Option * string option + +and CompilerOptionBlock = + | PublicOptions of string * CompilerOption list + | PrivateOptions of CompilerOption list val printCompilerOptionBlocks : CompilerOptionBlock list -> unit // for printing usage val dumpCompilerOptionBlocks : CompilerOptionBlock list -> unit // for QA @@ -193,60 +202,61 @@ type ResolveAssemblyReferenceMode = | Speculative | ReportErrors +/// Represents the file or string used for the --version flag type VersionFlag = | VersionString of string | VersionFile of string | VersionNone - member GetVersionInfo : (*implicitIncludeDir:*)string -> ILVersionInfo - member GetVersionString : (*implicitIncludeDir:*)string -> string + member GetVersionInfo : implicitIncludeDir:string -> ILVersionInfo + member GetVersionString : implicitIncludeDir:string -> string type TcConfigBuilder = - { mutable primaryAssembly : PrimaryAssembly; - mutable autoResolveOpenDirectivesToDlls: bool; - mutable noFeedback: bool; - mutable stackReserveSize: int32 option; - mutable implicitIncludeDir: string; - mutable openBinariesInMemory: bool; - mutable openDebugInformationForLaterStaticLinking: bool; - defaultFSharpBinariesDir: string; - mutable compilingFslib: bool; - mutable compilingFslib20: string option; - mutable compilingFslib40: bool; - mutable useIncrementalBuilder: bool; - mutable includes: string list; - mutable implicitOpens: string list; - mutable useFsiAuxLib: bool; - mutable framework: bool; + { mutable primaryAssembly : PrimaryAssembly + mutable autoResolveOpenDirectivesToDlls: bool + mutable noFeedback: bool + mutable stackReserveSize: int32 option + mutable implicitIncludeDir: string + mutable openBinariesInMemory: bool + mutable openDebugInformationForLaterStaticLinking: bool + defaultFSharpBinariesDir: string + mutable compilingFslib: bool + mutable compilingFslib20: string option + mutable compilingFslib40: bool + mutable useIncrementalBuilder: bool + mutable includes: string list + mutable implicitOpens: string list + mutable useFsiAuxLib: bool + mutable framework: bool mutable resolutionEnvironment : Microsoft.FSharp.Compiler.MSBuildResolver.ResolutionEnvironment mutable implicitlyResolveAssemblies : bool mutable addVersionSpecificFrameworkReferences : bool /// Set if the user has explicitly turned indentation-aware syntax on/off - mutable light: bool option; - mutable conditionalCompilationDefines: string list; + mutable light: bool option + mutable conditionalCompilationDefines: string list /// Sources added into the build with #load - mutable loadedSources: (range * string) list; + mutable loadedSources: (range * string) list - mutable referencedDLLs: AssemblyReference list; - mutable knownUnresolvedReferences : UnresolvedAssemblyReference list; - optimizeForMemory: bool; + mutable referencedDLLs: AssemblyReference list + mutable knownUnresolvedReferences : UnresolvedAssemblyReference list + optimizeForMemory: bool mutable subsystemVersion : int * int mutable useHighEntropyVA : bool - mutable inputCodePage: int option; - mutable embedResources : string list; - mutable globalWarnAsError: bool; - mutable globalWarnLevel: int; - mutable specificWarnOff: int list; - mutable specificWarnOn: int list; + mutable inputCodePage: int option + mutable embedResources : string list + mutable globalWarnAsError: bool + mutable globalWarnLevel: int + mutable specificWarnOff: int list + mutable specificWarnOn: int list mutable specificWarnAsError: int list mutable specificWarnAsWarn : int list - mutable mlCompatibility:bool; - mutable checkOverflow:bool; - mutable showReferenceResolutions:bool; - mutable outputFile : string option; - mutable resolutionFrameworkRegistryBase : string; - mutable resolutionAssemblyFoldersSuffix : string; - mutable resolutionAssemblyFoldersConditions : string; + mutable mlCompatibility:bool + mutable checkOverflow:bool + mutable showReferenceResolutions:bool + mutable outputFile : string option + mutable resolutionFrameworkRegistryBase : string + mutable resolutionAssemblyFoldersSuffix : string + mutable resolutionAssemblyFoldersConditions : string mutable platform : ILPlatform option mutable prefer32Bit : bool mutable useMonoResolution : bool @@ -305,7 +315,7 @@ type TcConfigBuilder = mutable doTLR : bool mutable doFinalSimplify : bool mutable optsOn : bool - mutable optSettings : Opt.OptimizationSettings + mutable optSettings : Optimizer.OptimizationSettings mutable emitTailcalls : bool mutable lcid : int option mutable productNameForBannerText : string @@ -354,44 +364,44 @@ type TcConfigBuilder = // Immutable TcConfig type TcConfig = member primaryAssembly: PrimaryAssembly - member autoResolveOpenDirectivesToDlls: bool; - member noFeedback: bool; - member stackReserveSize: int32 option; - member implicitIncludeDir: string; - member openBinariesInMemory: bool; - member openDebugInformationForLaterStaticLinking: bool; - member fsharpBinariesDir: string; - member compilingFslib: bool; - member compilingFslib20: string option; - member compilingFslib40: bool; - member useIncrementalBuilder: bool; - member includes: string list; - member implicitOpens: string list; - member useFsiAuxLib: bool; - member framework: bool; + member autoResolveOpenDirectivesToDlls: bool + member noFeedback: bool + member stackReserveSize: int32 option + member implicitIncludeDir: string + member openBinariesInMemory: bool + member openDebugInformationForLaterStaticLinking: bool + member fsharpBinariesDir: string + member compilingFslib: bool + member compilingFslib20: string option + member compilingFslib40: bool + member useIncrementalBuilder: bool + member includes: string list + member implicitOpens: string list + member useFsiAuxLib: bool + member framework: bool member implicitlyResolveAssemblies : bool /// Set if the user has explicitly turned indentation-aware syntax on/off - member light: bool option; - member conditionalCompilationDefines: string list; + member light: bool option + member conditionalCompilationDefines: string list member subsystemVersion : int * int member useHighEntropyVA : bool - member referencedDLLs: AssemblyReference list; - member optimizeForMemory: bool; - member inputCodePage: int option; - member embedResources : string list; - member globalWarnAsError: bool; - member globalWarnLevel: int; - member specificWarnOn: int list; - member specificWarnOff: int list; + member referencedDLLs: AssemblyReference list + member optimizeForMemory: bool + member inputCodePage: int option + member embedResources : string list + member globalWarnAsError: bool + member globalWarnLevel: int + member specificWarnOn: int list + member specificWarnOff: int list member specificWarnAsError: int list member specificWarnAsWarn : int list - member mlCompatibility:bool; - member checkOverflow:bool; - member showReferenceResolutions:bool; - member outputFile : string option; - member resolutionFrameworkRegistryBase : string; - member resolutionAssemblyFoldersSuffix : string; - member resolutionAssemblyFoldersConditions : string; + member mlCompatibility:bool + member checkOverflow:bool + member showReferenceResolutions:bool + member outputFile : string option + member resolutionFrameworkRegistryBase : string + member resolutionAssemblyFoldersSuffix : string + member resolutionAssemblyFoldersConditions : string member platform : ILPlatform option member prefer32Bit : bool member useMonoResolution : bool @@ -449,7 +459,7 @@ type TcConfig = member doDetuple : bool member doTLR : bool member doFinalSimplify : bool - member optSettings : Opt.OptimizationSettings + member optSettings : Optimizer.OptimizationSettings member emitTailcalls : bool member lcid : int option member optsOn : bool @@ -496,8 +506,9 @@ type TcConfig = // Tables of referenced DLLs //-------------------------------------------------------------------------- +/// Represents a resolved imported binary type ImportedBinary = - { FileName: string; + { FileName: string RawMetadata: ILModuleDef #if EXTENSIONTYPING ProviderGeneratedAssembly: System.Reflection.Assembly option @@ -507,16 +518,17 @@ type ImportedBinary = ILAssemblyRefs : ILAssemblyRef list ILScopeRef: ILScopeRef} +/// Represents a resolved imported assembly type ImportedAssembly = - { ILScopeRef: ILScopeRef; - FSharpViewOfMetadata: CcuThunk; - AssemblyAutoOpenAttributes: string list; - AssemblyInternalsVisibleToAttributes: string list; + { ILScopeRef: ILScopeRef + FSharpViewOfMetadata: CcuThunk + AssemblyAutoOpenAttributes: string list + AssemblyInternalsVisibleToAttributes: string list #if EXTENSIONTYPING - IsProviderGenerated: bool; - mutable TypeProviders: Tainted list; + IsProviderGenerated: bool + mutable TypeProviders: Tainted list #endif - FSharpOptimizationData : Lazy> } + FSharpOptimizationData : Lazy> } [] @@ -527,11 +539,18 @@ type TcAssemblyResolutions = static member BuildFromPriorResolutions : TcConfig * AssemblyResolution list * UnresolvedAssemblyReference list -> TcAssemblyResolutions +/// Represents a computation to return a TcConfig. Normally this is just a constant immutable TcConfig, +/// but for F# Interactive it may be based on an underlying mutable TcConfigBuilder. [] type TcConfigProvider = + /// Get a TcConfigProvider which will return only the exact TcConfig. static member Constant : TcConfig -> TcConfigProvider + + /// Get a TcConfigProvider which will continue to respect changes in the underlying + /// TcConfigBuilder rather than delivering snapshots. static member BasedOnMutableBuilder : TcConfigBuilder -> TcConfigProvider +/// Repreesnts a table of imported assemblies with their resolutions. [] type TcImports = interface System.IDisposable @@ -573,98 +592,118 @@ type TcImports = // Special resources in DLLs //-------------------------------------------------------------------------- +/// Determine if an IL resource attached to an F# assemnly is an F# signature data resource val IsSignatureDataResource : ILResource -> bool + +/// Determine if an IL resource attached to an F# assemnly is an F# optimization data resource val IsOptimizationDataResource : ILResource -> bool + +/// Determine if an IL resource attached to an F# assemnly is an F# quotation data resource for reflected definitions val IsReflectedDefinitionsResource : ILResource -> bool #if NO_COMPILER_BACKEND #else +/// Write F# signature data as an IL resource val WriteSignatureData : TcConfig * TcGlobals * Tastops.Remap * CcuThunk * string -> ILResource -val WriteOptimizationData : TcGlobals * string * CcuThunk * Opt.LazyModuleInfo -> ILResource -#endif -val GetNameOfILModule : ILModuleDef -> string +/// Write F# optimization data as an IL resource +val WriteOptimizationData : TcGlobals * string * CcuThunk * Optimizer.LazyModuleInfo -> ILResource +#endif +/// Get the name used for FSharp.Core val GetFSharpCoreLibraryName : unit -> string -//---------------------------------------------------------------------------- -// Finding and requiring DLLs -//-------------------------------------------------------------------------- - +/// Process #r in F# Interactive. +/// Adds the reference to the tcImports and add the ccu to the type checking environment. val RequireDLL : TcImports -> TcEnv -> range -> string -> TcEnv * (ImportedBinary list * ImportedAssembly list) -//---------------------------------------------------------------------------- -// Processing # commands -//-------------------------------------------------------------------------- - +/// Processing # commands val ProcessMetaCommandsFromInput : ('T -> range * string -> 'T) * ('T -> range * string -> 'T) * ('T -> range * string -> unit) -> TcConfigBuilder -> Ast.ParsedInput -> string -> 'T -> 'T +/// Find the scoped #nowarn pragmas with their range information val GetScopedPragmasForInput : Ast.ParsedInput -> ScopedPragma list + +/// Get an error logger that filters the reporting of warnings based on scoped pragma information val GetErrorLoggerFilteringByScopedPragmas : checkFile:bool * ScopedPragma list * ErrorLogger -> ErrorLogger +/// Process the #nowarn in an input val ApplyNoWarnsToTcConfig : TcConfig -> (Ast.ParsedInput*string) -> TcConfig + +/// Process all the #r, #I etc. in an input val ApplyMetaCommandsFromInputToTcConfig : TcConfig -> (Ast.ParsedInput * string) -> TcConfig -val GetAssemblyResolutionInformation : TcConfig -> AssemblyResolution list * UnresolvedAssemblyReference list -//---------------------------------------------------------------------------- -// Loading the default library sets -//-------------------------------------------------------------------------- - +/// This list is the default set of references for "non-project" files. val DefaultBasicReferencesForOutOfProjectSources : string list -//---------------------------------------------------------------------------- -// Parsing inputs -//-------------------------------------------------------------------------- +/// Parse one input file val ParseOneInputFile : TcConfig * Lexhelp.LexResourceManager * string list * string * isLastCompiland: bool * ErrorLogger * (*retryLocked*) bool -> ParsedInput option //---------------------------------------------------------------------------- // Type checking and querying the type checking state //-------------------------------------------------------------------------- -val GetInitialTypecheckerEnv : string option -> range -> TcConfig -> TcImports -> TcGlobals -> TcEnv +/// Get the initial type checking environment including the loading of mscorlib/System.Core, FSharp.Core +/// applying the InternalsVisibleTo in referenced assemblies and opening 'Checked' if requested. +val GetInitialTcEnv : string option -> range -> TcConfig -> TcImports -> TcGlobals -> TcEnv [] +/// Represents the incremental type checking state for a set of inputs type TcState = member NiceNameGenerator : Ast.NiceNameGenerator + + /// The CcuThunk for the current assembly being checked member Ccu : CcuThunk + + /// Get the typing environment implied by the set of signature files and/or inferred signatures of implementation files checked so far member TcEnvFromSignatures : TcEnv - member NextStateAfterIncrementalFragment : TcEnv -> TcState + + /// Get the typing environment implied by the set of implemetation files checked so far member TcEnvFromImpls : TcEnv -val TypecheckInitialState : + member NextStateAfterIncrementalFragment : TcEnv -> TcState + +/// Get the initial type checking state for a set of inputs +val GetInitialTcState : range * string * TcConfig * TcGlobals * TcImports * Ast.NiceNameGenerator * TcEnv -> TcState -val TypecheckOneInputEventually : - (unit -> bool) * TcConfig * TcImports * TcGlobals * Ast.LongIdent option * Nameres.TcResultsSink * TcState * Ast.ParsedInput +/// Check one input, returned as an Eventually computation +val TypeCheckOneInputEventually : + (unit -> bool) * TcConfig * TcImports * TcGlobals * Ast.LongIdent option * NameResolution.TcResultsSink * TcState * Ast.ParsedInput -> Eventually<(TcEnv * TopAttribs * Tast.TypedImplFile list) * TcState> -val TypecheckMultipleInputsFinish : - (TcEnv * TopAttribs * 'T list) list * TcState - -> (TcEnv * TopAttribs * 'T list) * TcState +/// Finish the checking of multiple inputs +val TypeCheckMultipleInputsFinish : (TcEnv * TopAttribs * 'T list) list * TcState -> (TcEnv * TopAttribs * 'T list) * TcState -val TypecheckClosedInputSetFinish : - TypedImplFile list * TcState - -> TcState * TypedAssembly +/// Finish the checking of a closed set of inputs +val TypeCheckClosedInputSetFinish : TypedImplFile list * TcState -> TcState * TypedAssembly -val TypecheckClosedInputSet : +/// Check a closed set of inputs +val TypeCheckClosedInputSet : (unit -> bool) * TcConfig * TcImports * TcGlobals * Ast.LongIdent option * TcState * Ast.ParsedInput list -> TcState * TopAttribs * Tast.TypedAssembly * TcEnv -val TypecheckSingleInputAndFinishEventually : - (unit -> bool) * TcConfig * TcImports * TcGlobals * Ast.LongIdent option * Nameres.TcResultsSink * TcState * Ast.ParsedInput +/// Check a single input and finish the checking +val TypeCheckSingleInputAndFinishEventually : + (unit -> bool) * TcConfig * TcImports * TcGlobals * Ast.LongIdent option * NameResolution.TcResultsSink * TcState * Ast.ParsedInput -> Eventually<(TcEnv * TopAttribs * Tast.TypedImplFile list) * TcState> +/// Parse and process a set of compiler options val ParseCompilerOptions : (string -> unit) -> CompilerOptionBlock list -> string list -> unit + +/// Report a warning through the current error logger val ReportWarning : int -> int list -> int list -> PhasedError -> bool + +/// Report a warning through the current error logger, but as an error val ReportWarningAsError : int -> int list -> int list -> int list -> int list -> bool -> PhasedError -> bool //---------------------------------------------------------------------------- // #load closure //-------------------------------------------------------------------------- + type CodeContext = | Evaluation | Compilation diff --git a/src/fsharp/check.fsi b/src/fsharp/check.fsi deleted file mode 100644 index b0c3ac8cf0d..00000000000 --- a/src/fsharp/check.fsi +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -module internal Microsoft.FSharp.Compiler.PostTypecheckSemanticChecks - -open Internal.Utilities -open Microsoft.FSharp.Compiler - -val testFlagMemberBody : bool ref -val CheckTopImpl : Env.TcGlobals * Import.ImportMap * bool * Infos.InfoReader * Tast.CompilationPath list * Tast.CcuThunk * Tastops.DisplayEnv * Tast.ModuleOrNamespaceExprWithSig * Tast.Attribs * bool -> bool diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 1c1e7835e2f..3d85c9d241b 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -29,7 +29,7 @@ open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Microsoft.FSharp.Compiler.AbstractIL.IL #if NO_COMPILER_BACKEND #else -open Microsoft.FSharp.Compiler.Ilxgen +open Microsoft.FSharp.Compiler.IlxGen #endif open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger @@ -43,11 +43,11 @@ open Microsoft.FSharp.Compiler.Infos.AccessibilityLogic open Microsoft.FSharp.Compiler.Infos.AttributeChecking open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops -open Microsoft.FSharp.Compiler.Opt -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.Optimizer +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Build open Microsoft.FSharp.Compiler.Lib -open Microsoft.FSharp.Compiler.Fscopts +open Microsoft.FSharp.Compiler.FscOptions open Microsoft.FSharp.Compiler.DiagnosticMessage #if EXTENSIONTYPING @@ -197,8 +197,8 @@ let TypeCheck (tcConfig,tcImports,tcGlobals,errorLogger:ErrorLogger,assemblyName try if isNil inputs then error(Error(FSComp.SR.fscNoImplementationFiles(),Range.rangeStartup)) let ccuName = assemblyName - let tcInitialState = TypecheckInitialState (rangeStartup,ccuName,tcConfig,tcGlobals,tcImports,niceNameGen,tcEnv0) - TypecheckClosedInputSet ((fun () -> errorLogger.ErrorCount > 0),tcConfig,tcImports,tcGlobals,None,tcInitialState,inputs) + let tcInitialState = GetInitialTcState (rangeStartup,ccuName,tcConfig,tcGlobals,tcImports,niceNameGen,tcEnv0) + TypeCheckClosedInputSet ((fun () -> errorLogger.ErrorCount > 0),tcConfig,tcImports,tcGlobals,None,tcInitialState,inputs) with e -> errorRecovery e rangeStartup #if SQM_SUPPORT @@ -496,7 +496,7 @@ let getTcImportsFromCommandLine(displayPSTypeProviderSecurityDialogBlockingUI : ReportTime tcConfig "Typecheck" use unwindParsePhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.TypeCheck) - let tcEnv0 = GetInitialTypecheckerEnv (Some assemblyName) rangeStartup tcConfig tcImports tcGlobals + let tcEnv0 = GetInitialTcEnv (Some assemblyName) rangeStartup tcConfig tcImports tcGlobals // typecheck let inputs : ParsedInput list = inputs |> List.map fst @@ -757,14 +757,14 @@ let GenerateOptimizationData(tcConfig) = let EncodeOptimizationData(tcGlobals,tcConfig,outfile,exportRemapping,data) = if GenerateOptimizationData tcConfig then - let data = map2Of2 (Opt.RemapLazyModulInfo tcGlobals exportRemapping) data + let data = map2Of2 (Optimizer.RemapOptimizationInfo tcGlobals exportRemapping) data if verbose then dprintn "Generating optimization data attribute..."; // REVIEW: need a better test for this let outFileNoExtension = Filename.chopExtension outfile let isCompilerServiceDll = outFileNoExtension.Contains("FSharp.LanguageService.Compiler") if tcConfig.useOptimizationDataFile || tcGlobals.compilingFslib || isCompilerServiceDll then let ccu,modulInfo = data - let bytes = Pickle.pickleObjWithDanglingCcus outfile tcGlobals ccu Opt.p_LazyModuleInfo modulInfo + let bytes = TastPickle.pickleObjWithDanglingCcus outfile tcGlobals ccu Optimizer.p_CcuOptimizationInfo modulInfo let optDataFileName = (Filename.chopExtension outfile)+".optdata" File.WriteAllBytes(optDataFileName,bytes); // As with the sigdata file, the optdata gets written to a file for FSharp.Core, FSharp.Compiler.Silverlight and FSharp.LanguageService.Compiler @@ -773,7 +773,7 @@ let EncodeOptimizationData(tcGlobals,tcConfig,outfile,exportRemapping,data) = else let (ccu, optData) = if tcConfig.onlyEssentialOptimizationData || tcConfig.useOptimizationDataFile - then map2Of2 Opt.AbstractLazyModulInfoToEssentials data + then map2Of2 Optimizer.AbstractOptimizationInfoToEssentials data else data [ WriteOptimizationData (tcGlobals, outfile, ccu, optData) ] else @@ -1813,7 +1813,7 @@ module FileWriter = #if STATISTICS Ilread.report oc; #endif - Ilxgen.ReportStatistics oc; + IlxGen.ReportStatistics oc; with _ -> () @@ -1902,7 +1902,7 @@ let main0(argv,bannerAlreadyPrinted,exiter:Exiter, errorLoggerProvider : ErrorLo ), (fun tcConfigB -> // display the banner text, if necessary if not bannerAlreadyPrinted then - Microsoft.FSharp.Compiler.Fscopts.DisplayBannerText tcConfigB + Microsoft.FSharp.Compiler.FscOptions.DisplayBannerText tcConfigB ), false, // optimizeForMemory - fsc.exe can use as much memory as it likes to try to compile as fast as possible exiter, @@ -2067,9 +2067,9 @@ let main2c(Args(tcConfig,errorLogger,staticLinker,ilGlobals,outfile,pdbfile,ilxM use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.IlGen) ReportTime tcConfig "ILX -> IL (Unions)"; - let ilxMainModule = EraseIlxUnions.ConvModule ilGlobals ilxMainModule + let ilxMainModule = EraseUnions.ConvModule ilGlobals ilxMainModule ReportTime tcConfig "ILX -> IL (Funcs)"; - let ilxMainModule = EraseIlxFuncs.ConvModule ilGlobals ilxMainModule + let ilxMainModule = EraseClosures.ConvModule ilGlobals ilxMainModule abortOnError(errorLogger,tcConfig,exiter) Args(tcConfig,errorLogger,staticLinker,ilGlobals,ilxMainModule,outfile,pdbfile,signingInfo,exiter) diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 7b9ad81364a..a1785705637 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -34,10 +34,10 @@ open Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter open Microsoft.FSharp.Compiler.Interactive.Settings open Microsoft.FSharp.Compiler.Interactive.RuntimeHelpers open Microsoft.FSharp.Compiler.Lib -open Microsoft.FSharp.Compiler.Fscopts +open Microsoft.FSharp.Compiler.FscOptions open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Microsoft.FSharp.Compiler.AbstractIL.IL -open Microsoft.FSharp.Compiler.Ilxgen +open Microsoft.FSharp.Compiler.IlxGen open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger @@ -45,12 +45,12 @@ open Microsoft.FSharp.Compiler.TypeChecker open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Infos open Microsoft.FSharp.Compiler.Tastops -open Microsoft.FSharp.Compiler.Opt -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.Optimizer +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Build open Microsoft.FSharp.Compiler.Lexhelp open Microsoft.FSharp.Compiler.Layout -open Microsoft.FSharp.Compiler.PostTypecheckSemanticChecks +open Microsoft.FSharp.Compiler.PostTypeCheckSemanticChecks open Internal.Utilities.Collections open Internal.Utilities.StructuredFormat @@ -228,13 +228,13 @@ type FsiValuePrinter(ilGlobals, generateDebugInfo, resolvePath, outWriter) = Layout.wordL "" /// Display the signature of an F# value declaration, along with its actual value. - member valuePrinter.InvokeDeclLayout (emEnv, ilxGenerator: Ilxgen.IlxAssemblyGenerator, v:Val) = + member valuePrinter.InvokeDeclLayout (emEnv, ilxGenerator: IlxGen.IlxAssemblyGenerator, v:Val) = // Implemented via a lookup from v to a concrete (System.Object,System.Type). // This (obj,objTy) pair can then be fed to the fsi value printer. // Note: The value may be (null:Object). // Note: A System.Type allows the value printer guide printing of nulls, e.g. as None or []. //------- - // Ilxgen knows what the v:Val was converted to w.r.t. AbsIL datastructures. + // IlxGen knows what the v:Val was converted to w.r.t. AbsIL datastructures. // Ilreflect knows what the AbsIL was generated to. // Combining these allows for obtaining the (obj,objTy) by reflection where possible. // This assumes the v:Val was given appropriate storage, e.g. StaticField. @@ -726,11 +726,11 @@ type FsiConsoleInput(fsiOptions: FsiCommandLineOptions, inReader: TextReader, ou [] [] type FsiDynamicCompilerState = - { optEnv : Opt.IncrementalOptimizationEnv + { optEnv : Optimizer.IncrementalOptimizationEnv emEnv : ILRuntimeWriter.emEnv - tcGlobals : Env.TcGlobals + tcGlobals : TcGlobals tcState : Build.TcState - ilxGenerator : Ilxgen.IlxAssemblyGenerator + ilxGenerator : IlxGen.IlxAssemblyGenerator // Why is this not in FsiOptions? timing : bool } @@ -796,7 +796,7 @@ type FsiDynamicCompiler(timeReporter : FsiTimeReporter, // Typecheck. The lock stops the type checker running at the same time as the // server intellisense implementation (which is currently incomplete and #if disabled) let (tcState:TcState),topCustomAttrs,declaredImpls,tcEnvAtEndOfLastInput = - lock tcLockObject (fun _ -> TypecheckClosedInputSet(errorLogger.CheckForErrors,tcConfig,tcImports,tcGlobals, Some prefixPath,tcState,inputs)) + lock tcLockObject (fun _ -> TypeCheckClosedInputSet(errorLogger.CheckForErrors,tcConfig,tcImports,tcGlobals, Some prefixPath,tcState,inputs)) #if DEBUG // Logging/debugging @@ -834,9 +834,9 @@ type FsiDynamicCompiler(timeReporter : FsiTimeReporter, errorLogger.AbortOnError(); ReportTime tcConfig "ILX -> IL (Unions)"; - let ilxMainModule = EraseIlxUnions.ConvModule ilGlobals ilxMainModule + let ilxMainModule = EraseUnions.ConvModule ilGlobals ilxMainModule ReportTime tcConfig "ILX -> IL (Funcs)"; - let ilxMainModule = EraseIlxFuncs.ConvModule ilGlobals ilxMainModule + let ilxMainModule = EraseClosures.ConvModule ilGlobals ilxMainModule errorLogger.AbortOnError(); @@ -937,7 +937,7 @@ type FsiDynamicCompiler(timeReporter : FsiTimeReporter, let prefix = mkFragmentPath i let prefixPath = pathOfLid prefix let impl = SynModuleOrNamespace(prefix,(* isModule: *) true,defs,PreXmlDoc.Empty,[],None,rangeStdin) - let input = ParsedInput.ImplFile(ParsedImplFileInput(filename,true, QualFileNameOfUniquePath (rangeStdin,prefixPath),[],[],[impl],true (* isLastCompiland *) )) + let input = ParsedInput.ImplFile(ParsedImplFileInput(filename,true, ComputeQualifiedNameOfFileFromUniquePath (rangeStdin,prefixPath),[],[],[impl],true (* isLastCompiland *) )) let istate,tcEnvAtEndOfLastInput = ProcessInputs (istate, [input], showTypes, true, isInteractiveItExpr, prefix) let tcState = istate.tcState { istate with tcState = tcState.NextStateAfterIncrementalFragment(tcEnvAtEndOfLastInput) } @@ -955,7 +955,7 @@ type FsiDynamicCompiler(timeReporter : FsiTimeReporter, let istate = fsiDynamicCompiler.EvalParsedDefinitions (istate, false, true, defs) // Snarf the type for 'it' via the binding match istate.tcState.TcEnvFromImpls.NameEnv.FindUnqualifiedItem itName with - | Nameres.Item.Value vref -> + | NameResolution.Item.Value vref -> if not tcConfig.noFeedback then valuePrinter.InvokeExprPrinter (istate.tcState.TcEnvFromImpls.DisplayEnv, vref.Deref) @@ -1062,10 +1062,10 @@ type FsiDynamicCompiler(timeReporter : FsiTimeReporter, let tcConfig = TcConfig.Create(tcConfigB,validate=false) let optEnv0 = InitialOptimizationEnv tcImports tcGlobals let emEnv = ILRuntimeWriter.emEnv0 - let tcEnv = GetInitialTypecheckerEnv None rangeStdin tcConfig tcImports tcGlobals + let tcEnv = GetInitialTcEnv None rangeStdin tcConfig tcImports tcGlobals let ccuName = assemblyName - let tcState = TypecheckInitialState (rangeStdin,ccuName,tcConfig,tcGlobals,tcImports,niceNameGen,tcEnv) + let tcState = GetInitialTcState (rangeStdin,ccuName,tcConfig,tcGlobals,tcImports,niceNameGen,tcEnv) let ilxGenerator = CreateIlxAssemblyGenerator(tcConfig,tcImports,tcGlobals, (LightweightTcValForUsingInBuildMethodCall tcGlobals), tcState.Ccu ) {optEnv = optEnv0; @@ -1097,10 +1097,10 @@ type FsiIntellisenseProvider(tcGlobals, tcImports: TcImports) = let amap = tcImports.GetImportMap() let infoReader = new Infos.InfoReader(tcGlobals,amap) - let ncenv = new Nameres.NameResolver(tcGlobals,amap,infoReader,Nameres.FakeInstantiationGenerator) + let ncenv = new NameResolution.NameResolver(tcGlobals,amap,infoReader,NameResolution.FakeInstantiationGenerator) // Note: for the accessor domain we should use (AccessRightsOfEnv tcState.TcEnvFromImpls) let ad = Infos.AccessibleFromSomeFSharpCode - let nItems = Nameres.ResolvePartialLongIdent ncenv tcState.TcEnvFromImpls.NameEnv (ConstraintSolver.IsApplicableMethApprox tcGlobals amap rangeStdin) rangeStdin ad lid false + let nItems = NameResolution.ResolvePartialLongIdent ncenv tcState.TcEnvFromImpls.NameEnv (ConstraintSolver.IsApplicableMethApprox tcGlobals amap rangeStdin) rangeStdin ad lid false let names = nItems |> List.map (fun d -> d.DisplayName tcGlobals) let names = names |> List.filter (fun (name:string) -> name.StartsWith(stem,StringComparison.Ordinal)) names @@ -1471,7 +1471,7 @@ type FsiStdinLexerProvider(tcConfigB, fsiStdinSyphon, let skip = true // don't report whitespace from lexer let defines = "INTERACTIVE"::tcConfigB.conditionalCompilationDefines let lexargs = mkLexargs (sourceFileName,defines, interactiveInputLightSyntaxStatus, lexResourceManager, ref [], errorLogger) - let tokenizer = Lexfilter.LexFilter(interactiveInputLightSyntaxStatus, tcConfigB.compilingFslib, Lexer.token lexargs skip, lexbuf) + let tokenizer = LexFilter.LexFilter(interactiveInputLightSyntaxStatus, tcConfigB.compilingFslib, Lexer.token lexargs skip, lexbuf) tokenizer @@ -1539,7 +1539,7 @@ type FsiInteractionProcessor(tcConfigB, /// Parse one interaction. Called on the parser thread. - let ParseInteraction (tokenizer:Lexfilter.LexFilter) = + let ParseInteraction (tokenizer:LexFilter.LexFilter) = let lastToken = ref Parser.ELSE // Any token besides SEMICOLON_SEMICOLON will do for initial value try if !progress then fprintfn fsiConsoleOutput.Out "In ParseInteraction..."; @@ -1734,7 +1734,7 @@ type FsiInteractionProcessor(tcConfigB, /// /// During processing of startup scripts, this runs on the main thread. - member __.ParseAndProcessAndEvalOneInteractionFromLexbuf (exitViaKillThread, runCodeOnMainThread, istate:FsiDynamicCompilerState, tokenizer:Lexfilter.LexFilter) = + member __.ParseAndProcessAndEvalOneInteractionFromLexbuf (exitViaKillThread, runCodeOnMainThread, istate:FsiDynamicCompilerState, tokenizer:LexFilter.LexFilter) = if tokenizer.LexBuffer.IsPastEndOfStream then let stepStatus = diff --git a/src/fsharp/import.fs b/src/fsharp/import.fs index 1f42cdb7d1d..c325a6b234b 100644 --- a/src/fsharp/import.fs +++ b/src/fsharp/import.fs @@ -1,19 +1,20 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +/// Functions to import .NET binary metadata as TAST objects module internal Microsoft.FSharp.Compiler.Import open System.Reflection open System.Collections.Generic open Internal.Utilities + open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library open Microsoft.FSharp.Compiler - open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.AbstractIL.IL -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Ast open Microsoft.FSharp.Compiler.ErrorLogger #if EXTENSIONTYPING diff --git a/src/fsharp/import.fsi b/src/fsharp/import.fsi index ebb62d2c1ed..a1907a1d4c6 100644 --- a/src/fsharp/import.fsi +++ b/src/fsharp/import.fsi @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +/// Functions to import .NET binary metadata as TAST objects module internal Microsoft.FSharp.Compiler.Import open Microsoft.FSharp.Compiler.Tast +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.AbstractIL.IL #if EXTENSIONTYPING @@ -37,13 +39,13 @@ type AssemblyLoader = /// serves as an interface through to the tables stored in the primary TcImports structures defined in build.fs. [] type ImportMap = - new : g:Env.TcGlobals * assemblyLoader:AssemblyLoader -> ImportMap + new : g:TcGlobals * assemblyLoader:AssemblyLoader -> ImportMap /// The AssemblyLoader for the import context member assemblyLoader : AssemblyLoader /// The TcGlobals for the import context - member g : Env.TcGlobals + member g : TcGlobals /// Import a reference to a type definition, given an AbstractIL ILTypeRef, with caching val internal ImportILTypeRef : ImportMap -> range -> ILTypeRef -> TyconRef diff --git a/src/fsharp/infos.fs b/src/fsharp/infos.fs index 20f3cc3403b..e6db04d7993 100644 --- a/src/fsharp/infos.fs +++ b/src/fsharp/infos.fs @@ -19,7 +19,7 @@ open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.Tastops open Microsoft.FSharp.Compiler.Tastops.DebugPrint -open Microsoft.FSharp.Compiler.Env +open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.Lib open Microsoft.FSharp.Core.Printf diff --git a/src/fsharp/layout.fs b/src/fsharp/layout.fs index 48ee99d9c2d..d3614f31c43 100644 --- a/src/fsharp/layout.fs +++ b/src/fsharp/layout.fs @@ -18,28 +18,25 @@ let spaces n = new String(' ',n) //-------------------------------------------------------------------------- let rec juxtLeft = function - Leaf (jl,_text,_jr) -> jl + | Leaf (jl,_text,_jr) -> jl | Node (jl,_l,_jm,_r,_jr,_joint) -> jl | Attr (_tag,_attrs,l) -> juxtLeft l let rec juxtRight = function - Leaf (_jl,_text,jr) -> jr + | Leaf (_jl,_text,jr) -> jr | Node (_jl,_l,_jm,_r,jr,_joint) -> jr | Attr (_tag,_attrs,l) -> juxtRight l -(* NOTE: - * emptyL might be better represented as a constructor, - * so then (Sep"") would have true meaning - *) +// NOTE: emptyL might be better represented as a constructor, so then (Sep"") would have true meaning let emptyL = Leaf (true,box "",true) let isEmptyL = function Leaf(true,tag,true) when unbox tag = "" -> true | _ -> false let mkNode l r joint = if isEmptyL l then r else if isEmptyL r then l else - let jl = juxtLeft l in - let jm = juxtRight l || juxtLeft r in - let jr = juxtRight r in + let jl = juxtLeft l + let jm = juxtRight l || juxtLeft r + let jr = juxtRight r Node(jl,l,jm,r,jr,joint) @@ -53,14 +50,8 @@ let rightL (str:string) = Leaf (true ,box str,false) let leftL (str:string) = Leaf (false,box str,true) let aboveL l r = mkNode l r (Broken 0) -let joinN i l r = mkNode l r (Breakable i) -let join = joinN 0 -let join1 = joinN 1 -let join2 = joinN 2 -let join3 = joinN 3 let tagAttrL str attrs ly = Attr (str,attrs,ly) -let linkL str ly = tagAttrL "html:a" [("href",str)] ly //-------------------------------------------------------------------------- //INDEX: constructors derived @@ -96,12 +87,12 @@ let sepListL x y = tagListL (fun prefixL -> prefixL ^^ x) y let bracketL l = leftL "(" ^^ l ^^ rightL ")" let tupleL xs = bracketL (sepListL (sepL ",") xs) let aboveListL = function - [] -> emptyL + | [] -> emptyL | [x] -> x | x::ys -> List.fold (fun pre y -> pre @@ y) x ys let optionL xL = function - None -> wordL "None" + | None -> wordL "None" | Some x -> wordL "Some" -- (xL x) let listL xL xs = leftL "[" ^^ sepListL (sepL ";") (List.map xL xs) ^^ rightL "]" @@ -219,20 +210,17 @@ let squashTo maxWidth layout = layout //-------------------------------------------------------------------------- -//INDEX: render +//INDEX: LayoutRenderer //-------------------------------------------------------------------------- -type render<'a,'b> = - (* exists 'b. - -- could use object type to get "exists 'b" on private state, - *) - abstract Start : unit -> 'b; - abstract AddText : 'b -> string -> 'b; - abstract AddBreak : 'b -> int -> 'b; - abstract AddTag : 'b -> string * (string * string) list * bool -> 'b; +type LayoutRenderer<'a,'b> = + abstract Start : unit -> 'b + abstract AddText : 'b -> string -> 'b + abstract AddBreak : 'b -> int -> 'b + abstract AddTag : 'b -> string * (string * string) list * bool -> 'b abstract Finish : 'b -> 'a -let renderL (rr: render<_,_>) layout = +let renderL (rr: LayoutRenderer<_,_>) layout = let rec addL z pos i layout k = match layout with (* pos is tab level *) @@ -262,7 +250,7 @@ let renderL (rr: render<_,_>) layout = /// string render let stringR = - { new render with + { new LayoutRenderer with member x.Start () = [] member x.AddText rstrs text = text::rstrs member x.AddBreak rstrs n = (spaces n) :: "\n" :: rstrs @@ -272,9 +260,9 @@ let stringR = type NoState = NoState type NoResult = NoResult -/// channel render +/// channel LayoutRenderer let channelR (chan:TextWriter) = - { new render with + { new LayoutRenderer with member r.Start () = NoState member r.AddText z s = chan.Write s; z member r.AddBreak z n = chan.WriteLine(); chan.Write (spaces n); z @@ -283,40 +271,13 @@ let channelR (chan:TextWriter) = /// buffer render let bufferR os = - { new render with + { new LayoutRenderer with member r.Start () = NoState member r.AddText z s = bprintf os "%s" s; z member r.AddBreak z n = bprintf os "\n"; bprintf os "%s" (spaces n); z member r.AddTag z (tag,attrs,start) = z member r.Finish z = NoResult } -/// html render - wraps HTML encoding (REVIEW) and hyperlinks -let htmlR (baseR : render<'Res,'State>) = - { new render<'Res,'State> with - member r.Start () = baseR.Start() - member r.AddText z s = baseR.AddText z s; (* REVIEW: escape HTML chars *) - member r.AddBreak z n = baseR.AddBreak z n - member r.AddTag z (tag,attrs,start) = - match tag,attrs with - | "html:a",[("href",link)] -> - if start - then baseR.AddText z (sprintf "" link) - else baseR.AddText z (sprintf "") - | _ -> z - member r.Finish z = baseR.Finish z } - -/// indent render - wraps fixed indentation -let indentR indent (baseR : render<'Res,'State>) = - { new render<'Res,'State> with - member r.Start () = - let z = baseR.Start() - let z = baseR.AddText z (spaces indent) - z - member r.AddText z s = baseR.AddText z s; (* REVIEW: escape HTML chars *) - member r.AddBreak z n = baseR.AddBreak z (n+indent); - member r.AddTag z (tag,attrs,start) = baseR.AddTag z (tag,attrs,start) - member r.Finish z = baseR.Finish z } - //-------------------------------------------------------------------------- //INDEX: showL, outL are most common //-------------------------------------------------------------------------- diff --git a/src/fsharp/layout.fsi b/src/fsharp/layout.fsi index e5070926a99..b3671ab1039 100644 --- a/src/fsharp/layout.fsi +++ b/src/fsharp/layout.fsi @@ -39,32 +39,28 @@ val aboveListL : Layout list -> Layout val optionL : ('a -> Layout) -> 'a option -> Layout val listL : ('a -> Layout) -> 'a list -> Layout -val linkL : string -> Layout -> Layout - val squashTo : int -> Layout -> Layout val showL : Layout -> string val outL : TextWriter -> Layout -> unit val bufferL : StringBuilder -> Layout -> unit -(* render a Layout yielding an 'a using a 'b (hidden state) type *) -type ('a,'b) render = - abstract Start : unit -> 'b; - abstract AddText : 'b -> string -> 'b; - abstract AddBreak : 'b -> int -> 'b; - abstract AddTag : 'b -> string * (string * string) list * bool -> 'b; +/// render a Layout yielding an 'a using a 'b (hidden state) type +type LayoutRenderer<'a,'b> = + abstract Start : unit -> 'b + abstract AddText : 'b -> string -> 'b + abstract AddBreak : 'b -> int -> 'b + abstract AddTag : 'b -> string * (string * string) list * bool -> 'b abstract Finish : 'b -> 'a -(* Run a render on a Layout *) -val renderL : ('b,'a) render -> Layout -> 'b - -(* Primitive renders *) -val stringR : (string,string list) render type NoState = NoState type NoResult = NoResult -val channelR : TextWriter -> (NoResult,NoState) render -val bufferR : StringBuilder -> (NoResult,NoState) render -(* Combinator renders *) -val htmlR : ('a,'b) render -> ('a,'b) render (* assumes in
 context *)
-val indentR  : int -> ('a,'b) render -> ('a,'b) render
+/// Run a render on a Layout       
+val renderL  : LayoutRenderer<'b,'a> -> Layout -> 'b
+
+/// Primitive renders 
+val stringR  : LayoutRenderer
+val channelR : TextWriter -> LayoutRenderer
+val bufferR  : StringBuilder -> LayoutRenderer
+
diff --git a/src/fsharp/lib.fs b/src/fsharp/lib.fs
index ee5d2818c69..fee5e7c848b 100644
--- a/src/fsharp/lib.fs
+++ b/src/fsharp/lib.fs
@@ -88,48 +88,6 @@ module NameMap =
     let domainL m = Zset.elements (domain m)
 
 
-(*
-
-//-------------------------------------------------------------------------
-// Library: Atoms
-//------------------------------------------------------------------------
-
-type AtomTable = 
-    { LookupTable : Dictionary
-      EncodeTable : Dictionary }
-    member at.Encode(name:string) = 
-        let mutable res = 0 
-        let idx = 
-            if at.EncodeTable.TryGetValue(name, &res) then 
-                res
-            else
-                let idx = at.EncodeTable.Count
-                at.LookupTable.[idx] <- name
-                at.EncodeTable.[name] <- idx
-                idx
-        Atom(res
-#if DEBUG
-             ,at
-#endif
-            )
-
-
-and Atom internal (idx:int32
-#if DEBUG
-                   ,_provider:AtomTable
-#endif
-                   ) =
-    member __.Index = idx
-    member __.Deref(provider: AtomTable) = 
-       
-#if DEBUG
-        assert (provider = _provider)
-        assert (provider.LookupTable.ContainsKey idx)
-#endif
-        provider.LookupTable.[idx]
-*)            
-
-    
 
 //---------------------------------------------------------------------------
 // Library: Pre\Post checks
@@ -481,7 +439,7 @@ let inline cacheOptRef cache f =
 // and goes depending on whether components are NGEN'd or not, e.g. 'ngen install FSharp.COmpiler.dll'
 // One workaround for the bug is to break NGEN loading and fixups into smaller fragments. Roughly speaking, the NGEN
 // loading process works by doing delayed fixups of references in NGEN code. This happens on a per-method
-// basis. For example, one manifestation is that a "print" before calling a method like Lexfilter.create gets
+// basis. For example, one manifestation is that a "print" before calling a method like LexFilter.create gets
 // displayed but the corresponding "print" in the body of that function doesn't get displayed. In between, the NGEN
 // image loader is performing a whole bunch of fixups of the NGEN code for the body of that method, and also for
 // bodies of methods referred to by that method. That second bit is very important: the fixup causing the crash may
diff --git a/src/fsharp/outcome.fs b/src/fsharp/outcome.fs
deleted file mode 100644
index d2a348d455f..00000000000
--- a/src/fsharp/outcome.fs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
-
-// --------------------------------------------------------------------	
-// Outcomes.  These are used to describe steps of a machine that
-// may raise errors.  The errors can be trapped.
-// --------------------------------------------------------------------	
-
-module internal Microsoft.FSharp.Compiler.Outcome
-
-open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
-
-let success a = Result a
-let raze (b:exn) = Exception b
-
-// map
-let (|?>) res f = 
-  match res with 
-  | Result x -> Result(f x )
-  | Exception err -> Exception err
-  
-let ForceRaise = function
-  | Result x -> x
-  | Exception err -> raise err
-
-let otherwise f x =
-  match x with 
-  | Result x -> success x
-  | Exception _err -> f()
-
-    
diff --git a/src/fsharp/outcome.fsi b/src/fsharp/outcome.fsi
deleted file mode 100644
index 64cd9f4968d..00000000000
--- a/src/fsharp/outcome.fsi
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
-
-module internal Microsoft.FSharp.Compiler.Outcome
-
-open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
-
-val success : 'T -> ResultOrException<'T>
-val raze : exn -> ResultOrException<'T>
-val ( |?> ) : ResultOrException<'T> -> ('T -> 'U) -> ResultOrException<'U>
-val ForceRaise : ResultOrException<'T> -> 'T
-val otherwise : (unit -> ResultOrException<'T>) -> ResultOrException<'T> -> ResultOrException<'T>
diff --git a/src/fsharp/pickle.fsi b/src/fsharp/pickle.fsi
deleted file mode 100644
index deba917e2bf..00000000000
--- a/src/fsharp/pickle.fsi
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
-
-module internal Microsoft.FSharp.Compiler.Pickle 
-
-open Internal.Utilities
-open Microsoft.FSharp.Compiler 
-open Microsoft.FSharp.Compiler.AbstractIL 
-open Microsoft.FSharp.Compiler.AbstractIL.IL
-open Microsoft.FSharp.Compiler.AbstractIL.Internal 
-open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
-open Microsoft.FSharp.Compiler.Tast
-
-// Fixup pickled data w.r.t. a set of CCU thunks indexed by name
-[]
-type PickledDataWithReferences<'RawData> = 
-    { /// The data that uses a collection of CcuThunks internally
-      RawData: 'RawData; 
-      /// The assumptions that need to be fixed up
-      FixupThunks: list } 
-
-    member Fixup : (CcuReference -> CcuThunk) -> 'RawData
-    /// Like Fixup but loader may return None, in which case there is no fixup.
-    member OptionalFixup: (CcuReference -> CcuThunk option) -> 'RawData
-    
-#if INCLUDE_METADATA_WRITER
-type WriterState 
-
-type pickler<'T> = 'T -> WriterState -> unit
-val internal p_byte : int -> WriterState -> unit
-val internal p_bool : bool -> WriterState -> unit
-val internal p_int : int -> WriterState -> unit
-val internal p_string : string -> WriterState -> unit
-val internal p_lazy : 'T pickler -> Lazy<'T> pickler
-val inline  internal p_tup2 : ('T1 pickler) -> ('T2 pickler) -> ('T1 * 'T2) pickler
-val inline  internal p_tup3 : ('T1 pickler) -> ('T2 pickler) -> ('T3 pickler) -> ('T1 * 'T2 * 'T3) pickler
-val inline  internal p_tup4 : ('T1 pickler) -> ('T2 pickler) -> ('T3 pickler) -> ('T4 pickler) -> ('T1 * 'T2 * 'T3 * 'T4) pickler
-val internal p_array : 'T pickler -> 'T[] pickler
-val internal p_namemap : 'T pickler -> NameMap<'T> pickler
-val internal p_const : Const pickler
-val internal p_vref : string -> ValRef pickler
-val internal p_tcref : string -> TyconRef pickler
-val internal p_ucref : UnionCaseRef pickler
-val internal p_expr : Expr pickler
-val internal p_typ : TType pickler
-val internal pickleModuleOrNamespace : pickler
-val internal pickleModuleInfo : pickler
-val pickleObjWithDanglingCcus : string -> Env.TcGlobals -> scope:CcuThunk -> ('T pickler) -> 'T -> byte[]
-#else
-#endif
-
-type ReaderState 
-
-type unpickler<'T> = ReaderState -> 'T
-val internal u_byte : ReaderState -> int
-val internal u_bool : ReaderState -> bool
-val internal u_int : ReaderState -> int
-val internal u_string : ReaderState -> string
-val internal u_lazy : 'T unpickler -> Lazy<'T> unpickler
-val inline  internal u_tup2 : ('T2 unpickler) -> ('T3 unpickler ) -> ('T2 * 'T3) unpickler
-val inline  internal u_tup3 : ('T2 unpickler) -> ('T3 unpickler ) -> ('T4 unpickler ) -> ('T2 * 'T3 * 'T4) unpickler
-val inline  internal u_tup4 : ('T2 unpickler) -> ('T3 unpickler ) -> ('T4 unpickler ) -> ('T5 unpickler) -> ('T2 * 'T3 * 'T4 * 'T5) unpickler
-val internal u_array : 'T unpickler -> 'T[] unpickler
-val internal u_namemap : 'T unpickler -> NameMap<'T> unpickler
-val internal u_const : Const unpickler
-val internal u_vref : ValRef unpickler
-val internal u_tcref : TyconRef unpickler
-val internal u_ucref : UnionCaseRef unpickler
-val internal u_expr : Expr unpickler
-val internal u_typ : TType unpickler
-val internal unpickleModuleOrNamespace : ReaderState -> ModuleOrNamespace
-val internal unpickleModuleInfo : ReaderState -> PickledModuleInfo
-val internal unpickleObjWithDanglingCcus : string -> viewedScope:ILScopeRef -> ilModule:ILModuleDef -> ('T  unpickler) -> byte[] ->  PickledDataWithReferences<'T>
-
-
-
diff --git a/src/fsharp/tast.fs b/src/fsharp/tast.fs
index 5260a1f54c5..4f27b552e0f 100644
--- a/src/fsharp/tast.fs
+++ b/src/fsharp/tast.fs
@@ -1,5 +1,9 @@
 // Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
   
+//-------------------------------------------------------------------------
+// Defines the typed abstract syntax trees used throughout the F# compiler.
+//------------------------------------------------------------------------- 
+
 module internal Microsoft.FSharp.Compiler.Tast 
 
 open System
@@ -1465,7 +1469,7 @@ and
       /// Get a table of values indexed by logical name
       member mtyp.AllValsByLogicalName = 
           let addValByName (x:Val) tab = 
-             // Note: names may occur twice prior to raising errors about this in PostTypecheckSemanticChecks
+             // Note: names may occur twice prior to raising errors about this in PostTypeCheckSemanticChecks
              // Earlier ones take precedence sice we report errors about the later ones
              if not x.IsMember && not x.IsCompilerGenerated then 
                  NameMap.add x.LogicalName x tab 
@@ -2847,13 +2851,6 @@ and RecdFieldRef =
 and 
   /// The algebra of types
     []
-// REMOVING because of possible stack overflow 
-
-#if EXTENSIBLE_DUMPER
-#if DEBUG
-    [)>]
-#endif  
-#endif  
     TType =
 
     /// TType_forall(typars, bodyTy).
@@ -3102,7 +3099,7 @@ and CcuResolutionResult =
     | UnresolvedCcu of string
 
 /// Represents the information saved in the assembly signature data resource for an F# assembly
-and PickledModuleInfo =
+and PickledCcuInfo =
   { mspec: ModuleOrNamespace
     compileTimeWorkingDir: string
     usesQuotations : bool }
diff --git a/src/fsharp/vs/IncrementalBuild.fs b/src/fsharp/vs/IncrementalBuild.fs
index 59ca37f8b57..38dc103e172 100644
--- a/src/fsharp/vs/IncrementalBuild.fs
+++ b/src/fsharp/vs/IncrementalBuild.fs
@@ -15,6 +15,7 @@ open Microsoft.FSharp.Compiler
 open Microsoft.FSharp.Compiler.Range
 open Microsoft.FSharp.Compiler.Build
 open Microsoft.FSharp.Compiler.Tastops
+open Microsoft.FSharp.Compiler.TcGlobals
 open Microsoft.FSharp.Compiler.ErrorLogger
 open Microsoft.FSharp.Compiler.Lib
 open Microsoft.FSharp.Compiler.AbstractIL
@@ -1082,10 +1083,10 @@ module internal IncrementalFSharpBuild =
 
     open IncrementalBuild
     open Microsoft.FSharp.Compiler.Build
-    open Microsoft.FSharp.Compiler.Fscopts
+    open Microsoft.FSharp.Compiler.FscOptions
     open Microsoft.FSharp.Compiler.Ast
     open Microsoft.FSharp.Compiler.ErrorLogger
-    open Microsoft.FSharp.Compiler.Env
+    open Microsoft.FSharp.Compiler.TcGlobals
     open Microsoft.FSharp.Compiler.TypeChecker
     open Microsoft.FSharp.Compiler.Tast 
     open Microsoft.FSharp.Compiler.Range
@@ -1427,8 +1428,8 @@ module internal IncrementalFSharpBuild =
                     errorLogger.Warning(e)
                     frameworkTcImports           
 
-            let tcEnv0 = GetInitialTypecheckerEnv (Some assemblyName) rangeStartup tcConfig tcImports tcGlobals
-            let tcState0 = TypecheckInitialState (rangeStartup,assemblyName,tcConfig,tcGlobals,tcImports,niceNameGen,tcEnv0)
+            let tcEnv0 = GetInitialTcEnv (Some assemblyName) rangeStartup tcConfig tcImports tcGlobals
+            let tcState0 = GetInitialTcState (rangeStartup,assemblyName,tcConfig,tcGlobals,tcImports,niceNameGen,tcEnv0)
             let tcAcc = 
                 { tcGlobals=tcGlobals
                   tcImports=tcImports
@@ -1456,11 +1457,11 @@ module internal IncrementalFSharpBuild =
                         Trace.PrintLine("FSharpBackgroundBuild", fun _ -> sprintf "Typechecking %s..." filename)                
                         beforeTypeCheckFile.Trigger filename
                         let! (tcEnv,topAttribs,typedImplFiles),tcState = 
-                            TypecheckOneInputEventually ((fun () -> errorLogger.ErrorCount > 0),
+                            TypeCheckOneInputEventually ((fun () -> errorLogger.ErrorCount > 0),
                                                          tcConfig,tcAcc.tcImports,
                                                          tcAcc.tcGlobals,
                                                          None,
-                                                         Nameres.TcResultsSink.NoSink,
+                                                         NameResolution.TcResultsSink.NoSink,
                                                          tcAcc.tcState,input)
                         
                         /// Only keep the typed interface files when doing a "full" build for fsc.exe, otherwise just throw them away
@@ -1505,8 +1506,8 @@ module internal IncrementalFSharpBuild =
             Trace.PrintLine("FSharpBackgroundBuildVerbose", fun _ -> sprintf "Finalizing Type Check" )
             let finalAcc = tcStates.[tcStates.Length-1]
             let results = tcStates |> List.ofArray |> List.map (fun acc-> acc.tcEnv, (Option.get acc.topAttribs), acc.typedImplFiles)
-            let (tcEnvAtEndOfLastFile,topAttrs,mimpls),tcState = TypecheckMultipleInputsFinish (results,finalAcc.tcState)
-            let tcState,tassembly = TypecheckClosedInputSetFinish (mimpls,tcState)
+            let (tcEnvAtEndOfLastFile,topAttrs,mimpls),tcState = TypeCheckMultipleInputsFinish (results,finalAcc.tcState)
+            let tcState,tassembly = TypeCheckClosedInputSetFinish (mimpls,tcState)
             tcState, topAttrs, tassembly, tcEnvAtEndOfLastFile, finalAcc.tcImports, finalAcc.tcGlobals, finalAcc.tcConfig
 
         // END OF BUILD TASK FUNCTIONS
@@ -1618,7 +1619,7 @@ module internal IncrementalFSharpBuild =
         member __.TypeCheck() = 
             let newPartialBuild = IncrementalBuild.Eval "FinalizeTypeCheck" partialBuild
             partialBuild <- newPartialBuild
-            match GetScalarResult("FinalizeTypeCheck",partialBuild) with
+            match GetScalarResult("FinalizeTypeCheck",partialBuild) with
             | Some((tcState,topAttribs,typedAssembly,tcEnv,tcImports,tcGlobals,tcConfig),_) -> tcState,topAttribs,typedAssembly,tcEnv,tcImports,tcGlobals,tcConfig
             | None -> failwith "Build was not evaluated."
         
@@ -1688,7 +1689,7 @@ module internal IncrementalFSharpBuild =
                 try
                     ParseCompilerOptions
                         (fun _sourceOrDll -> () )
-                        (Fscopts.GetCoreServiceCompilerOptions tcConfigB)
+                        (FscOptions.GetCoreServiceCompilerOptions tcConfigB)
                         commandLineArgs             
                 with e -> errorRecovery e range0
 
diff --git a/src/fsharp/vs/IncrementalBuild.fsi b/src/fsharp/vs/IncrementalBuild.fsi
index 104072bbcb8..4af29c6e87b 100644
--- a/src/fsharp/vs/IncrementalBuild.fsi
+++ b/src/fsharp/vs/IncrementalBuild.fsi
@@ -6,6 +6,7 @@ open Microsoft.FSharp.Compiler
 open Microsoft.FSharp.Compiler.Range
 open Microsoft.FSharp.Compiler.ErrorLogger
 open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
+open Microsoft.FSharp.Compiler.TcGlobals
 open Microsoft.FSharp.Compiler.Build
 
 
@@ -159,10 +160,10 @@ module internal IncrementalFSharpBuild =
       /// Ensure that the given file has been typechecked.
       /// Get the preceding typecheck state of a slot, allow stale results.
       member GetAntecedentTypeCheckResultsBySlot :
-        int -> (Build.TcState * Build.TcImports * Microsoft.FSharp.Compiler.Env.TcGlobals * Build.TcConfig * (PhasedError * bool) list * System.DateTime) option
+        int -> (Build.TcState * Build.TcImports * Microsoft.FSharp.Compiler.TcGlobals.TcGlobals * Build.TcConfig * (PhasedError * bool) list * System.DateTime) option
 
       /// Get the final typecheck result. Only allowed when 'generateTypedImplFiles' was set on Create, otherwise the TypedAssembly will have not implementations.
-      member TypeCheck : unit -> Build.TcState * TypeChecker.TopAttribs * Tast.TypedAssembly * TypeChecker.TcEnv * Build.TcImports * Env.TcGlobals * Build.TcConfig
+      member TypeCheck : unit -> Build.TcState * TypeChecker.TopAttribs * Tast.TypedAssembly * TypeChecker.TcEnv * Build.TcImports * TcGlobals * Build.TcConfig
 
       /// Attempts to find the slot of the given input file name. Throws an exception if it couldn't find it.    
       member GetSlotOfFileName : string -> int
diff --git a/src/fsharp/vs/ServiceDeclarations.fs b/src/fsharp/vs/ServiceDeclarations.fs
index 9b735734c88..6c0de2ab0a8 100644
--- a/src/fsharp/vs/ServiceDeclarations.fs
+++ b/src/fsharp/vs/ServiceDeclarations.fs
@@ -20,7 +20,7 @@ open Microsoft.FSharp.Compiler
 open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics 
 open Microsoft.FSharp.Compiler.PrettyNaming
 
-open Microsoft.FSharp.Compiler.Env 
+open Microsoft.FSharp.Compiler.TcGlobals 
 open Microsoft.FSharp.Compiler.Parser
 open Microsoft.FSharp.Compiler.Range
 open Microsoft.FSharp.Compiler.Ast
@@ -31,7 +31,7 @@ open Microsoft.FSharp.Compiler.Tastops
 open Microsoft.FSharp.Compiler.Lib
 open Microsoft.FSharp.Compiler.Layout
 open Microsoft.FSharp.Compiler.Infos
-open Microsoft.FSharp.Compiler.Nameres
+open Microsoft.FSharp.Compiler.NameResolution
 open ItemDescriptionIcons 
 
 module EnvMisc2 =
diff --git a/src/fsharp/vs/ServiceDeclarations.fsi b/src/fsharp/vs/ServiceDeclarations.fsi
index cc011e3cd45..ead479606d8 100644
--- a/src/fsharp/vs/ServiceDeclarations.fsi
+++ b/src/fsharp/vs/ServiceDeclarations.fsi
@@ -10,9 +10,9 @@ namespace Microsoft.FSharp.Compiler.SourceCodeServices
 open Microsoft.FSharp.Compiler 
 open Microsoft.FSharp.Compiler.Range
 open System.Collections.Generic
-open Microsoft.FSharp.Compiler.Env 
+open Microsoft.FSharp.Compiler.TcGlobals 
 open Microsoft.FSharp.Compiler.Infos
-open Microsoft.FSharp.Compiler.Nameres
+open Microsoft.FSharp.Compiler.NameResolution
 open Microsoft.FSharp.Compiler.Tast
 open Microsoft.FSharp.Compiler.Tastops
 
diff --git a/src/fsharp/vs/ServiceLexing.fs b/src/fsharp/vs/ServiceLexing.fs
index 65a7198ec19..4830e831ca6 100644
--- a/src/fsharp/vs/ServiceLexing.fs
+++ b/src/fsharp/vs/ServiceLexing.fs
@@ -646,7 +646,7 @@ type internal LineTokenizer(text:string,
                   | RQUOTE_DOT (s,raw) -> 
                       delayToken(DOT, rightc, rightc)
                       false, (RQUOTE (s,raw), leftc, rightc - 1)
-                  | INFIX_COMPARE_OP (Lexfilter.TyparsCloseOp(greaters,afterOp) as opstr) -> 
+                  | INFIX_COMPARE_OP (LexFilter.TyparsCloseOp(greaters,afterOp) as opstr) -> 
                       match afterOp with
                       | None -> ()
                       | Some tok -> delayToken(tok, leftc + greaters.Length, rightc)
diff --git a/src/fsharp/vs/service.fs b/src/fsharp/vs/service.fs
index e6f662dcc43..064226edd06 100644
--- a/src/fsharp/vs/service.fs
+++ b/src/fsharp/vs/service.fs
@@ -13,10 +13,10 @@ open System.Threading
 open System.Collections.Generic
  
 open Microsoft.FSharp.Core.Printf
+open Microsoft.FSharp.Compiler 
 open Microsoft.FSharp.Compiler.AbstractIL
 open Microsoft.FSharp.Compiler.AbstractIL.Internal  
 open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library  
-open Microsoft.FSharp.Compiler 
 open Microsoft.FSharp.Compiler.MSBuildResolver
 open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics 
 open Microsoft.FSharp.Compiler.PrettyNaming
@@ -24,7 +24,7 @@ open Internal.Utilities.Collections
 open Internal.Utilities.Debug
 open System.Security.Permissions
 
-open Microsoft.FSharp.Compiler.Env 
+open Microsoft.FSharp.Compiler.TcGlobals 
 open Microsoft.FSharp.Compiler.Parser
 open Microsoft.FSharp.Compiler.Range
 open Microsoft.FSharp.Compiler.Ast
@@ -39,7 +39,7 @@ open Microsoft.FSharp.Compiler.AbstractIL.IL
 open Microsoft.FSharp.Compiler.Layout
 open Microsoft.FSharp.Compiler.TypeChecker
 open Microsoft.FSharp.Compiler.Infos
-open Microsoft.FSharp.Compiler.Nameres
+open Microsoft.FSharp.Compiler.NameResolution
 open Internal.Utilities.StructuredFormat
 open ItemDescriptionIcons 
 open ItemDescriptionsImpl 
@@ -372,7 +372,7 @@ type Names = string list
 type NamesWithResidue = Names * string 
 
 []
-type CapturedNameResolution(p:pos, i:Item, io:ItemOccurence, de:DisplayEnv, nre:Nameres.NameResolutionEnv, ad:AccessorDomain, m:range) =
+type CapturedNameResolution(p:pos, i:Item, io:ItemOccurence, de:DisplayEnv, nre:NameResolution.NameResolutionEnv, ad:AccessorDomain, m:range) =
     member this.Pos = p
     member this.Item = i
     member this.ItemOccurence = io
@@ -391,7 +391,7 @@ type CapturedNameResolution(p:pos, i:Item, io:ItemOccurence, de:DisplayEnv, nre:
 type TypeCheckInfo
           (/// Information corresponding to miscellaneous command-line options (--define, etc).
            _sTcConfig: Build.TcConfig,
-           g: Env.TcGlobals,
+           g: TcGlobals,
            /// AssemblyName -> IL-Module 
            amap: Import.ImportMap,
            /// project directory, or directory containing the file that generated this scope if no project directory given 
@@ -399,9 +399,9 @@ type TypeCheckInfo
            sFile:string,
            /// Name resolution environments for every interesting region in the file. These regions may
            /// overlap, in which case the smallest region applicable should be used.
-           sEnvs: ResizeArray,
+           sEnvs: ResizeArray,
            /// This is a name resolution environment to use if no better match can be found.
-           sFallback:Nameres.NameResolutionEnv,
+           sFallback:NameResolution.NameResolutionEnv,
            /// Information of exact types found for expressions, that can be to the left of a dot.
            /// Also for exact name resolutions
            /// pos -- line and column
@@ -410,9 +410,9 @@ type TypeCheckInfo
            /// DisplayEnv -- information about printing. For example, should redundant keywords be hidden?
            /// NameResolutionEnv -- naming environment--for example, currently open namespaces.
            /// range -- the starting and ending position      
-           capturedExprTypings: ResizeArray<(pos * TType * DisplayEnv * Nameres.NameResolutionEnv * AccessorDomain * range)>,
-           capturedNameResolutions: ResizeArray<(pos * Item * ItemOccurence * DisplayEnv * Nameres.NameResolutionEnv * AccessorDomain * range)>,
-           capturedResolutionsWithMethodGroups: ResizeArray<(pos * Item * ItemOccurence * DisplayEnv * Nameres.NameResolutionEnv * AccessorDomain * range)>,
+           capturedExprTypings: ResizeArray<(pos * TType * DisplayEnv * NameResolution.NameResolutionEnv * AccessorDomain * range)>,
+           capturedNameResolutions: ResizeArray<(pos * Item * ItemOccurence * DisplayEnv * NameResolution.NameResolutionEnv * AccessorDomain * range)>,
+           capturedResolutionsWithMethodGroups: ResizeArray<(pos * Item * ItemOccurence * DisplayEnv * NameResolution.NameResolutionEnv * AccessorDomain * range)>,
            loadClosure : LoadClosure option,
            syncop:(unit->unit)->unit,
            checkAlive : (unit -> bool),
@@ -432,7 +432,7 @@ type TypeCheckInfo
     let getDataTipTextCache = AgedLookup(recentForgroundTypeCheckLookupSize,areSame=(fun (x,y) -> x = y))
     
     let infoReader = new InfoReader(g,amap)
-    let ncenv = new NameResolver(g,amap,infoReader,Nameres.FakeInstantiationGenerator)
+    let ncenv = new NameResolver(g,amap,infoReader,NameResolution.FakeInstantiationGenerator)
     
     /// Find the most precise naming environment for the given line and column
     let GetBestEnvForPos cursorPos  =
@@ -565,7 +565,7 @@ type TypeCheckInfo
                     // check that type of value is the same or subtype of tcref
                     // yes - allow access to protected members
                     // no - strip ability to access protected members
-                    if Microsoft.FSharp.Compiler.Typrelns.TypeFeasiblySubsumesType 0 g amap m tcref Microsoft.FSharp.Compiler.Typrelns.CanCoerce ty then
+                    if Microsoft.FSharp.Compiler.TypeRelations.TypeFeasiblySubsumesType 0 g amap m tcref Microsoft.FSharp.Compiler.TypeRelations.CanCoerce ty then
                         ad
                     else
                         AccessibleFrom(paths, None)
@@ -619,7 +619,7 @@ type TypeCheckInfo
                                             posEq r.Start rq.Start)
         match bestQual with
         | Some (_,typ,denv,_nenv,ad,m) when isRecdTy denv.g typ ->
-            let items = Nameres.ResolveRecordOrClassFieldsOfType ncenv m ad typ false
+            let items = NameResolution.ResolveRecordOrClassFieldsOfType ncenv m ad typ false
             Some (items, denv, m)
         | _ -> None
 
@@ -681,7 +681,7 @@ type TypeCheckInfo
         Trace.PrintLine("CompilerServicesVerbose", fun () -> sprintf "GetEnvironmentLookupResolutions: line = %d, colAtEndOfNamesAndResidue = %d, plid = %+A, showObsolete = %b\n" line colAtEndOfNamesAndResidue plid showObsolete)
         let cursorPos = Pos.fromVS line colAtEndOfNamesAndResidue
         let (nenv,ad),m = GetBestEnvForPos cursorPos
-        let items = Nameres.ResolvePartialLongIdent ncenv nenv (ConstraintSolver.IsApplicableMethApprox g amap m) m ad plid showObsolete
+        let items = NameResolution.ResolvePartialLongIdent ncenv nenv (ConstraintSolver.IsApplicableMethApprox g amap m) m ad plid showObsolete
         let items = items |> RemoveDuplicateItems g 
         let items = items |> RemoveExplicitlySuppressed g
         let items = items |> FilterItemsForCtors filterCtors 
@@ -693,7 +693,7 @@ type TypeCheckInfo
     let GetClassOrRecordFieldsEnvironmentLookupResolutions(line,colAtEndOfNamesAndResidue, plid, (_residue : string option)) = 
         let cursorPos = Pos.fromVS line colAtEndOfNamesAndResidue
         let (nenv, ad),m = GetBestEnvForPos cursorPos
-        let items = Nameres.ResolvePartialLongIdentToClassOrRecdFields ncenv nenv m ad plid false
+        let items = NameResolution.ResolvePartialLongIdentToClassOrRecdFields ncenv nenv m ad plid false
         let items = items |> RemoveDuplicateItems g 
         let items = items |> RemoveExplicitlySuppressed g
         items, nenv.DisplayEnv,m 
@@ -1201,7 +1201,7 @@ module internal Parser =
                             // Not ideal, but it's hard to see what else to do.
                             let fallbackRange = rangeN mainInputFileName 1
                             let ei = ErrorInfo.CreateFromExceptionAndAdjustEof(exn,warn,trim,fallbackRange,fileInfo)
-                            if (ei.FileName=mainInputFileName) || (ei.FileName=Microsoft.FSharp.Compiler.Env.DummyFileNameForRangesWithoutASpecificLocation) then
+                            if (ei.FileName=mainInputFileName) || (ei.FileName=Microsoft.FSharp.Compiler.TcGlobals.DummyFileNameForRangesWithoutASpecificLocation) then
                                 Trace.PrintLine("UntypedParseAux", fun _ -> sprintf "Reporting one error: %s\n" (ei.ToString()))
                                 errorsAndWarningsCollector.Add ei
                                 if not warn then 
@@ -1290,7 +1290,7 @@ module internal Parser =
               Lexhelp.usingLexbufForParsing (lexbuf, mainInputFileName) (fun lexbuf -> 
                   try 
                     let skip = true
-                    let tokenizer = Lexfilter.LexFilter (lightSyntaxStatus, tcConfig.compilingFslib, Lexer.token lexargs skip, lexbuf)
+                    let tokenizer = LexFilter.LexFilter (lightSyntaxStatus, tcConfig.compilingFslib, Lexer.token lexargs skip, lexbuf)
                     let lexfun = tokenizer.Lexer
                     if matchBracesOnly then 
                         // Quick bracket matching parse  
@@ -1355,7 +1355,7 @@ module internal Parser =
                                             member __.Equals((p1,i1),(p2,i2)) = posEq p1 p2 && i1 =  i2 } )
         let capturedMethodGroupResolutions = new ResizeArray<_>(100)
         let allowedRange (m:range) = not m.IsSynthetic
-        interface Nameres.ITypecheckResultsSink with
+        interface NameResolution.ITypecheckResultsSink with
             member sink.NotifyEnvWithScope(m,nenv,ad) = 
                 if allowedRange m then 
                     capturedEnvs.Add((m,nenv,ad)) 
@@ -1510,7 +1510,7 @@ module internal Parser =
                     let checkForErrors() = (parseHadErrors || errHandler.ErrorCount > 0)
                     // Typecheck is potentially a long running operation. We chop it up here with an Eventually continuation and, at each slice, give a chance
                     // for the client to claim the result as obsolete and have the typecheck abort.
-                    let computation = TypecheckSingleInputAndFinishEventually(checkForErrors,tcConfig, tcImports, tcGlobals, None, TcResultsSink.WithSink sink, tcState, parsedMainInput)
+                    let computation = TypeCheckSingleInputAndFinishEventually(checkForErrors,tcConfig, tcImports, tcGlobals, None, TcResultsSink.WithSink sink, tcState, parsedMainInput)
                     match computation |> Eventually.forceWhile (fun () -> not (isResultObsolete())) with
                     | Some((tcEnvAtEnd,_,_),_) -> Some tcEnvAtEnd
                     | None -> None // Means 'aborted'
@@ -2148,7 +2148,7 @@ module internal PrettyNaming =
 #if DEBUG
 
 namespace Internal.Utilities.Diagnostic
-open Microsoft.FSharp.Compiler.Env
+open Microsoft.FSharp.Compiler.TcGlobals
 open Microsoft.FSharp.Compiler.Tastops 
 open Microsoft.FSharp.Compiler.Infos
 open Microsoft.FSharp.Compiler
diff --git a/src/fsharp/vs/service.fsi b/src/fsharp/vs/service.fsi
index f678689cdc6..acf32204bd6 100644
--- a/src/fsharp/vs/service.fsi
+++ b/src/fsharp/vs/service.fsi
@@ -215,7 +215,7 @@ type internal InteractiveChecker =
 #if FSI_SERVER_INTELLISENSE
 // These functions determine all declarations, called by fsi.fs for fsi-server requests.
 module internal FsiIntelisense =
-    val getDeclarations : Build.TcConfig * Env.TcGlobals * Build.TcImports * Build.TcState -> string -> string[] -> (string * string * string * int)[]
+    val getDeclarations : Build.TcConfig * TcGlobals * Build.TcImports * Build.TcState -> string -> string[] -> (string * string * string * int)[]
 #endif
 
 module internal PrettyNaming =
diff --git a/src/ilx/pubclo.fs b/src/ilx/EraseClosures.fs
similarity index 99%
rename from src/ilx/pubclo.fs
rename to src/ilx/EraseClosures.fs
index d5824038aa5..f4c0030315e 100644
--- a/src/ilx/pubclo.fs
+++ b/src/ilx/EraseClosures.fs
@@ -1,6 +1,6 @@
 // Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
 
-module internal Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.EraseIlxFuncs
+module internal Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.EraseClosures
 
 open Internal.Utilities
 
diff --git a/src/ilx/pubclo.fsi b/src/ilx/EraseClosures.fsi
similarity index 97%
rename from src/ilx/pubclo.fsi
rename to src/ilx/EraseClosures.fsi
index 0ac9a5f6bfa..c888d77c4c6 100644
--- a/src/ilx/pubclo.fsi
+++ b/src/ilx/EraseClosures.fsi
@@ -1,7 +1,7 @@
 // Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
 
 /// Internal use only.  Erase closures
-module internal Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.EraseIlxFuncs
+module internal Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.EraseClosures
 
 open Microsoft.FSharp.Compiler.AbstractIL
 open Microsoft.FSharp.Compiler.AbstractIL.IL 
diff --git a/src/ilx/cu_erase.fs b/src/ilx/EraseUnions.fs
similarity index 99%
rename from src/ilx/cu_erase.fs
rename to src/ilx/EraseUnions.fs
index 84877a9c897..b7be424fd65 100644
--- a/src/ilx/cu_erase.fs
+++ b/src/ilx/EraseUnions.fs
@@ -5,7 +5,7 @@
 // -------------------------------------------------------------------- 
 
 
-module internal Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.EraseIlxUnions
+module internal Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.EraseUnions
 
 open Internal.Utilities
 open Microsoft.FSharp.Compiler.AbstractIL 
diff --git a/src/ilx/cu_erase.fsi b/src/ilx/EraseUnions.fsi
similarity index 97%
rename from src/ilx/cu_erase.fsi
rename to src/ilx/EraseUnions.fsi
index ecfc28a37a9..002258a43ee 100644
--- a/src/ilx/cu_erase.fsi
+++ b/src/ilx/EraseUnions.fsi
@@ -4,7 +4,7 @@
 // Internal use only.  Erase discriminated unions.
 // -------------------------------------------------------------------- 
 
-module internal Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.EraseIlxUnions
+module internal Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.EraseUnions
 
 open Microsoft.FSharp.Compiler.AbstractIL.IL
 open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types
diff --git a/src/utils/resizearray.fs b/src/utils/ResizeArray.fs
similarity index 100%
rename from src/utils/resizearray.fs
rename to src/utils/ResizeArray.fs
diff --git a/src/utils/resizearray.fsi b/src/utils/ResizeArray.fsi
similarity index 100%
rename from src/utils/resizearray.fsi
rename to src/utils/ResizeArray.fsi
diff --git a/src/utils/sformat.fs b/src/utils/sformat.fs
index e9e1686f315..17cbbd05d61 100644
--- a/src/utils/sformat.fs
+++ b/src/utils/sformat.fs
@@ -145,12 +145,6 @@ namespace Microsoft.FSharp.Text.StructuredFormat
 
         let aboveL  l r = mkNode l r (Broken 0)
 
-        let joinN i l r = mkNode l r (Breakable i)                                      
-        let join  = joinN 0
-        let join1 = joinN 1
-        let join2 = joinN 2
-        let join3 = joinN 3
-
         let tagAttrL tag attrs l = Attr(tag,attrs,l)
 
         let apply2 f l r = if isEmptyL l then r else
@@ -168,9 +162,9 @@ namespace Microsoft.FSharp.Text.StructuredFormat
             | [x]   -> x
             | x::xs ->
                 let rec process' prefixL = function
-                    []    -> prefixL
+                  | []    -> prefixL
                   | y::ys -> process' ((tagger prefixL) ++ y) ys
-                in  process' x xs
+                process' x xs
             
         let commaListL x = tagListL (fun prefixL -> prefixL ^^ rightL ",") x
         let semiListL x  = tagListL (fun prefixL -> prefixL ^^ rightL ";") x
@@ -184,7 +178,7 @@ namespace Microsoft.FSharp.Text.StructuredFormat
           | x::ys -> List.fold (fun pre y -> pre @@ y) x ys
 
         let optionL xL = function
-            None   -> wordL "None"
+          | None   -> wordL "None"
           | Some x -> wordL "Some" -- (xL x)
 
         let listL xL xs = leftL "[" ^^ sepListL (sepL ";") (List.map xL xs) ^^ rightL "]"