Skip to content

Code actions for replacing wildcards in types broken in GHC 9.8 #4134

Closed
@jhrcek

Description

@jhrcek

There's a regression in GHC 9.8 in how types of wildcards in type signatures are inferred.
We added a conditional in tests to adjust to this new behavior - see comment.

I reported it in ghc and it got rejected as "this is the new behavior now, we should just document it"

I don't think we can easily change back the behaviour (in GHC 9.6 we defaulted the type variable, which we no longer do in 9.8).
See ghc issues for details.
https://gitlab.haskell.org/ghc/ghc/-/issues/24522
https://gitlab.haskell.org/ghc/ghc/-/issues/24425

This change in behavior breaks 2 tests:

, testUseTypeSignature "multi-line message 1"
[ "func :: _"
, "func x y = x + y"
]
[ if ghcVersion >= GHC98
then "func :: a -> a -> a" -- 9.8 has a different suggestion
else "func :: Integer -> Integer -> Integer"
, "func x y = x + y"
]

, testUseTypeSignature "no spaces around '::'"
[ "func::_"
, "func x y = x + y"
]
[ if ghcVersion >= GHC98
then "func::a -> a -> a" -- 9.8 has a different suggestion
else "func::Integer -> Integer -> Integer"
, "func x y = x + y"
]

So I think we should just update the test not to rely on polymorphic type and type defaulting
e.g.

func :: _
func x y = x && y

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triagetype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions