Skip to content

The impossible happen, mkUsage, HLS 1.5.0 #2385

Closed
@guibou

Description

@guibou

I'm really sorry, this will be a bug report without much context.

What I know: it was working with HLS 1.4 and it is now failing with HLS 1.5.

HLS fails on a file with:

Message: 
  haskell-language-server: panic! (the 'impossible' happened)
  (GHC version 8.10.7:
  mkUsage

  Data.Quantities.Constructors fromString {Definitions, baseQuant,
  dimensionalityFromUnit, divideQuants, emptyDefinitions,
  expSimpleUnit, expUnit, exptQuants, invertSimpleUnit,
  invertUnit, multiplyQuants, normalizeDimensionality,
  powerToPower, prettyCompUnit', reduceUnits,
  reduceUnitsAndPrefixes, showSort, totalPower,
  unionDefinitions, units', CompoundUnit, CompoundUnit,
  sUnits, Definition, BaseDefinition, PrefixDefinition,
  UnitDefinition, base, defPrefix, defSymbol, defSynonyms,
  dimBase, factor, quantity, Definitions, bases,
  prefixSynonyms, prefixValues, prefixes, synonyms,
  typeToUnit, unitTypes, unitsSet, Dimensionality,
  Dimensionality, getDimensionality, Power, Power, Quantity,
  Quantity, magnitude, units, QuantityComputation,
  QuantityError, DimensionalityError, ParserError,
  PrefixAlreadyDefinedError, ScalingFactorError,
  UndefinedUnitError, UnitAlreadyDefinedError, SimpleUnit,
  SimpleUnit, power, prefix, symbol, Symbol, addQuants,
  convert, convertBase, dimensionality, subtractQuants,
  fromString, unitsFromString, simplifyUnit}
  Call stack:
  CallStack (from HasCallStack):
  callStackDoc, called at compiler/utils/Outputable.hs:1179:37 in ghc:Outputable
  pprPanic, called at compiler/deSugar/DsUsage.hs:356:28 in ghc:DsUsage

  Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug

fromString is a symbol defined in our library.

The problem only happen with the following setup: The symbol fromString is defined in A.hs, in B.hs I had:

module B (fromString) where

import A

And the issue only happen if the module B is imported in module C. There is obviously something else in the equation because I cannot write a proper repro.

I was able to workaround the problem with the following version of B.hs:

module B (fromString) where

import qualified A
fromString = A.fromString

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

haskell-language-server version: 1.5.0.0 (GHC: 8.10.7) (PATH: /nix/store/aqkbkdwfyacpl7qwmzpq7js4g2jaxmza-haskell-language-server-1.5.0.0/bin/haskell-language-server)
Tool versions found on the $PATH
cabal:		3.4.0.0
stack:		Not found
ghc:		8.10.7

Which OS do you use: Linux

Which lsp-client do you use: nvim-lspconfig, but the problem happen in command line too

Describe your project (alternative: link to the project): huge proprietary codebase

Contents of hie.yaml: Unfortunately it defer to a script which calls bazel in order to gather flags

Steps to reproduce

I have no idea ;(

Expected behaviour

It should not fail.

Actual behaviour

It fails, see the error message printed above.

I do realize that my project have .hs-boot files too. Maybe it is related to #2377, I'll try that first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: ghcidetype: 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