Skip to content

Commit

Permalink
Fix #2308 -- Struct tuples do not work in FSI / VS FSI (#2309)
Browse files Browse the repository at this point in the history
* Fix #2308 -- Struct tuples do not work in FSI / VS FSI

* add test

* Make new test work on coreclr

* Add fsc_basic struct tuple test

* Fix typo in name, correct build tests-coreclr-fsharp
  • Loading branch information
KevinRansom committed Jan 22, 2017
1 parent d921725 commit 877aed4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
1 change: 1 addition & 0 deletions build.cmd
Expand Up @@ -319,6 +319,7 @@ if /i '%ARG%' == 'test-net40-fsharp' (

if /i '%ARG%' == 'test-coreclr-fsharp' (
set BUILD_NET40=1
set BUILD_PROTO_WITH_CORECLR_LKG=1
set BUILD_CORECLR=1
set TEST_CORECLR_FSHARP_SUITE=1
)
Expand Down
1 change: 1 addition & 0 deletions src/fsharp/CompileOps.fs
Expand Up @@ -1683,6 +1683,7 @@ let DefaultReferencesForScriptsAndOutOfProjectSources(assumeDotNetFramework) =
yield "System.Collections" // System.Collections.Generic.List<T>
yield "System.Runtime.Numerics" // BigInteger
yield "System.Threading" // OperationCanceledException
yield "System.ValueTuple"

yield "System.Web"
yield "System.Web.Services"
Expand Down
20 changes: 20 additions & 0 deletions tests/fsharp/regression/struct-tuple-bug-1/test.fsx
@@ -0,0 +1,20 @@
// #Regression
let failures = ref false
let report_failure msg =
printfn "%A" msg
failures := true

try
let struct (_x,_y) = struct (1,2)
()
with ex -> report_failure (ex.ToString())

let _ =
if !failures then
printfn "Test Failed"
exit 1
else
printfn "Test Passed"
System.IO.File.WriteAllText("test.ok", "ok")
exit 0
()
12 changes: 9 additions & 3 deletions tests/fsharp/tests.fs
Expand Up @@ -1378,6 +1378,13 @@ module ToolsTests =


module RegressionTests =

[<Test >]
let ``struct-tuple-bug-1-FSC_BASIC`` () = singleTestBuildAndRun "regression/struct-tuple-bug-1" FSC_BASIC

[<Test >]
let ``tuple-bug-1`` () = singleTestBuildAndRun "regression/tuple-bug-1" FSC_BASIC

[<Test>]
let ``26`` () = singleTestBuildAndRun "regression/26" FSC_BASIC

Expand Down Expand Up @@ -1425,13 +1432,12 @@ module RegressionTests =
fsc cfg "%s -r:Category.dll -a -o:petshop.dll" cfg.fsc_flags ["Category.ml"]

peverify cfg "petshop.dll"

[<Test >]
let ``86`` () = singleTestBuildAndRun "regression/86" FSC_BASIC

[<Test >]
let ``tuple-bug-1`` () = singleTestBuildAndRun "regression/tuple-bug-1" FSC_BASIC

let ``struct-tuple-bug-1-FSI_BASIC`` () = singleTestBuildAndRun "regression/struct-tuple-bug-1" FSI_BASIC

#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
module OptimizationTests =
Expand Down
4 changes: 2 additions & 2 deletions tests/scripts/fsci.fsx
Expand Up @@ -56,8 +56,8 @@ let executeFsi references =
let arguments2 = sprintf @"%s %s" fsiExe (String.concat " " arguments)
if isVerbose then
log "%s %s" coreRunExe arguments2
log "%s %s @fsc.cmd.args" coreRunExe fsiExe
File.WriteAllLines(OutputDir ++ "fsc.cmd.args", arguments)
log "%s %s @fsi.cmd.args" coreRunExe fsiExe
File.WriteAllLines(OutputDir ++ "fsi.cmd.args", arguments)
File.WriteAllLines(OutputDir ++ (TestName + ".runtimeconfig.json"), runtimeConfigLines)
CopyDlls.Split(';') |> Array.iter(fun s -> if not (System.String.IsNullOrWhiteSpace(s)) then File.Copy(s, OutputDir ++ Path.GetFileName(s), true))
executeProcess coreRunExe arguments2
Expand Down

0 comments on commit 877aed4

Please sign in to comment.