Skip to content

Commit 0576add

Browse files
committed
hls-refactor-plugin: More predictable hole fit for test
Now that we limit number of hole fits recommended by GHC, the test that hopes to find `+` being recommended for `Int -> Int -> Int` becomes unpredictable because there are too many symbols which match that type and the sorting has little control over which symbols get recommended. There are way fewer matches for `(Int -> Maybe Int) -> Maybe Int -> Maybe Int`, so it makes the test consistently succeed.
1 parent 0d9bb43 commit 0576add

File tree

1 file changed

+4
-4
lines changed
  • plugins/hls-refactor-plugin/test

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,16 +2653,16 @@ fillTypedHoleTests = let
26532653
, testSession "filling infix type hole uses infix operator" $ do
26542654
let mkDoc x = T.unlines
26552655
[ "module Testing where"
2656-
, "test :: Int -> Int -> Int"
2657-
, "test a1 a2 = a1 " <> x <> " a2"
2656+
, "test :: Int -> Maybe Int -> Maybe Int"
2657+
, "test a ma = (a +) " <> x <> " ma"
26582658
]
26592659
doc <- createDoc "Test.hs" "haskell" $ mkDoc "`_`"
26602660
_ <- waitForDiagnostics
26612661
actions <- getCodeActions doc (Range (Position 2 16) (Position 2 19))
2662-
chosen <- pickActionWithTitle "replace _ with (+)" actions
2662+
chosen <- pickActionWithTitle "replace _ with (<$>)" actions
26632663
executeCodeAction chosen
26642664
modifiedCode <- documentContents doc
2665-
liftIO $ mkDoc "+" @=? modifiedCode
2665+
liftIO $ mkDoc "<$>" @=? modifiedCode
26662666
]
26672667

26682668
addInstanceConstraintTests :: TestTree

0 commit comments

Comments
 (0)