Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The impossible happen, mkUsage, HLS 1.5.0 #2385

Closed
guibou opened this issue Nov 22, 2021 · 3 comments · Fixed by #2377
Closed

The impossible happen, mkUsage, HLS 1.5.0 #2385

guibou opened this issue Nov 22, 2021 · 3 comments · Fixed by #2377
Labels
component: ghcide type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@guibou
Copy link
Collaborator

guibou commented Nov 22, 2021

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.

@guibou
Copy link
Collaborator Author

guibou commented Nov 22, 2021

Maybe linked to #2365

@guibou
Copy link
Collaborator Author

guibou commented Nov 22, 2021

I confirm that #2377 fix the problem. Thank you.

@guibou guibou mentioned this issue Nov 22, 2021
@jneira jneira added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. component: ghcide labels Nov 22, 2021
@jneira jneira linked a pull request Nov 22, 2021 that will close this issue
@jneira
Copy link
Member

jneira commented Nov 22, 2021

many thanks for the report and further investigation, I linked the pr and the issue

@mergify mergify bot closed this as completed in #2377 Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ghcide type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants