Skip to content

Commit 360ae63

Browse files
CopilotT-Gro
andcommitted
Address code review: fix LoadLocalFSharpBuild, simplify versions, remove unwanted files
- Fixed project files to properly use DirectoryBuildPropsPath for controlling UseLocalCompiler import - Simplified version scheme to "local", "latest", "9" as requested - Added all combinations with "local" on at least one side (5 test cases total) - Removed release notes entry as it's just tests - Removed checked-in global.json and commandline.txt files - Added .gitignore to prevent checking in test-generated files Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
1 parent c5a2700 commit 360ae63

File tree

8 files changed

+22
-20
lines changed

8 files changed

+22
-20
lines changed

docs/release-notes/.FSharp.Compiler.Service/10.0.100.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* Diagnostics: add extended data for 'No constructors' error ([PR #18863](https://github.com/dotnet/fsharp/pull/18863))
77
* FSharpType.Format: support top-level prefix generic types style. ([PR #18897](https://github.com/dotnet/fsharp/pull/18897))
88
* FCS: allow getting captured types ([PR $18878](https://github.com/dotnet/fsharp/pull/18878))
9-
* Add compiler compatibility test suite to verify anonymous records work across different F# compiler versions. Test projects under tests/projects/CompilerCompat verify backward and forward compatibility scenarios.
109

1110
### Fixed
1211

tests/FSharp.Compiler.ComponentTests/CompilerCompatibilityTests.fs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ type CompilerCompatibilityTests() =
1313
let libProjectPath = Path.Combine(projectsPath, "CompilerCompatLib")
1414
let appProjectPath = Path.Combine(projectsPath, "CompilerCompatApp")
1515

16-
let createGlobalJson targetFramework projectPath =
17-
let globalJsonContent = $"""{{
18-
"sdk": {{
19-
"version": "{targetFramework}"
20-
}}
21-
}}"""
16+
let createGlobalJson version projectPath =
17+
let globalJsonContent =
18+
match version with
19+
| "9" -> """{"sdk":{"version":"9.0.100"}}"""
20+
| _ -> failwith $"Unsupported version for global.json: {version}"
21+
2222
let globalJsonPath = Path.Combine(projectPath, "global.json")
2323
File.WriteAllText(globalJsonPath, globalJsonContent)
2424
globalJsonPath
@@ -30,12 +30,9 @@ type CompilerCompatibilityTests() =
3030
let runDotnetBuild projectPath compilerVersion =
3131
let globalJsonPath =
3232
match compilerVersion with
33-
| "local" ->
34-
// For local compiler, use LoadLocalFSharpBuild property
35-
None
36-
| version ->
37-
// For specific .NET versions, create global.json
38-
Some (createGlobalJson version projectPath)
33+
| "local" -> None
34+
| "latest" -> None
35+
| version -> Some (createGlobalJson version projectPath)
3936

4037
let args =
4138
match compilerVersion with
@@ -73,8 +70,10 @@ type CompilerCompatibilityTests() =
7370

7471
[<Theory>]
7572
[<InlineData("local", "local", "Baseline scenario - Both library and app built with local compiler")>]
76-
[<InlineData("10.0.100-rc.1.25411.109", "local", "Forward compatibility - Library built with .NET 10 SDK, app with local compiler")>]
77-
[<InlineData("local", "10.0.100-rc.1.25411.109", "Backward compatibility - Library built with local compiler, app with .NET 10 SDK")>]
73+
[<InlineData("latest", "local", "Forward compatibility - Library built with latest SDK, app with local compiler")>]
74+
[<InlineData("local", "latest", "Backward compatibility - Library built with local compiler, app with latest SDK")>]
75+
[<InlineData("9", "local", "Forward compatibility - Library built with .NET 9 SDK, app with local compiler")>]
76+
[<InlineData("local", "9", "Backward compatibility - Library built with local compiler, app with .NET 9 SDK")>]
7877
member _.``Compiler compatibility test``(libCompilerVersion: string, appCompilerVersion: string, scenarioDescription: string) =
7978
// Clean previous builds
8079
cleanBinObjDirectories libProjectPath
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore test-generated files
2+
global.json
3+
commandline.txt
4+
StandardOutput.txt
5+
StandardError.txt

tests/projects/CompilerCompat/CompilerCompatApp/CompilerCompatApp.fsproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net8.0</TargetFramework>
6+
<DirectoryBuildPropsPath Condition="'$(LoadLocalFSharpBuild)' == 'True'">../../../../UseLocalCompiler.Directory.Build.props</DirectoryBuildPropsPath>
7+
<DirectoryBuildPropsPath Condition="'$(LoadLocalFSharpBuild)' != 'True'"></DirectoryBuildPropsPath>
68
</PropertyGroup>
79

810
<ItemGroup>

tests/projects/CompilerCompat/CompilerCompatApp/commandline.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/projects/CompilerCompat/CompilerCompatApp/global.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/projects/CompilerCompat/CompilerCompatLib/CompilerCompatLib.fsproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
6+
<DirectoryBuildPropsPath Condition="'$(LoadLocalFSharpBuild)' == 'True'">../../../../UseLocalCompiler.Directory.Build.props</DirectoryBuildPropsPath>
7+
<DirectoryBuildPropsPath Condition="'$(LoadLocalFSharpBuild)' != 'True'"></DirectoryBuildPropsPath>
68
</PropertyGroup>
79

810
<ItemGroup>

tests/projects/CompilerCompat/CompilerCompatLib/commandline.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)