haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.61k stars 351 forks source link

HLS hangs in file with typed hole #4242

Closed andriusstank closed 2 days ago

andriusstank commented 1 month ago

HLS seems to loop forever typechecking certain code.

I have GHC 9.8.2 and HLS 2.8.0.0, both installed by GHCup on Fedora 33 system.

Heres' complete code to reproduce the issue:

{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE TypeOperators #-}
module MyLib where

type family F a

class F a ~ F b => C a b

f :: (forall x. C x x) => ()
f y = _

I run haskell-language-server-9.8.2~2.8.0.0 MyLib.hs on command line and it hangs, consuming 100% cpu. If I change this code just about any way, HLS correctly reports errors and exits. GHC also correctly handles this code, reporting type errors.

michaelpj commented 1 month ago

Possible duplicate? https://github.com/haskell/haskell-language-server/issues/2731

michaelpj commented 1 month ago

If it's to do with the hole

andriusstank commented 1 month ago

It's about the hole, I didn't succeed hanging HLS without it. I just tried the code from #2731, HLS quickly inferred the hole, so this must be a different issue.

michaelpj commented 1 week ago

We now limit the hole fits, which I hope should fix this.

fendor commented 2 days ago

Closed by https://github.com/haskell/haskell-language-server/pull/4288, could you check your issue is indeed solved in the latest release?