-
-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closure property for multiple home units is not enforced nor checked #3422
Comments
Users don't "add units", so I'm not sure that the workflow you lay out can map into HLS. I guess the closest thing that would correspond to is:
This is a slightly odd situation anyway: it supposes that we have two units A and B such that A depends on B and the user can open files from both. In that scenario why would we not immediately load B as a home unit as soon as the user opens a file in A? The problematic case is I guess where we have A -> B -> C where A and C are local but B is not. That does seem tricky and we'll probably have to give an error. But if all the units are local I don't see why we can't just load them all as home units to begin with? |
I made a similar proposal a while ago: haskell/hie-bios#269 The problem back then is that the user doesn't really know which dependency is breaking the closure property. It sounds like Agree with Michael, it would be best if HLS could parse the result of |
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422).
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422).
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422).
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422).
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422).
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422).
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422).
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422). fixes Fix closure check session-loader: override old units with new in multi-unit support
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422). fixes Fix closure check session-loader: override old units with new in multi-unit support
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422). fixes Fix closure check session-loader: override old units with new in multi-unit support
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422). fixes Fix closure check session-loader: override old units with new in multi-unit support
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422). fixes Fix closure check session-loader: override old units with new in multi-unit support
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422). fixes Fix closure check session-loader: override old units with new in multi-unit support
…ttps://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422). fixes Fix closure check session-loader: override old units with new in multi-unit support Remove implicit-hie session-loader: remember which files caused old components to be loaded, and also pass them on to hie-bios so it can in turn pass them to `cabal repl` when loading newer components. This allows us to create valid set of build flags encompassing both the old and new components, and the closure of all components in between. The observation is that if you want to load some components X, Y, Z and so on, cabal repl X Y Z ... will be more likely to give you a valid multi component build plan/flags than cabal repl all, or any way of combining the results of cabal repl X, cabal repl Y ... Use new hie-bios Move implicit cradles to HLS Fix build on 9.0 Werror Improve handling of specialTarget
* Add support for the multi unit argument syntax introduced in GHC 9.4: https://downloads.haskell.org/ghc/9.4.4/docs/users_guide/using.html#multiple-home-units We now support arguments of the form ``` -unit @unitA -unit @unitb ``` where the response files `unitA` and `unitB` contain the actual list of arguments for that unit: ``` -this-unit-id a-0.1.0.0 -i -isrc A1 A2 ``` Also refactor the session loader and simplify it. Also adds error messages on GHC 9.4 if the units are not closed (#3422). fixes Fix closure check session-loader: override old units with new in multi-unit support Remove implicit-hie session-loader: remember which files caused old components to be loaded, and also pass them on to hie-bios so it can in turn pass them to `cabal repl` when loading newer components. This allows us to create valid set of build flags encompassing both the old and new components, and the closure of all components in between. The observation is that if you want to load some components X, Y, Z and so on, cabal repl X Y Z ... will be more likely to give you a valid multi component build plan/flags than cabal repl all, or any way of combining the results of cabal repl X, cabal repl Y ... Use new hie-bios Move implicit cradles to HLS Fix build on 9.0 Werror Improve handling of specialTarget * hie-bios doesn't mention the component name in the message anymore * stack fixes * wrapper: remove unused argument * werror * werror * Implicit cradle: match implicit-hie-cradle logic * Fix eval plugin * ignore multi unit tests on 9.2 * Some fixes for 9.2 * Add hie.yaml for call-hierarchy-plugin tests * Add hie.yaml for explicit-record-fields-plugin * Add hie.yaml for hls-overloaded-record-dot-plugin
Sounds like we added a check. |
The blog post [The Interface for Multiple Home Units](https://well-typed.com/blog/2022/01/multiple-home-units/#closure-property-for-home-units) explains the closure property needed for setting up a multiple component session.
HLS does not ensure this holds which leads to broken sessions when loading multiple components. For example.. random overlapping instance errors, panics in checkFamConst etc etc. It is critical that any session which HLS constructs obeys the closure property.
Stated simply the closure property is:
And in terms of implementation there is a function in GHC called
checkHomeUnitsClosed
which implements this check and reports the reason why it's not closed.My proposal is
My experience is that multi-component works without problem as long as the closure property. I spent the last week using the support whilst developing cabal-install, which has 5 components.
In the future:
There should be a better interface for initialising a session which contains multiple components rather than having to create the session incrementally one component at a time.
The text was updated successfully, but these errors were encountered: