Skip to content

Commit 6dbd749

Browse files
committed
Add a simple test
1 parent e25f16f commit 6dbd749

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
<Compile Include="Language\ComputationExpressionTests.fs" />
170170
<Compile Include="Language\CastingTests.fs" />
171171
<Compile Include="Language\NameofTests.fs" />
172+
<Compile Include="Language\DotLambdaTests.fs" />
172173
<Compile Include="ConstraintSolver\PrimitiveConstraints.fs" />
173174
<Compile Include="ConstraintSolver\MemberConstraints.fs" />
174175
<None Include="**\*.cs;**\*.fs;**\*.fsx;**\*.fsi" Exclude="@(Compile)">
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.ComponentTests.Language
4+
5+
open Xunit
6+
open FSharp.Test.Compiler
7+
8+
module DotLambdaTests =
9+
10+
[<Fact>]
11+
let ``Script: _.ToString()`` () =
12+
Fsx "_.ToString()"
13+
|> compile
14+
|> shouldSucceed
15+
16+
let ``Simple anonymous unary function shorthands compile`` () =
17+
FSharp """
18+
module One
19+
let a1 : {| Foo : {| Bar : string |}|} -> string = _.Foo.Bar
20+
let a2 : {| Foo : int array |} -> int = _.Foo.[5]
21+
let a3 : {| Foo : int array |} -> int = _.Foo[5]
22+
let a4 : {| Foo : unit -> string |} -> string = _.Foo()
23+
let a5 : {| Foo : int -> {| X : string |} |} -> string = _.Foo(5).X
24+
25+
open System
26+
let a6 = [1] |> List.map _.ToString()
27+
"""
28+
|> compile
29+
|> shouldSucceed

0 commit comments

Comments
 (0)