Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e8533e1
fx directives and editing
Sep 22, 2020
c9a011b
rename
dsyme Sep 22, 2020
1235f56
reduce diff
Sep 28, 2020
6f9b414
merge main
Sep 28, 2020
edc9571
remove files
Sep 29, 2020
6ed74a2
fix test
Sep 29, 2020
59976ff
fix script compilation
Sep 29, 2020
4fce990
fix build
Sep 29, 2020
29ee398
fix script compilation
Sep 29, 2020
df6d993
fix build
Sep 29, 2020
1dfcca8
fix compilation of projects where scripts are included in the build
Sep 29, 2020
86c655f
fix FCS API baseline
Sep 30, 2020
c8ab23a
revert script compilation to behave like it used to
Sep 30, 2020
271e79b
revert script compilation to behave like it used to
Sep 30, 2020
7ff4696
fix test baselines
Oct 1, 2020
518ce00
add option for F# interactive in VS
Oct 1, 2020
d5f3d59
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Oct 9, 2020
472cc50
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
dsyme Oct 21, 2020
1bf8817
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Oct 23, 2020
6ce9920
fix build
Oct 25, 2020
9588407
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Oct 28, 2020
7d2e40c
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Nov 11, 2020
d27a6fe
merge main
Nov 19, 2020
21d1982
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Nov 20, 2020
1ba4156
merge main
Dec 7, 2020
6ba4ebd
fix build
Dec 7, 2020
4adfdbc
use F# Interactive setting for script editing
Dec 8, 2020
6290a9f
merge main
Dec 10, 2020
fe67473
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/…
Dec 13, 2020
cb1c5b8
fix build
Dec 13, 2020
a2a3dac
fxspec update
Dec 16, 2020
2834db3
fxspec update
Dec 16, 2020
f065cbd
simplify diff and run 'dotnet --info' to get sdk
Dec 17, 2020
9d09aa5
use source directory of file if send-to-interactive, and delay actual…
Dec 17, 2020
93bd166
use source directory of file if send-to-interactive, and delay actual…
Dec 17, 2020
4a71027
reduce diff and get diagnostic when sdk not found
Dec 17, 2020
8e5cab2
reduce diff and get diagnostic when sdk not found
Dec 17, 2020
c941340
git log
Dec 17, 2020
a889efb
rip out failed attempt to activate menus
Dec 17, 2020
5f096b6
for interactive/reflective execution avoid incompatible sdks
Dec 18, 2020
1b7a4e9
add sdkDirOverride flag
Dec 18, 2020
5e5471d
add diagnostics
Dec 18, 2020
acba6dd
disable test that runs locally but not with some CI setting that allo…
Dec 18, 2020
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
28 changes: 21 additions & 7 deletions src/fsharp/CompilerConfig.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ open System.Text

open Internal.Utilities
open Internal.Utilities.Filename
open Internal.Utilities.FSharpEnvironment

open FSharp.Compiler
open FSharp.Compiler.AbstractIL
Expand All @@ -21,7 +22,6 @@ open FSharp.Compiler.AbstractIL.ILPdbWriter
open FSharp.Compiler.AbstractIL.Internal
open FSharp.Compiler.AbstractIL.Internal.Library
open FSharp.Compiler.AbstractIL.Internal.Utils
open FSharp.Compiler.DotNetFrameworkDependencies
open FSharp.Compiler.ErrorLogger
open FSharp.Compiler.Features
open FSharp.Compiler.Lib
Expand Down Expand Up @@ -399,6 +399,7 @@ type TcConfigBuilder =
mutable includewin32manifest: bool
mutable linkResources: string list
mutable legacyReferenceResolver: ReferenceResolver.Resolver
mutable fxResolver: FxResolver

mutable showFullPaths: bool
mutable errorStyle: ErrorStyle
Expand Down Expand Up @@ -462,6 +463,9 @@ type TcConfigBuilder =
/// When false FSI will lock referenced assemblies requiring process restart, false = disable Shadow Copy false (*default*)
mutable shadowCopyReferences: bool
mutable useSdkRefs: bool

/// Override the SDK directory used by FxResolver, used for FCS only
mutable sdkDirOverride: string option

/// A function to call to try to get an object that acts as a snapshot of the metadata section of a .NET binary,
/// and from which we can read the metadata. Only used when metadataOnly=true.
Expand Down Expand Up @@ -566,6 +570,7 @@ type TcConfigBuilder =
includewin32manifest = true
linkResources = []
legacyReferenceResolver = null
fxResolver = Unchecked.defaultof<_>
showFullPaths = false
errorStyle = ErrorStyle.DefaultErrors

Expand All @@ -587,7 +592,7 @@ type TcConfigBuilder =
deterministic = false
preferredUiLang = None
lcid = None
productNameForBannerText = FSharpEnvironment.FSharpProductName
productNameForBannerText = FSharpProductName
showBanner = true
showTimes = false
showLoadedAssemblies = false
Expand All @@ -605,6 +610,7 @@ type TcConfigBuilder =
copyFSharpCore = CopyFSharpCoreFlag.No
shadowCopyReferences = false
useSdkRefs = true
sdkDirOverride = None
tryGetMetadataSnapshot = (fun _ -> None)
internalTestSpanStackReferring = false
noConditionalErasure = false
Expand All @@ -631,7 +637,7 @@ type TcConfigBuilder =
}
|> Seq.distinct

static member CreateNew(legacyReferenceResolver, defaultFSharpBinariesDir, reduceMemoryUsage, implicitIncludeDir,
static member CreateNew(legacyReferenceResolver, fxResolver, defaultFSharpBinariesDir, reduceMemoryUsage, implicitIncludeDir,
isInteractive, isInvalidationSupported, defaultCopyFSharpCore, tryGetMetadataSnapshot) =

Debug.Assert(FileSystem.IsPathRootedShim implicitIncludeDir, sprintf "implicitIncludeDir should be absolute: '%s'" implicitIncludeDir)
Expand All @@ -645,6 +651,7 @@ type TcConfigBuilder =
defaultFSharpBinariesDir = defaultFSharpBinariesDir
reduceMemoryUsage = reduceMemoryUsage
legacyReferenceResolver = legacyReferenceResolver
fxResolver = fxResolver
isInteractive = isInteractive
isInvalidationSupported = isInvalidationSupported
copyFSharpCore = defaultCopyFSharpCore
Expand Down Expand Up @@ -848,7 +855,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
let dllReference, fileNameOpt = computeKnownDllReference getFSharpCoreLibraryName
match fileNameOpt with
| Some _ -> dllReference
| None -> AssemblyReference(range0, getDefaultFSharpCoreLocation, None)
| None -> AssemblyReference(range0, getDefaultFSharpCoreLocation(), None)

// clrRoot: the location of the primary assembly (mscorlib.dll or netstandard.dll or System.Runtime.dll)
//
Expand Down Expand Up @@ -877,6 +884,9 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
#endif
None, data.legacyReferenceResolver.HighestInstalledNetFrameworkVersion()

let systemAssemblies = data.fxResolver.GetSystemAssemblies()

member x.FxResolver = data.fxResolver
member x.primaryAssembly = data.primaryAssembly
member x.noFeedback = data.noFeedback
member x.stackReserveSize = data.stackReserveSize
Expand Down Expand Up @@ -996,6 +1006,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
member x.copyFSharpCore = data.copyFSharpCore
member x.shadowCopyReferences = data.shadowCopyReferences
member x.useSdkRefs = data.useSdkRefs
member x.sdkDirOverride = data.sdkDirOverride
member x.tryGetMetadataSnapshot = data.tryGetMetadataSnapshot
member x.internalTestSpanStackReferring = data.internalTestSpanStackReferring
member x.noConditionalErasure = data.noConditionalErasure
Expand Down Expand Up @@ -1048,7 +1059,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
if Directory.Exists runtimeRootWPF then
yield runtimeRootWPF // PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF

match frameworkRefsPackDirectory with
match tcConfig.FxResolver.GetFrameworkRefsPackDirectory() with
| Some path when Directory.Exists(path) ->
yield path
| _ -> ()
Expand Down Expand Up @@ -1083,7 +1094,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
let facades = Path.Combine(frameworkRootVersion, "Facades")
if Directory.Exists facades then
yield facades
match frameworkRefsPackDirectory with
match tcConfig.FxResolver.GetFrameworkRefsPackDirectory() with
| Some path when Directory.Exists(path) ->
yield path
| _ -> ()
Expand Down Expand Up @@ -1155,7 +1166,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
FileSystem.SafeExists filename &&
((tcConfig.GetTargetFrameworkDirectories() |> List.exists (fun clrRoot -> clrRoot = Path.GetDirectoryName filename)) ||
(systemAssemblies.Contains (fileNameWithoutExtension filename)) ||
isInReferenceAssemblyPackDirectory filename)
tcConfig.FxResolver.IsInReferenceAssemblyPackDirectory filename)
with _ ->
false

Expand All @@ -1165,6 +1176,9 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
member tcConfig.GenerateOptimizationData =
tcConfig.GenerateSignatureData

member tcConfig.assumeDotNetFramework =
tcConfig.primaryAssembly = PrimaryAssembly.Mscorlib

/// Represents a computation to return a TcConfig. Normally this is just a constant immutable TcConfig,
/// but for F# Interactive it may be based on an underlying mutable TcConfigBuilder.
type TcConfigProvider =
Expand Down
10 changes: 10 additions & 0 deletions src/fsharp/CompilerConfig.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ type TcConfigBuilder =
mutable includewin32manifest: bool
mutable linkResources: string list
mutable legacyReferenceResolver: ReferenceResolver.Resolver
mutable fxResolver: FxResolver
mutable showFullPaths: bool
mutable errorStyle: ErrorStyle
mutable utf8output: bool
Expand Down Expand Up @@ -255,6 +256,7 @@ type TcConfigBuilder =
mutable copyFSharpCore: CopyFSharpCoreFlag
mutable shadowCopyReferences: bool
mutable useSdkRefs: bool
mutable sdkDirOverride: string option

/// A function to call to try to get an object that acts as a snapshot of the metadata section of a .NET binary,
/// and from which we can read the metadata. Only used when metadataOnly=true.
Expand All @@ -275,6 +277,7 @@ type TcConfigBuilder =

static member CreateNew:
legacyReferenceResolver: ReferenceResolver.Resolver *
fxResolver: FxResolver *
defaultFSharpBinariesDir: string *
reduceMemoryUsage: ReduceMemoryFlag *
implicitIncludeDir: string *
Expand Down Expand Up @@ -428,6 +431,8 @@ type TcConfig =
member isInteractive: bool
member isInvalidationSupported: bool

member FxResolver: FxResolver

member ComputeLightSyntaxInitialStatus: string -> bool

member GetTargetFrameworkDirectories: unit -> string list
Expand All @@ -451,6 +456,8 @@ type TcConfig =

member useSdkRefs: bool

member sdkDirOverride: string option

member legacyReferenceResolver: ReferenceResolver.Resolver

member emitDebugInfoInQuotations: bool
Expand Down Expand Up @@ -492,6 +499,9 @@ type TcConfig =
/// Indicates if the compilation will result in an F# optimization data resource in the generated binary
member GenerateOptimizationData: bool

/// Check if the primary assembly is mscorlib
member assumeDotNetFramework: bool

/// Represents a computation to return a TcConfig. Normally this is just a constant immutable TcConfig,
/// but for F# Interactive it may be based on an underlying mutable TcConfigBuilder.
[<Sealed>]
Expand Down
9 changes: 3 additions & 6 deletions src/fsharp/CompilerImports.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ open System.IO

open Internal.Utilities
open Internal.Utilities.Collections
open Internal.Utilities.FSharpEnvironment

open FSharp.Compiler
open FSharp.Compiler.AbstractIL
Expand All @@ -24,7 +25,6 @@ open FSharp.Compiler.AbstractIL.Diagnostics
open FSharp.Compiler.CheckDeclarations
open FSharp.Compiler.CompilerGlobalState
open FSharp.Compiler.CompilerConfig
open FSharp.Compiler.DotNetFrameworkDependencies
open FSharp.Compiler.ErrorLogger
open FSharp.Compiler.Import
open FSharp.Compiler.Lib
Expand Down Expand Up @@ -554,7 +554,8 @@ type TcAssemblyResolutions(tcConfig: TcConfig, results: AssemblyResolution list,
if found then yield asm

if tcConfig.framework then
for s in defaultReferencesForScriptsAndOutOfProjectSources tcConfig.useFsiAuxLib assumeDotNetFramework tcConfig.useSdkRefs do
let references, _useDotNetFramework = tcConfig.FxResolver.GetDefaultReferences(tcConfig.useFsiAuxLib, assumeDotNetFramework)
for s in references do
yield AssemblyReference(rangeStartup, (if s.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) then s else s+".dll"), None)

yield! tcConfig.referencedDLLs
Expand Down Expand Up @@ -1834,7 +1835,3 @@ let RequireDLL (ctok, tcImports: TcImports, tcEnv, thisAssemblyName, referenceRa
AddCcuToTcEnv(g, amap, referenceRange, tcEnv, thisAssemblyName, asm.FSharpViewOfMetadata, asm.AssemblyAutoOpenAttributes, asm.AssemblyInternalsVisibleToAttributes)
let tcEnv = (tcEnv, asms) ||> List.fold buildTcEnv
tcEnv, (dllinfos, asms)

// Existing public APIs delegate to newer implementations
let DefaultReferencesForScriptsAndOutOfProjectSources assumeDotNetFramework =
defaultReferencesForScriptsAndOutOfProjectSources (*useFsiAuxLib*)false assumeDotNetFramework (*useSdkRefs*)false
3 changes: 0 additions & 3 deletions src/fsharp/CompilerImports.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,3 @@ type TcImports =
/// Process #r in F# Interactive.
/// Adds the reference to the tcImports and add the ccu to the type checking environment.
val RequireDLL: ctok: CompilationThreadToken * tcImports: TcImports * tcEnv: TcEnv * thisAssemblyName: string * referenceRange: range * file: string -> TcEnv * (ImportedBinary list * ImportedAssembly list)

/// This list is the default set of references for "non-project" files.
val DefaultReferencesForScriptsAndOutOfProjectSources: bool -> string list
3 changes: 2 additions & 1 deletion src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1543,11 +1543,12 @@ forFormatInvalidForInterpolated4,"Interpolated strings used as type IFormattable
3381,parsEofInInterpolatedTripleQuoteString,"Incomplete interpolated triple-quote string begun at or before here"
3382,parsEmptyFillInInterpolatedString,"Invalid interpolated string. This interpolated string expression fill is empty, an expression was expected."
3383,lexRBraceInInterpolatedString,"A '}}' character must be escaped (by doubling) in an interpolated string."
3384,scriptSdkNotDetermined,"The .NET SDK for this script could not be determined. If the script is in a directory using a 'global.json' then ensure the relevant .NET SDK is installed. The output from '%s --version' in the directory '%s' was: '%s' and the exit code was '%d'."
#3501 "This construct is not supported by your version of the F# compiler" CompilerMessage(ExperimentalAttributeMessages.NotSupportedYet, 3501, IsError=true)
3390,xmlDocBadlyFormed,"This XML comment is invalid: '%s'"
3390,xmlDocMissingParameterName,"This XML comment is invalid: missing 'name' attribute for parameter or parameter reference"
3390,xmlDocMissingCrossReference,"This XML comment is invalid: missing 'cref' attribute for cross-reference"
3390,xmlDocInvalidParameterName,"This XML comment is invalid: unknown parameter '%s'"
3390,xmlDocDuplicateParameter,"This XML comment is invalid: multiple documentation entries for parameter '%s'"
3390,xmlDocUnresolvedCrossReference,"This XML comment is invalid: unresolved cross-reference '%s'"
3390,xmlDocMissingParameter,"This XML comment is incomplete: no documentation for parameter '%s'"
3390,xmlDocMissingParameter,"This XML comment is incomplete: no documentation for parameter '%s'"
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,8 @@
<Compile Include="..\IlxGen.fs">
<Link>CodeGen\IlxGen.fs</Link>
</Compile>
<Compile Include="..\DotNetFrameworkDependencies.fs">
<Link>Driver\DotNetFrameworkDependencies.fs</Link>
<Compile Include="..\FxResolver.fs">
<Link>Driver\FxResolver.fs</Link>
</Compile>
<Compile Include="..\CompilerConfig.fsi">
<Link>Driver\CompilerConfig.fsi</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<DefineConstants>$(DefineConstants);COMPILER_SERVICE_AS_DLL</DefineConstants>
<DefineConstants>$(DefineConstants);COMPILER</DefineConstants>
<DefineConstants>$(DefineConstants);ENABLE_MONO_SUPPORT</DefineConstants>
<OtherFlags>$(OtherFlags) --sig:all.fsi /warnon:3218 /warnon:1182 /warnon:3390 --times</OtherFlags>
<OtherFlags>$(OtherFlags) /warnon:3218 /warnon:1182 /warnon:3390 --times</OtherFlags>
<Tailcalls>true</Tailcalls>
<!-- .tail annotations always emitted for this binary, even in debug mode -->
<NGenBinary>true</NGenBinary>
Expand Down Expand Up @@ -650,8 +650,8 @@
<Compile Include="..\IlxGen.fs">
<Link>CodeGen\IlxGen.fs</Link>
</Compile>
<Compile Include="..\DotNetFrameworkDependencies.fs">
<Link>Driver\DotNetFrameworkDependencies.fs</Link>
<Compile Include="..\FxResolver.fs">
<Link>Driver\FxResolver.fs</Link>
</Compile>
<Compile Include="..\Microsoft.DotNet.DependencyManager/AssemblyResolveHandler.fsi">
<Link>Driver\AssemblyResolveHandler.fsi</Link>
Expand Down
Loading