Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

E_LessThanDotOpenParen001.fsx(23,12,23,15): typecheck error FS0043: No overloads match for method 'op_PlusPlusPlus'.

Known return type: ^a
Known return type: 'a

Known type parameters: < (string -> int) , TestType<int,string> >

Expand Down
20 changes: 17 additions & 3 deletions tests/fsharp/single-test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo
"FSharp.Core"
(Path.GetFullPath(__SOURCE_DIRECTORY__) + "/../../artifacts/bin/" + compiler + "/" + configuration + "/netstandard2.0/FSharp.Core.dll")

let langver, options =
match languageVersion with
| "supports-ml" -> "5.0", "--mlcompatibility"
| v -> v, ""

let computeSourceItems addDirectory addCondition (compileItem:CompileItem) sources =
let computeInclude src =
let fileName = if addDirectory then Path.Combine(pc.SourceDirectory, src) else src
Expand Down Expand Up @@ -142,6 +147,7 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo
<DebugSymbols>$(DEBUG)</DebugSymbols>
<DebugType>portable</DebugType>
<LangVersion>$(LANGUAGEVERSION)</LangVersion>
<OtherFlags>$(OTHERFLAGS)</OtherFlags>
<Optimize>$(OPTIMIZE)</Optimize>
<SignAssembly>false</SignAssembly>
<DefineConstants Condition=""'$(OutputType)' == 'Script' and '$(FSharpTestCompilerVersion)' == 'coreclr'"">NETCOREAPP</DefineConstants>
Expand Down Expand Up @@ -196,7 +202,8 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo
|> replaceTokens "$(OPTIMIZE)" optimize
|> replaceTokens "$(DEBUG)" debug
|> replaceTokens "$(TARGETFRAMEWORK)" targetFramework
|> replaceTokens "$(LANGUAGEVERSION)" languageVersion
|> replaceTokens "$(LANGUAGEVERSION)" langver
|> replaceTokens "$(OTHERFLAGS)" options
|> replaceTokens "$(RestoreFromArtifactsPath)" (Path.GetFullPath(__SOURCE_DIRECTORY__) + "/../../artifacts/packages/" + configuration)
generateProjBody

Expand Down Expand Up @@ -376,10 +383,17 @@ let singleTestBuildAndRunVersion dir p version =

let singleVersionedNegTest (cfg: TestConfig) version testname =

let options =
match version with
| "supports-ml" -> "--langversion:5.0 --mlcompatibility"
| "supports-ml*" -> "--mlcompatibility"
| v when not (String.IsNullOrEmpty(v)) -> $"--langversion:{v}"
| _ -> ""

let cfg = {
cfg with
fsc_flags = sprintf "%s %s --preferreduilang:en-US --define:NEGATIVE" cfg.fsc_flags (if not (String.IsNullOrEmpty(version)) then "--langversion:" + version else "")
fsi_flags = sprintf "%s --preferreduilang:en-US %s" cfg.fsi_flags (if not (String.IsNullOrEmpty(version)) then "--langversion:" + version else "")
fsc_flags = sprintf "%s %s --preferreduilang:en-US --define:NEGATIVE" cfg.fsc_flags options
fsi_flags = sprintf "%s --preferreduilang:en-US %s" cfg.fsi_flags options
}

// REM == Set baseline (fsc vs vs, in case the vs baseline exists)
Expand Down
81 changes: 42 additions & 39 deletions tests/fsharp/tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -299,22 +299,22 @@ module CoreTests =
let ``members-factors-mutrec-FSI`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSI

[<Test>]
let ``graph-FSC_DEBUG`` () = singleTestBuildAndRun "perf/graph" FSC_DEBUG
let ``graph-FSC_DEBUG`` () = singleTestBuildAndRunVersion "perf/graph" FSC_DEBUG "supports-ml"

[<Test>]
let ``graph-FSC_OPTIMIZED`` () = singleTestBuildAndRun "perf/graph" FSC_OPTIMIZED
let ``graph-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "perf/graph" FSC_OPTIMIZED "supports-ml"

[<Test>]
let ``graph-FSI`` () = singleTestBuildAndRun "perf/graph" FSI
let ``graph-FSI`` () = singleTestBuildAndRunVersion "perf/graph" FSI "supports-ml"

[<Test>]
let ``nbody-FSC_DEBUG`` () = singleTestBuildAndRun "perf/nbody" FSC_DEBUG
let ``nbody-FSC_DEBUG`` () = singleTestBuildAndRunVersion "perf/nbody" FSC_DEBUG "supports-ml"

[<Test>]
let ``nbody-FSC_OPTIMIZED`` () = singleTestBuildAndRun "perf/nbody" FSC_OPTIMIZED
let ``nbody-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "perf/nbody" FSC_OPTIMIZED "supports-ml"

[<Test>]
let ``nbody-FSI`` () = singleTestBuildAndRun "perf/nbody" FSI
let ``nbody-FSI`` () = singleTestBuildAndRunVersion "perf/nbody" FSI "supports-ml"

[<Test>]
let ``forexpression-FSC_DEBUG`` () = singleTestBuildAndRun "core/forexpression" FSC_DEBUG
Expand Down Expand Up @@ -939,7 +939,7 @@ module CoreTests =

begin
use testOkFile = fileguard cfg "test.ok"
fsiStdin cfg "test1.ml" "--maxerrors:1" []
fsiStdin cfg "test1.ml" " --langversion:5.0 --mlcompatibility --maxerrors:1" []
testOkFile.CheckExists()
end

Expand Down Expand Up @@ -981,15 +981,15 @@ module CoreTests =
let hiding () =
let cfg = testConfig "core/hiding"

fsc cfg "%s -a --optimize -o:lib.dll" cfg.fsc_flags ["lib.mli";"lib.ml";"libv.ml"]
fsc cfg "%s -a --optimize --langversion:5.0 --mlcompatibility -o:lib.dll" cfg.fsc_flags ["lib.mli";"lib.ml";"libv.ml"]

peverify cfg "lib.dll"

fsc cfg "%s -a --optimize -r:lib.dll -o:lib2.dll" cfg.fsc_flags ["lib2.mli";"lib2.ml";"lib3.ml"]
fsc cfg "%s -a --optimize --langversion:5.0 --mlcompatibility -r:lib.dll -o:lib2.dll" cfg.fsc_flags ["lib2.mli";"lib2.ml";"lib3.ml"]

peverify cfg "lib2.dll"

fsc cfg "%s --optimize -r:lib.dll -r:lib2.dll -o:client.exe" cfg.fsc_flags ["client.ml"]
fsc cfg "%s --optimize --langversion:5.0 --mlcompatibility -r:lib.dll -r:lib2.dll -o:client.exe" cfg.fsc_flags ["client.ml"]

peverify cfg "client.exe"

Expand Down Expand Up @@ -1262,9 +1262,9 @@ module CoreTests =
let parsing () =
let cfg = testConfig "core/parsing"

fsc cfg "%s -a -o:crlf.dll -g" cfg.fsc_flags ["crlf.ml"]
fsc cfg "%s -a --langversion:5.0 --mlcompatibility -o:crlf.dll -g" cfg.fsc_flags ["crlf.ml"]

fsc cfg "%s -o:toplet.exe -g" cfg.fsc_flags ["toplet.ml"]
fsc cfg "%s --langversion:5.0 --mlcompatibility -o:toplet.exe -g" cfg.fsc_flags ["toplet.ml"]

peverify cfg "toplet.exe"

Expand Down Expand Up @@ -1298,7 +1298,7 @@ module CoreTests =
let cfg = testConfig "core/internalsvisible"

// Compiling F# Library
fsc cfg "%s --version:1.2.3 --keyfile:key.snk -a --optimize -o:library.dll" cfg.fsc_flags ["library.fsi"; "library.fs"]
fsc cfg "%s --version:1.2.3 --keyfile:key.snk --langversion:5.0 --mlcompatibility -a --optimize -o:library.dll" cfg.fsc_flags ["library.fsi"; "library.fs"]

peverify cfg "library.dll"

Expand All @@ -1308,7 +1308,7 @@ module CoreTests =
peverify cfg "librarycs.dll"

// Compiling F# main referencing C# and F# libraries
fsc cfg "%s --version:1.2.3 --keyfile:key.snk --optimize -r:library.dll -r:librarycs.dll -o:main.exe" cfg.fsc_flags ["main.fs"]
fsc cfg "%s --version:1.2.3 --keyfile:key.snk --optimize --langversion:5.0 --mlcompatibility -r:library.dll -r:librarycs.dll -o:main.exe" cfg.fsc_flags ["main.fs"]

peverify cfg "main.exe"

Expand Down Expand Up @@ -1882,19 +1882,19 @@ module CoreTests =
let testResources () =
let cfg = testConfig "core/resources"

fsc cfg "%s --resource:Resources.resources -o:test-embed.exe -g" cfg.fsc_flags ["test.fs"]
fsc cfg "%s --langversion:5.0 --mlcompatibility --resource:Resources.resources -o:test-embed.exe -g" cfg.fsc_flags ["test.fs"]

peverify cfg "test-embed.exe"

fsc cfg "%s --linkresource:Resources.resources -o:test-link.exe -g" cfg.fsc_flags ["test.fs"]
fsc cfg "%s --langversion:5.0 --mlcompatibility --linkresource:Resources.resources -o:test-link.exe -g" cfg.fsc_flags ["test.fs"]

peverify cfg "test-link.exe"

fsc cfg "%s --resource:Resources.resources,ResourceName.resources -o:test-embed-named.exe -g" cfg.fsc_flags ["test.fs"]
fsc cfg "%s --langversion:5.0 --mlcompatibility --resource:Resources.resources,ResourceName.resources -o:test-embed-named.exe -g" cfg.fsc_flags ["test.fs"]

peverify cfg "test-embed-named.exe"

fsc cfg "%s --linkresource:Resources.resources,ResourceName.resources -o:test-link-named.exe -g" cfg.fsc_flags ["test.fs"]
fsc cfg "%s --langversion:5.0 --mlcompatibility --linkresource:Resources.resources,ResourceName.resources -o:test-link-named.exe -g" cfg.fsc_flags ["test.fs"]

peverify cfg "test-link-named.exe"

Expand Down Expand Up @@ -1950,13 +1950,13 @@ module CoreTests =

peverify cfg "app69514-withsig.exe"

fsc cfg "%s -o:lib.dll -a -g" cfg.fsc_flags ["lib.ml"]
fsc cfg "%s -o:lib.dll -a --langversion:5.0 --mlcompatibility -g" cfg.fsc_flags ["lib.ml"]

peverify cfg "lib.dll"

csc cfg """/nologo /r:"%s" /r:lib.dll /out:test.exe """ cfg.FSCOREDLLPATH ["test.cs"]

fsc cfg "%s --optimize -o:lib--optimize.dll -a -g" cfg.fsc_flags ["lib.ml"]
fsc cfg "%s --optimize -o:lib--optimize.dll -a --langversion:5.0 --mlcompatibility -g" cfg.fsc_flags ["lib.ml"]

peverify cfg "lib--optimize.dll"

Expand Down Expand Up @@ -2111,19 +2111,19 @@ module ToolsTests =
let cfg =
testConfig "tools/bundle"

fsc cfg "%s --progress --standalone -o:test-one-fsharp-module.exe -g" cfg.fsc_flags ["test-one-fsharp-module.fs"]
fsc cfg "%s --progress --langversion:5.0 --mlcompatibility --standalone -o:test-one-fsharp-module.exe -g" cfg.fsc_flags ["test-one-fsharp-module.fs"]

peverify cfg "test-one-fsharp-module.exe"

fsc cfg "%s -a -o:test_two_fsharp_modules_module_1.dll -g" cfg.fsc_flags ["test_two_fsharp_modules_module_1.fs"]
fsc cfg "%s -a --langversion:5.0 --mlcompatibility -o:test_two_fsharp_modules_module_1.dll -g" cfg.fsc_flags ["test_two_fsharp_modules_module_1.fs"]

peverify cfg "test_two_fsharp_modules_module_1.dll"

fsc cfg "%s --standalone -r:test_two_fsharp_modules_module_1.dll -o:test_two_fsharp_modules_module_2.exe -g" cfg.fsc_flags ["test_two_fsharp_modules_module_2.fs"]
fsc cfg "%s --langversion:5.0 --mlcompatibility --standalone -r:test_two_fsharp_modules_module_1.dll -o:test_two_fsharp_modules_module_2.exe -g" cfg.fsc_flags ["test_two_fsharp_modules_module_2.fs"]

peverify cfg "test_two_fsharp_modules_module_2.exe"

fsc cfg "%s -a --standalone -r:test_two_fsharp_modules_module_1.dll -o:test_two_fsharp_modules_module_2_as_dll.dll -g" cfg.fsc_flags ["test_two_fsharp_modules_module_2.fs"]
fsc cfg "%s -a --langversion:5.0 --mlcompatibility --standalone -r:test_two_fsharp_modules_module_1.dll -o:test_two_fsharp_modules_module_2_as_dll.dll -g" cfg.fsc_flags ["test_two_fsharp_modules_module_2.fs"]

peverify cfg "test_two_fsharp_modules_module_2_as_dll.dll"
#endif
Expand Down Expand Up @@ -2152,7 +2152,7 @@ module RegressionTests =
let ``struct-tuple-bug-1-FSC_OPTIMIZED`` () = singleTestBuildAndRun "regression/struct-tuple-bug-1" FSC_OPTIMIZED

[<Test >]
let ``tuple-bug-1-FSC_OPTIMIZED`` () = singleTestBuildAndRun "regression/tuple-bug-1" FSC_OPTIMIZED
let ``tuple-bug-1-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "regression/tuple-bug-1" FSC_OPTIMIZED "supports-ml"

[<Test >]
let ``12383-FSC_OPTIMIZED`` () = singleTestBuildAndRun "regression/12383" FSC_OPTIMIZED
Expand Down Expand Up @@ -2262,22 +2262,22 @@ module RegressionTests =
#endif

[<Test>]
let ``26`` () = singleTestBuildAndRun "regression/26" FSC_OPTIMIZED
let ``26`` () = singleTestBuildAndRunVersion "regression/26" FSC_OPTIMIZED "supports-ml"

[<Test >]
let ``321`` () = singleTestBuildAndRun "regression/321" FSC_OPTIMIZED
let ``321`` () = singleTestBuildAndRunVersion "regression/321" FSC_OPTIMIZED "supports-ml"

#if !NETCOREAPP
// This test is disabled in coreclr builds dependent on fixing : https://github.com/dotnet/fsharp/issues/2600
[<Test>]
let ``655`` () =
let cfg = testConfig "regression/655"

fsc cfg "%s -a -o:pack.dll" cfg.fsc_flags ["xlibC.ml"]
fsc cfg "%s --langversion:5.0 --mlcompatibility -a -o:pack.dll" cfg.fsc_flags ["xlibC.ml"]

peverify cfg "pack.dll"

fsc cfg "%s -o:test.exe -r:pack.dll" cfg.fsc_flags ["main.fs"]
fsc cfg "%s --langversion:5.0 --mlcompatibility -o:test.exe -r:pack.dll" cfg.fsc_flags ["main.fs"]

peverify cfg "test.exe"

Expand All @@ -2292,30 +2292,30 @@ module RegressionTests =
let ``656`` () =
let cfg = testConfig "regression/656"

fsc cfg "%s -o:pack.exe" cfg.fsc_flags ["misc.fs mathhelper.fs filehelper.fs formshelper.fs plot.fs traj.fs playerrecord.fs trackedplayers.fs form.fs"]
fsc cfg "%s --langversion:5.0 --mlcompatibility -o:pack.exe" cfg.fsc_flags ["misc.fs mathhelper.fs filehelper.fs formshelper.fs plot.fs traj.fs playerrecord.fs trackedplayers.fs form.fs"]

peverify cfg "pack.exe"
#endif

#if !NETCOREAPP
// Requires WinForms
[<Test>]
let ``83`` () = singleTestBuildAndRun "regression/83" FSC_OPTIMIZED
let ``83`` () = singleTestBuildAndRunVersion "regression/83" FSC_OPTIMIZED "supports-ml"

[<Test >]
let ``84`` () = singleTestBuildAndRun "regression/84" FSC_OPTIMIZED
let ``84`` () = singleTestBuildAndRunVersion "regression/84" FSC_OPTIMIZED "supports-ml"

[<Test >]
let ``85`` () =
let cfg = testConfig "regression/85"

fsc cfg "%s -r:Category.dll -a -o:petshop.dll" cfg.fsc_flags ["Category.ml"]
fsc cfg "%s --langversion:5.0 --mlcompatibility -r:Category.dll -a -o:petshop.dll" cfg.fsc_flags ["Category.ml"]

peverify cfg "petshop.dll"
#endif

[<Test >]
let ``86`` () = singleTestBuildAndRun "regression/86" FSC_OPTIMIZED
let ``86`` () = singleTestBuildAndRunVersion "regression/86" FSC_OPTIMIZED "supports-ml"

[<Test >]
let ``struct-tuple-bug-1-FSI`` () = singleTestBuildAndRun "regression/struct-tuple-bug-1" FSI
Expand Down Expand Up @@ -2472,7 +2472,7 @@ module TypecheckTests =
SingleTest.singleTestBuildAndRunWithCopyDlls cfg "full-rank-arrays.dll" FSC_OPTIMIZED

[<Test>]
let misc () = singleTestBuildAndRun "typecheck/misc" FSC_OPTIMIZED
let misc () = singleTestBuildAndRunVersion "typecheck/misc" FSC_OPTIMIZED "supports-ml"

#if !NETCOREAPP

Expand Down Expand Up @@ -2697,7 +2697,7 @@ module TypecheckTests =
[<Test>]
let ``sigs pos01a`` () =
let cfg = testConfig "typecheck/sigs"
fsc cfg "%s -a -o:pos01a.dll" cfg.fsc_flags ["pos01a.fsi"; "pos01a.fs"]
fsc cfg "%s -a --langversion:5.0 --mlcompatibility -o:pos01a.dll" cfg.fsc_flags ["pos01a.fsi"; "pos01a.fs"]
peverify cfg "pos01a.dll"

[<Test>]
Expand All @@ -2715,10 +2715,10 @@ module TypecheckTests =
let ``type check neg01`` () = singleNegTest (testConfig "typecheck/sigs") "neg01"

[<Test>]
let ``type check neg02`` () = singleNegTest (testConfig "typecheck/sigs") "neg02"
let ``type check neg02`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "6.0" "neg02"

[<Test>]
let ``type check neg03`` () = singleNegTest (testConfig "typecheck/sigs") "neg03"
let ``type check neg03`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "supports-ml*" "neg03"

[<Test>]
let ``type check neg04`` () = singleNegTest (testConfig "typecheck/sigs") "neg04"
Expand Down Expand Up @@ -3103,7 +3103,10 @@ module TypecheckTests =
let ``type check neg118`` () = singleNegTest (testConfig "typecheck/sigs") "neg118"

[<Test>]
let ``type check neg119`` () = singleNegTest (testConfig "typecheck/sigs") "neg119"
let ``type check neg119a`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "6.0" "neg119a"

[<Test>]
let ``type check neg119b`` () = singleVersionedNegTest (testConfig "typecheck/sigs") "7.0" "neg119b"

[<Test>]
let ``type check neg120`` () = singleNegTest (testConfig "typecheck/sigs") "neg120"
Expand Down
2 changes: 1 addition & 1 deletion tests/fsharp/typecheck/sigs/neg02.vsbsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ neg02.fs(6,8,6,15): parse error FS0010: Unexpected identifier in member definiti

neg02.fs(17,21,17,26): typecheck error FS3351: Feature 'static abstract interface members' is not supported by target runtime.

neg02.fs(17,21,17,26): typecheck error FS3350: Feature 'static abstract interface members' is not available in F# 6.0. Please use language version 'PREVIEW' or greater.
neg02.fs(17,21,17,26): typecheck error FS3350: Feature 'static abstract interface members' is not available in F# 6.0. Please use language version 7.0 or greater.

neg02.fs(17,21,17,24): typecheck error FS0855: No abstract or interface member was found that corresponds to this override
10 changes: 5 additions & 5 deletions tests/fsharp/typecheck/sigs/neg116.bsl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

neg116.fs(10,44,10,45): typecheck error FS0043: No overloads match for method 'op_Multiply'.
neg116.fs(10,34,10,47): ilxgen error FS0041: No overloads match for method 'op_Multiply'.

Known return type: ^a
Known return type: 'a

Known type parameters: < float , Polynomial >
Known type parameters: < Microsoft.FSharp.Core.float , Neg116.Polynomial >

Available overloads:
- static member Polynomial.( * ) : s: Complex * p: Polynomial -> Polynomial // Argument 's' doesn't match
- static member Polynomial.( * ) : s: decimal * p: Polynomial -> Polynomial // Argument 's' doesn't match
- static member Neg116.Polynomial.( * ) : s: Microsoft.FSharp.Core.decimal * p: Neg116.Polynomial -> Neg116.Polynomial // Argument 's' doesn't match
- static member Neg116.Polynomial.( * ) : s: Neg116.Complex * p: Neg116.Polynomial -> Neg116.Polynomial // Argument 's' doesn't match
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

neg119.fs(40,20,40,22): typecheck error FS0071: Type constraint mismatch when applying the default type 'obj' for a type inference variable. No overloads match for method 'Return'.
neg119a.fs(40,20,40,22): typecheck error FS0071: Type constraint mismatch when applying the default type 'obj' for a type inference variable. No overloads match for method 'Return'.

Known return type: ((int -> int -> int) -> obj)

Expand Down
4 changes: 4 additions & 0 deletions tests/fsharp/typecheck/sigs/neg119b.bsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

neg119b.fs(40,9,40,17): typecheck error FS0030: Value restriction. The value 'res2n3n4' has been inferred to have generic type
val res2n3n4: ^_a when (^_b or Applicatives.ZipList<int> or ^_a) : (static member (<*>) : ^_b * Applicatives.ZipList<int> -> ^_a) and (^_c or obj or ^_b) : (static member (<*>) : ^_c * obj -> ^_b) and (Applicatives.Ap or ^_c) : (static member Return: ^_c * Applicatives.Ap -> ((int -> int -> int) -> ^_c))
Either define 'res2n3n4' as a simple data term, make it a function with explicit arguments or, if you do not intend for it to be generic, add a type annotation.
Loading