hlint misses -XNoForeignFunctionInterface in the cradle #3095
Labels
component: formatters
component: hls-hlint-plugin
status: blocked
Not actionable, because blocked by upstream/GHC etc.
type: bug
Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Here is an hls branch with a broken test case (only runs on ghc-9.2):
https://github.com/lf-/haskell-language-server/tree/hlint-flags-bug
and the commit, for convenience: lf-@8a90d27
The issue happens in this source:
The bug is that hls' hlint plugin will trigger parse errors, even if the hlint.yaml has
-XNoForeignFunctionInterface
in it, and also even if the cradle provides it.It is "fixable" in a project by
"haskell.plugin.hlint.config.flags": ["-XNoForeignFunctionInterface"]
.The cause of this bug is that the disabled language extensions are not correctly propagated to hlint when hlint is called: only enabled extensions are propagated:
haskell-language-server/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs
Lines 318 to 321 in 1bc1def
Unfortunately, actually retrieving disabled extensions is significantly frustrated by OnOff (https://hackage.haskell.org/package/ghc-9.2.4/docs/src/GHC.Driver.Session.html#OnOff) being a private member of GHC.Driver.Session, so it is impossible to get the disabled extensions out of
DynFlags.extensions
without more or less doing something likeread . dropOnOffPrefix . show
.So what I am 99% sure is happening, based on putting traces in both sides, is that
ForeignFunctionInterface
is absent from theenabledExtensions
passed to hlint if the cradle is configured with-XNoForeignFunctionInterface
, but it is then reenabled because it is a default extension.I got fairly far in fixing this, but ran up against this brick wall, and don't really have more time to commit to fixing it. So I am filing this report with the hopes that it will at least be easier to fix.I found some time :)Your environment
..
Steps to reproduce
Run the test suite from https://github.com/lf-/haskell-language-server/tree/hlint-flags-bug
Expected behaviour
Should pass :)
Actual behaviour
Debug information
The text was updated successfully, but these errors were encountered: