Skip to content

Commit ebd9445

Browse files
committed
Add reproduction for haskell#2290
1 parent 92f776d commit ebd9445

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ suggestionsTests =
139139
, testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
140140
testRefactor "Comments.hs" "Redundant bracket" expectedComments
141141

142+
, testCase "[#2290] apply all hints works with a trailing comment" $ runHlintSession "" $ do
143+
testRefactor "TwoHintsAndComment.hs" "Apply all hints" expectedComments2
144+
142145
, testCase "applyAll is shown only when there is at least one diagnostic in range" $ runHlintSession "" $ do
143146
doc <- openDoc "TwoHints.hs" "haskell"
144147
_ <- waitForDiagnosticsFromSource doc "hlint"
@@ -212,6 +215,9 @@ suggestionsTests =
212215
, "f = {- inline comment -}{- inline comment inside refactored code -} 1 -- ending comment", ""
213216
, "-- final comment"
214217
]
218+
expectedComments2 = [ "module TwoHintsAndComment where"
219+
, "biggest items = foldr1 max -- the line above will show two hlint hints, \"eta reduce\" and \"use maximum\""
220+
]
215221
expectedTypeApp = [ "module TypeApplication where", ""
216222
, "a = id @Int 1"
217223
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module TwoHintsAndComments where
2+
3+
biggest items = foldr1 max items -- the line above will show two hlint hints, "eta reduce" and "use maximum"

plugins/hls-hlint-plugin/test/testdata/hie.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ cradle:
1313
- "TwoHints"
1414
- "PatternKeyword"
1515
- "StrictData"
16+
- "TwoHintsAndComment"

0 commit comments

Comments
 (0)