Skip to content
Snippets Groups Projects
  1. Oct 28, 2023
  2. Oct 12, 2023
  3. Oct 10, 2023
  4. Oct 05, 2023
  5. Sep 27, 2023
  6. Sep 15, 2023
  7. 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
  8. 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
  9. Aug 28, 2023
  10. 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
  11. 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
  12. 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
  13. Jul 06, 2023
  14. Jul 05, 2023
  15. Jun 27, 2023
  16. Jun 21, 2023
  17. Jun 18, 2023
  18. Jun 13, 2023
  19. 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
  20. 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
  21. May 29, 2023
  22. May 25, 2023
  23. May 19, 2023
  24. May 18, 2023
  25. May 09, 2023
  26. May 05, 2023
  27. Apr 30, 2023
  28. Apr 25, 2023
  29. Apr 18, 2023
    • Matthew Pickering's avatar
      Convert interface file loading errors into proper diagnostics · 5e1d33d7
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This patch converts all the errors to do with loading interface files
      into proper structured diagnostics.
      
      * DriverMessage: Sometimes in the driver we attempt to load an interface
        file so we embed the IfaceMessage into the DriverMessage.
      * TcRnMessage: Most the time we are loading interface files during
        typechecking, so we embed the IfaceMessage
      
      This patch also removes the TcRnInterfaceLookupError constructor which
      is superceded by the IfaceMessage, which is now structured compared to
      just storing an SDoc before.
      5e1d33d7
  30. Apr 12, 2023
    • Oleg Grenrus's avatar
      Allow generation of TTH syntax with TH · ebd8918b
      Oleg Grenrus authored and Marge Bot's avatar Marge Bot committed
      In other words allow generation of typed splices and brackets with
      Untyped Template Haskell.
      
      That is useful in cases where a library is build with TTH in mind,
      but we still want to generate some auxiliary declarations,
      where TTH cannot help us, but untyped TH can.
      Such example is e.g. `staged-sop` which works with TTH,
      but we would like to derive `Generic` declarations with TH.
      
      An alternative approach is to use `unsafeCodeCoerce`, but then the
      derived `Generic` instances would be type-checked only at use sites,
      i.e. much later. Also `-ddump-splices` output is quite ugly:
      user-written instances would use TTH brackets, not `unsafeCodeCoerce`.
      
      This commit doesn't allow generating of untyped template splices
      and brackets with untyped TH, as I don't know why one would want to do
      that (instead of merging the splices, e.g.)
      ebd8918b
  31. Apr 04, 2023
    • Ryan Scott's avatar
      Make INLINE pragmas for pattern synonyms work with TH · 071139c3
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      Previously, the code for converting `INLINE <name>` pragmas from TH splices
      used `vNameN`, which assumed that `<name>` must live in the variable namespace.
      Pattern synonyms, on the other hand, live in the constructor namespace. I've
      fixed the issue by switching to `vcNameN` instead, which works for both the
      variable and constructor namespaces.
      
      Fixes #23203.
      071139c3
  32. Apr 03, 2023
    • Haskell-mouse's avatar
      Convert diagnostics in GHC.Rename.HsType to proper TcRnMessage · 8b092910
      Haskell-mouse authored and Marge Bot's avatar Marge Bot committed
      I've turned all occurrences of TcRnUnknownMessage in GHC.Rename.HsType
      module into a proper TcRnMessage.
      Instead, these TcRnMessage messages were introduced:
      
      TcRnDataKindsError
      TcRnUnusedQuantifiedTypeVar
      TcRnIllegalKindSignature
      TcRnUnexpectedPatSigType
      TcRnSectionPrecedenceError
      TcRnPrecedenceParsingError
      TcRnIllegalKind
      TcRnNegativeNumTypeLiteral
      TcRnUnexpectedKindVar
      TcRnBindMultipleVariables
      TcRnBindVarAlreadyInScope
      8b092910
  33. Apr 01, 2023
Loading