@@ -2386,6 +2386,48 @@ fillTypedHoleTests = let
2386
2386
executeCodeAction chosen
2387
2387
modifiedCode <- documentContents doc
2388
2388
liftIO $ mkDoc " E.toException" @=? modifiedCode
2389
+ , testSession " filling infix type hole uses prefix notation" $ do
2390
+ let mkDoc x = T. unlines
2391
+ [ " module Testing where"
2392
+ , " data A = A"
2393
+ , " foo :: A -> A -> A"
2394
+ , " foo A A = A"
2395
+ , " test :: A -> A -> A"
2396
+ , " test a1 a2 = a1 " <> x <> " a2"
2397
+ ]
2398
+ doc <- createDoc " Test.hs" " haskell" $ mkDoc " `_`"
2399
+ _ <- waitForDiagnostics
2400
+ actions <- getCodeActions doc (Range (Position 5 16 ) (Position 5 19 ))
2401
+ chosen <- liftIO $ pickActionWithTitle " replace _ with foo" actions
2402
+ executeCodeAction chosen
2403
+ modifiedCode <- documentContents doc
2404
+ liftIO $ mkDoc " `foo`" @=? modifiedCode
2405
+ , testSession " postfix hole uses postfix notation of infix operator" $ do
2406
+ let mkDoc x = T. unlines
2407
+ [ " module Testing where"
2408
+ , " test :: Int -> Int -> Int"
2409
+ , " test a1 a2 = " <> x <> " a1 a2"
2410
+ ]
2411
+ doc <- createDoc " Test.hs" " haskell" $ mkDoc " _"
2412
+ _ <- waitForDiagnostics
2413
+ actions <- getCodeActions doc (Range (Position 2 13 ) (Position 2 14 ))
2414
+ chosen <- liftIO $ pickActionWithTitle " replace _ with (+)" actions
2415
+ executeCodeAction chosen
2416
+ modifiedCode <- documentContents doc
2417
+ liftIO $ mkDoc " (+)" @=? modifiedCode
2418
+ , testSession " filling infix type hole uses infix operator" $ do
2419
+ let mkDoc x = T. unlines
2420
+ [ " module Testing where"
2421
+ , " test :: Int -> Int -> Int"
2422
+ , " test a1 a2 = a1 " <> x <> " a2"
2423
+ ]
2424
+ doc <- createDoc " Test.hs" " haskell" $ mkDoc " `_`"
2425
+ _ <- waitForDiagnostics
2426
+ actions <- getCodeActions doc (Range (Position 2 16 ) (Position 2 19 ))
2427
+ chosen <- liftIO $ pickActionWithTitle " replace _ with (+)" actions
2428
+ executeCodeAction chosen
2429
+ modifiedCode <- documentContents doc
2430
+ liftIO $ mkDoc " +" @=? modifiedCode
2389
2431
]
2390
2432
2391
2433
addInstanceConstraintTests :: TestTree
0 commit comments