rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.32k stars 94 forks source link

constructor confused for type during optimize imports (+leftover syntax) #534

Open aryairani opened 4 years ago

aryairani commented 4 years ago

image

becomes

image

It should have become import Unison.Codebase (Codebase), but I can see how this could be a challenging case! Though import Unison.Codebase (()) is no good. 😄

ghc justs says:

/Users/arya/unison4/parser-typechecker/src/Unison/Codebase/FileCodebase/Reserialize.hs:40:1: error: [-Wunused-imports, -Werror=unused-imports]
    The import of ‘BuiltinAnnotation, Codebase’
    from module ‘Unison.Codebase’ is redundant
   |
40 | import           Unison.Codebase                ( Codebase(Codebase), BuiltinAnnotation )
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I'm not sure how you'd tell whether it's the type or the constructor name that's redundant, though. 😕

rikvdkleij commented 4 years ago

Thanks for reporting! Yes, this is a difficult one to solve properly.