Skip to content

hls-hlint-plugin: Build fails with ghc-lib >= 9.0 and ghc <= 8.10.7 #2728

Closed
@maralorn

Description

@maralorn

I am trying to build hls-hlint-plugin in the above mentioned combination.

I get the following error:

src/Ide/Plugin/Hlint.hs:132:44: error:
    • The constructor ‘GHC.RealSrcSpan’ should have 2 arguments, but has been given 1
    • In the pattern: GHC.RealSrcSpan x
      In the pattern: (GHC.RealSrcSpan x, y)
      In the pattern: (, Nothing) -> (GHC.RealSrcSpan x, y)
    |
132 | pattern RealSrcSpan x y <- ((,Nothing) -> (GHC.RealSrcSpan x, y))
    |                                            ^^^^^^^^^^^^^^^^^

src/Ide/Plugin/Hlint.hs:230:23: error:
    • The constructor ‘RealSrcSpan’ should have no arguments, but has been given 2
    • In the pattern: RealSrcSpan span _
      In an equation for ‘srcSpanToRange’:
          srcSpanToRange (RealSrcSpan span _)
            = Range
                {_start = Position
                            {_line = fromIntegral $ srcSpanStartLine span - 1,
                             _character = fromIntegral $ srcSpanStartCol span - 1},
                 _end = Position
                          {_line = fromIntegral $ srcSpanEndLine span - 1,
                           _character = fromIntegral $ srcSpanEndCol span - 1}}
      In an equation for ‘rules’:
          rules plugin
            = do define $ \ GetHlintDiagnostics file -> ...                 defineNoFile $ \ GetHlintSettings -> ...
                 action
                   $ do files <- getFilesOfInterestUntracked
                        ....
            where
                diagnostics ::
                  NormalizedFilePath -> Either ParseError [Idea] -> [FileDiagnostic]
                diagnostics file (Right ideas)
                  = [(file, ShowDiag, ideaToDiagnostic i) |
                       i <- ideas, ideaSeverity i /= Ignore]
                diagnostics file (Left parseErr)
                  = [(file, ShowDiag, parseErrorToDiagnostic parseErr)]
                ideaToDiagnostic :: Idea -> Diagnostic
                ideaToDiagnostic idea
                  = Diagnostic
                      {_range = srcSpanToRange $ ideaSpan idea, _severity = Just DsInfo,
                       _code = Just (InR $ T.pack $ codePre ++ ideaHint idea),
                       _source = Just "hlint", _message = idea2Message idea,
                       _relatedInformation = Nothing, _tags = Nothing}
                  where
                      codePre = ...
                ....
    |
230 |       srcSpanToRange (RealSrcSpan span _) = Range {

I might be holding it wrong, but my impression is, that this line should not compare ghc, but ghc-lib versions.

If someone more knowledgeable (e.g. @fendor) could tell me if that’s right, I‘d be very grateful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: hls-hlint-pluginstatus: blockedNot actionable, because blocked by upstream/GHC etc.type: 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