Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/10.0.300.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Fix FS0229 B-stream misalignment when reading metadata from assemblies compiled with LangVersion < 9.0, introduced by [#17706](https://github.com/dotnet/fsharp/pull/17706). ([PR #19260](https://github.com/dotnet/fsharp/pull/19260))
* Fix FS3356 false positive for instance extension members with same name on different types, introduced by [#18821](https://github.com/dotnet/fsharp/pull/18821). ([PR #19260](https://github.com/dotnet/fsharp/pull/19260))
* F# Scripts: Fix default reference paths resolving when an SDK directory is specified. ([PR #19270](https://github.com/dotnet/fsharp/pull/19270))

### Added

Expand Down
39 changes: 23 additions & 16 deletions src/Compiler/Driver/FxResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,28 @@ type internal FxResolver

let getImplementationAssemblyDir () = implementationAssemblyDir.Force()

let getFSharpCoreLibraryName = "FSharp.Core"

let getFsiLibraryName = "FSharp.Compiler.Interactive.Settings"

// Use the FSharp.Core that is executing with the compiler as a backup reference
let getFSharpCoreImplementationReference () =
Path.Combine(getFSharpCompilerLocation (), getFSharpCoreLibraryName + ".dll")
let getFSharpLibImplementationReferences useFsiAuxLib =
let getFSharpLibImplementationReference libName =
// Use the FSharp.Core/FSharp.Compiler.Interactive.Settings
// that is executing with the compiler as a backup reference
let getDefaultImplementationReference libName =
Path.Combine(getFSharpCompilerLocation (), libName + ".dll")

match sdkDirOverride with
| None -> getDefaultImplementationReference libName
| Some sdkDirOverride ->
let libPath = Path.Combine(sdkDirOverride, "FSharp", libName + ".dll")

if File.Exists(libPath) then
libPath
else
getDefaultImplementationReference libName

// Use the FSharp.Compiler.Interactive.Settings executing with the compiler as a backup reference
let getFsiLibraryImplementationReference () =
Path.Combine(getFSharpCompilerLocation (), getFsiLibraryName + ".dll")
[
getFSharpLibImplementationReference getFSharpCoreLibraryName
if useFsiAuxLib then
getFSharpLibImplementationReference fsiLibraryName
]

// Use the ValueTuple that is executing with the compiler if it is from System.ValueTuple
// or the System.ValueTuple.dll that sits alongside the compiler. (Note we always ship one with the compiler)
Expand Down Expand Up @@ -615,9 +626,7 @@ type internal FxResolver
let roots =
[
yield! Directory.GetFiles(implDir, "*.dll")
getFSharpCoreImplementationReference ()
if useFsiAuxLib then
getFsiLibraryImplementationReference ()
yield! getFSharpLibImplementationReferences useFsiAuxLib
]

(getDependenciesOf roots).Values |> Seq.toList
Expand Down Expand Up @@ -928,9 +937,7 @@ type internal FxResolver
let sdkReferences =
[
yield! Directory.GetFiles(path, "*.dll")
getFSharpCoreImplementationReference ()
if useFsiAuxLib then
getFsiLibraryImplementationReference ()
yield! getFSharpLibImplementationReferences useFsiAuxLib
]
|> List.filter (Path.GetFileNameWithoutExtension >> (!!) >> systemAssemblies.Contains)

Expand Down
Loading