1. 27 Sep, 2019 4 commits
    • John Ericson's avatar
    • John Ericson's avatar
      WIP: Put hole instantiation typechecking in the module graph · c1ae5223
      John Ericson authored
      Backpack instantiations need to be typechecked to make sure that the
      arguments fit the parameters. `tcRnInstantiateSignature` checks
      instantiations with concrete modules, while `tcRnCheckUnitId` checks
      instantiations with free holes (signatures in the current modules).
      Before this change, it worked that `tcRnInstantiateSignature` was called
      after typechecking the argument module, see `HscMain.hsc_typecheck`,
      while `tcRnCheckUnitId` was called in `unsweep'` where-bound in
      `GhcMake.upsweep`. `tcRnCheckUnitId` was called once per each
      instantiation once all the argument sigs were processed. This was done
      with simple "to do" and "already done" accumulators in the fold.
      `parUpsweep` did not implement the change.
      With this change, `tcRnCheckUnitId` instead is associated with its own
      node in the `ModuleGraph`. Nodes are now:
      data WorkGraphNode
        = InstantiationNode IndefUnitId
        | ModuleNode ModSummary
      instead of just `ModSummary`; the `InstantiationNode` case is the
      instantiation of a unit to be checked. The dependencies of such nodes
      are the same free holes as was checked with the accumulator before. Both
      upsweeps on such a node call `tcRnCheckUnitId`.
      The instantiation nodes are not depended on by other nodes; `tcRnCheckUnitId` is
      just being called for errors. I do take this as evidence for the argument that
      perhaps my patch is over-engineered; one could also just leave the graph as-is
      and post upsweep `tcRnCheckUnitId` all unit-ids unconditionally. Now, if there
      is extra `-j` sooner one can get the errors quicker than that with mine, but
      without the dependencies into the merged node (mimicking the eagerness of the
      fold of the sequential upsweep) this isn't guaranteed to happen.
      I admit I went with the current approach before I realized that nothing
      else depended on the effects for `tcRnCheckUnitId`, but I still think
      it is the right one with future changes in mind. For this, I refer to
      "Note [Identity versus semantic module]". The current reasoning appeals
      to the compilation pipeline invariants, but if we get multi package
      support [proposal 23], we could have all three of the original
      signature, argument, and instiation in home packages. I think having
      separate dependency nodes for each of those 3 might yield more
      incrementality and/or parallelism, especially if nodes became per
      pipeline stage.
      Fixes #17188
      Things yet to do:
      * [ ]  There are extra numbered steps that don't print out, probably should have some `[m of n] checking instantiation ...`
      * [ ]  Errors are rendered slightly differently for some reason
      [proposal 23]: https://github.com/ghc-proposals/ghc-proposals/pull/263
    • John Ericson's avatar
    • John Ericson's avatar
      For -fkeep-failed do not duplicate dependency edge code · 17d68242
      John Ericson authored
      We now compute the deps for -fkeep-failed the same way that the original
      graph calculates them, so the edges are correct. Upsweep really ought to
      take the graph rather than a topological sort so we are never
      recalculating anything, but at least things are done consistently now.
  2. 26 Sep, 2019 4 commits
    • John Ericson's avatar
      Switch from HscSource to IsBootInterface for module lookup in GhcMake · db3b9132
      John Ericson authored
      We look up modules by their name, and not their contents. There is no
      way to separately reference a signature vs regular module; you get what
      you get. Only boot files can be referenced indepenently with `import {-#
      SOURCE #-}`.
    • John Ericson's avatar
      Make Haddock submodule remote point to gitlab mirror · 13629f6b
      John Ericson authored
      This makes it match the others
    • John Ericson's avatar
      Clean up boot vs non-boot disambiguating types · 48308264
      John Ericson authored
      We often have (ModuleName, Bool) or (Module, Bool) pairs for "extended"
      module names (without or with a unit id) disambiguating boot and normal
      modules. I think this is important enough across the compiler that it
      deserves a new nominal product type.
      With that written, I think the IsBool enum type in GhcMake is overkill;
      just use the same product. I first tried to use both the custom product
      and enum everywhere---against my judgement but in order to make sure we
      never regressed in inference or boolean blindness---but the refactor was
      annoying so I so switched tacks.
    • John Ericson's avatar
      Switch order on GhcMake.IsBoot · 2280965f
      John Ericson authored
      In the next commit I replace it with a boolean (and make it stored in a
      named product type). This one test failed, which scared me greatly, but
      then I realized it was just a matter of the Ord instance being
      different. Doing this as a separate step so as to demonstrate that the
      refactor itself changes no behavior.
  3. 25 Sep, 2019 9 commits
    • John Ericson's avatar
      Skip type family defaults with hs-boot and hsig files · cf4de90e
      John Ericson authored
      Works around #17190, possible resolution for #17224
      Instances in signatures currently unconditionally opt into associated
      family defaults if no explicit instance is given. This is bad for two
        1. It constrains possible instantiations to use the default, rather
        than possibly define the associated family differently.
        2. It breaks compilation as type families are unsupported in
      This PR simply turns off the filling in of defaults in those cases.
      Additionally, it squelches a missing definition warning for hs-boot too
      that was only squelched for hsig before.
      The downsides are:
        1. There is no way to opt into the default, other than coppying its
        2. If we fixed type classes in signatures, and wanted instances to
        have to explicitly *out of* rather than into the default, that would
        now be a breaking change.
      Neither opt-in or opt-out is very appealing. Perhaps the right answer is
      "just use deriving via"! Default methods are once again being more
      combersome and requiring more syntax (c.f. default signatures), and yet
      are still less powerful.
      The only part of this patch I am sure is a good iea is harmonizing the
      warning squelching between hs-boot or hsig. Maybe they should have the
      warning (opt out of default) maybe they shouldn't (opt in to default),
      but surely it should be the same for both.
    • John Ericson's avatar
      Add `module {-# SOURCE #-} Foo` syntax for hs-boot in bkp · 09f145f4
      John Ericson authored
      This is a good convenience for testing.
    • Ryan Scott's avatar
      Remove unneeded CPP now that GHC 8.6 is the minimum · 795986aa
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      The minimum required GHC version for bootstrapping is 8.6, so we can
      get rid of some unneeded `#if `__GLASGOW_HASKELL__` CPP guards, as
      well as one `MIN_VERSION_ghc_prim(0,5,3)` guard (since GHC 8.6 bundles
    • Ben Gamari's avatar
      base: Move Ix typeclass to GHC.Ix · d90d0bad
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      The `Ix` class seems rather orthogonal to its original home in
    • Sebastian Graf's avatar
      PmCheck: Only ever check constantly many models against a single pattern · ebc65025
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      Introduces a new flag `-fmax-pmcheck-deltas` to achieve that. Deprecates
      the old `-fmax-pmcheck-iter` mechanism in favor of this new flag.
      From the user's guide:
      Pattern match checking can be exponential in some cases. This limit makes sure
      we scale polynomially in the number of patterns, by forgetting refined
      information gained from a partially successful match. For example, when
      matching `x` against `Just 4`, we split each incoming matching model into two
      sub-models: One where `x` is not `Nothing` and one where `x` is `Just y` but
      `y` is not `4`. When the number of incoming models exceeds the limit, we
      continue checking the next clause with the original, unrefined model.
      This also retires the incredibly hard to understand "maximum number of
      refinements" mechanism, because the current mechanism is more general
      and should catch the same exponential cases like PrelRules at the same
      Metric Decrease:
    • John Ericson's avatar
      includes/CodeGen.Platform.hs don't include ghcautoconf.h · 4540bbe2
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      It doesn't need it, and it shouldn't need it or else multi-target will
    • Kari Pahula's avatar
      Add -Wderiving-defaults (#15839) · 2970dc7a
      Kari Pahula authored and Marge Bot's avatar Marge Bot committed
      Enabling both DeriveAnyClass and GeneralizedNewtypeDeriving can cause
      a warning when no explicit deriving strategy is in use. This change adds
      an enable/suppress flag for it.
    • Matthew Pickering's avatar
      Add ghcide configuration files · 218c5dbf
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This commit adds three new files
      1. A hie.yaml file to the project root which specifies to IDEs how to
      set up the correct environment for loading GHC. This currently
      specifies to call the `./hadrian/hie-bios` script.
      2. A `hie.yaml` file for the hadrian subcomponent, which uses the
      `cabal` cradle type.
      2. The `./hadrian/hie-bios` script which supplies the correct arguments
      for an IDE to start a session.
      With these two files it is possible to run
      ghcide compiler/
      and successfully load all the modules for use in the IDE.
      ghcide --cwd hadrian/ src/
      to test loading all of Hadrian's modules.
      Closes #17194
    • Andreas Klebinger's avatar
      Fix bounds check in ocResolve_PEi386 for relocation values. · ed520678
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      The old test was wrong at least for gcc and the value -2287728808L.
      It also relied on implementation defined behaviour (right shift
      on a negative value), which might or might not be ok.
      Either way it's now a simple comparison which will always work.
  4. 24 Sep, 2019 7 commits
  5. 23 Sep, 2019 11 commits
  6. 22 Sep, 2019 5 commits