Skip to content
Merged
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
14 changes: 12 additions & 2 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ param (
[switch]$testAllButIntegrationAndAot,
[switch]$testpack,
[switch]$testAOT,
[switch]$testEditor,
[switch]$testBenchmarks,
[string]$officialSkipTests = "false",
[switch]$noVisualStudio,
Expand Down Expand Up @@ -119,6 +120,7 @@ function Print-Usage() {
Write-Host " -testVs Run F# editor unit tests"
Write-Host " -testpack Verify built packages"
Write-Host " -testAOT Run AOT/Trimming tests"
Write-Host " -testEditor Run VS Editor tests"
Write-Host " -testBenchmarks Build and Run Benchmark suite"
Write-Host " -officialSkipTests <bool> Set to 'true' to skip running tests"
Write-Host ""
Expand Down Expand Up @@ -178,7 +180,11 @@ function Process-Arguments() {
$script:testFSharpQA = $True
$script:testIntegration = $False
$script:testVs = $True
$script:testAOT = $False
$script:testEditor = $True
}

if($script:testVs) {
$script:testEditor = $True
}

if ([System.Boolean]::Parse($script:officialSkipTests)) {
Expand Down Expand Up @@ -669,11 +675,15 @@ try {
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"
}

if ($testVs -and -not $noVisualStudio) {
if ($testEditor -and -not $noVisualStudio) {
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj"
}

if ($testVs -and -not $noVisualStudio) {
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\VisualFSharp.UnitTests\"
}


if ($testIntegration) {
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.IntegrationTests\FSharp.Editor.IntegrationTests.csproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.IntegrationTests\"
}
Expand Down
29 changes: 29 additions & 0 deletions src/Compiler/Service/IncrementalBuild.fs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,33 @@ type FrameworkImportsCache(size) =
let frameworkDLLs, nonFrameworkResolutions, unresolved = TcAssemblyResolutions.SplitNonFoundationalResolutions(tcConfig)
let node = this.GetNode(tcConfig, frameworkDLLs, nonFrameworkResolutions)
let! tcGlobals, frameworkTcImports = node.GetOrComputeValue()

// If the tcGlobals was loaded from a different project, langVersion and realsig may be different
// for each cached project. So here we create a new tcGlobals, with the existing framework values
// and updated realsig and langversion
let tcGlobals =
if tcGlobals.langVersion.SpecifiedVersion <> tcConfig.langVersion.SpecifiedVersion
|| tcGlobals.realsig <> tcConfig.realsig then
TcGlobals(
tcGlobals.compilingFSharpCore,
tcGlobals.ilg,
tcGlobals.fslibCcu,
tcGlobals.directoryToResolveRelativePaths,
tcGlobals.mlCompatibility,
tcGlobals.isInteractive,
tcGlobals.checkNullness,
tcGlobals.useReflectionFreeCodeGen,
tcGlobals.tryFindSysTypeCcuHelper,
tcGlobals.emitDebugInfoInQuotations,
tcGlobals.noDebugAttributes,
tcGlobals.pathMap,
tcConfig.langVersion,
tcConfig.realsig
)

else
tcGlobals

return tcGlobals, frameworkTcImports, nonFrameworkResolutions, unresolved
}

Expand Down Expand Up @@ -1445,6 +1472,8 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc

tcConfigB.useSimpleResolution <- (getSwitchValue useSimpleResolutionSwitch) |> Option.isSome

tcConfigB.realsig <- List.contains "--realsig" commandLineArgs || List.contains "--realsig+" commandLineArgs

// Apply command-line arguments and collect more source files if they are in the arguments
let sourceFilesNew = ApplyCommandLineArgs(tcConfigB, sourceFiles, commandLineArgs)

Expand Down
4 changes: 4 additions & 0 deletions src/Compiler/Service/TransparentCompiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,10 @@ type internal TransparentCompiler

define :: tcConfigB.conditionalDefines

tcConfigB.realsig <-
List.contains "--realsig" commandLineArgs
|| List.contains "--realsig+" commandLineArgs

tcConfigB.projectReferences <- projectReferences

tcConfigB.useSimpleResolution <- useSimpleResolution
Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/Service/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,8 @@ type FSharpChecker
if isEditing then
tcConfigB.conditionalDefines <- "EDITING" :: tcConfigB.conditionalDefines

tcConfigB.realsig <- List.contains "--realsig" argv || List.contains "--realsig+" argv

// Apply command-line arguments and collect more source files if they are in the arguments
let sourceFilesNew = ApplyCommandLineArgs(tcConfigB, sourceFiles, argv)
FSharpParsingOptions.FromTcConfigBuilder(tcConfigB, Array.ofList sourceFilesNew, isInteractive), errorScope.Diagnostics
Expand Down
16 changes: 10 additions & 6 deletions src/Compiler/TypedTree/TcGlobals.fs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ type TcGlobals(
checkNullness: bool,
useReflectionFreeCodeGen: bool,
// The helper to find system types amongst referenced DLLs
tryFindSysTypeCcuHelper,
tryFindSysTypeCcuHelper: string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option,
emitDebugInfoInQuotations: bool,
noDebugAttributes: bool,
pathMap: PathMap,
Expand Down Expand Up @@ -215,11 +215,9 @@ type TcGlobals(
let mk_MFCompilerServices_tcref ccu n = mkNonLocalTyconRef2 ccu CompilerServicesPath n
let mk_MFControl_tcref ccu n = mkNonLocalTyconRef2 ccu ControlPathArray n

let tryFindSysTypeCcu path nm =
tryFindSysTypeCcuHelper path nm false
let tryFindSysTypeCcu path nm = tryFindSysTypeCcuHelper path nm false

let tryFindPublicSysTypeCcu path nm =
tryFindSysTypeCcuHelper path nm true
let tryFindPublicSysTypeCcu path nm = tryFindSysTypeCcuHelper path nm true

let vara = Construct.NewRigidTypar "a" envRange
let varb = Construct.NewRigidTypar "b" envRange
Expand Down Expand Up @@ -1089,11 +1087,17 @@ type TcGlobals(
tryFindSysAttrib "System.Runtime.CompilerServices.RequiredMemberAttribute"
] |> List.choose (Option.map (fun x -> x.TyconRef))

static member IsInEmbeddableKnownSet name = isInEmbeddableKnownSet name

override _.ToString() = "<TcGlobals>"

member _.directoryToResolveRelativePaths = directoryToResolveRelativePaths

member _.ilg = ilg

static member IsInEmbeddableKnownSet name = isInEmbeddableKnownSet name
member _.noDebugAttributes = noDebugAttributes

member _.tryFindSysTypeCcuHelper: string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option = tryFindSysTypeCcuHelper

member _.tryRemoveEmbeddedILTypeDefs () = [
for key in embeddedILTypeDefs.Keys.OrderBy id do
Expand Down
6 changes: 6 additions & 0 deletions src/Compiler/TypedTree/TcGlobals.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ type internal TcGlobals =

static member IsInEmbeddableKnownSet: name: string -> bool

member directoryToResolveRelativePaths: string

member noDebugAttributes: bool

member tryFindSysTypeCcuHelper: (string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option) with get

member AddFieldGeneratedAttributes:
mdef: FSharp.Compiler.AbstractIL.IL.ILFieldDef -> FSharp.Compiler.AbstractIL.IL.ILFieldDef

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ type HelpContextServiceTests() =
TestF1Keywords(keywords, file)

[<Fact>]
member _.``F1 help keyword Regression.DotNetMethod.854364``() =
member _.``F1 help keyword Regression.DotNetMethod-854364``() =
let file = [ "let i : int = 42"; "i.ToStri$ng()"; "i.ToStri$ng(\"format\")" ]
let keywords = [ Some "System.Int32.ToString"; Some "System.Int32.ToString" ]
TestF1Keywords(keywords, file)
Expand Down Expand Up @@ -335,13 +335,13 @@ type HelpContextServiceTests() =
TestF1Keywords(keywords, file)

[<Fact>]
member _.``F1 help keyword Regression.NewInstance.854367``() =
member _.``F1 help keyword Regression.NewInstance-854367``() =
let file = [ "let q : System.Runtime.Remoting.TypeE$ntry = null" ]
let keywords = [ Some "System.Runtime.Remoting.TypeEntry" ]
TestF1Keywords(keywords, file)

[<Fact>]
member _.``F1 help keyword Regression.NewInstance.854367.2``() =
member _.``F1 help keyword Regression.NewInstance-854367-2``() =
let file =
[
"let q1 = new System.Runtime.Remoting.Type$Entry()" // this constructor exists but is not accessible (it is protected), but the help entry still goes to the type
Expand Down
8 changes: 4 additions & 4 deletions vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ module Test =
()

[<Fact>]
let ``Automation.LetBindings.InsideType.Instance`` () =
let ``Automation.LetBindings.Instance`` () =
let code =
"""
namespace FsTest
Expand All @@ -525,7 +525,7 @@ module Test =
Assert.StartsWith(expectedSignature, tooltip)

[<Fact>]
let ``Automation.LetBindings.InsideType.Static`` () =
let ``Automation.LetBindings.Static`` () =
let code =
"""
namespace FsTest
Expand All @@ -535,15 +535,15 @@ module Test =
static let fu$$nc x = ()
"""

let expectedSignature = "val func: x: 'a -> unit"
let expectedSignature = "val private func: x: 'a -> unit"

let tooltip = GetQuickInfoTextFromCode code

Assert.StartsWith(expectedSignature, tooltip)
()

[<Fact>]
let ``Automation.LetBindings`` () =
let ``Automation.LetBindings.Do`` () =
let code =
"""
namespace FsTest
Expand Down