-
Notifications
You must be signed in to change notification settings - Fork 838
Fixed consuming CSharp interface with an inref parameter #8287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ open System.Diagnostics | |
| open System.IO | ||
| open System.Text | ||
| open System.Diagnostics | ||
| open System.Collections.Generic | ||
| open System.Reflection | ||
| open FSharp.Compiler.Text | ||
| open FSharp.Compiler.SourceCodeServices | ||
|
|
@@ -17,6 +18,9 @@ open System.Runtime.Loader | |
| #endif | ||
| open NUnit.Framework | ||
| open System.Reflection.Emit | ||
| open Microsoft.CodeAnalysis | ||
| open Microsoft.CodeAnalysis.CSharp | ||
| open FSharp.Compiler.UnitTests.Utilities | ||
|
|
||
| [<Sealed>] | ||
| type ILVerifier (dllFilePath: string) = | ||
|
|
@@ -52,12 +56,18 @@ type CompileOutput = | |
| | Library | ||
| | Exe | ||
|
|
||
| type CompilationReference = private CompilationReference of Compilation * staticLink: bool with | ||
| type CompilationReference = | ||
| private | ||
| | CompilationReference of Compilation * staticLink: bool | ||
| | TestCompilationReference of TestCompilation | ||
|
|
||
| static member CreateFSharp(cmpl: Compilation, ?staticLink) = | ||
| let staticLink = defaultArg staticLink false | ||
| CompilationReference(cmpl, staticLink) | ||
|
|
||
| static member Create(cmpl: TestCompilation) = | ||
| TestCompilationReference cmpl | ||
|
|
||
| and Compilation = private Compilation of string * SourceKind * CompileOutput * options: string[] * CompilationReference list with | ||
|
|
||
| static member Create(source, sourceKind, output, ?options, ?cmplRefs) = | ||
|
|
@@ -257,7 +267,14 @@ let main argv = 0""" | |
| |> List.map (fun cmpl -> | ||
| match cmpl with | ||
| | CompilationReference (cmpl, staticLink) -> | ||
| compileCompilationAux disposals ignoreWarnings cmpl, staticLink) | ||
| compileCompilationAux disposals ignoreWarnings cmpl, staticLink | ||
| | TestCompilationReference (cmpl) -> | ||
| let tmp = Path.GetTempFileName() | ||
| disposals.Add({ new IDisposable with | ||
| member _.Dispose() = | ||
| try File.Delete tmp with | _ -> () }) | ||
| cmpl.EmitAsFile tmp | ||
| (([||], tmp), []), false) | ||
|
Comment on lines
+271
to
+277
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I take it this was just leaving stuff around?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is all new, so nothing was being left around before. But yes, once I create a tmp file, I need to make sure we always try to delete it on dispose. |
||
|
|
||
| let compilationRefs = | ||
| compiledRefs | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
type privateis more idiomaticThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type privatemakes the whole typeprivatewhich is not what I want. I only want to make the union cases private to the module.