-
Notifications
You must be signed in to change notification settings - Fork 855
Expand file tree
/
Copy pathUseBindings.fs
More file actions
73 lines (60 loc) · 2.04 KB
/
UseBindings.fs
File metadata and controls
73 lines (60 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace Conformance.BasicGrammarElements
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module UseBindings =
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"UseBindingDiscard01.fs"|])>]
let ``UseBindings - UseBindingDiscard01_fs - Current LangVersion`` compilation =
compilation
|> asFsx
|> withLangVersion80
|> compile
|> shouldSucceed
|> ignore
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"UseBindingDiscard02.fs"|])>]
let ``Dispose called for discarded value of use binding`` compilation =
compilation
|> asExe
|> withLangVersion80
|> compileAndRun
|> shouldSucceed
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"UseBindingDiscard03.fs"|])>]
let ``UseBindings - UseBindingDiscard03_fs - Current LangVersion`` compilation =
compilation
|> asExe
|> compileAndRun
|> shouldSucceed
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"UseBinding01.fs"|])>]
let ``UseBindings - UseBinding01_fs - Current LangVersion`` compilation =
compilation
|> asFsx
|> compile
|> shouldSucceed
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"UseBinding02.fs"|])>]
let ``UseBindings - UseBinding02_fs - Current LangVersion`` compilation =
compilation
|> asFsx
|> compile
|> shouldSucceed
[<Fact>]
let ``use binding does not ICE when Dispose extension method is in scope`` () =
FSharp """
open System
open System.Runtime.CompilerServices
type Disposable() =
interface IDisposable with
member _.Dispose() = ()
[<Extension>]
type PublicExtensions =
[<Extension>]
static member inline Dispose(this: #IDisposable) =
this
let foo() =
use a = new Disposable()
()
foo()
"""
|> asExe
|> compile
|> shouldSucceed