Skip to content

Commit

Permalink
Ignore constraints in signature for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Oct 6, 2022
1 parent 497aa09 commit c888af8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ type AddFunctionToSignatureFileAction(dataProvider: FSharpContextActionDataProvi
let (|ValFromImpl|_|) (symbol:FSharpSymbol) =
match symbol with
| :? FSharpMemberOrFunctionOrValue as valSymbol ->
let hasConstraints =
valSymbol.GenericParameters
|> Seq.exists (fun gp -> not (Seq.isEmpty gp.Constraints))

// Ignore constraints for now.
if hasConstraints then None else

valSymbol.SignatureLocation
|> Option.bind (fun range -> if range.FileName.EndsWith(".fs") then Some valSymbol else None)
| _ -> None
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Test

let memoizeBy{caret} (g: 'a -> 'c) (f: 'a -> 'b) =
let cache =
System.Collections.Concurrent.ConcurrentDictionary<_, _>(HashIdentity.Structural)

fun x -> cache.GetOrAdd(Some(g x), lazy (f x)).Force()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOT AVAILABLE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Test
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ type AddFunctionToSignatureFileActionTest() =
[<Test>] member x.``Tuple parameter - 02`` () = x.DoNamedTestWithSignature()
[<Test>] member x.``Attribute in parameter - 01`` () = x.DoNamedTestWithSignature()
[<Test>] member x.``Attribute in parameter - 02`` () = x.DoNamedTestWithSignature()
[<Test>] member x.``Attribute in parameter - 03`` () = x.DoNamedTestWithSignature()
[<Test>] member x.``Attribute in parameter - 03`` () = x.DoNamedTestWithSignature()
// Ignore generic constraints for now

// This test requires `when 'c: equality` at the end of the signature.
[<Test>] member x.``Generic constraints - 01`` () = x.DoNamedTestWithSignature()

0 comments on commit c888af8

Please sign in to comment.