From 9f62337e507c7cd9ded2402bafcbea71fd2741b7 Mon Sep 17 00:00:00 2001 From: Michael Peyton Jones Date: Tue, 8 Mar 2022 23:43:56 +0000 Subject: [PATCH] Add failing test for variables in hovers (#2742) Witnesses #2716. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Pepe Iborra --- ghcide/test/data/hover/GotoHover.hs | 3 +++ ghcide/test/exe/Main.hs | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ghcide/test/data/hover/GotoHover.hs b/ghcide/test/data/hover/GotoHover.hs index ae261c6bdf..e1802580e2 100644 --- a/ghcide/test/data/hover/GotoHover.hs +++ b/ghcide/test/data/hover/GotoHover.hs @@ -61,3 +61,6 @@ aa2 = $(id [| True |]) hole :: Int hole = _ + +hole2 :: a -> Maybe a +hole2 = _ diff --git a/ghcide/test/exe/Main.hs b/ghcide/test/exe/Main.hs index f82cc9509f..87b18cfcbb 100644 --- a/ghcide/test/exe/Main.hs +++ b/ghcide/test/exe/Main.hs @@ -4059,7 +4059,9 @@ findDefinitionAndHoverTests = let , testGroup "hover" $ mapMaybe snd tests , checkFileCompiles sourceFilePath $ expectDiagnostics - [ ( "GotoHover.hs", [(DsError, (62, 7), "Found hole: _")]) ] + [ ( "GotoHover.hs", [(DsError, (62, 7), "Found hole: _")]) + , ( "GotoHover.hs", [(DsError, (65, 8), "Found hole: _")]) + ] , testGroup "type-definition" typeDefinitionTests ] typeDefinitionTests = [ tst (getTypeDefinitions, checkDefs) aaaL14 (pure tcData) "Saturated data con" @@ -4111,6 +4113,7 @@ findDefinitionAndHoverTests = let outL45 = Position 49 3 ; outSig = [ExpectHoverText ["outer", "Bool"], mkR 50 0 50 5] innL48 = Position 52 5 ; innSig = [ExpectHoverText ["inner", "Char"], mkR 49 2 49 7] holeL60 = Position 62 7 ; hleInfo = [ExpectHoverText ["_ ::"]] + holeL65 = Position 65 8 ; hleInfo2 = [ExpectHoverText ["_ :: a -> Maybe a"]] cccL17 = Position 17 16 ; docLink = [ExpectHoverText ["[Documentation](file:///"]] imported = Position 56 13 ; importedSig = getDocUri "Foo.hs" >>= \foo -> return [ExpectHoverText ["foo", "Foo", "Haddock"], mkL foo 5 0 5 3] reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar", "Haddock"], mkL bar 3 0 3 14] @@ -4165,6 +4168,11 @@ findDefinitionAndHoverTests = let , test no yes outL45 outSig "top-level signature #767" , test broken broken innL48 innSig "inner signature #767" , test no yes holeL60 hleInfo "hole without internal name #831" + , if ghcVersion >= GHC92 then + -- Broken on GHC 9.2 and above due to printing of uniques + test no yes holeL65 [] "hole with variable" + else + test no yes holeL65 hleInfo2 "hole with variable" , test no skip cccL17 docLink "Haddock html links" , testM yes yes imported importedSig "Imported symbol" , testM yes yes reexported reexportedSig "Imported symbol (reexported)"