Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jhrcek opened this issue Mar 11, 2024 · 1 comment
Closed

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

jhrcek opened this issue Mar 11, 2024 · 1 comment
Labels
status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@jhrcek
Copy link
Collaborator

jhrcek commented Mar 11, 2024

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
@jhrcek jhrcek added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. status: needs triage labels Mar 11, 2024
@jhrcek jhrcek changed the title Code actions for Code actions for replacing wildcards in types with types broken in GHC 9.8 Mar 11, 2024
@jhrcek jhrcek changed the title Code actions for replacing wildcards in types with types broken in GHC 9.8 Code actions for replacing wildcards in types broken in GHC 9.8 Mar 11, 2024
@jhrcek
Copy link
Collaborator Author

jhrcek commented Mar 13, 2024

It’s not actually broken, just works differently now (no type defaulting). Added comment about it in #4138. Not much more we can do about it now.

@jhrcek jhrcek closed this as completed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

1 participant