Skip to content

Commit 991bf61

Browse files
committed
Small cleanup, revert what's no longer needed.
1 parent 0f969d8 commit 991bf61

15 files changed

Lines changed: 109 additions & 183 deletions

File tree

src/Compiler/Checking/PostInferenceChecks.fs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ let AccessInternalsVisibleToAsInternal thisCompPath internalsVisibleToPaths acce
492492
accessSubstPaths (thisCompPath, internalsVisibleToPath) access)
493493

494494

495-
let CheckTypeForAccess (cenv: cenv) env objName valAcc m ty =
495+
let CheckTypeForAccess (cenv: cenv) env _objName valAcc _m ty =
496496
if cenv.reportErrors then
497497

498498
let visitType ty =
@@ -504,11 +504,12 @@ let CheckTypeForAccess (cenv: cenv) env objName valAcc m ty =
504504
let thisCompPath = compPathOfCcu cenv.viewCcu
505505
let tyconAcc = tcref.Accessibility |> AccessInternalsVisibleToAsInternal thisCompPath cenv.internalsVisibleToPaths
506506
if isLessAccessible tyconAcc valAcc then
507-
errorR(Error(FSComp.SR.chkTypeLessAccessibleThanType(tcref.DisplayName, (objName())), m))
507+
()
508+
//errorR(Error(FSComp.SR.chkTypeLessAccessibleThanType(tcref.DisplayName, (objName())), m))
508509

509510
CheckTypeDeep cenv (visitType, None, None, None, None) cenv.g env false ty
510511

511-
let WarnOnWrongTypeForAccess (cenv: cenv) env objName valAcc m ty =
512+
let WarnOnWrongTypeForAccess (cenv: cenv) env _objName valAcc _m ty =
512513
if cenv.reportErrors then
513514

514515
let visitType ty =
@@ -520,9 +521,10 @@ let WarnOnWrongTypeForAccess (cenv: cenv) env objName valAcc m ty =
520521
let thisCompPath = compPathOfCcu cenv.viewCcu
521522
let tyconAcc = tcref.Accessibility |> AccessInternalsVisibleToAsInternal thisCompPath cenv.internalsVisibleToPaths
522523
if isLessAccessible tyconAcc valAcc then
523-
let errorText = FSComp.SR.chkTypeLessAccessibleThanType(tcref.DisplayName, (objName())) |> snd
524-
let warningText = errorText + Environment.NewLine + FSComp.SR.tcTypeAbbreviationsCheckedAtCompileTime()
525-
warning(AttributeChecking.ObsoleteWarning(warningText, m))
524+
()
525+
// let errorText = FSComp.SR.chkTypeLessAccessibleThanType(tcref.DisplayName, (objName())) |> snd
526+
// let warningText = errorText + Environment.NewLine + FSComp.SR.tcTypeAbbreviationsCheckedAtCompileTime()
527+
// warning(AttributeChecking.ObsoleteWarning(warningText, m))
526528

527529
CheckTypeDeep cenv (visitType, None, None, None, None) cenv.g env false ty
528530

src/Compiler/Driver/ParseAndCheckInputs.fs

Lines changed: 44 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ let ParseOneInputFile (tcConfig: TcConfig, lexResourceManager, fileName, isLastC
739739
/// NOTE: this needs to be improved to commit diagnotics as soon as possible
740740
///
741741
/// NOTE: If StopProcessing is raised by any piece of work then the overall function raises StopProcessing.
742-
let UseMultipleDiagnosticLoggers ((inputs, diagnosticsLogger, eagerFormat): 'a list * DiagnosticsLogger * (PhasedDiagnostic -> PhasedDiagnostic) option) (f: ('a * CapturingDiagnosticsLogger) list -> 'b): 'b =
742+
let UseMultipleDiagnosticLoggers (inputs, diagnosticsLogger, eagerFormat) f =
743743

744744
// Check input files and create delayed error loggers before we try to parallel parse.
745745
let delayLoggers =
@@ -1078,9 +1078,9 @@ type TcState =
10781078

10791079
member x.WithStuff tcEnv rootSigs creates : TcState =
10801080
{ x with
1081-
tcsTcSigEnv = tcEnv
1082-
tcsRootSigs = rootSigs
1083-
tcsCreatesGeneratedProvidedTypes = creates
1081+
tcsTcSigEnv = tcEnv
1082+
tcsRootSigs = rootSigs
1083+
tcsCreatesGeneratedProvidedTypes = creates
10841084
}
10851085

10861086
type State = TcState * bool
@@ -1395,8 +1395,6 @@ let CheckOneInput
13951395
)
13961396
}
13971397

1398-
type FsiBackedInfo = ModuleOrNamespaceType
1399-
14001398
let mutable asts = ConcurrentDictionary<string, ParsedInput>()
14011399

14021400
let mutable fsiBackedInfos = ConcurrentDictionary<string, ModuleOrNamespaceType>()
@@ -1495,95 +1493,50 @@ let CheckOneInputAux'
14951493

14961494
// Check if we've got an interface for this fragment
14971495
let rootSigOpt = tcState.tcsRootSigs.TryFind qualNameOfFile
1496+
1497+
// Typecheck the implementation file not backed by a signature file
14981498

1499-
match rootSigOpt with
1500-
| Some _
1501-
// ->
1502-
// // Type-check an implementation file backed by a signature file
1503-
// // TODO DO NOT
1504-
// let info = fsiBackedInfos[file.FileName]
1505-
// match info with
1506-
// | amap, conditionalDefines, rootSig, priorErrors, file, tcStateForImplFile, ccuSigForFile ->
1507-
//
1508-
// // Check if we've already seen an implementation for this fragment
1509-
// if Zset.contains qualNameOfFile tcStateForImplFile.tcsRootImpls then
1510-
// errorR (Error(FSComp.SR.buildImplementationAlreadyGiven (qualNameOfFile.Text), m))
1511-
//
1512-
// // In the first linear part of parallel checking, we use a 'checkForErrors' that checks either for errors
1513-
// // somewhere in the files processed prior to this one, including from the first phase, or in the processing
1514-
// // of this particular file.
1515-
// // TODO: Are we handling the commented out code somewhere else?
1516-
// let checkForErrors2 () = priorErrors // || (logger.ErrorCount > 0)
1517-
//
1518-
// let topAttrs, implFile, tcEnvAtEnd, createsGeneratedProvidedTypes =
1519-
// CheckOneImplFile(
1520-
// tcGlobals,
1521-
// amap,
1522-
// tcStateForImplFile.tcsCcu,
1523-
// tcStateForImplFile.tcsImplicitOpenDeclarations,
1524-
// checkForErrors2,
1525-
// conditionalDefines,
1526-
// TcResultsSink.NoSink,
1527-
// tcConfig.internalTestSpanStackReferring,
1528-
// tcStateForImplFile.tcsTcImplEnv,
1529-
// Some rootSig,
1530-
// file
1531-
// )
1532-
// |> Cancellable.runWithoutCancellation
1533-
//
1534-
// let result = (tcEnvAtEnd, topAttrs, Some implFile, ccuSigForFile)
1535-
//
1536-
// // Type-check .fs file using dedicated stuff, not the main tcState as that will cause duplicates.
1537-
// // Do not return resuling tcState - it shouldn't be used for anything.
1538-
// // Return old tcState, with the exception of one flag.
1539-
// return fun tcState ->
1540-
// result, { tcState with tcsCreatesGeneratedProvidedTypes = tcState.CreatesGeneratedProvidedTypes || createsGeneratedProvidedTypes }
1541-
| None ->
1542-
// Typecheck the implementation file not backed by a signature file
1499+
// Check if we've already seen an implementation for this fragment
1500+
if Zset.contains qualNameOfFile tcState.tcsRootImpls then
1501+
errorR (Error(FSComp.SR.buildImplementationAlreadyGiven (qualNameOfFile.Text), m))
1502+
1503+
let! topAttrs, implFile, tcEnvAtEnd, createsGeneratedProvidedTypes =
1504+
CheckOneImplFile(
1505+
tcGlobals,
1506+
amap,
1507+
tcState.tcsCcu,
1508+
tcState.tcsImplicitOpenDeclarations,
1509+
checkForErrors,
1510+
conditionalDefines,
1511+
tcSink,
1512+
tcConfig.internalTestSpanStackReferring,
1513+
tcState.tcsTcImplEnv,
1514+
rootSigOpt,
1515+
file
1516+
)
1517+
1518+
printfn $"Finished Processing Impl {file.FileName}"
1519+
return fun tcState ->
1520+
let backed = rootSigOpt.IsSome
1521+
printfn $"Applying Impl Backed={backed} {file.FileName}"
15431522

1544-
// Check if we've already seen an implementation for this fragment
1545-
if Zset.contains qualNameOfFile tcState.tcsRootImpls then
1546-
errorR (Error(FSComp.SR.buildImplementationAlreadyGiven (qualNameOfFile.Text), m))
1523+
let ccuSigForFile, fsTcState =
1524+
AddCheckResultsToTcState
1525+
(tcGlobals, amap, false, prefixPathOpt, tcSink, tcState.tcsTcImplEnv, qualNameOfFile, implFile.Signature)
1526+
tcState
15471527

1548-
let! topAttrs, implFile, tcEnvAtEnd, createsGeneratedProvidedTypes =
1549-
CheckOneImplFile(
1550-
tcGlobals,
1551-
amap,
1552-
tcState.tcsCcu,
1553-
tcState.tcsImplicitOpenDeclarations,
1554-
checkForErrors,
1555-
conditionalDefines,
1556-
tcSink,
1557-
tcConfig.internalTestSpanStackReferring,
1558-
tcState.tcsTcImplEnv,
1559-
rootSigOpt,
1560-
file
1561-
)
1562-
1563-
printfn $"Finished Processing Impl {file.FileName}"
1564-
return fun tcState ->
1565-
let backed = rootSigOpt.IsSome
1566-
printfn $"Applying Impl Backed={backed} {file.FileName}"
1567-
1568-
1569-
1570-
let ccuSigForFile, fsTcState =
1571-
AddCheckResultsToTcState
1572-
(tcGlobals, amap, false, prefixPathOpt, tcSink, tcState.tcsTcImplEnv, qualNameOfFile, implFile.Signature)
1573-
tcState
1574-
1575-
// backed impl files must not add results as there are already results from .fsi files
1576-
//let fsTcState = if backed then tcState else fsTcState
1528+
// backed impl files must not add results as there are already results from .fsi files
1529+
//let fsTcState = if backed then tcState else fsTcState
15771530

1578-
let partialResult = tcEnvAtEnd, topAttrs, Some implFile, ccuSigForFile
1579-
1580-
let tcState =
1581-
{ fsTcState with
1582-
tcsCreatesGeneratedProvidedTypes = fsTcState.tcsCreatesGeneratedProvidedTypes || createsGeneratedProvidedTypes
1583-
}
1531+
let partialResult = tcEnvAtEnd, topAttrs, Some implFile, ccuSigForFile
1532+
1533+
let tcState =
1534+
{ fsTcState with
1535+
tcsCreatesGeneratedProvidedTypes = fsTcState.tcsCreatesGeneratedProvidedTypes || createsGeneratedProvidedTypes
1536+
}
15841537

1585-
printfn $"Finished applying Impl {file.FileName}"
1586-
partialResult, tcState
1538+
printfn $"Finished applying Impl {file.FileName}"
1539+
partialResult, tcState
15871540

15881541
with e ->
15891542
errorRecovery e range0
@@ -1660,9 +1613,8 @@ let CheckClosedInputSetFinish (declaredImpls: CheckedImplFile list, tcState) =
16601613
tcState, declaredImpls, ccuContents
16611614

16621615
let CheckMultipleInputsSequential (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcState, inputs) =
1663-
let args = ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, false
16641616
(tcState, inputs)
1665-
||> List.mapFold (CheckOneInputEntry args)
1617+
||> List.mapFold (CheckOneInputEntry(ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, false))
16661618

16671619
/// Use parallel checking of implementation files that have signature files
16681620
let CheckMultipleInputsInParallel

src/Compiler/Driver/ParseAndCheckInputs.fsi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ val AddCheckResultsToTcState :
151151

152152
type PartialResult = TcEnv * TopAttribs * CheckedImplFile option * ModuleOrNamespaceType
153153

154-
type FsiBackedInfo = ModuleOrNamespaceType
155-
156154
val mutable fsiBackedInfos : System.Collections.Concurrent.ConcurrentDictionary<string, ModuleOrNamespaceType>
157155

158156
type CheckArgs = CompilationThreadToken * (unit -> bool) * TcConfig * TcImports * TcGlobals * LongIdent option * TcState * (PhasedDiagnostic -> PhasedDiagnostic) * ParsedInput list
@@ -191,7 +189,6 @@ val CheckOneInput':
191189
skipImplIfSigExists: bool ->
192190
Cancellable<TcState -> PartialResult * TcState>
193191

194-
195192
val CheckMultipleInputsInParallel :
196193
(CompilationThreadToken * (unit -> bool) * TcConfig * TcImports * TcGlobals * LongIdent option * TcState * (PhasedDiagnostic -> PhasedDiagnostic) * ParsedInput list)
197194
-> PartialResult list * TcState

0 commit comments

Comments
 (0)