Skip to content
Snippets Groups Projects
  1. Feb 06, 2024
    • Andrei Borzenkov's avatar
      Lazy skolemisation for @a-binders (#17594) · f5d3e03c
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      This patch is a preparation for @a-binders implementation.  The main changes are:
      
      * Skolemisation is now prepared to deal with @binders.
        See Note [Skolemisation overview] in GHC.Tc.Utils.Unify.
        Most of the action is in
          - Utils.Unify.matchExpectedFunTys
          - Gen.Pat.tcMatchPats
          - Gen.Expr.tcPolyExprCheck
          - Gen.Binds.tcPolyCheck
      
      Some accompanying refactoring:
      
      * I found that funTyConAppTy_maybe was doing a lot of allocation, and
        rejigged userTypeError_maybe to avoid calling it.
      f5d3e03c
  2. Jan 26, 2024
    • Matt Walker's avatar
      Fix #24308 · b2d8cd85
      Matt Walker authored
      Add tests for semicolon separated where clauses
      b2d8cd85
  3. Jan 10, 2024
  4. Dec 12, 2023
  5. Dec 11, 2023
    • Vladislav Zavialov's avatar
      Make forall a keyword (#23719) · d9e4c597
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      Before this change, GHC used to accept `forall` as a term-level
      identifier:
      
      	-- from constraints-0.13
      	forall :: forall p. (forall a. Dict (p a)) -> Dict (Forall p)
      	forall d = ...
      
      Now it is a parse error.
      
      The -Wforall-identifier warning has served its purpose and is now
      a deprecated no-op.
      d9e4c597
  6. Dec 06, 2023
    • Vladislav Zavialov's avatar
      T2T in Patterns (#23739) · 0f0c53a5
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This patch implements the T2T (term-to-type) transformation in patterns.
      Patterns that are checked against a visible forall can now be written
      without the `type` keyword:
      
      	  \(type t) (x :: t) -> ...   -- old
      	  \t (x :: t) -> ...          -- new
      
      The `t` binder is parsed and renamed as a term pattern (Pat), but
      then undergoes a conversion to a type pattern (HsTyPat).
      See the new function pat_to_type_pat in compiler/GHC/Tc/Gen/Pat.hs
      0f0c53a5
  7. Oct 28, 2023
  8. Oct 12, 2023
  9. Oct 10, 2023
  10. Oct 05, 2023
  11. Sep 27, 2023
  12. Sep 15, 2023
  13. Sep 12, 2023
    • Matthew Pickering's avatar
      Add -Winconsistent-flags warning · 21a906c2
      Matthew Pickering authored and Krzysztof Gogolewski's avatar Krzysztof Gogolewski committed
      The warning fires when inconsistent command line flags are passed.
      
      For example:
      
      * -dynamic-too and -dynamic
      * -dynamic-too on windows
      * -O and --interactive
      * etc
      
      This is on by default and allows users to control whether the warning is
      displayed and whether it should be an error or not.
      
      Fixes #22572
      21a906c2
    • Mario's avatar
      Fix TH pretty-printing of nested GADTs, issue #23937 · f418f919
      Mario authored and Marge Bot's avatar Marge Bot committed
      This commit fixes `Language.Haskell.TH.Ppr.pprint` so that it correctly
      pretty-prints GADTs declarations contained within data family instances.
      
      Fixes #23937
      f418f919
  14. Sep 08, 2023
    • Oleg Grenrus's avatar
      Add warning for badly staged types. · 88b942c4
      Oleg Grenrus authored and Marge Bot's avatar Marge Bot committed
      Resolves #23829.
      
      The stage violation results in out-of-bound names in splices.
      Technically this is an error, but someone might rely on this!?
      
      Internal changes:
      - we now track stages for TyVars.
      - thLevel (RunSplice _) = 0, instead of panic, as reifyInstances does
        in fact rename its argument type, and it can contain variables.
      88b942c4
  15. Aug 28, 2023
  16. Aug 08, 2023
    • Ryan Scott's avatar
      tcExpr: Push expected types for untyped TH splices inwards · 3b373838
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      In !10911, I deleted a `tcExpr` case for `HsUntypedSplice` in favor of a much
      simpler case that simply delegates to `tcApp`. Although this passed the test
      suite at the time, this was actually an error, as the previous `tcExpr` case
      was critically pushing the expected type inwards. This actually matters for
      programs like the one in #23796, which GHC would not accept with type inference
      alone—we need full-blown type _checking_ to accept these.
      
      I have added back the previous `tcExpr` case for `HsUntypedSplice` and now
      explain why we have two different `HsUntypedSplice` cases (one in `tcExpr` and
      another in `splitHsApps`) in `Note [Looking through Template Haskell splices in
      splitHsApps]` in `GHC.Tc.Gen.Head`.
      
      Fixes #23796.
      3b373838
  17. Aug 04, 2023
    • Vladislav Zavialov's avatar
      Fix (~) and (@) infix operators in TH splices (#23748) · 46fd8ced
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      8168b42a "Whitespace-sensitive bang patterns" allows GHC to accept
      the following infix operators:
      
      	a ~ b = ()
      	a @ b = ()
      
      But not if TH is used to generate those declarations:
      
      	$([d| a ~ b = ()
      	      a @ b = ()
      	    |])
      
      	-- Test.hs:5:2: error: [GHC-55017]
      	--    Illegal variable name: ‘~’
      	--    When splicing a TH declaration: (~_0) a_1 b_2 = GHC.Tuple.Prim.()
      
      This is easily fixed by modifying `reservedOps` in GHC.Utils.Lexeme
      46fd8ced
    • Ryan Scott's avatar
      Look through TH splices in splitHsApps · fdef003a
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      This modifies `splitHsApps` (a key function used in typechecking function
      applications) to look through untyped TH splices and quasiquotes. Not doing so
      was the cause of #21077. This builds on !7821 by making `splitHsApps` match on
      `HsUntypedSpliceTop`, which contains the `ThModFinalizers` that must be run as
      part of invoking the TH splice. See the new `Note [Looking through Template
      Haskell splices in splitHsApps]` in `GHC.Tc.Gen.Head`.
      
      Along the way, I needed to make the type of `splitHsApps.set` slightly more
      general to accommodate the fact that the location attached to a quasiquote is
      a `SrcAnn NoEpAnns` rather than a `SrcSpanAnnA`.
      
      Fixes #21077.
      fdef003a
  18. Jul 13, 2023
    • sheaf's avatar
      Fix deprecation of record fields · 6143838a
      sheaf authored and Marge Bot's avatar Marge Bot committed
      Commit 3f374399 inadvertently broke the deprecation/warning mechanism
      for record fields due to its introduction of record field namespaces.
      
      This patch ensures that, when a top-level deprecation is applied to
      an identifier, it applies to all the record fields as well.
      This is achieved by refactoring GHC.Rename.Env.lookupLocalTcNames, and
      GHC.Rename.Env.lookupBindGroupOcc, to not look up a fixed number of
      NameSpaces but to look up all NameSpaces and filter out the irrelevant
      ones.
      6143838a
  19. Jul 06, 2023
  20. Jul 05, 2023
  21. Jun 27, 2023
  22. Jun 21, 2023
  23. Jun 18, 2023
  24. Jun 13, 2023
  25. Jun 09, 2023
    • Ryan Scott's avatar
      Consistently use validity checks for TH conversion of data constructors · 3ab0155b
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      We were checking that TH-spliced data declarations do not look like this:
      
      ```hs
      data D :: Type = MkD Int
      ```
      
      But we were only doing so for `data` declarations' data constructors, not for
      `newtype`s, `data instance`s, or `newtype instance`s. This patch factors out
      the necessary validity checks into its own `cvtDataDefnCons` function and uses
      it in all of the places where it needs to be.
      
      Fixes #22559.
      3ab0155b
  26. Jun 07, 2023
    • Vladislav Zavialov's avatar
      Invisible binders in type declarations (#22560) · 4aea0a72
      Vladislav Zavialov authored
      
      This patch implements @k-binders introduced in GHC Proposal #425
      and guarded behind the TypeAbstractions extension:
      
      	type D :: forall k j. k -> j -> Type
      	data D @k @j a b = ...
      	       ^^ ^^
      
      To represent the new syntax, we modify LHsQTyVars as follows:
      
      	-  hsq_explicit :: [LHsTyVarBndr () pass]
      	+  hsq_explicit :: [LHsTyVarBndr (HsBndrVis pass) pass]
      
      HsBndrVis is a new data type that records the distinction between
      type variable binders written with and without the @ sign:
      
      	data HsBndrVis pass
      	  = HsBndrRequired
      	  | HsBndrInvisible (LHsToken "@" pass)
      
      The rest of the patch updates GHC, template-haskell, and haddock
      to handle the new syntax.
      
      Parser:
        The PsErrUnexpectedTypeAppInDecl error message is removed.
        The syntax it used to reject is now permitted.
      
      Renamer:
        The @ sign does not affect the scope of a binder, so the changes to
        the renamer are minimal.  See rnLHsTyVarBndrVisFlag.
      
      Type checker:
        There are three code paths that were updated to deal with the newly
        introduced invisible type variable binders:
      
          1. checking SAKS: see kcCheckDeclHeader_sig, matchUpSigWithDecl
          2. checking CUSK: see kcCheckDeclHeader_cusk
          3. inference: see kcInferDeclHeader, rejectInvisibleBinders
      
        Helper functions bindExplicitTKBndrs_Q_Skol and bindExplicitTKBndrs_Q_Tv
        are generalized to work with HsBndrVis.
      
      Updates the haddock submodule.
      
      Metric Increase:
          MultiLayerModulesTH_OneShot
      
      Co-authored-by: default avatarSimon Peyton Jones <simon.peytonjones@gmail.com>
      4aea0a72
  27. May 29, 2023
  28. May 25, 2023
  29. May 19, 2023
  30. May 18, 2023
  31. May 09, 2023
  32. May 05, 2023
  33. Apr 30, 2023
Loading