-
-
Notifications
You must be signed in to change notification settings - Fork 397
Fix renaming data constructors with fields (resolves #2915, resolves #4083) #4635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+75
−15
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1ca33e3
Prevent renaming record fields whenever record constructor is renamed
jhrcek e429304
wip
jhrcek f81ab41
WAP
jhrcek 59eb14e
Update stack yamls, add RecordWildcard test
jhrcek f1f33d0
Looks like RecordWildcards renaming is only broken on GHC 9.6 and 9.8
jhrcek 53a2aa0
Consolidate comment, undo whitespace changes
jhrcek dbfcda7
Merge branch 'master' into jan/fix-rename-constructor-record-fields
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
plugins/hls-rename-plugin/test/testdata/DataConstructorWithFields.expected.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
data Foo = FooRenamed { a :: Int, b :: Bool } | ||
|
||
foo1 :: Foo | ||
foo1 = FooRenamed { a = 1, b = True } | ||
|
||
foo2 :: Foo | ||
foo2 = FooRenamed 1 True | ||
|
||
fun1 :: Foo -> Int | ||
fun1 FooRenamed {a} = a | ||
|
||
fun2 :: Foo -> Int | ||
fun2 FooRenamed {a = i} = i |
14 changes: 14 additions & 0 deletions
14
plugins/hls-rename-plugin/test/testdata/DataConstructorWithFields.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
data Foo = Foo { a :: Int, b :: Bool } | ||
|
||
foo1 :: Foo | ||
foo1 = Foo { a = 1, b = True } | ||
|
||
foo2 :: Foo | ||
foo2 = Foo 1 True | ||
|
||
fun1 :: Foo -> Int | ||
fun1 Foo {a} = a | ||
|
||
fun2 :: Foo -> Int | ||
fun2 Foo {a = i} = i |
5 changes: 5 additions & 0 deletions
5
plugins/hls-rename-plugin/test/testdata/DataConstructorWithFieldsRecordWildcards.expected.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE RecordWildCards #-} | ||
data Foo = FooRenamed { a :: Int, b :: Bool } | ||
|
||
fun :: Foo -> Int | ||
fun FooRenamed {..} = a |
5 changes: 5 additions & 0 deletions
5
plugins/hls-rename-plugin/test/testdata/DataConstructorWithFieldsRecordWildcards.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE RecordWildCards #-} | ||
data Foo = Foo { a :: Int, b :: Bool } | ||
|
||
fun :: Foo -> Int | ||
fun Foo {..} = a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fyi this is a separate new issue I discovered while testing this PR that affects ghc 9.6 and 9.8.
I opened a separate issue to track that: #4636