Skip to content

Commit

Permalink
Apply Fantomas
Browse files Browse the repository at this point in the history
  • Loading branch information
safesparrow committed Dec 7, 2022
1 parent 2e2c636 commit 6a500d4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion tests/ParallelTypeCheckingTests/Code/Parallel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let processInParallel
processedCount)

// let toScheduleString =
// toSchedule |> Array.map _itemToString |> (fun names -> String.Join(", ", names))
// toSchedule |> Array.map _itemToString |> (fun names -> String.Join(", ", names))

// printfn $"Scheduling {toSchedule.Length} items: {toScheduleString}"
toSchedule |> Array.iter bc.Add
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,26 +190,28 @@ let zip4 (l1: 'a list) (l2: 'b list) (l3: 'c list) (l4: 'd list) =
"""
let x
"""

let document = getFsDocument code

let result = getTypeHints document

Assert.IsEmpty(result)

[<Test>]
let ``Hints are not shown for unsolved types in _for_ expressions in collections`` () =
let ``Hints are not shown for unsolved types in _for_ expressions in collections`` () =
let code =
"""
let _ = [ for x ]
"""

let document = getFsDocument code

let result = getTypeHints document

Assert.IsEmpty(result)

[<Test>]
let ``Hints are not shown for unsolved types in _for_ expressions within computational expressions`` () =
let ``Hints are not shown for unsolved types in _for_ expressions within computational expressions`` () =
let code =
"""
do task {
Expand All @@ -218,6 +220,7 @@ do task {
do! Task.Delay 0
}
"""

let document = getFsDocument code

let result = getTypeHints document
Expand All @@ -236,12 +239,19 @@ type Number<'T when IAddition<'T>>(value: 'T) =
interface IAddition<Number<'T>> with
static member op_Addition(a, b) = Number(a.Value + b.Value)
"""

let document = getFsDocument code

let expected =
[
{ Content = ": Number<'T>"; Location = (7, 36) }
{ Content = ": Number<'T>"; Location = (7, 39) }
{
Content = ": Number<'T>"
Location = (7, 36)
}
{
Content = ": Number<'T>"
Location = (7, 39)
}
]

let actual = getTypeHints document
Expand Down
34 changes: 17 additions & 17 deletions vsintegration/tests/FSharp.Editor.Tests/QuickInfoProviderTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -213,93 +213,93 @@ let res8 = abs 5.0<kg>
Some
"(extension) System.Collections.Generic.IEnumerable.GroupBy<'TSource,'TKey>(keySelector: System.Func<'TSource,'TKey>) : System.Collections.Generic.IEnumerable<IGrouping<'TKey,'TSource>>
'TSource is int * string
'TKey is int");
'TKey is int")
("Sort",
Some
"System.Array.Sort<'T>(array: 'T array) : unit
'T is int");
'T is int")
("let test4 x = C().FSharpGenericMethodExplitTypeParams",
Some
"member C.FSharpGenericMethodExplitTypeParams: a: 'T0 * y: 'T0 -> 'T0 * 'T0
'T is 'a list");
'T is 'a list")
("let test5<'U> (x: 'U) = C().FSharpGenericMethodExplitTypeParams",
Some
"member C.FSharpGenericMethodExplitTypeParams: a: 'T0 * y: 'T0 -> 'T0 * 'T0
'T is 'U list");
'T is 'U list")
("let test6 = C().FSharpGenericMethodExplitTypeParams",
Some
"member C.FSharpGenericMethodExplitTypeParams: a: 'T0 * y: 'T0 -> 'T0 * 'T0
'T is int");
'T is int")
("let test7 x = C().FSharpGenericMethodInferredTypeParams",
Some
"member C.FSharpGenericMethodInferredTypeParams: a: 'a1 * y: 'b2 -> 'a1 * 'b2
'a is 'a0 list
'b is 'a0 list");
'b is 'a0 list")
("let test8 = C().FSharpGenericMethodInferredTypeParams",
Some
"member C.FSharpGenericMethodInferredTypeParams: a: 'a0 * y: 'b1 -> 'a0 * 'b1
'a is int
'b is int");
'b is int")
("let test9<'U> (x: 'U) = C().FSharpGenericMethodInferredTypeParams",
Some
"member C.FSharpGenericMethodInferredTypeParams: a: 'a0 * y: 'b1 -> 'a0 * 'b1
'a is 'U list
'b is 'U list");
'b is 'U list")
("let res3 = [1] |>",
Some
"val (|>) : arg: 'T1 -> func: ('T1 -> 'U) -> 'U
Full name: Microsoft.FSharp.Core.Operators.(|>)
'T1 is int list
'U is int list");
'U is int list")
("let res3 = [1] |> List.map id",
Some
"val id: x: 'T -> 'T
Full name: Microsoft.FSharp.Core.Operators.id
'T is int");
'T is int")
("let res4 = (1.0,[1]) ||>",
Some
"val (||>) : arg1: 'T1 * arg2: 'T2 -> func: ('T1 -> 'T2 -> 'U) -> 'U
Full name: Microsoft.FSharp.Core.Operators.(||>)
'T1 is float
'T2 is int list
'U is float");
'U is float")
("let res4 = (1.0,[1]) ||> List.fold",
Some
"val fold: folder: ('State -> 'T -> 'State) -> state: 'State -> list: 'T list -> 'State
Full name: Microsoft.FSharp.Collections.List.fold
'T is int
'State is float");
'State is float")
("let res4 = (1.0,[1]) ||> List.fold (fun s x -> string s +",
Some
"val (+) : x: 'T1 -> y: 'T2 -> 'T3 (requires member (+))
Full name: Microsoft.FSharp.Core.Operators.(+)
'T1 is string
'T2 is string
'T3 is float");
'T3 is float")
("let res5 = 1 +",
Some
"val (+) : x: 'T1 -> y: 'T2 -> 'T3 (requires member (+))
Full name: Microsoft.FSharp.Core.Operators.(+)
'T1 is int
'T2 is int
'T3 is int");
'T3 is int")
("let res6 = System.DateTime.Now +",
Some
"val (+) : x: 'T1 -> y: 'T2 -> 'T3 (requires member (+))
Full name: Microsoft.FSharp.Core.Operators.(+)
'T1 is System.DateTime
'T2 is System.TimeSpan
'T3 is System.DateTime");
'T3 is System.DateTime")
("let res7 = sin",
Some
"val sin: value: 'T -> 'T (requires member Sin)
Full name: Microsoft.FSharp.Core.Operators.sin
'T is float");
'T is float")
("let res8 = abs",
Some
"val abs: value: 'T -> 'T (requires member Abs)
Full name: Microsoft.FSharp.Core.Operators.abs
'T is int");
'T is int")
]

executeQuickInfoTest fileContents testCases

0 comments on commit 6a500d4

Please sign in to comment.