haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.71k stars 368 forks source link

Eval Plugin: error involving newtypes are not reported #1217

Closed konn closed 7 months ago

konn commented 3 years ago

Your environment

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

$ /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server --probe-tools
haskell-language-server version: 0.8.0.0 (GHC: 8.6.5) (PATH: /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server) (GIT hash: 4b0e4560361ce429e09e6708ae8a845e2d37d2cd)
Tool versions found on the $PATH
cabal:          3.2.0.0
stack:          2.5.1

Which lsp-client do you use: VSCode

Describe your project (alternative: link to the project): Following module alone:

module Lib where

newtype P = P () deriving (Read, Show, Eq, Ord)

erroras :: P
erroras = error "nope"

-- >>> erroras

Contents of hie.yaml: No hie.yaml

Steps to reproduce

  1. Click Evaluate

Expected behaviour

  1. show "nope" as comment

Actual behaviour

  1. No error reported. If one replaces P with Int in type signature, it works as expected.

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output: ``` haskell-language-server version: 0.8.0.0 (GHC: 8.6.5) (PATH: /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server) (GIT hash: 4b0e4560361ce429e09e6708ae8a845e2d37d2cd) (haskell-language-server)Ghcide setup tester in /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit. Report bugs at https://github.com/haskell/haskell-language-server/issues Tool versions found on the $PATH cabal: 3.2.0.0 stack: 2.5.1 ghc: 8.6.5 Step 1/4: Finding files to test in /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit Found 4 files Step 2/4: Looking for hie.yaml files that control setup Found 1 cradle Step 3/4: Initializing the IDE Step 4/4: Type checking the files [INFO] Consulting the cradle for "app/Main.hs" Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack} > Using main module: 1. Package `bugs-sandpit' component bugs-sandpit:exe:bugs-sandpit-exe with main-is file: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/app/Main.hs > bugs-sandpit> configure (lib + exe) > Configuring bugs-sandpit-0.1.0.0... > bugs-sandpit> initial-build-steps (lib + exe) > The following GHC options are incompatible with GHCi and have not been passed to it: -threaded > Configuring GHCi with the following packages: bugs-sandpit > /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/install/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d [INFO] Using interface files cache dir: ghcide [INFO] Making new HscEnv[main] [INFO] Consulting the cradle for "test/Spec.hs" Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack} > Using main module: 1. Package `bugs-sandpit' component bugs-sandpit:test:bugs-sandpit-test with main-is file: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/test/Spec.hs > bugs-sandpit> configure (lib + test) > Configuring bugs-sandpit-0.1.0.0... > bugs-sandpit> initial-build-steps (lib + test) > bugs-sandpit> Test running disabled by --no-run-tests flag. > Completed 2 action(s). > The following GHC options are incompatible with GHCi and have not been passed to it: -threaded > Configuring GHCi with the following packages: bugs-sandpit > /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/install/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d [INFO] Using interface files cache dir: ghcide [INFO] Using interface files cache dir: ghcide [INFO] Making new HscEnv[main,main] [INFO] Consulting the cradle for "src/Lib.hs" Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack} > bugs-sandpit> configure (lib) > Configuring bugs-sandpit-0.1.0.0... > bugs-sandpit> initial-build-steps (lib) > Configuring GHCi with the following packages: bugs-sandpit > /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/install/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d [INFO] Using interface files cache dir: ghcide [INFO] Using interface files cache dir: ghcide [INFO] Using interface files cache dir: ghcide [INFO] Making new HscEnv[main,main,main] [INFO] Consulting the cradle for "Setup.hs" Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack} File: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/Setup.hs Hidden: no Range: 1:1-2:1 Source: cradle Severity: DsError Message: Multi Cradle: No prefixes matched pwd: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit filepath: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/Setup.hs prefixes: ("src",Stack {component = Just "bugs-sandpit:lib", stackYaml = Nothing}) ("app/Main.hs",Stack {component = Just "bugs-sandpit:exe:bugs-sandpit-exe", stackYaml = Nothing}) ("test",Stack {component = Just "bugs-sandpit:test:bugs-sandpit-test", stackYaml = Nothing}) File: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/bugs-sandpit-test/autogen/Paths_bugs_sandpit.hs Hidden: no Range: 1:1-2:1 Source: compiler Severity: DsError Message: Failed to get the immediate reverse dependencies of NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/bugs-sandpit-test/autogen/Paths_bugs_sandpit.hs" File: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen/Paths_bugs_sandpit.hs Hidden: no Range: 1:1-2:1 Source: compiler Severity: DsError Message: Failed to get the immediate reverse dependencies of NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen/Paths_bugs_sandpit.hs" Files that failed: * /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/Setup.hs Completed (3 files worked, 1 file failed) [INFO] finish: User TypeCheck (took 0.13s) ```

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs: ``` [client] run command: "/Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server --lsp" [client] debug command: "/Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server --lsp" [client] server cwd: undefined haskell-language-server version: 0.8.0.0 (GHC: 8.6.5) (PATH: /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server) (GIT hash: 4b0e4560361ce429e09e6708ae8a845e2d37d2cd) Starting (haskell-language-server)LSP server... with arguments: LspArguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False} with plugins: [PluginId "brittany",PluginId "class",PluginId "eval",PluginId "floskell",PluginId "fourmolu",PluginId "ghcide",PluginId "haddockComments",PluginId "hlint",PluginId "importLens",PluginId "moduleName",PluginId "ormolu",PluginId "pragmas",PluginId "retrie",PluginId "splice",PluginId "stylish-haskell",PluginId "tactic"] in directory: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option! Started LSP server in 0.00s 2021-01-17 12:57:23.941384 [ThreadId 38] - Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 2448812684686715143 "file:///Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit"], clientSettings = hashed Nothing} 2021-01-17 12:57:23.953815 [ThreadId 38] - Configuration changed: Object (fromList [("haskell",Object (fromList [("hlint",Object (fromList [("logLevel",String "info"),("executablePath",String "/Users/hiromi/.local/bin/hlint")])),("logFile",String ""),("updateBehavior",String "keep-up-to-date"),("hlintOn",Bool True),("formatOnImportOn",Bool True),("indentationRules",Object (fromList [("enabled",Bool True)])),("liquidOn",Bool False),("languageServerVariant",String "haskell-language-server"),("serverExecutablePath",String "/Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server"),("diagnosticsOnChange",Bool True),("completionSnippetsOn",Bool True),("maxNumberOfProblems",Number 100.0),("formattingProvider",String "fourmolu"),("trace",Object (fromList [("server",String "off")]))]))]) 2021-01-17 12:57:23.955518 [ThreadId 38] - Opened text document: file:///Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/src/Lib.hs 2021-01-17 12:57:23.956998 [ThreadId 117] - hlint:getIdeas:file:NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/src/Lib.hs" 2021-01-17 12:57:23.958131 [ThreadId 125] - Consulting the cradle for "src/Lib.hs" Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack} 2021-01-17 12:57:24.231974 [ThreadId 140] - Plugin.makeCodeLens (ideLogger) > bugs-sandpit> configure (lib) > Configuring bugs-sandpit-0.1.0.0... > bugs-sandpit> initial-build-steps (lib) > Configuring GHCi with the following packages: bugs-sandpit > /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/install/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d 2021-01-17 12:57:27.237514 [ThreadId 125] - Using interface files cache dir: ghcide 2021-01-17 12:57:27.237653 [ThreadId 125] - Making new HscEnv[main] 2021-01-17 12:57:27.263764 [ThreadId 203] - hlint:getIdeas:file:NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/src/Lib.hs" 2021-01-17 12:57:27.268752 [ThreadId 256] - finish: getSession (took 0.01s) 2021-01-17 12:57:27.270854 [ThreadId 283] - hlint:getIdeas:setExtensions:[Cpp,OverlappingInstances,UndecidableInstances,IncoherentInstances,UndecidableSuperClasses,MonomorphismRestriction,MonoPatBinds,MonoLocalBinds,RelaxedPolyRec,ExtendedDefaultRules,ForeignFunctionInterface,UnliftedFFITypes,InterruptibleFFI,CApiFFI,GHCForeignImportPrim,JavaScriptFFI,ParallelArrays,TemplateHaskell,TemplateHaskellQuotes,ImplicitParams,ImplicitPrelude,ScopedTypeVariables,AllowAmbiguousTypes,UnliftedNewtypes,BangPatterns,TypeFamilies,TypeFamilyDependencies,TypeInType,OverloadedStrings,OverloadedLists,NumDecimals,DisambiguateRecordFields,RecordWildCards,RecordPuns,ViewPatterns,GADTs,GADTSyntax,NPlusKPatterns,DoAndIfThenElse,BlockArguments,RebindableSyntax,ConstraintKinds,PolyKinds,DataKinds,InstanceSigs,ApplicativeDo,StandaloneDeriving,DeriveDataTypeable,AutoDeriveTypeable,DeriveFunctor,DeriveTraversable,DeriveFoldable,DeriveGeneric,DefaultSignatures,DeriveAnyClass,DeriveLift,DerivingStrategies,DerivingVia,TypeSynonymInstances,FlexibleContexts,FlexibleInstances,ConstrainedClassMethods,MultiParamTypeClasses,NullaryTypeClasses,FunctionalDependencies,UnicodeSyntax,ExistentialQuantification,MagicHash,EmptyDataDecls,KindSignatures,RoleAnnotations,ParallelListComp,MonadComprehensions,GeneralizedNewtypeDeriving,PostfixOperators,TupleSections,PatternGuards,LiberalTypeSynonyms,RankNTypes,ImpredicativeTypes,TypeOperators,ExplicitNamespaces,PackageImports,ExplicitForAll,AlternativeLayoutRuleTransitional,DatatypeContexts,NondecreasingIndentation,RelaxedLayout,TraditionalRecordSyntax,LambdaCase,MultiWayIf,BinaryLiterals,HexFloatLiterals,DuplicateRecordFields,OverloadedLabels,EmptyCase,PatternSynonyms,PartialTypeSignatures,NamedWildCards,TypeApplications,Strict,StrictData,MonadFailDesugaring,EmptyDataDeriving,NumericUnderscores,QuantifiedConstraints,ImportQualifiedPost,CUSKs,StandaloneKindSignatures,StarIsType] 2021-01-17 12:57:27.270832 [ThreadId 281] - finish: Outline (took 0.01s) 2021-01-17 12:57:27.36381 [ThreadId 339] - finish: codeLens (took 0.09s) 2021-01-17 12:57:27.364725 [ThreadId 349] - finish: (took 0.00s) 2021-01-17 12:57:27.365701 [ThreadId 352] - finish: ModuleName.ghcSession (took 0.00s) 2021-01-17 12:57:27.367117 [ThreadId 354] - finish: ModuleName.GetParsedModule (took 0.00s) 2021-01-17 12:57:28.651254 [ThreadId 365] - finish: getSession (took 0.00s) 2021-01-17 12:57:28.651342 [ThreadId 367] - finish: runEvalCmd.getModSummary (took 0.00s) haskell-language-server: nope CallStack (from HasCallStack): error, called at /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/src/Lib.hs:6:11 in fake_uid:Lib ```
jhrcek commented 7 months ago

This is no longer reproducible it seems. The current behavior is what's described in "expected behavior". @konn can you please check if you can reproduce this issue or is it ok to close this?

konn commented 7 months ago

Thanks for pointing it out. It seems disappeared. Closing this!