Skip to content

Commit 65a9c09

Browse files
committed
Ignore constraints in signature for now.
1 parent 9d33676 commit 65a9c09

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

ReSharper.FSharp/src/FSharp.Psi.Intentions/src/Intentions/AddFunctionToSignatureFileAction.fs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ type AddFunctionToSignatureFileAction(dataProvider: FSharpContextActionDataProvi
2525
let (|ValFromImpl|_|) (symbol:FSharpSymbol) =
2626
match symbol with
2727
| :? FSharpMemberOrFunctionOrValue as valSymbol ->
28+
let hasConstraints =
29+
valSymbol.GenericParameters
30+
|> Seq.exists (fun gp -> not (Seq.isEmpty gp.Constraints))
31+
32+
// Ignore constraints for now.
33+
if hasConstraints then None else
34+
2835
valSymbol.SignatureLocation
2936
|> Option.bind (fun range -> if range.FileName.EndsWith(".fs") then Some valSymbol else None)
3037
| _ -> None
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Test
2+
3+
let memoizeBy{caret} (g: 'a -> 'c) (f: 'a -> 'b) =
4+
let cache =
5+
System.Collections.Concurrent.ConcurrentDictionary<_, _>(HashIdentity.Structural)
6+
7+
fun x -> cache.GetOrAdd(Some(g x), lazy (f x)).Force()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NOT AVAILABLE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Test

ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/Intentions/AddFunctionToSignatureFileActionTest.fs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ type AddFunctionToSignatureFileActionTest() =
2626
[<Test>] member x.``Tuple parameter - 02`` () = x.DoNamedTestWithSignature()
2727
[<Test>] member x.``Attribute in parameter - 01`` () = x.DoNamedTestWithSignature()
2828
[<Test>] member x.``Attribute in parameter - 02`` () = x.DoNamedTestWithSignature()
29-
[<Test>] member x.``Attribute in parameter - 03`` () = x.DoNamedTestWithSignature()
29+
[<Test>] member x.``Attribute in parameter - 03`` () = x.DoNamedTestWithSignature()
30+
// Ignore generic constraints for now
31+
32+
// This test requires `when 'c: equality` at the end of the signature.
33+
[<Test>] member x.``Generic constraints - 01`` () = x.DoNamedTestWithSignature()

0 commit comments

Comments
 (0)