Closed facundominguez closed 6 months ago
This also seems to happen in 9.6.3, with hls: https://github.com/haskell/haskell-language-server/issues/3885
In this case, after changing the offending lines https://github.com/kowainik/stan/blob/ddcd461be0bfe3ff7d5353ff6f5d64fb0536c38e/src/Stan/Hie/Compat904.hs#L52C1-L58C74 to
nodeInfo :: HieAST a -> NodeInfo a
nodeInfo h = case (lookup' SourceInfo, lookup' GeneratedInfo) of
(Nothing, Nothing) ->
let a = error "nodeInfo Nothing Nothing"
in
-- NodeInfo S.empty [] M.empty
a
(Just n1, Nothing) -> n1
(Nothing, Just b) -> let a = error "nodeInfo Nothing Just"
in
-- b
a
(Just n1, Just{}) -> n1
where lookup' k = Map.lookup k (getSourcedNodeInfo (sourcedNodeInfo h))
gives us
stan: nodeInfo Nothing Just
CallStack (from HasCallStack):
error, called at src/Relude/Debug.hs:296:11 in rld-1.2.1.0-8bb4440e:Relude.Debug
error, called at src/Stan/Hie/Compat904.hs:63:32 in stn-0.1.0.2-89eeeecd:Stan.Hie.Compat904
For liquid-fixpoint and ghcide in hls, the error happens with the Nothing, Just b
pattern match. And if i change it to return the value from the Just, it does alright, no errors are thrown and tests also pass. I only know of these two cases, but I do not know what would be the right thing to do...
Returning the value from the Just might be a good enough solution though @tomjaguarpaw .
Thanks for reporting this @facundominguez. Sorry for not responding earlier. I didn't have notifications on for this repository so I was only notified when I was mentioned. And thanks for jumping on this @0rphee.
This code is in CompatXXX
for 9.0 onwards, so I suspect the same failing examples will fail in all those GHC versions. We need a minimal reproducer that we can add to our test cases. One thing that we could apply as an emergency fix is return an empty NodeInfo
. At least then people can still use stan
, even if it ends up ignoring some parts of the file.
I guess we should replace nodeInfo
with this implementation: https://hackage.haskell.org/package/ghc-9.8.1/docs/src/GHC.Iface.Ext.Utils.html#nodeInfo
WIP fixing this here: https://github.com/tomjaguarpaw/stan/tree/nodeInfo
Fixed and released to Hackage: https://hackage.haskell.org/package/stan-0.1.1.0
I managed to track this down to Language/Fixpoint/Types/Refinements.hs
but I didn't find a smaller reproducer than that, unfortunately.
Thanks @tomjaguarpaw!
Hello! When running
stan
withghc-9.4.7
in the liquid-fixpoint repo I get the following crash and error messageThe error is rather uninformative to me. Is there anything I could do about it?