diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Ands pat 01.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Ands pat 01.fs new file mode 100644 index 0000000000..8a2e45e871 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Ands pat 01.fs @@ -0,0 +1,5 @@ +module Module + +let (|Bool|) (x: int) = true + +let f (x{caret} & Bool(_)) = () diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Ands pat 01.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Ands pat 01.fs.gold new file mode 100644 index 0000000000..ad7e18de3e --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Ands pat 01.fs.gold @@ -0,0 +1,5 @@ +module Module + +let (|Bool|) (x: int) = true + +let f (x: int{caret} & Bool(_)) = () diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/As pat 01.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/As pat 01.fs new file mode 100644 index 0000000000..24131b5f3d --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/As pat 01.fs @@ -0,0 +1,3 @@ +module Module + +let f (x, y as z{caret}) = () diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/As pat 01.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/As pat 01.fs.gold new file mode 100644 index 0000000000..9ce13b98c7 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/As pat 01.fs.gold @@ -0,0 +1,3 @@ +module Module + +let f (x, y as (z: 'a * 'b){caret}) = () diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Lambda 01.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Lambda 01.fs new file mode 100644 index 0000000000..187e45d4d5 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Lambda 01.fs @@ -0,0 +1,3 @@ +module Module + +fun x{caret} -> x + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Lambda 01.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Lambda 01.fs.gold new file mode 100644 index 0000000000..7f2bf28940 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Lambda 01.fs.gold @@ -0,0 +1,3 @@ +module Module + +fun (x: int){caret} -> x + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 01.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 01.fs new file mode 100644 index 0000000000..e2c940f577 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 01.fs @@ -0,0 +1,3 @@ +module Module + +let f x{caret} = x + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 01.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 01.fs.gold new file mode 100644 index 0000000000..98e05f2a9b --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 01.fs.gold @@ -0,0 +1,3 @@ +module Module + +let f (x: int){caret} = x + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 02 - Optional.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 02 - Optional.fs new file mode 100644 index 0000000000..09ca243f2c --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 02 - Optional.fs @@ -0,0 +1,4 @@ +module Module + +type A = + member _.M1(?x{caret}) = x.Value + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 02 - Optional.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 02 - Optional.fs.gold new file mode 100644 index 0000000000..3b82122a9a --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Parameter 02 - Optional.fs.gold @@ -0,0 +1,4 @@ +module Module + +type A = + member _.M1(?x: int{caret}) = x.Value + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Record field 01.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Record field 01.fs new file mode 100644 index 0000000000..64f04dd2a0 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Record field 01.fs @@ -0,0 +1,5 @@ +module Module + +type R = { A: int } + +let f { A = a{caret} } = () diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Record field 01.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Record field 01.fs.gold new file mode 100644 index 0000000000..99ff82b8ab --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Record field 01.fs.gold @@ -0,0 +1,5 @@ +module Module + +type R = { A: int } + +let f { A = (a: int){caret} } = () diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 01.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 01.fs new file mode 100644 index 0000000000..6223b12fd1 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 01.fs @@ -0,0 +1,3 @@ +module Module + +let f (a{caret}, b) = a + b diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 01.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 01.fs.gold new file mode 100644 index 0000000000..adb7122d69 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 01.fs.gold @@ -0,0 +1,3 @@ +module Module + +let f (a: int{caret}, b) = a + b diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 02 - Top level.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 02 - Top level.fs new file mode 100644 index 0000000000..7270641ad2 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 02 - Top level.fs @@ -0,0 +1,3 @@ +module Module + +let a, b{caret} = 1, 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 02 - Top level.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 02 - Top level.fs.gold new file mode 100644 index 0000000000..865721db24 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 02 - Top level.fs.gold @@ -0,0 +1,3 @@ +module Module + +let a, (b: int){caret} = 1, 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 03 - As.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 03 - As.fs new file mode 100644 index 0000000000..bec6d0e280 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 03 - As.fs @@ -0,0 +1,3 @@ +module Module + +let f (x{caret}, y as z) = () diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 03 - As.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 03 - As.fs.gold new file mode 100644 index 0000000000..d32dbe9277 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Tuple 03 - As.fs.gold @@ -0,0 +1,3 @@ +module Module + +let f (x: 'a{caret}, y as z) = () diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 01.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 01.fs new file mode 100644 index 0000000000..c1898bf92a --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 01.fs @@ -0,0 +1,3 @@ +module Module + +let f (Some(x{caret})) = x + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 01.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 01.fs.gold new file mode 100644 index 0000000000..bb0f7ced84 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 01.fs.gold @@ -0,0 +1,3 @@ +module Module + +let f (Some(x: int{caret})) = x + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 02 - Named.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 02 - Named.fs new file mode 100644 index 0000000000..562a2d56f9 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 02 - Named.fs @@ -0,0 +1,3 @@ +module Module + +let f (Some(Value = x{caret})) = x + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 02 - Named.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 02 - Named.fs.gold new file mode 100644 index 0000000000..b208f4576a --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 02 - Named.fs.gold @@ -0,0 +1,3 @@ +module Module + +let f (Some(Value = (x: int){caret})) = x + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 03 - Parens.fs b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 03 - Parens.fs new file mode 100644 index 0000000000..3a7ddf08d6 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 03 - Parens.fs @@ -0,0 +1,3 @@ +module Module + +let f (Some x{caret}) = x + 1 diff --git a/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 03 - Parens.fs.gold b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 03 - Parens.fs.gold new file mode 100644 index 0000000000..2bb53247ad --- /dev/null +++ b/ReSharper.FSharp/test/data/features/intentions/specifyTypes/patterns/Union case 03 - Parens.fs.gold @@ -0,0 +1,3 @@ +module Module + +let f (Some(x: int){caret}) = x + 1 diff --git a/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/Intentions/SpecifyTypesTest.fs b/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/Intentions/SpecifyTypesTest.fs index 69ccb7f26f..fb54a70233 100644 --- a/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/Intentions/SpecifyTypesTest.fs +++ b/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/Intentions/SpecifyTypesTest.fs @@ -58,6 +58,31 @@ type SpecifyFunctionTypesActionTest() = [] member x.``Function - Recursive - Function 04`` () = x.DoNamedTest() +type SpecifyPatternTypeActionTest() = + inherit FSharpContextActionExecuteTestBase() + + override x.ExtraPath = "specifyTypes/patterns" + + [] member x.``Parameter 01``() = x.DoNamedTest() + [] member x.``Parameter 02 - Optional``() = x.DoNamedTest() + + [] member x.``Lambda 01``() = x.DoNamedTest() + + [] member x.``Tuple 01``() = x.DoNamedTest() + [] member x.``Tuple 02 - Top level``() = x.DoNamedTest() + [] member x.``Tuple 03 - As``() = x.DoNamedTest() + + [] member x.``Record field 01``() = x.DoNamedTest() + + [] member x.``Union case 01``() = x.DoNamedTest() + [] member x.``Union case 02 - Named``() = x.DoNamedTest() + [] member x.``Union case 03 - Parens``() = x.DoNamedTest() + + [] member x.``As pat 01``() = x.DoNamedTest() + + [] member x.``Ands pat 01``() = x.DoNamedTest() + + type SpecifyTypesActionAvailabilityTest() = inherit FSharpContextActionAvailabilityTestBase()