From 9566bbfff6f896e2d3658d1e05697635620a2790 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Sun, 25 Sep 2022 21:32:07 -0700 Subject: [PATCH] Fixed merge issues --- fcs/fcs-fable/service_slim.fs | 5 ++--- src/Compiler/AbstractIL/ilread.fs | 4 ++-- src/Compiler/Driver/CompilerConfig.fs | 2 ++ src/Compiler/Driver/CompilerConfig.fsi | 2 ++ src/Compiler/Driver/CompilerDiagnostics.fsi | 2 ++ src/Compiler/Driver/ParseAndCheckInputs.fs | 11 ++++++++++- src/Compiler/Facilities/DiagnosticsLogger.fs | 2 ++ src/Compiler/Service/FSharpCheckerResults.fs | 4 ++++ src/Compiler/Service/FSharpCheckerResults.fsi | 18 ------------------ 9 files changed, 26 insertions(+), 24 deletions(-) diff --git a/fcs/fcs-fable/service_slim.fs b/fcs/fcs-fable/service_slim.fs index 09a30702cdc..10b7a23f5b4 100644 --- a/fcs/fcs-fable/service_slim.fs +++ b/fcs/fcs-fable/service_slim.fs @@ -113,10 +113,9 @@ type internal CompilerStateCache(readAllBytes: string -> byte[], projectOptions: ) #endif - let niceNameGen = NiceNameGenerator() let assemblyName = projectOptions.ProjectFileName |> Path.GetFileNameWithoutExtension let tcInitial, openDecls0 = GetInitialTcEnv (assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals) - let tcInitialState = GetInitialTcState (rangeStartup, assemblyName, tcConfig, tcGlobals, tcImports, niceNameGen, tcInitial, openDecls0) + let tcInitialState = GetInitialTcState (rangeStartup, assemblyName, tcConfig, tcGlobals, tcImports, tcInitial, openDecls0) // parse cache, keyed on file name and source hash let parseCache = ConcurrentDictionary(HashIdentity.Structural) @@ -190,7 +189,7 @@ module internal ParseAndCheck = let input = parseResults.ParseTree let diagnosticsOptions = compilerState.tcConfig.diagnosticsOptions let capturingLogger = CompilationDiagnosticLogger("TypeCheckFile", diagnosticsOptions) - let diagnosticsLogger = GetDiagnosticsLoggerFilteringByScopedPragmas(false, GetScopedPragmasForInput(input), diagnosticsOptions, capturingLogger) + let diagnosticsLogger = GetDiagnosticsLoggerFilteringByScopedPragmas(false, input.ScopedPragmas, diagnosticsOptions, capturingLogger) use _scope = new CompilationGlobalsScope (diagnosticsLogger, BuildPhase.TypeCheck) let checkForErrors () = parseResults.ParseHadErrors || diagnosticsLogger.ErrorCount > 0 diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index af30435da35..0b19082ac11 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -1333,14 +1333,14 @@ let seekReadIndexedRowsRange numRows binaryChop (reader: ISeekReadIndexedRowRead startRid, endRid -let seekReadIndexedRowsByInterface numRows binaryChop (reader: ISeekReadIndexedRowReader<'RowT, _, _>) = +let seekReadIndexedRowsByInterface numRows binaryChop (reader: ISeekReadIndexedRowReader) = let startRid, endRid = seekReadIndexedRowsRange numRows binaryChop reader if startRid <= 0 || endRid < startRid then [||] else Array.init (endRid - startRid + 1) (fun i -> - let mutable row = Unchecked.defaultof<'RowT> + let mutable row = ref Unchecked.defaultof reader.GetRow(startRid + i, row) reader.ConvertRow(row)) diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index a1274bea0df..b28b23f60b8 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -1230,6 +1230,8 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = errorRecovery e range0 [] +#endif //!FABLE_COMPILER + member _.bufferWidth = data.bufferWidth member _.fsiMultiAssemblyEmit = data.fsiMultiAssemblyEmit member _.FxResolver = data.FxResolver diff --git a/src/Compiler/Driver/CompilerConfig.fsi b/src/Compiler/Driver/CompilerConfig.fsi index 2c099c207e3..47153e08300 100644 --- a/src/Compiler/Driver/CompilerConfig.fsi +++ b/src/Compiler/Driver/CompilerConfig.fsi @@ -867,9 +867,11 @@ type TcConfig = /// Check if the primary assembly is mscorlib member assumeDotNetFramework: bool +#endif //!FABLE_COMPILER member exiter: Exiter +#if !FABLE_COMPILER member parallelReferenceResolution: ParallelReferenceResolution /// Represents a computation to return a TcConfig. Normally this is just a constant immutable TcConfig, diff --git a/src/Compiler/Driver/CompilerDiagnostics.fsi b/src/Compiler/Driver/CompilerDiagnostics.fsi index 44d303b0c46..64077fcf06d 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fsi +++ b/src/Compiler/Driver/CompilerDiagnostics.fsi @@ -70,6 +70,7 @@ type PhasedDiagnostic with /// Indicates if a diagnostic should be reported as an error member ReportAsError: FSharpDiagnosticOptions * FSharpDiagnosticSeverity -> bool +#if !FABLE_COMPILER /// Output all of a diagnostic to a buffer, including range member Output: buf: StringBuilder * tcConfig: TcConfig * severity: FSharpDiagnosticSeverity -> unit @@ -81,6 +82,7 @@ type PhasedDiagnostic with tcConfig: TcConfig * severity: FSharpDiagnosticSeverity -> unit +#endif //!FABLE_COMPILER /// Get a diagnostics logger that filters the reporting of warnings based on scoped pragma information val GetDiagnosticsLoggerFilteringByScopedPragmas: diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index 2e2bdf178f3..29e192bafac 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -1399,6 +1399,8 @@ let CheckMultipleInputsSequential (ctok, checkForErrors, tcConfig, tcImports, tc (tcState, inputs) ||> List.mapFold (CheckOneInputEntry(ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, false)) +#if !FABLE_COMPILER + /// Use parallel checking of implementation files that have signature files let CheckMultipleInputsInParallel ( @@ -1511,12 +1513,19 @@ let CheckMultipleInputsInParallel results, tcState) -let CheckClosedInputSet (ctok, checkForErrors, tcConfig: TcConfig, tcImports, tcGlobals, prefixPathOpt, tcState, eagerFormat, inputs) = +#endif //!FABLE_COMPILER + +let CheckClosedInputSet (ctok, checkForErrors, tcConfig: TcConfig, tcImports, tcGlobals, prefixPathOpt, tcState, eagerFormat: (PhasedDiagnostic -> PhasedDiagnostic), inputs) = // tcEnvAtEndOfLastFile is the environment required by fsi.exe when incrementally adding definitions +#if FABLE_COMPILER + ignore eagerFormat +#endif let results, tcState = +#if !FABLE_COMPILER if tcConfig.parallelCheckingWithSignatureFiles then CheckMultipleInputsInParallel(ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcState, eagerFormat, inputs) else +#endif //!FABLE_COMPILER CheckMultipleInputsSequential(ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcState, inputs) let (tcEnvAtEndOfLastFile, topAttrs, implFiles, _), tcState = diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index dd828163ed2..b5acc96a30b 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -162,6 +162,7 @@ let rec AttachRange m (exn: exn) = | Failure msg -> InternalError(msg + " (Failure)", m) #if !FABLE_COMPILER | :? ArgumentException as exn -> InternalError(exn.Message + " (ArgumentException)", m) +#endif | _ -> exn type Exiter = @@ -859,6 +860,7 @@ type StackGuard(maxDepth: int, name: string) = #if FABLE_COMPILER ignore depth ignore maxDepth + ignore name f () #else //!FABLE_COMPILER depth <- depth + 1 diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index f3c8975e06b..9ff7f27d1af 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -2845,7 +2845,11 @@ type FSharpCheckFileResults match pageWidth with | None -> layout +#if FABLE_COMPILER + | Some _pageWidth -> layout +#else | Some pageWidth -> Display.squashTo pageWidth layout +#endif |> LayoutRender.showL |> SourceText.ofString) diff --git a/src/Compiler/Service/FSharpCheckerResults.fsi b/src/Compiler/Service/FSharpCheckerResults.fsi index 6b377347f64..52dcda281b7 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fsi +++ b/src/Compiler/Service/FSharpCheckerResults.fsi @@ -587,24 +587,6 @@ module internal ParseAndCheckFile = suggestNamesForErrors: bool -> (range * range)[] -// #if FABLE_COMPILER -// val CheckOneFile: -// parseResults: FSharpParseFileResults * -// sourceText: ISourceText * -// mainInputFileName: string * -// projectOptions: FSharpProjectOptions * -// projectFileName: string * -// tcConfig: TcConfig * -// tcGlobals: TcGlobals * -// tcImports: TcImports * -// tcState: TcState * -// moduleNamesDict: ModuleNamesDict * -// loadClosure: LoadClosure option * -// backgroundDiagnostics: (PhasedDiagnostic * FSharpDiagnosticSeverity)[] * -// suggestNamesForErrors: bool -// -> Cancellable -// #endif - #if !FABLE_COMPILER // An object to typecheck source in a given typechecking environment.