Skip to content
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

Extra tests for type hints #14552

Merged
merged 1 commit into from
Jan 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ type Song() as x =
Assert.IsEmpty(result)

[<Test>]
let ``Hints are shown for lambdas`` () =
let ``Hints are shown within lambdas`` () =
let code =
"""
let iamboring() =
Expand All @@ -162,7 +162,7 @@ let iamboring() =
Assert.AreEqual(expected, actual)

[<Test>]
let ``Hints are shown for lambdas with tuples`` () =
let ``Hints are shown within lambdas with tuples`` () =
let code =
"""
let zip4 (l1: 'a list) (l2: 'b list) (l3: 'c list) (l4: 'd list) =
Expand All @@ -184,6 +184,19 @@ let zip4 (l1: 'a list) (l2: 'b list) (l3: 'c list) (l4: 'd list) =

CollectionAssert.AreEquivalent(expected, actual)

[<Test>]
let ``Hints are not shown for lambda return types`` () =
let code =
"""
let func = fun () -> 3
"""

let document = getFsDocument code

let result = getTypeHints document

Assert.IsEmpty(result)

[<Test>]
let ``Hints are not shown for unfinished expressions`` () =
let code =
Expand Down Expand Up @@ -248,7 +261,6 @@ type Number<'T when IAddition<'T>>(value: 'T) =

CollectionAssert.AreEquivalent(expected, actual)


[<Test>]
let ``Hints are not shown when type is specified`` () =
let code =
Expand All @@ -264,4 +276,4 @@ type MyType() =

let result = getTypeHints document

Assert.IsEmpty(result)
Assert.IsEmpty(result)