diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 6d2787dbfd656577ac3467ad502710272633bfb8..424cbe6c578376b8de37a47b7daee32607374321 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -509,7 +509,7 @@ try { Create-Directory $resultsRoot UpdatePath $env:HOSTED_COMPILER = 1 - $env:CSC_PIPE = "$nugetPackages\Microsoft.Net.Compilers\2.7.0\tools\csc.exe" + $env:CSC_PIPE = "$nugetPackages\Microsoft.Net.Compilers\4.3.0-1.22220.8\tools\csc.exe" $env:FSCOREDLLPATH = "$ArtifactsDir\bin\fsc\$configuration\net472\FSharp.Core.dll" $env:LINK_EXE = "$RepoRoot\tests\fsharpqa\testenv\bin\link\link.exe" $env:OSARCH = $env:PROCESSOR_ARCHITECTURE diff --git a/eng/Versions.props b/eng/Versions.props index ff4d8ac8998369f4a940e33c4d887c666cf1cbbd..87774bad87e2b73186982ee3c07e3d182ec71270 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -113,8 +113,8 @@ 6.0.0 4.5.0 - 17.0.391-preview-g5e248c9073 - 17.0.0-previews-4-31709-430 + 17.2.178-preview + 17.2.0-preview-1-32131-009 17.0.77-pre-g62a6cb5699 $(VisualStudioContractPackagesVersion) $(VisualStudioContractPackagesVersion) @@ -135,7 +135,7 @@ $(VisualStudioContractPackagesVersion) $(VisualStudioContractPackagesVersion) - 4.1.0-1.21511.14 + 4.2.0-2.22103.11 $(RoslynVersion) $(RoslynVersion) $(RoslynVersion) @@ -169,7 +169,7 @@ $(VisualStudioContractPackagesVersion) $(VisualStudioContractPackagesVersion) - 17.0.50-preview-0002-0025 + 17.2.22-alpha $(VisualStudioImplementationPackagesVersion) 17.0.0 $(VisualStudioContractPackagesVersion) @@ -185,9 +185,9 @@ 15.0.25123-Dev15Preview 16.0.1 16.0.28924.11111 - 17.0.46-alpha + 17.2.10-alpha $(VisualStudioContractPackagesVersion) - 17.0.23-alpha + 17.0.46 9.0.30729 12.0.4 7.0.4 @@ -203,7 +203,7 @@ 4.3.0.0 1.0.30 8.0.0 - 2.7.0 + 4.3.0-1.22220.8 3.1.0 5.0.0-preview.7.20364.11 5.0.0-preview.7.20364.11 @@ -214,8 +214,8 @@ 4.1.0 2.1.80 1.0.0-beta2-dev3 - 2.8.21 - 2.7.74 + 2.11.34 + 2.8.57 2.4.1 2.4.2 5.10.3 diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index cf1cbc694f0075a463dc093b85a09f70b9814ac6..5df511899846f0c4f0873042493f1f70eb5f2950 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -18,12 +18,12 @@ - - %(RelativeDir)\TestSource\%(Filename)%(Extension) - - - %(RelativeDir)\TestSource\%(Filename)%(Extension) - + + %(RelativeDir)\TestSource\%(Filename)%(Extension) + + + %(RelativeDir)\TestSource\%(Filename)%(Extension) + @@ -161,7 +161,8 @@ - + + diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/StaticsInInterfaces.fs b/tests/FSharp.Compiler.ComponentTests/Interop/StaticsInInterfaces.fs new file mode 100644 index 0000000000000000000000000000000000000000..ebbcc9580774545d2ef66d19fb7aaa7cdb63fc38 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Interop/StaticsInInterfaces.fs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +namespace FSharp.Compiler.ComponentTests.Interop + +open Xunit +open FSharp.Test.Compiler +open FSharp.Test + +module ``Static Methods In Interfaces`` = + + let withCSharpLanguageVersion (ver: CSharpLanguageVersion) (cUnit: CompilationUnit) : CompilationUnit = + match cUnit with + | CS cs -> CS { cs with LangVersion = ver } + | _ -> failwith "Only supported in C#" + + let csharpBaseClass = + CSharp """ + namespace StaticsInInterfaces + { + public interface IGetNext where T : IGetNext + { + static abstract T Next(T other); + } + public record RepeatSequence : IGetNext + { + private const char Ch = 'A'; + public string Text = new string(Ch, 1); + + public static RepeatSequence Next(RepeatSequence other) => other with { Text = other.Text + Ch }; + + public override string ToString() => Text; + } + + }""" |> withCSharpLanguageVersion CSharpLanguageVersion.Preview |> withName "csLib" + + +#if !NETCOREAPP + [] +#else + [] +#endif + let ``F# can call static methods declared in interfaces from C#`` () = + + let csharpLib = csharpBaseClass + + let fsharpSource = + """ +open System +open StaticsInInterfaces + +[] +let main _ = + + let mutable str = RepeatSequence () + let res = [ for i in 0..10 do + yield string(str) + str <- RepeatSequence.Next(str) ] + + if res <> ["A"; "AA"; "AAA"; "AAAA"; "AAAAA"; "AAAAAA"; "AAAAAAA"; "AAAAAAAA"; "AAAAAAAAA"; "AAAAAAAAAA"; "AAAAAAAAAAA"] then + failwith $"Unexpected result: %A{res}" + + if string(str) <> "AAAAAAAAAAAA" then + failwith $"Unexpected result %s{string(str)}" + 0 +""" + FSharp fsharpSource + |> asExe + |> withLangVersionPreview + |> withReferences [csharpLib] + |> compileAndRun + |> shouldSucceed + // TODO: test operators, test implementing statics. \ No newline at end of file diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 8e554153f54a3c5ef625e127ef73febed8081f7a..de0942d94f9528969282cb53fb6be976c2ff5a48 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -580,6 +580,8 @@ module rec Compiler = let lv = match csSource.LangVersion with | CSharpLanguageVersion.CSharp8 -> LanguageVersion.CSharp8 + | CSharpLanguageVersion.CSharp9 -> LanguageVersion.CSharp9 + | CSharpLanguageVersion.Preview -> LanguageVersion.Preview | _ -> LanguageVersion.Default let cmpl = diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index f288bbd4ae4187440057b00bd6ca25c208009ddf..c3cb5e0cc5c6da4bc3a48750debb37074d852ab5 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -130,6 +130,7 @@ type TestCompilation = type CSharpLanguageVersion = | CSharp8 = 0 | CSharp9 = 1 + | Preview = 99 [] type CompilationUtil private () = @@ -139,6 +140,7 @@ type CompilationUtil private () = match lv with | CSharpLanguageVersion.CSharp8 -> LanguageVersion.CSharp8 | CSharpLanguageVersion.CSharp9 -> LanguageVersion.CSharp9 + | CSharpLanguageVersion.Preview -> LanguageVersion.Preview | _ -> LanguageVersion.Default let tf = defaultArg tf TargetFramework.NetStandard20 diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index f20bbf94fa5191d27c4ae300573f45b64a4ac047..936794b175bf464f6f864ee5907b1524c1211490 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -316,8 +316,8 @@ let config configurationName envVars = let packagesDir = getPackagesDir () let requirePackage = requireFile packagesDir let requireArtifact = requireFile artifactsBinPath - let CSC = requirePackage ("Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "csc.exe") - let VBC = requirePackage ("Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "vbc.exe") + let CSC = requirePackage ("Microsoft.Net.Compilers" ++ "4.3.0-1.22220.8" ++ "tools" ++ "csc.exe") + let VBC = requirePackage ("Microsoft.Net.Compilers" ++ "4.3.0-1.22220.8" ++ "tools" ++ "vbc.exe") let ILDASM_EXE = if operatingSystem = "win" then "ildasm.exe" else "ildasm" let ILDASM = requirePackage (("runtime." + operatingSystem + "-" + architectureMoniker + ".Microsoft.NETCore.ILDAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ (operatingSystem + "-" + architectureMoniker) ++ "native" ++ ILDASM_EXE) let ILASM_EXE = if operatingSystem = "win" then "ilasm.exe" else "ilasm" diff --git a/tests/fsharpqa/run.fsharpqa.test.fsx b/tests/fsharpqa/run.fsharpqa.test.fsx index 215082a8b85a74ec35097e9eda9b92f9ee9f0369..89006028a3db371aa555eeb04940e2c7e94dc065 100644 --- a/tests/fsharpqa/run.fsharpqa.test.fsx +++ b/tests/fsharpqa/run.fsharpqa.test.fsx @@ -23,7 +23,7 @@ let nugetCache = | path -> path let rootFolder = Path.Combine(__SOURCE_DIRECTORY__, "..", "..") let compilerBinFolder = Path.Combine(rootFolder, "artifacts", "bin", "fsc", releaseOrDebug, "net472") -setEnvVar "CSC_PIPE" (Path.Combine(nugetCache, "Microsoft.Net.Compilers", "2.7.0", "tools", "csc.exe")) +setEnvVar "CSC_PIPE" (Path.Combine(nugetCache, "Microsoft.Net.Compilers", "4.3.0-1.22220.8", "tools", "csc.exe")) setEnvVar "FSC" (Path.Combine(compilerBinFolder, "fsc.exe")) setEnvVar "FSCOREDLLPATH" (Path.Combine(compilerBinFolder, "FSharp.Core.dll")) addToPath compilerBinFolder diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.ProjectSystem.PropertyPages.vbproj b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.ProjectSystem.PropertyPages.vbproj index 82d493fe0cc676507d9e96156fc082a17b528a20..799603e1c3585eb63f40bf052eca2a2f851bee10 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.ProjectSystem.PropertyPages.vbproj +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.ProjectSystem.PropertyPages.vbproj @@ -52,7 +52,6 @@ - diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index 961895ee8ba860a4caad08f2482af5c352a16b1c..d45e0cd77df92b41443c8a15beca3f43e6afdbef 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -194,7 +194,6 @@ -