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
Prev Previous commit
Hiding internals of CompilationReference
  • Loading branch information
TIHan committed Jan 6, 2020
commit 14cd3af63e089868d581f0b2fa21fb2defcb08a5
10 changes: 5 additions & 5 deletions tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type C() = class end
let y = Module1.C()
printfn "%A" y
"""
Compilation.Create(source, Fsx, Exe, cmplRefs=[CompilationReference(module1, true)])
Compilation.Create(source, Fsx, Exe, cmplRefs=[CompilationReference.CreateFSharp(module1, staticLink=true)])

CompilerAssert.Execute(module2,
beforeExecute=(fun _ deps ->
Expand All @@ -51,7 +51,7 @@ type C() = class end
let y = Module1.C()
printfn "%A" y
"""
Compilation.Create(source, Fsx, Exe, cmplRefs=[CompilationReference(module1, false)])
Compilation.Create(source, Fsx, Exe, cmplRefs=[CompilationReference.CreateFSharp module1])

Assert.Throws<TargetInvocationException>(fun _ ->
CompilerAssert.Execute(module2,
Expand All @@ -76,7 +76,7 @@ type C() = class end
let y = Module1.C()
printfn "%A" y
"""
Compilation.Create(source, Fsx, Exe, cmplRefs=[CompilationReference(module1, false)])
Compilation.Create(source, Fsx, Exe, cmplRefs=[CompilationReference.CreateFSharp module1])

CompilerAssert.Execute module2

Expand Down Expand Up @@ -149,7 +149,7 @@ if not test3 then
if test1 && test2 && test3 then ()
else failwith "Test Failed"
"""
Compilation.Create(source, Fsx, Exe, cmplRefs=[CompilationReference(module1, true)])
Compilation.Create(source, Fsx, Exe, cmplRefs=[CompilationReference.CreateFSharp(module1, staticLink=true)])

CompilerAssert.Execute(module2, ignoreWarnings=true)

Expand Down Expand Up @@ -222,6 +222,6 @@ if not test3 then
if test1 && test2 && test3 then ()
else failwith "Test Failed"
"""
Compilation.Create(source, Fsx, Exe, [|"--optimize+"|], [CompilationReference(module1, false)])
Compilation.Create(source, Fsx, Exe, [|"--optimize+"|], [CompilationReference.CreateFSharp(module1, staticLink=true)])

CompilerAssert.Execute(module2, ignoreWarnings=true)
7 changes: 5 additions & 2 deletions tests/fsharp/Compiler/CompilerAssert.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ type CompileOutput =
| Library
| Exe

type CompilationReference =
| CompilationReference of Compilation * staticLink: bool
type CompilationReference = private CompilationReference of Compilation * staticLink: bool with

static member CreateFSharp(cmpl: Compilation, ?staticLink) =
let staticLink = defaultArg staticLink false
CompilationReference(cmpl, staticLink)

and Compilation = private Compilation of string * SourceKind * CompileOutput * options: string[] * CompilationReference list with

Expand Down