Skip to content

Redundant symbol containing Unicode character may cause HLS to hang #2859

Closed
@konn

Description

@konn

Your environment

  • Which OS do you use: Ubuntu 20.04.2 LTS
  • Which LSP client (editor/plugin) do you use: VSCode + vscode-haskell
  • Describe your project (alternative: link to the project): A simple project using GHC 9.02 consisting of the following two modules:

    • Types.hs:

      module Types where
      
      ε :: Double
      ε = 0.5
      
      data A = A
    • Lib.hs

      {-# OPTIONS_GHC -Wall #-}
      module Lib where
      import Types (A (..), ε)
      
      a :: A
      a = A

Steps to reproduce

  1. Open Lib.hs and wait a moment.
  2. Warning on redundant import of ε gets reported and HLS stops responding.

Expected behaviour

HLS should continue working and provide some code action to remove ε from the list.

Actual behaviour

HLS hangs and stop responding indefinitely.

If we rename ε so that it doesn't include any unicode character, then the panic goes away.
Also note that removing the definition of a from Lib.hs and stop importing A(..), then HLS won't panic anymore - it seems that at least one extra imported item are needed to reproduce the situation. In other words, the following Lib.hs won't make HLS panic:

{-# OPTIONS_GHC -Wall #-}
module Lib where

import Types (ε)

Include debug information

Debug Output here:

panic.log

The following panic lines from the above illustrates the situation:

haskell-language-server-9.0.2: haskell-language-server-9.0.2: panic! (the 'impossible' happened)
  (GHC version 9.0.2:
	charType: '\949'

\949 corresponds to ε.

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