commercialhaskell / stack-ide

Stack-based JSON interface to ide-backend
98 stars 23 forks source link

RequestGetSourceErrors fails to produce correct error - instead says haskell file cannot be found #53

Closed CRogers closed 8 years ago

CRogers commented 9 years ago

This gist has the minimal failing example. Previously (a couple of weeks ago) this would return the expected error in OneSourceError.hs. Now it claims to not even find OneSourceError. stack build successfully reports the expected type error rather than saying it cannot find the file.

$ stack --version
Version 0.1.3.1, Git revision 908b04205e6f436d4a5f420b1c6c646ed2b804d7

Using stack-ide commit fda52a9. Happens on OS X and linux.

Starting stack-ide followed by a RequestGetSoruceErrors:

$ stack ide start
{"tag":"ResponseWelcome","contents":[0,1,1]}
# snip logging
{"tag":"RequestGetSourceErrors","contents":[]}
{"tag":"ResponseGetSourceErrors","contents":[{"errorSpan":{"tag":"TextSpan","contents":"<no location info>"},"errorKind":"KindError","errorMsg":"can't find file: /blah/haskell/test-data/one-source-error/OneSourceError"}]}
lukexi commented 9 years ago

Hi Callum, It's working for me here. I think I ran into this one too, and if I remember right it was a bug in stack that's now fixed — can you try installing the latest stack HEAD?

lukexi@LukeMBP:~/Downloads/4c1ea6336404a6f12e9f-b79642d1b8e9ccb27d8c633536f86769419510d7$ stack ide start 
{"tag":"ResponseWelcome","contents":[0,1,1]}
{"tag":"ResponseLog","contents":"[Info] Initializing ide-backend session @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:195:3)\n"}
{"tag":"ResponseLog","contents":"[Debug] Session dir = /Users/lukexi/Downloads/4c1ea6336404a6f12e9f-b79642d1b8e9ccb27d8c633536f86769419510d7/session.11645 @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:208:3)\n"}
{"tag":"ResponseLog","contents":"[Debug] Dist dir = /Users/lukexi/Downloads/4c1ea6336404a6f12e9f-b79642d1b8e9ccb27d8c633536f86769419510d7/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/ @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:210:3)\n"}
{"tag":"ResponseLog","contents":"[Debug] Local working dir = /Users/lukexi/Downloads/4c1ea6336404a6f12e9f-b79642d1b8e9ccb27d8c633536f86769419510d7/ @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:217:17)\n"}
{"tag":"ResponseLog","contents":"[Info] Searching for ide-backend-server on this path: /Users/lukexi/Downloads/4c1ea6336404a6f12e9f-b79642d1b8e9ccb27d8c633536f86769419510d7/.stack-work/install/x86_64-osx/lts-3.0/7.10.2/bin/:/Users/lukexi/.stack/snapshots/x86_64-osx/lts-3.0/7.10.2/bin/:/Users/lukexi/.local/bin:/Users/lukexi/.cabal/bin:/usr/local/ghc-head/bin:/Applications/ghc-7.10.2.app/Contents/bin:/Users/lukexi/Code/ghc-ios-scripts:/Users/lukexi/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/opt/llvm/bin @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:341:5)\n"}
{"tag":"ResponseLog","contents":"[Info] Found ide-backend-server - using this one: /Users/lukexi/.local/bin/ide-backend-server @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:343:5)\n"}
{"tag":"ResponseLog","contents":"[Debug] Recompile required, starting... @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update.ExecuteSessionUpdate ./IdeSession/Update/ExecuteSessionUpdate.hs:223:5)\n"}
{"tag":"ResponseLog","contents":"[Info] Restarting session due to update requiring it. @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:422:11)\n"}
{"tag":"ResponseUpdateSession","contents":{"tag":"UpdateStatusRequiredRestart","contents":[]}}
{"tag":"ResponseLog","contents":"[Info] Restarting ide-backend-server @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:351:3)\n"}
{"tag":"ResponseLog","contents":"[Info] Searching for ide-backend-server on this path: /Users/lukexi/Downloads/4c1ea6336404a6f12e9f-b79642d1b8e9ccb27d8c633536f86769419510d7/.stack-work/install/x86_64-osx/lts-3.0/7.10.2/bin/:/Users/lukexi/.stack/snapshots/x86_64-osx/lts-3.0/7.10.2/bin/:/Users/lukexi/.local/bin:/Users/lukexi/.cabal/bin:/usr/local/ghc-head/bin:/Applications/ghc-7.10.2.app/Contents/bin:/Users/lukexi/Code/ghc-ios-scripts:/Users/lukexi/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/opt/llvm/bin @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:341:5)\n"}
{"tag":"ResponseLog","contents":"[Info] Found ide-backend-server - using this one: /Users/lukexi/.local/bin/ide-backend-server @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:343:5)\n"}
{"tag":"ResponseLog","contents":"[Debug] Recompile required, starting... @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update.ExecuteSessionUpdate ./IdeSession/Update/ExecuteSessionUpdate.hs:223:5)\n"}
{"tag":"ResponseUpdateSession","contents":{"tag":"UpdateStatusProgress","contents":{"progressOrigMsg":"[1 of 1] Compiling OneSourceError   ( /Users/lukexi/Downloads/4c1ea6336404a6f12e9f-b79642d1b8e9ccb27d8c633536f86769419510d7/OneSourceError.hs, interpreted )","progressStep":1,"progressNumSteps":1,"progressParsedMsg":"Compiling OneSourceError"}}}
{"tag":"ResponseUpdateSession","contents":{"tag":"UpdateStatusDone","contents":[]}}
{"tag":"RequestGetSourceErrors","contents":[]}
{"tag":"ResponseGetSourceErrors","contents":[{"errorSpan":{"tag":"ProperSpan","contents":{"spanFromLine":4,"spanFilePath":"OneSourceError.hs","spanToColumn":9,"spanFromColumn":8,"spanToLine":4}},"errorKind":"KindError","errorMsg":"No instance for (Num [Char]) arising from the literal ‘1’\nIn the first argument of ‘(++)’, namely ‘1’\nIn the expression: 1 ++ \"str\"\nIn an equation for ‘expr’: expr = 1 ++ \"str\""}]}
CRogers commented 9 years ago

Oh, stack-ide requires HEAD stack? I will give it a go tomorrow. It seems pretty wild that we have these 3 projects (ide-backend, stack-ide and stack) developed in lockstep yet spread over many different repos. I guess we don't expect the bits of stack and ide-backend that stack-ide depends on to change that much?

CRogers commented 9 years ago

Ok, I just tried it with latest stack:

$ stack --version
Version 0.1.3.1, Git revision f0dec592d3aaf72b38cee795fb486a5421b6b4de

It tries to build the project first, which fails, and stack-ide doesn't start. This is giving me horrifying flashbacks of having to work around cabal repl's behaviour of failing to start unless the project actually built.

$ stack ide start
one-source-error-0.1.0.0: build
Building one-source-error-0.1.0.0...
Preprocessing library one-source-error-0.1.0.0...
[1 of 1] Compiling OneSourceError   ( OneSourceError.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/OneSourceError.o )

/Users/callumr/Dropbox/Programming/atom/atom-stack-ide/haskell/test-data/one-source-error/OneSourceError.hs:4:8:
    No instance for (Num [Char]) arising from the literal ‘1’
    In the first argument of ‘(++)’, namely ‘1’
    In the expression: 1 ++ "str"
    In an equation for ‘expr’: expr = 1 ++ "str"

--  While building package one-source-error-0.1.0.0 using:
      /Users/callumr/.stack/programs/x86_64-osx/ghc-7.10.2/bin/runhaskell -package=Cabal-1.22.4.0 -clear-package-db -global-package-db -package-db=/Users/callumr/.stack/snapshots/x86_64-osx/lts-3.0/7.10.2/pkgdb/ /var/folders/gx/7lt1gq996118d06q7g9ft7dd080grz/T/stack1551/Setup.hs --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/ build --ghc-options -hpcdir .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/hpc/.hpc/ -ddump-hi -ddump-to-file
    Process exited with code: ExitFailure 1
lukexi commented 9 years ago

Hmmm that must have been newly introduced : P

Want to try with this rev? : )

lukexi@LukeMBP:~$ stack --version
Version 0.1.3.1, Git revision a0b1881d4c32a647448c875e44af36fff5bb7ed8 (dirty) (1557 commits)
CRogers commented 9 years ago

I'll make a bug on stack for my last comment and try using the revision for now.

CRogers commented 9 years ago

Made a bug at https://github.com/commercialhaskell/stack/issues/810

mgsloan commented 8 years ago

Sounds like this is resolved! Feel free to reopen if not