From 6edaa179266cd5805d768e002afb8c8d297dd18a Mon Sep 17 00:00:00 2001 From: Petr Pokorny Date: Mon, 6 Jan 2025 17:29:02 +0100 Subject: [PATCH 1/4] Remove FSharpProjectOptions from Transparent Compiler check results --- src/Compiler/Service/BackgroundCompiler.fs | 4 ++-- src/Compiler/Service/FSharpCheckerResults.fs | 12 ++++++------ src/Compiler/Service/FSharpCheckerResults.fsi | 4 ++-- src/Compiler/Service/TransparentCompiler.fs | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Compiler/Service/BackgroundCompiler.fs b/src/Compiler/Service/BackgroundCompiler.fs index 1089f5774e8..ade90c9da3f 100644 --- a/src/Compiler/Service/BackgroundCompiler.fs +++ b/src/Compiler/Service/BackgroundCompiler.fs @@ -1065,7 +1065,7 @@ type internal BackgroundCompiler tcProj.TcGlobals, options.IsIncompleteTypeCheckEnvironment, Some builder, - options, + Some options, Array.ofList tcDependencyFiles, creationDiags, parseResults.Diagnostics, @@ -1247,7 +1247,7 @@ type internal BackgroundCompiler tcEnvAtEnd.AccessRights, tcAssemblyExprOpt, Array.ofList tcDependencyFiles, - options) + Some options) let results = FSharpCheckProjectResults( diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 1c7878c6df8..7d1306e8684 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -348,7 +348,7 @@ type internal TypeCheckInfo tcAccessRights: AccessorDomain, projectFileName: string, mainInputFileName: string, - projectOptions: FSharpProjectOptions, + projectOptions: FSharpProjectOptions option, sResolutions: TcResolutions, sSymbolUses: TcSymbolUses, sFallback: NameResolutionEnv, @@ -3289,7 +3289,7 @@ module internal ParseAndCheckFile = tcEnvAtEnd.AccessRights, projectFileName, mainInputFileName, - projectOptions, + Some projectOptions, sink.GetResolutions(), sink.GetSymbolUses(), tcEnvAtEnd.NameEnv, @@ -3302,9 +3302,9 @@ module internal ParseAndCheckFile = } [] -type FSharpProjectContext(thisCcu: CcuThunk, assemblies: FSharpAssembly list, ad: AccessorDomain, projectOptions: FSharpProjectOptions) = +type FSharpProjectContext(thisCcu: CcuThunk, assemblies: FSharpAssembly list, ad: AccessorDomain, projectOptions: FSharpProjectOptions option) = - member _.ProjectOptions = projectOptions + member _.ProjectOptions = projectOptions |> Option.defaultWith (fun () -> failwith "not available") member _.GetReferencedAssemblies() = assemblies @@ -3713,7 +3713,7 @@ type FSharpCheckProjectResults AccessorDomain * CheckedImplFile list option * string[] * - FSharpProjectOptions) option + FSharpProjectOptions option) option ) = let getDetails () = @@ -4009,7 +4009,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, tcConfig: TcConfig, tcGlobal tcState.TcEnvFromImpls.AccessRights, None, dependencyFiles, - projectOptions) + Some projectOptions) let projectResults = FSharpCheckProjectResults(fileName, Some tcConfig, keepAssemblyContents, errors, Some details) diff --git a/src/Compiler/Service/FSharpCheckerResults.fsi b/src/Compiler/Service/FSharpCheckerResults.fsi index 6b0a7f49135..607232f3c92 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fsi +++ b/src/Compiler/Service/FSharpCheckerResults.fsi @@ -454,7 +454,7 @@ type public FSharpCheckFileResults = tcGlobals: TcGlobals * isIncompleteTypeCheckEnvironment: bool * builder: IncrementalBuilder option * - projectOptions: FSharpProjectOptions * + projectOptions: FSharpProjectOptions option * dependencyFiles: string[] * creationErrors: FSharpDiagnostic[] * parseErrors: FSharpDiagnostic[] * @@ -554,7 +554,7 @@ type public FSharpCheckProjectResults = AccessorDomain * CheckedImplFile list option * string[] * - FSharpProjectOptions) option -> + FSharpProjectOptions option) option -> FSharpCheckProjectResults module internal ParseAndCheckFile = diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index bc15b6c3b67..db91fea3ea3 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -1695,7 +1695,7 @@ type internal TransparentCompiler bootstrapInfo.TcGlobals, projectSnapshot.IsIncompleteTypeCheckEnvironment, None, - projectSnapshot.ToOptions(), + None, Array.ofList tcInfo.tcDependencyFiles, creationDiags, parseResults.Diagnostics, @@ -1962,7 +1962,7 @@ type internal TransparentCompiler tcEnvAtEnd.AccessRights, Some checkedImplFiles, Array.ofList tcDependencyFiles, - projectSnapshot.ToOptions()) + None) let results = FSharpCheckProjectResults( From e2012d1925ee89efc87c1eaea622fe3307ef18a7 Mon Sep 17 00:00:00 2001 From: 0101 <0101@innit.cz> Date: Mon, 6 Jan 2025 19:47:13 +0100 Subject: [PATCH 2/4] f --- src/Compiler/Service/FSharpCheckerResults.fs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 7d1306e8684..ab561ab6d18 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -3302,9 +3302,11 @@ module internal ParseAndCheckFile = } [] -type FSharpProjectContext(thisCcu: CcuThunk, assemblies: FSharpAssembly list, ad: AccessorDomain, projectOptions: FSharpProjectOptions option) = +type FSharpProjectContext + (thisCcu: CcuThunk, assemblies: FSharpAssembly list, ad: AccessorDomain, projectOptions: FSharpProjectOptions option) = - member _.ProjectOptions = projectOptions |> Option.defaultWith (fun () -> failwith "not available") + member _.ProjectOptions = + projectOptions |> Option.defaultWith (fun () -> failwith "not available") member _.GetReferencedAssemblies() = assemblies From 4af3243d162a6d5c35f149b629a022634367aac4 Mon Sep 17 00:00:00 2001 From: Petr Pokorny Date: Mon, 20 Jan 2025 13:13:17 +0100 Subject: [PATCH 3/4] Clarification in exception message, release notes --- docs/release-notes/.FSharp.Compiler.Service/9.0.300.md | 1 + src/Compiler/Service/FSharpCheckerResults.fs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md index 5997ca29bd4..b377e754a53 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md @@ -9,6 +9,7 @@ ### Changed +* FSharpCheckFileResults.ProjectContext.ProjectOptions will not be available when using the experimental Transparent Compiler feature. ### Breaking Changes diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index ab561ab6d18..2ebc6c18151 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -3305,8 +3305,9 @@ module internal ParseAndCheckFile = type FSharpProjectContext (thisCcu: CcuThunk, assemblies: FSharpAssembly list, ad: AccessorDomain, projectOptions: FSharpProjectOptions option) = + // TODO: Once API around Transparent Compiler is stabilized we should probably remove this. member _.ProjectOptions = - projectOptions |> Option.defaultWith (fun () -> failwith "not available") + projectOptions |> Option.defaultWith (fun () -> failwith "ProjectOptions are not available. This is expected when using FSharpChecker with useTransparentCompiler=true.") member _.GetReferencedAssemblies() = assemblies From a823fa3b27b60fbca75a9758d0d15d2dccfa104c Mon Sep 17 00:00:00 2001 From: Petr Pokorny Date: Mon, 20 Jan 2025 13:18:13 +0100 Subject: [PATCH 4/4] f --- src/Compiler/Service/FSharpCheckerResults.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 2ebc6c18151..0d6e83a61c2 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -3307,7 +3307,9 @@ type FSharpProjectContext // TODO: Once API around Transparent Compiler is stabilized we should probably remove this. member _.ProjectOptions = - projectOptions |> Option.defaultWith (fun () -> failwith "ProjectOptions are not available. This is expected when using FSharpChecker with useTransparentCompiler=true.") + projectOptions + |> Option.defaultWith (fun () -> + failwith "ProjectOptions are not available. This is expected when using FSharpChecker with useTransparentCompiler=true.") member _.GetReferencedAssemblies() = assemblies