Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow
_
in use bindings by checking for special case of TPat_wild i…
…n TcLetBinding implements fsharp/fslang-suggestions#881 and https://github.com/fsharp/fslang-design/blob/6c1ba3425c6129f1b6cf22ac8ddec30761136a12/RFCs/FS-1102-discards-on-use-bindings.md has basic test UseBindingDiscard01, that ensures, that `use _ = new Disposable()` type checks
- Loading branch information
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/LetBindings/UseBindings.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | ||
|
||
namespace FSharp.Compiler.ComponentTests.Conformance.DeclarationElements.LetBindings | ||
|
||
open Xunit | ||
open FSharp.Test.Utilities.Compiler | ||
open FSharp.Test.Utilities.Xunit.Attributes | ||
|
||
module UseBindings = | ||
|
||
//<Expects status="success"></Expects> | ||
[<Theory; Directory(__SOURCE_DIRECTORY__ + "/../../../resources/tests/Conformance/DeclarationElements/LetBindings", Includes=[|"UseBindingDiscard01.fs"|])>] | ||
let ``UseBindings - UseBindingDiscard01.fs - `` compilation = | ||
compilation | ||
|> asFsx | ||
|> compile | ||
|> shouldSucceed | ||
|> ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...tTests/resources/tests/Conformance/DeclarationElements/LetBindings/UseBindingDiscard01.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// #DeclarationElements #LetBindings | ||
//<Expects status="success"></Expects> | ||
|
||
let answer = | ||
use _ = new System.IO.MemoryStream() | ||
42 |