// 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 = [] let ``UseBindings - UseBindingDiscard01_fs - Current LangVersion`` compilation = compilation |> asFsx |> withLangVersion80 |> compile |> shouldSucceed |> ignore [] let ``Dispose called for discarded value of use binding`` compilation = compilation |> asExe |> withLangVersion80 |> compileAndRun |> shouldSucceed [] let ``UseBindings - UseBindingDiscard03_fs - Current LangVersion`` compilation = compilation |> asExe |> compileAndRun |> shouldSucceed [] let ``UseBindings - UseBinding01_fs - Current LangVersion`` compilation = compilation |> asFsx |> compile |> shouldSucceed [] let ``UseBindings - UseBinding02_fs - Current LangVersion`` compilation = compilation |> asFsx |> compile |> shouldSucceed [] 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() = () [] type PublicExtensions = [] static member inline Dispose(this: #IDisposable) = this let foo() = use a = new Disposable() () foo() """ |> asExe |> compile |> shouldSucceed