Skip to content
New issue

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

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

Already on GitHub? # to your account

Type error in one file, only after opening other. #3835

Closed
lsmor opened this issue Oct 10, 2023 · 2 comments
Closed

Type error in one file, only after opening other. #3835

lsmor opened this issue Oct 10, 2023 · 2 comments
Labels
type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@lsmor
Copy link

lsmor commented Oct 10, 2023

Your environment

  • OS: Ubuntu
  • ghc-9.2.8 from ghcup
  • The project is current master branch of ghcup tool. (commit: a73ce18)
  • vscode; haskell extension
  • bug reproduced with hls-2.1.0.0 and 2.3.0.0
# hie.yaml
cradle:
  cabal:
  - component: "ghcup:lib:ghcup"
    path: ./lib
  - component: "ghcup:exe:ghcup"
    path: ./app/ghcup
  - component: "ghcup:test:ghcup-test"
    path: ./test/ghcup-test
  - component: "ghcup:test:ghcup-optparse-test"
    path: ./test/optparse-test

Steps to reproduce

  1. Clone ghcup repo (commit at the time of writting this: a73ce18)
  2. Open app/BrickMain.hs file in the editor (vscode in my case)
  3. Wait until hls finishes compiling/indexing etc... and stays idle
  4. Without closing BrickMain.hs open lib/Types.hs (the file not the folder)

Expected behaviour

Nothing should happen other than listing / processing / indexing files.

Actual behaviour

Suddenly, file BrickMain.hs shows a type error in line 577. Very rare since the project does compile perfectly with cabal

@lsmor lsmor added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Oct 10, 2023
@fendor
Copy link
Collaborator

fendor commented Oct 10, 2023

Hi!

Without checking too thoroughly, my gut tells me this is related to #3738. It is usually the culprit for such errors.

@fendor fendor added status: needs info Not actionable, because there's missing information and removed status: needs triage status: needs info Not actionable, because there's missing information labels Oct 18, 2023
@fendor
Copy link
Collaborator

fendor commented Oct 18, 2023

I can reproduce and the issue is caused by #3738. Essentially, you have to make sure maintain the closure property of home units, see https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Unit/Env.hs#L548.

Make you sure you open all components in the ghcup project in your project to fix this or wait for #3738. Closing this in favour of #3738 which tracks our efforts to fix these kinds of issues.

@fendor fendor closed this as completed Oct 18, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants