Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix de-duplication of module names in ParseAndCheckFileInProject (FCS bug #819) #820

Closed
wants to merge 4 commits into from
Closed
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
6 changes: 3 additions & 3 deletions fcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ which does things like:
Yu can push the packages if you have permissions, either automatically using ``build Release`` or manually

set APIKEY=...
.nuget\nuget.exe push Release\FSharp.Compiler.Service.16.0.2.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.MSBuild.v12.16.0.2.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.ProjectCracker.16.0.2.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.16.0.3.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.MSBuild.v12.16.0.3.nupkg %APIKEY% -Source https://nuget.org
.nuget\nuget.exe push Release\FSharp.Compiler.Service.ProjectCracker.16.0.3.nupkg %APIKEY% -Source https://nuget.org


### Use of Paket and FAKE
Expand Down
3 changes: 3 additions & 0 deletions fcs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 16.0.3
* [File name deduplication not working with ParseAndCheckFileInProject](https://github.com/fsharp/FSharp.Compiler.Service/issues/819)

#### 16.0.2
* [ProjectCracker returns *.fsi files in FSharpProjectOptions.SourceFiles array](https://github.com/fsharp/FSharp.Compiler.Service/pull/812)

Expand Down
2 changes: 1 addition & 1 deletion fcs/fcs.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>

<VersionPrefix>16.0.2</VersionPrefix>
<VersionPrefix>16.0.3</VersionPrefix>
<!-- FSharp.Compiler.Tools is currently only used to get a working FSI.EXE to execute some scripts during the build -->
<!-- The LKG FSI.EXE requires MSBuild 15 to be installed, which is painful -->
<FsiToolPath>$(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools</FsiToolPath>
Expand Down
4 changes: 2 additions & 2 deletions fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description>Adds legacy MSBuild 12.0 support to the F# compiler services package for resolving references such as #r "System, Version=4.1.0.0,..."</description>
<language>en-US</language>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<version>16.0.2</version>
<version>16.0.3</version>
<authors>Microsoft Corporation and F# community contributors</authors>
<licenseUrl>https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/fsharp/FSharp.Compiler.Service</projectUrl>
Expand All @@ -14,7 +14,7 @@
<summary>F# compiler services for creating IDE tools, language extensions and for F# embedding.</summary>
<dependencies>
<group targetFramework="net45">
<dependency id="FSharp.Compiler.Service" version="16.0.2" />
<dependency id="FSharp.Compiler.Service" version="16.0.3" />
</group>
</dependencies>
</metadata>
Expand Down
4 changes: 2 additions & 2 deletions fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description>The F# compiler services package contains a custom build of the F# compiler that exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications.</description>
<language>en-US</language>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<version>16.0.2</version>
<version>16.0.3</version>
<authors>Microsoft Corporation and F# community contributors</authors>
<licenseUrl>https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/fsharp/FSharp.Compiler.Service</projectUrl>
Expand All @@ -14,7 +14,7 @@
<summary>F# compiler services for creating IDE tools, language extensions and for F# embedding.</summary>
<dependencies>
<group targetFramework="net45">
<dependency id="FSharp.Compiler.Service" version="16.0.2" />
<dependency id="FSharp.Compiler.Service" version="16.0.3" />
</group>
</dependencies>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion fcs/nuget/FSharp.Compiler.Service.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description>The F# compiler services package contains a custom build of the F# compiler that exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications.</description>
<language>en-US</language>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<version>16.0.2</version>
<version>16.0.3</version>
<authors>Microsoft Corporation and F# community contributors</authors>
<licenseUrl>https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/fsharp/FSharp.Compiler.Service</projectUrl>
Expand Down
3 changes: 3 additions & 0 deletions src/fsharp/vs/IncrementalBuild.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,9 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput
member builder.GetCheckResultsAfterLastFileInProject (ctok: CompilationThreadToken) =
builder.GetCheckResultsBeforeSlotInProject(ctok, builder.GetSlotsCount())

member builder.DeduplicateParsedInputModuleNameInProject (input) =
DeduplicateParsedInputModuleName moduleNamesDict input

member __.GetCheckResultsAndImplementationsForProject(ctok: CompilationThreadToken) =
cancellable {
let cache = TimeStampCache(defaultTimeStamp)
Expand Down
2 changes: 2 additions & 0 deletions src/fsharp/vs/IncrementalBuild.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ type internal IncrementalBuilder =
// TODO: make this an Eventually (which can be scheduled) or an Async (which can be cancelled)
member GetCheckResultsAndImplementationsForProject : CompilationThreadToken -> Cancellable<PartialCheckResults * IL.ILAssemblyRef * IRawFSharpAssemblyData option * TypedImplFile list option>

member DeduplicateParsedInputModuleNameInProject: Ast.ParsedInput -> Ast.ParsedInput

/// Get the logical time stamp that is associated with the output of the project if it were gully built immediately
member GetLogicalTimeStampForProject: TimeStampCache * CompilationThreadToken -> DateTime

Expand Down
26 changes: 14 additions & 12 deletions src/fsharp/vs/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2380,8 +2380,8 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
| Some res -> return res
| None ->
foregroundParseCount <- foregroundParseCount + 1
let parseErrors, inputOpt, anyErrors = Parser.parseFile(source, filename, options, userOpName)
let res = FSharpParseFileResults(parseErrors, inputOpt, anyErrors, options.SourceFiles)
let parseErrors, parseTreeOpt, anyErrors = Parser.parseFile(source, filename, options, userOpName)
let res = FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, options.SourceFiles)
parseCacheLock.AcquireLock(fun ltok -> parseFileCache.Set(ltok, (filename, source, options), res))
return res
}
Expand All @@ -2395,9 +2395,9 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
match builderOpt with
| None -> return FSharpParseFileResults(List.toArray creationErrors, None, true, [| |])
| Some builder ->
let! inputOpt,_,_,parseErrors = builder.GetParseResultsForFile (ctok, filename)
let! parseTreeOpt,_,_,parseErrors = builder.GetParseResultsForFile (ctok, filename)
let errors = [| yield! creationErrors; yield! ErrorHelpers.CreateErrorInfos (builder.TcConfig.errorSeverityOptions, false, filename, parseErrors) |]
return FSharpParseFileResults(errors = errors, input = inputOpt, parseHadErrors = false, dependencyFiles = builder.AllDependenciesDeprecated)
return FSharpParseFileResults(errors = errors, input = parseTreeOpt, parseHadErrors = false, dependencyFiles = builder.AllDependenciesDeprecated)
}
)

Expand Down Expand Up @@ -2541,7 +2541,9 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
| _ ->
Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName, "CheckFileInProject.CacheMiss", filename)
let! tcPrior = execWithReactorAsync <| fun ctok -> builder.GetCheckResultsBeforeFileInProject (ctok, filename)
let! checkAnswer = bc.CheckOneFileImpl(parseResults, source, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName)
let parseTreeOpt = parseResults.ParseTree |> Option.map builder.DeduplicateParsedInputModuleNameInProject
let parseResultsAterDeDuplication = FSharpParseFileResults(parseResults.Errors, parseTreeOpt, parseResults.ParseHadErrors, parseResults.DependencyFiles)
let! checkAnswer = bc.CheckOneFileImpl(parseResultsAterDeDuplication, source, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName)
return checkAnswer
finally
bc.ImplicitlyStartCheckProjectInBackground(options, userOpName)
Expand Down Expand Up @@ -2574,9 +2576,9 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC

// Do the parsing.
let parsingOptions = FSharpParsingOptions.FromTcConfig(builder.TcConfig, Array.ofList (builder.SourceFiles))
let parseErrors, inputOpt, anyErrors = Parser.parseFile (source, filename, parsingOptions, userOpName)

let parseResults = FSharpParseFileResults(parseErrors, inputOpt, anyErrors, builder.AllDependenciesDeprecated)
let parseErrors, parseTreeOpt, anyErrors = Parser.parseFile (source, filename, parsingOptions, userOpName)
let parseTreeOpt = parseTreeOpt |> Option.map builder.DeduplicateParsedInputModuleNameInProject
let parseResults = FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, builder.AllDependenciesDeprecated)
let! checkResults = bc.CheckOneFileImpl(parseResults, source, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName)
return parseResults, checkResults
finally
Expand All @@ -2595,12 +2597,12 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
let typedResults = MakeCheckFileResultsEmpty(filename, creationErrors)
return (parseResults, typedResults)
| Some builder ->
let! (inputOpt, _, _, untypedErrors) = builder.GetParseResultsForFile (ctok, filename)
let! (parseTreeOpt, _, _, untypedErrors) = builder.GetParseResultsForFile (ctok, filename)
let! tcProj = builder.GetCheckResultsAfterFileInProject (ctok, filename)
let errorOptions = builder.TcConfig.errorSeverityOptions
let untypedErrors = [| yield! creationErrors; yield! ErrorHelpers.CreateErrorInfos (errorOptions, false, filename, untypedErrors) |]
let tcErrors = [| yield! creationErrors; yield! ErrorHelpers.CreateErrorInfos (errorOptions, false, filename, tcProj.Errors) |]
let parseResults = FSharpParseFileResults(errors = untypedErrors, input = inputOpt, parseHadErrors = false, dependencyFiles = builder.AllDependenciesDeprecated)
let parseResults = FSharpParseFileResults(errors = untypedErrors, input = parseTreeOpt, parseHadErrors = false, dependencyFiles = builder.AllDependenciesDeprecated)
let loadClosure = scriptClosureCacheLock.AcquireLock (fun ltok -> scriptClosureCache.TryGet (ltok, options) )
let scope =
TypeCheckInfo(tcProj.TcConfig, tcProj.TcGlobals, tcProj.TcState.PartialAssemblySignature, tcProj.TcState.Ccu, tcProj.TcImports, tcProj.TcEnvAtEnd.AccessRights,
Expand Down Expand Up @@ -3136,9 +3138,9 @@ type FsiInteractiveChecker(legacyReferenceResolver, reactorOps: IReactorOperatio
let filename = Path.Combine(tcConfig.implicitIncludeDir, "stdin.fsx")
// Note: projectSourceFiles is only used to compute isLastCompiland, and is ignored if Build.IsScript(mainInputFileName) is true (which it is in this case).
let parsingOptions = FSharpParsingOptions.FromTcConfig(tcConfig, [| filename |])
let parseErrors, inputOpt, anyErrors = Parser.parseFile (source, filename, parsingOptions, userOpName)
let parseErrors, parseTreeOpt, anyErrors = Parser.parseFile (source, filename, parsingOptions, userOpName)
let dependencyFiles = [| |] // interactions have no dependencies
let parseResults = FSharpParseFileResults(parseErrors, inputOpt, parseHadErrors = anyErrors, dependencyFiles = dependencyFiles)
let parseResults = FSharpParseFileResults(parseErrors, parseTreeOpt, parseHadErrors = anyErrors, dependencyFiles = dependencyFiles)

let backgroundDiagnostics = []

Expand Down