Skip to content

Commit 7f912e2

Browse files
authored
Cleanup (#13113)
* cleanup * split files * rename * split infos.fs and SymbolHelpres.fs * split infos.fs and SymbolHelpres.fs * fix code formating * rename autobox --> LowerLocalMutables * adjust names * block --> ImmutableArray * format * Error --> SRDiagnostic * Error --> SRDiagnostic * this -> _ * rename and cleanup * rename Diagnostic --> FormattedDiagnostic * format sigs * format sigs * fix build * fix build
1 parent 4cabd18 commit 7f912e2

File tree

183 files changed

+3483
-2946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+3483
-2946
lines changed

src/fsharp/AccessibilityLogic.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ module internal FSharp.Compiler.AccessibilityLogic
66
open Internal.Utilities.Library
77
open FSharp.Compiler
88
open FSharp.Compiler.AbstractIL.IL
9-
open FSharp.Compiler.ErrorLogger
9+
open FSharp.Compiler.DiagnosticsLogger
1010
open FSharp.Compiler.Infos
1111
open FSharp.Compiler.TcGlobals
1212
open FSharp.Compiler.TypedTree
1313
open FSharp.Compiler.TypedTreeBasics
1414
open FSharp.Compiler.TypedTreeOps
15+
open FSharp.Compiler.TypeHierarchy
1516

1617
#if !NO_TYPEPROVIDERS
1718
open FSharp.Compiler.TypeProviders

src/fsharp/AttributeChecking.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ open System.Collections.Generic
99
open Internal.Utilities.Library
1010
open FSharp.Compiler.AbstractIL.IL
1111
open FSharp.Compiler
12-
open FSharp.Compiler.ErrorLogger
12+
open FSharp.Compiler.DiagnosticsLogger
13+
open FSharp.Compiler.Import
1314
open FSharp.Compiler.Infos
1415
open FSharp.Compiler.TcGlobals
1516
open FSharp.Compiler.Text
1617
open FSharp.Compiler.TypedTree
1718
open FSharp.Compiler.TypedTreeOps
19+
open FSharp.Compiler.TypeHierarchy
1820

1921
#if !NO_TYPEPROVIDERS
2022
open FSharp.Compiler.TypeProviders
@@ -87,7 +89,7 @@ type AttribInfo =
8789
match x with
8890
| FSAttribInfo(_g, Attrib(tcref, _, _, _, _, _, _)) -> tcref
8991
| ILAttribInfo (g, amap, scoref, a, m) ->
90-
let ty = ImportILType scoref amap m [] a.Method.DeclaringType
92+
let ty = RescopeAndImportILType scoref amap m [] a.Method.DeclaringType
9193
tcrefOfAppTy g ty
9294

9395
member x.ConstructorArguments =
@@ -101,7 +103,7 @@ type AttribInfo =
101103
| ILAttribInfo (_g, amap, scoref, cattr, m) ->
102104
let parms, _args = decodeILAttribData cattr
103105
[ for argTy, arg in Seq.zip cattr.Method.FormalArgTypes parms ->
104-
let ty = ImportILType scoref amap m [] argTy
106+
let ty = RescopeAndImportILType scoref amap m [] argTy
105107
let obj = evalILAttribElem arg
106108
ty, obj ]
107109

@@ -116,7 +118,7 @@ type AttribInfo =
116118
| ILAttribInfo (_g, amap, scoref, cattr, m) ->
117119
let _parms, namedArgs = decodeILAttribData cattr
118120
[ for nm, argTy, isProp, arg in namedArgs ->
119-
let ty = ImportILType scoref amap m [] argTy
121+
let ty = RescopeAndImportILType scoref amap m [] argTy
120122
let obj = evalILAttribElem arg
121123
let isField = not isProp
122124
ty, nm, isField, obj ]

src/fsharp/AttributeChecking.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module internal FSharp.Compiler.AttributeChecking
77
open System.Collections.Generic
88
open FSharp.Compiler.AbstractIL.IL
99
open FSharp.Compiler
10-
open FSharp.Compiler.ErrorLogger
10+
open FSharp.Compiler.DiagnosticsLogger
1111
open FSharp.Compiler.Infos
1212
open FSharp.Compiler.TcGlobals
1313
open FSharp.Compiler.Text

src/fsharp/AugmentWithHashCompare.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ module internal FSharp.Compiler.AugmentWithHashCompare
55

66
open Internal.Utilities.Library
77
open FSharp.Compiler.AbstractIL.IL
8-
open FSharp.Compiler.ErrorLogger
9-
open FSharp.Compiler.Infos
8+
open FSharp.Compiler.DiagnosticsLogger
109
open FSharp.Compiler.Syntax
1110
open FSharp.Compiler.SyntaxTrivia
1211
open FSharp.Compiler.Xml
1312
open FSharp.Compiler.TcGlobals
1413
open FSharp.Compiler.TypedTree
1514
open FSharp.Compiler.TypedTreeBasics
1615
open FSharp.Compiler.TypedTreeOps
16+
open FSharp.Compiler.TypeHierarchy
1717

1818
let mkIComparableCompareToSlotSig (g: TcGlobals) =
1919
TSlotSig("CompareTo", g.mk_IComparable_ty, [], [], [[TSlotParam(Some("obj"), g.obj_ty, false, false, false, [])]], Some g.int_ty)
@@ -175,7 +175,7 @@ let mkEqualsTestConjuncts g m exprs =
175175
List.foldBack (fun e acc -> mkCond DebugPointAtBinding.NoneAtSticky m g.bool_ty e acc (mkFalse g m)) a b
176176

177177
let mkMinimalTy (g: TcGlobals) (tcref: TyconRef) =
178-
if tcref.Deref.IsExceptionDecl then [], g.exn_ty
178+
if tcref.Deref.IsFSharpException then [], g.exn_ty
179179
else generalizeTyconRef g tcref
180180

181181
// check for nulls
@@ -679,7 +679,7 @@ let isTrueFSharpStructTycon _g (tycon: Tycon) =
679679
let canBeAugmentedWithEquals g (tycon: Tycon) =
680680
tycon.IsUnionTycon ||
681681
tycon.IsRecordTycon ||
682-
(tycon.IsExceptionDecl && isNominalExnc tycon) ||
682+
(tycon.IsFSharpException && isNominalExnc tycon) ||
683683
isTrueFSharpStructTycon g tycon
684684

685685
let canBeAugmentedWithCompare g (tycon: Tycon) =
@@ -918,7 +918,7 @@ let MakeValsForEqualsAugmentation g (tcref: TyconRef) =
918918
let tps = tcref.Typars m
919919

920920
let objEqualsVal = mkValSpec g tcref ty vis (Some(mkEqualsSlotSig g)) "Equals" (tps +-> (mkEqualsObjTy g ty)) unaryArg
921-
let nocEqualsVal = mkValSpec g tcref ty vis (if tcref.Deref.IsExceptionDecl then None else Some(mkGenericIEquatableEqualsSlotSig g ty)) "Equals" (tps +-> (mkEqualsTy g ty)) unaryArg
921+
let nocEqualsVal = mkValSpec g tcref ty vis (if tcref.Deref.IsFSharpException then None else Some(mkGenericIEquatableEqualsSlotSig g ty)) "Equals" (tps +-> (mkEqualsTy g ty)) unaryArg
922922
objEqualsVal, nocEqualsVal
923923

924924
let MakeValsForEqualityWithComparerAugmentation g (tcref: TyconRef) =
@@ -1032,7 +1032,7 @@ let MakeBindingsForEqualityWithComparerAugmentation (g: TcGlobals) (tycon: Tycon
10321032
(mkCompGenBind withcEqualsVal.Deref withcEqualsExpr)]
10331033
if tycon.IsUnionTycon then mkStructuralEquatable mkUnionHashWithComparer mkUnionEqualityWithComparer
10341034
elif (tycon.IsRecordTycon || tycon.IsStructOrEnumTycon) then mkStructuralEquatable mkRecdHashWithComparer mkRecdEqualityWithComparer
1035-
elif tycon.IsExceptionDecl then mkStructuralEquatable mkExnHashWithComparer mkExnEqualityWithComparer
1035+
elif tycon.IsFSharpException then mkStructuralEquatable mkExnHashWithComparer mkExnEqualityWithComparer
10361036
else []
10371037

10381038
let MakeBindingsForEqualsAugmentation (g: TcGlobals) (tycon: Tycon) =
@@ -1066,7 +1066,7 @@ let MakeBindingsForEqualsAugmentation (g: TcGlobals) (tycon: Tycon) =
10661066

10671067
[ mkCompGenBind nocEqualsVal.Deref nocEqualsExpr
10681068
mkCompGenBind objEqualsVal.Deref objEqualsExpr ]
1069-
if tycon.IsExceptionDecl then mkEquals mkExnEquality
1069+
if tycon.IsFSharpException then mkEquals mkExnEquality
10701070
elif tycon.IsUnionTycon then mkEquals mkUnionEquality
10711071
elif tycon.IsRecordTycon || tycon.IsStructOrEnumTycon then mkEquals mkRecdEquality
10721072
else []

src/fsharp/BuildGraph.fs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ open System.Threading
77
open System.Threading.Tasks
88
open System.Diagnostics
99
open System.Globalization
10-
open FSharp.Compiler.ErrorLogger
10+
open FSharp.Compiler.DiagnosticsLogger
1111
open Internal.Utilities.Library
1212

1313
[<NoEquality;NoComparison>]
1414
type NodeCode<'T> = Node of Async<'T>
1515

1616
let wrapThreadStaticInfo computation =
1717
async {
18-
let errorLogger = CompileThreadStatic.ErrorLogger
18+
let errorLogger = CompileThreadStatic.DiagnosticsLogger
1919
let phase = CompileThreadStatic.BuildPhase
2020
try
2121
return! computation
2222
finally
23-
CompileThreadStatic.ErrorLogger <- errorLogger
23+
CompileThreadStatic.DiagnosticsLogger <- errorLogger
2424
CompileThreadStatic.BuildPhase <- phase
2525
}
2626

@@ -72,7 +72,7 @@ type NodeCodeBuilder() =
7272
member _.Using(value: CompilationGlobalsScope, binder: CompilationGlobalsScope -> NodeCode<'U>) =
7373
Node(
7474
async {
75-
CompileThreadStatic.ErrorLogger <- value.ErrorLogger
75+
CompileThreadStatic.DiagnosticsLogger <- value.DiagnosticsLogger
7676
CompileThreadStatic.BuildPhase <- value.BuildPhase
7777
try
7878
return! binder value |> Async.AwaitNodeCode
@@ -90,19 +90,19 @@ type NodeCode private () =
9090
Node(wrapThreadStaticInfo Async.CancellationToken)
9191

9292
static member RunImmediate (computation: NodeCode<'T>, ct: CancellationToken) =
93-
let errorLogger = CompileThreadStatic.ErrorLogger
93+
let errorLogger = CompileThreadStatic.DiagnosticsLogger
9494
let phase = CompileThreadStatic.BuildPhase
9595
try
9696
try
9797
let work =
9898
async {
99-
CompileThreadStatic.ErrorLogger <- errorLogger
99+
CompileThreadStatic.DiagnosticsLogger <- errorLogger
100100
CompileThreadStatic.BuildPhase <- phase
101101
return! computation |> Async.AwaitNodeCode
102102
}
103103
Async.StartImmediateAsTask(work, cancellationToken=ct).Result
104104
finally
105-
CompileThreadStatic.ErrorLogger <- errorLogger
105+
CompileThreadStatic.DiagnosticsLogger <- errorLogger
106106
CompileThreadStatic.BuildPhase <- phase
107107
with
108108
| :? AggregateException as ex when ex.InnerExceptions.Count = 1 ->
@@ -112,18 +112,18 @@ type NodeCode private () =
112112
NodeCode.RunImmediate(computation, CancellationToken.None)
113113

114114
static member StartAsTask_ForTesting (computation: NodeCode<'T>, ?ct: CancellationToken) =
115-
let errorLogger = CompileThreadStatic.ErrorLogger
115+
let errorLogger = CompileThreadStatic.DiagnosticsLogger
116116
let phase = CompileThreadStatic.BuildPhase
117117
try
118118
let work =
119119
async {
120-
CompileThreadStatic.ErrorLogger <- errorLogger
120+
CompileThreadStatic.DiagnosticsLogger <- errorLogger
121121
CompileThreadStatic.BuildPhase <- phase
122122
return! computation |> Async.AwaitNodeCode
123123
}
124124
Async.StartAsTask(work, cancellationToken=defaultArg ct CancellationToken.None)
125125
finally
126-
CompileThreadStatic.ErrorLogger <- errorLogger
126+
CompileThreadStatic.DiagnosticsLogger <- errorLogger
127127
CompileThreadStatic.BuildPhase <- phase
128128

129129
static member CancellationToken = cancellationToken

src/fsharp/BuildGraph.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module internal FSharp.Compiler.BuildGraph
55
open System
66
open System.Threading
77
open System.Threading.Tasks
8-
open FSharp.Compiler.ErrorLogger
8+
open FSharp.Compiler.DiagnosticsLogger
99
open Internal.Utilities.Library
1010

1111
/// Represents code that can be run as part of the build graph.

src/fsharp/CheckComputationExpressions.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ open FSharp.Compiler.AccessibilityLogic
99
open FSharp.Compiler.AttributeChecking
1010
open FSharp.Compiler.CheckExpressions
1111
open FSharp.Compiler.ConstraintSolver
12-
open FSharp.Compiler.ErrorLogger
12+
open FSharp.Compiler.DiagnosticsLogger
1313
open FSharp.Compiler.Features
1414
open FSharp.Compiler.Infos
1515
open FSharp.Compiler.InfoReader

src/fsharp/CheckDeclarations.fs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ open FSharp.Compiler.CheckExpressions
1818
open FSharp.Compiler.CheckComputationExpressions
1919
open FSharp.Compiler.CompilerGlobalState
2020
open FSharp.Compiler.ConstraintSolver
21-
open FSharp.Compiler.ErrorLogger
21+
open FSharp.Compiler.DiagnosticsLogger
2222
open FSharp.Compiler.Features
2323
open FSharp.Compiler.Infos
2424
open FSharp.Compiler.InfoReader
@@ -35,6 +35,7 @@ open FSharp.Compiler.TcGlobals
3535
open FSharp.Compiler.TypedTree
3636
open FSharp.Compiler.TypedTreeBasics
3737
open FSharp.Compiler.TypedTreeOps
38+
open FSharp.Compiler.TypeHierarchy
3839
open FSharp.Compiler.TypeRelations
3940

4041
#if !NO_TYPEPROVIDERS
@@ -374,7 +375,7 @@ let ImplicitlyOpenOwnNamespace tcSink g amap scopem enclosingNamespacePath (env:
374375
// Bind elements of data definitions for exceptions and types (fields, etc.)
375376
//-------------------------------------------------------------------------
376377

377-
exception NotUpperCaseConstructor of range
378+
exception NotUpperCaseConstructor of range: range
378379

379380
let CheckNamespaceModuleOrTypeName (g: TcGlobals) (id: Ident) =
380381
// type names '[]' etc. are used in fslib
@@ -678,7 +679,7 @@ let TcOpenDecl (cenv: cenv) mOpenDecl scopem env target =
678679
| SynOpenDeclTarget.Type (synType, m) ->
679680
TcOpenTypeDecl cenv mOpenDecl scopem env (synType, m)
680681

681-
exception ParameterlessStructCtor of range
682+
exception ParameterlessStructCtor of range: range
682683

683684
let MakeSafeInitField (g: TcGlobals) env m isStatic =
684685
let id =
@@ -2290,7 +2291,7 @@ module MutRecBindingChecking =
22902291
let moduleAbbrevs = decls |> List.choose (function MutRecShape.ModuleAbbrev (MutRecDataForModuleAbbrev (id, mp, m)) -> Some (id, mp, m) | _ -> None)
22912292
let opens = decls |> List.choose (function MutRecShape.Open (MutRecDataForOpen (target, m, moduleRange, openDeclsRef)) -> Some (target, m, moduleRange, openDeclsRef) | _ -> None)
22922293
let lets = decls |> List.collect (function MutRecShape.Lets binds -> getVals binds | _ -> [])
2293-
let exns = tycons |> List.filter (fun (tycon: Tycon) -> tycon.IsExceptionDecl)
2294+
let exns = tycons |> List.filter (fun (tycon: Tycon) -> tycon.IsFSharpException)
22942295

22952296
// Add the type definitions, exceptions, modules and "open" declarations.
22962297
// The order here is sensitive. The things added first will be resolved in an environment
@@ -2475,7 +2476,7 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial bindsm scopem mutRecNSInfo (env
24752476
let overridesOK = DeclKind.CanOverrideOrImplement declKind
24762477
members |> List.collect (function
24772478
| SynMemberDefn.Interface(interfaceType=intfTy; members=defnOpt) ->
2478-
let ty = if tcref.Deref.IsExceptionDecl then g.exn_ty else generalizedTyconRef g tcref
2479+
let ty = if tcref.Deref.IsFSharpException then g.exn_ty else generalizedTyconRef g tcref
24792480
let m = intfTy.Range
24802481
if tcref.IsTypeAbbrev then error(Error(FSComp.SR.tcTypeAbbreviationsCannotHaveInterfaceDeclaration(), m))
24812482
if tcref.IsEnumTycon then error(Error(FSComp.SR.tcEnumerationsCannotHaveInterfaceDeclaration(), m))
@@ -2600,7 +2601,7 @@ module AddAugmentationDeclarations =
26002601
if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare g tycon && scSet.Contains tycon.Stamp then
26012602
let tcref = mkLocalTyconRef tycon
26022603
let tcaug = tycon.TypeContents
2603-
let ty = if tcref.Deref.IsExceptionDecl then g.exn_ty else generalizedTyconRef g tcref
2604+
let ty = if tcref.Deref.IsFSharpException then g.exn_ty else generalizedTyconRef g tcref
26042605
let m = tycon.Range
26052606
let genericIComparableTy = mkAppTy g.system_GenericIComparable_tcref [ty]
26062607

@@ -2623,7 +2624,7 @@ module AddAugmentationDeclarations =
26232624

26242625
PublishInterface cenv env.DisplayEnv tcref m true g.mk_IStructuralComparable_ty
26252626
PublishInterface cenv env.DisplayEnv tcref m true g.mk_IComparable_ty
2626-
if not tycon.IsExceptionDecl && not hasExplicitGenericIComparable then
2627+
if not tycon.IsFSharpException && not hasExplicitGenericIComparable then
26272628
PublishInterface cenv env.DisplayEnv tcref m true genericIComparableTy
26282629
tcaug.SetCompare (mkLocalValRef cvspec1, mkLocalValRef cvspec2)
26292630
tcaug.SetCompareWith (mkLocalValRef cvspec3)
@@ -2684,7 +2685,7 @@ module AddAugmentationDeclarations =
26842685
if AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tycon then
26852686
let tcref = mkLocalTyconRef tycon
26862687
let tcaug = tycon.TypeContents
2687-
let ty = if tcref.Deref.IsExceptionDecl then g.exn_ty else generalizedTyconRef g tcref
2688+
let ty = if tcref.Deref.IsFSharpException then g.exn_ty else generalizedTyconRef g tcref
26882689
let m = tycon.Range
26892690

26902691
// Note: tycon.HasOverride only gives correct results after we've done the type augmentation
@@ -2701,7 +2702,7 @@ module AddAugmentationDeclarations =
27012702

27022703
let vspec1, vspec2 = AugmentWithHashCompare.MakeValsForEqualsAugmentation g tcref
27032704
tcaug.SetEquals (mkLocalValRef vspec1, mkLocalValRef vspec2)
2704-
if not tycon.IsExceptionDecl then
2705+
if not tycon.IsFSharpException then
27052706
PublishInterface cenv env.DisplayEnv tcref m true (mkAppTy g.system_GenericIEquatable_tcref [ty])
27062707
PublishValueDefn cenv env ModuleOrMemberBinding vspec1
27072708
PublishValueDefn cenv env ModuleOrMemberBinding vspec2
@@ -4606,7 +4607,7 @@ module EstablishTypeDefinitionCores =
46064607
(envMutRecPrelim, withAttrs)
46074608
||> MutRecShapes.extendEnvs (fun envForDecls decls ->
46084609
let tycons = decls |> List.choose (function MutRecShape.Tycon (_, Some (tycon, _)) -> Some tycon | _ -> None)
4609-
let exns = tycons |> List.filter (fun tycon -> tycon.IsExceptionDecl)
4610+
let exns = tycons |> List.filter (fun tycon -> tycon.IsFSharpException)
46104611
let envForDecls = (envForDecls, exns) ||> List.fold (AddLocalExnDefnAndReport cenv.tcSink scopem)
46114612
envForDecls)
46124613

src/fsharp/CheckDeclarations.fsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ val CheckOneSigFile:
7474
ParsedSigFileInput ->
7575
Cancellable<TcEnv * ModuleOrNamespaceType * bool>
7676

77-
exception ParameterlessStructCtor of range
77+
exception ParameterlessStructCtor of range: range
7878

79-
exception NotUpperCaseConstructor of range
79+
exception NotUpperCaseConstructor of range: range

0 commit comments

Comments
 (0)