Skip to content

Commit f1f33d0

Browse files
committed
Looks like RecordWildcards renaming is only broken on GHC 9.6 and 9.8
1 parent 59eb14e commit f1f33d0

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

plugins/hls-rename-plugin/test/Main.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ tests = testGroup "Rename"
2525
[ goldenWithRename "Data constructor" "DataConstructor" $ \doc ->
2626
rename doc (Position 0 15) "Op"
2727
, goldenWithRename "Data constructor with fields" "DataConstructorWithFields" $ \doc ->
28-
rename doc (Position 2 13) "FooRenamed"
28+
rename doc (Position 1 13) "FooRenamed"
29+
, knownBrokenForGhcVersions [GHC96, GHC98] "renaming Constructor{..} with RecordWildcard removes .." $
30+
goldenWithRename "Data constructor with fields" "DataConstructorWithFieldsRecordWildcards" $ \doc ->
31+
rename doc (Position 1 13) "FooRenamed"
2932
, goldenWithRename "Exported function" "ExportedFunction" $ \doc ->
3033
rename doc (Position 2 1) "quux"
3134
, goldenWithRename "Field Puns" "FieldPuns" $ \doc ->

plugins/hls-rename-plugin/test/testdata/DataConstructorWithFields.expected.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE NamedFieldPuns #-}
2-
{-# LANGUAGE RecordWildCards #-}
32
data Foo = FooRenamed { a :: Int, b :: Bool }
43

54
foo1 :: Foo
@@ -13,6 +12,3 @@ fun1 FooRenamed {a} = a
1312

1413
fun2 :: Foo -> Int
1514
fun2 FooRenamed {a = i} = i
16-
17-
fun3 :: Foo -> Int
18-
fun3 FooRenamed {..} = a

plugins/hls-rename-plugin/test/testdata/DataConstructorWithFields.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE NamedFieldPuns #-}
2-
{-# LANGUAGE RecordWildCards #-}
32
data Foo = Foo { a :: Int, b :: Bool }
43

54
foo1 :: Foo
@@ -13,6 +12,3 @@ fun1 Foo {a} = a
1312

1413
fun2 :: Foo -> Int
1514
fun2 Foo {a = i} = i
16-
17-
fun3 :: Foo -> Int
18-
fun3 Foo {..} = a
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{-# LANGUAGE RecordWildCards #-}
2+
data Foo = FooRenamed { a :: Int, b :: Bool }
3+
4+
fun :: Foo -> Int
5+
fun FooRenamed {..} = a
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{-# LANGUAGE RecordWildCards #-}
2+
data Foo = Foo { a :: Int, b :: Bool }
3+
4+
fun :: Foo -> Int
5+
fun Foo {..} = a

0 commit comments

Comments
 (0)