1. 29 May, 2022 4 commits
  2. 27 May, 2022 3 commits
    • Krzysztof Gogolewski's avatar
      Use a class to check validity of withDict · 3bd7d5d6
      Krzysztof Gogolewski authored
      This moves handling of the magic 'withDict' function from the desugarer
      to the typechecker. Details in Note [withDict].
      
      I've extracted a part of T16646Fail to a separate file T16646Fail2,
      because the new error in 'reify' hides the errors from 'f' and 'g'.
      
      WithDict now works with casts, this fixes #21328.
      
      Part of #19915
      3bd7d5d6
    • Hécate Moonlight's avatar
      [base] Fix the links in the Data.Data module · ed37027f
      Hécate Moonlight authored and Marge Bot's avatar Marge Bot committed
      fix #21658
      fix #21657
      fix #21657
      ed37027f
    • Richard Eisenberg's avatar
      Generalize breakTyVarCycle to work with TyFamLHS · d87530bb
      Richard Eisenberg authored and Marge Bot's avatar Marge Bot committed
      The function breakTyVarCycle_maybe has been installed
      in a dark corner of GHC to catch some gremlins (a.k.a.
      occurs-check failures) who lurk
      there. But it previously only caught gremlins of the
      form (a ~ ... F a ...), where some of our intrepid users
      have spawned gremlins of the form (G a ~ ... F (G a) ...).
      This commit improves breakTyVarCycle_maybe (and renames
      it to breakTyEqCycle_maybe) to catch the new gremlins.
      
      Happily, the change is remarkably small.
      
      The gory details are in Note [Type equality cycles].
      
      Test cases: typecheck/should_compile/{T21515,T21473}.
      d87530bb
  3. 26 May, 2022 10 commits
    • sheaf's avatar
      Add tests for eta-expansion of data constructors · 88e58600
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This patch adds several tests relating to the eta-expansion of
      data constructors, including UnliftedNewtypes and DataTypeContexts.
      88e58600
    • Rodrigo Mesquita's avatar
    • John Ericson's avatar
      Factor out `initArityOps` to `GHC.Driver.Config.*` module · d0e4355a
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      We want `DynFlags` only mentioned in `GHC.Driver`.
      d0e4355a
    • Fraser Tweedale's avatar
      fix executablePath test for NetBSD · afde4276
      Fraser Tweedale authored and Marge Bot's avatar Marge Bot committed
      executablePath support for NetBSD was added in
      a172be07, but the test was not
      updated.
      
      Update the test so that it works for NetBSD.  This requires handling
      some quirks:
      
      - The result of getExecutablePath could include "./" segments.
        Therefore use System.FilePath.equalFilePath to compare paths.
      
      - The sysctl(2) call returns the original executable name even after
        it was deleted.  Add `canQueryAfterDelete :: [FilePath]` and
        adjust expectations for the post-delete query accordingly.
      
      Also add a note to the `executablePath` haddock to advise that
      NetBSD behaves differently from other OSes when the file has been
      deleted.
      
      Also accept a decrease in memory usage for T16875.  On Windows, the
      metric is -2.2% of baseline, just outside the allowed ±2%.  I don't
      see how this commit could have influenced this metric, so I suppose
      it's something in the CI environment.
      
      Metric Decrease:
          T16875
      afde4276
    • Fraser Tweedale's avatar
      executablePath test: fix file extension treatment · b22979fb
      Fraser Tweedale authored and Marge Bot's avatar Marge Bot committed
      The executablePath test strips the file extension (if any) when
      comparing the query result with the expected value.  This is to
      handle platforms where GHC adds a file extension to the output
      program file (e.g. .exe on Windows).
      
      After the initial check, the file gets deleted (if supported).
      However, it tries to delete the *stripped* filename, which is
      incorrect.  The test currently passes only because Windows does not
      allow deleting the program while any process created from it is
      alive.
      
      Make the test program correct in general by deleting the
      *non-stripped* executable filename.
      b22979fb
    • sheaf's avatar
      Optimiser: avoid introducing bad rep-poly · 3bd975b4
      sheaf authored and Marge Bot's avatar Marge Bot committed
      The functions `pushCoValArg` and `pushCoercionIntoLambda` could
      introduce bad representation-polymorphism. Example:
      
        type RR :: RuntimeRep
        type family RR where { RR = IntRep }
        type F :: TYPE RR
        type family F where  { F  = Int# }
      
        co = GRefl F (TYPE RR[0])
          :: (F :: TYPE RR)
          ~# (F |> TYPE RR[0] :: TYPE IntRep)
      
        f :: F -> ()
      
      `pushCoValArg` would transform the unproblematic application
      
        (f |> (co -> <()>)) (arg :: F |> TYPE RR[0])
      
      into an application in which the argument does not have a fixed
      `RuntimeRep`:
      
        f ((arg |> sym co) :: (F :: TYPE RR))
      3bd975b4
    • Dominik Peteler's avatar
      Avoid global compiler state for `GHC.Core.Opt.WorkWrap` · da5ccf0e
      Dominik Peteler authored and Marge Bot's avatar Marge Bot committed
      Progress towards #17957
      da5ccf0e
    • John Ericson's avatar
      Add Haddocks for `WwOpts` · ee61c7f9
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      ee61c7f9
    • BinderDavid's avatar
      3d7e7e84
    • Eric Lindblad's avatar
      update README · 2b8bdab8
      Eric Lindblad authored and Marge Bot's avatar Marge Bot committed
      2b8bdab8
  4. 25 May, 2022 7 commits
    • CarrieMY's avatar
      Desugar RecordUpd in `tcExpr` · e74fc066
      CarrieMY authored and sheaf's avatar sheaf committed
      This patch typechecks record updates by desugaring them inside
      the typechecker using the HsExpansion mechanism, and then typechecking
      this desugared result.
      
      Example:
      
          data T p q = T1 { x :: Int, y :: Bool, z :: Char }
                     | T2 { v :: Char }
                     | T3 { x :: Int }
                     | T4 { p :: Float, y :: Bool, x :: Int }
                     | T5
      
      The record update `e { x=e1, y=e2 }` desugars as follows
      
        e { x=e1, y=e2 }
          ===>
        let { x' = e1; y' = e2 } in
        case e of
           T1 _ _ z -> T1 x' y' z
           T4 p _ _ -> T4 p y' x'
      
      The desugared expression is put into an HsExpansion, and we typecheck
      that.
      
      The full details are given in Note [Record Updates] in GHC.Tc.Gen.Expr.
      
      Fixes #2595 #3632 #10808 #10856 #16501 #18311 #18802 #21158 #21289
      
      Updates haddock submodule
      e74fc066
    • sheaf's avatar
      SimpleOpt: beta-reduce through casts · 2ff18e39
      sheaf authored and Marge Bot's avatar Marge Bot committed
      The simple optimiser would sometimes fail to
      beta-reduce a lambda when there were casts
      in between the lambda and its arguments.
      This can cause problems because we rely on
      representation-polymorphic lambdas getting
      beta-reduced away (for example, those
      that arise from newtype constructors with
      representation-polymorphic arguments, with
      UnliftedNewtypes).
      2ff18e39
    • Andre Marianiello's avatar
      Remove HscEnv from GHC.HsToCore.Usage (related to #17957) · 9973c016
      Andre Marianiello authored and Marge Bot's avatar Marge Bot committed
      Metric Decrease:
          T16875
      9973c016
    • sheaf's avatar
      Hadrian: don't add "lib" for relocatable builds · cfb9faff
      sheaf authored and Marge Bot's avatar Marge Bot committed
      The conditional in hadrian/bindist/Makefile depended on the target OS,
      but it makes more sense to use whether we are using a relocatable build.
      (Currently this only gets set to true on Windows, but this ensures
      that the logic stays correctly coupled.)
      cfb9faff
    • Zubin's avatar
      Fix compilation with -haddock on GHC <= 8.10 · 2c25fff6
      Zubin authored and Marge Bot's avatar Marge Bot committed
      -haddock on GHC < 9.0 is quite fragile and can result in obtuse parse errors
      when it encounters invalid haddock syntax.
      
      This has started to affect users since 297156e0
      enabled -haddock by default on many flavours.
      
      Furthermore, since we don't test bootstrapping with 8.10 on CI, this problem
      managed to slip throught the cracks.
      2c25fff6
    • Andreas Klebinger's avatar
      Fix #21563 by using Word64 for 64bit shift code. · 81b3741f
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      We use the 64bit shifts only on 64bit platforms. But we
      compile the code always so compiling it on 32bit caused a
      lint error. So use Word64 instead.
      81b3741f
    • Andreas Klebinger's avatar
      Use UnionListsOrd instead of UnionLists in most places. · 7c51177d
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      This should get rid of most, if not all "Overlong lists" errors and fix #20016
      7c51177d
  5. 24 May, 2022 7 commits
  6. 23 May, 2022 4 commits
    • John Ericson's avatar
      Make debug a `Bool` not an `Int` in `StgToCmmConfig` · 1a4195b0
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      We don't need any more resolution than this.
      
      Rename the field to `stgToCmmEmitDebugInfo` to indicate it is no longer
      conveying any "level" information.
      1a4195b0
    • Simon Peyton Jones's avatar
      Improve FloatOut and SpecConstr · bc723ac2
      Simon Peyton Jones authored
      This patch addresses a relatively obscure situation that arose
      when chasing perf regressions in !7847, which itself is fixing
      
      It does two things:
      
      * SpecConstr can specialise on ($df d1 d2) dictionary arguments
      * FloatOut no longer checks argument strictness
      
      See Note [Specialising on dictionaries] in GHC.Core.Opt.SpecConstr.
      
      A test case is difficult to construct, but it makes a big difference
      in nofib/real/eff/VSM, at least when we have the patch for #21286
      installed. (The latter stops worker/wrapper for dictionary arguments).
      
      There is a spectacular, but slightly illusory, improvement in
      runtime perf on T15426.  I have documented the specifics in
      T15426 itself.
      
      Metric Decrease:
          T15426
      bc723ac2
    • Dominik Peteler's avatar
      Modularize GHC.Core.Opt.LiberateCase · ffbe28e5
      Dominik Peteler authored and Marge Bot's avatar Marge Bot committed
      Progress towards #17957
      ffbe28e5
    • Matthew Pickering's avatar
      Consider the stage of typeable evidence when checking stage restriction · ea895b94
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      We were considering all Typeable evidence to be "BuiltinInstance"s which
      meant the stage restriction was going unchecked. In-fact, typeable has
      evidence and so we need to apply the stage restriction.
      
      This is
      complicated by the fact we don't generate typeable evidence and the
      corresponding DFunIds until after typechecking is concluded so we
      introcue a new `InstanceWhat` constructor, BuiltinTypeableInstance which
      records whether the evidence is going to be local or not.
      
      Fixes #21547
      ea895b94
  7. 21 May, 2022 3 commits
  8. 20 May, 2022 2 commits