Skip to content
Snippets Groups Projects
  1. Jul 19, 2023
  2. Jun 21, 2023
    • Bartłomiej Cieślar's avatar
      Add support for deprecating exported items (proposal #134) · 711b1d24
      Bartłomiej Cieślar authored and Ben Gamari's avatar Ben Gamari committed
      
      This is an implementation of the deprecated exports proposal #134.
      The proposal introduces an ability to introduce warnings to exports.
      This allows for deprecating a name only when it is exported from a specific
      module, rather than always depreacting its usage. In this example:
      
          module A ({-# DEPRECATED "do not use" #-} x) where
          x = undefined
          ---
          module B where
          import A(x)
      
      `x` will emit a warning when it is explicitly imported.
      
      Like the declaration warnings, export warnings are first accumulated within
      the `Warnings` struct, then passed into the ModIface, from which they are
      then looked up and warned about in the importing module in the `lookup_ie`
      helpers of the `filterImports` function (for the explicitly imported names)
      and in the `addUsedGRE(s)` functions where they warn about regular usages
      of the imported name.
      
      In terms of the AST information, the custom warning is stored in the
      extension field of the variants of the `IE` type (see Trees that Grow for
      more information).
      
      The commit includes a bump to the haddock submodule added in MR #28
      
      Signed-off-by: default avatarBartłomiej Cieślar <bcieslar2001@gmail.com>
      711b1d24
    • Sylvain Henry's avatar
      JS: implement TH support · 4d356ea3
      Sylvain Henry authored
      
      - Add ghc-interp.js bootstrap script for the JS interpreter
      - Interactively link and execute iserv code from the ghci package
      - Incrementally load and run JS code for splices into the running iserv
      
      Co-authored-by: default avatarLuite Stegeman <stegeman@gmail.com>
      4d356ea3
  3. May 04, 2023
  4. Apr 26, 2023
  5. Feb 07, 2023
    • sheaf's avatar
      Don't allow . in overloaded labels · b17fb3d9
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This patch removes . from the list of allowed characters in a non-quoted
      overloaded label, as it was realised this steals syntax, e.g. (#.).
      
      Users who want this functionality will have to add quotes around the
      label, e.g. `#"17.28"`.
      
      Fixes #22821
      b17fb3d9
  6. Jan 23, 2023
  7. Jan 19, 2023
    • Andrei Borzenkov's avatar
      Fix printing of promoted MkSolo datacon (#22785) · 14b5982a
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      Problem: In 2463df2f, the Solo data constructor was renamed to MkSolo,
      and Solo was turned into a pattern synonym for backwards compatibility.
      Since pattern synonyms can not be promoted, the old code that pretty-printed
      promoted single-element tuples started producing ill-typed code:
         t :: Proxy ('Solo Int)
      This fails with "Pattern synonym ‘Solo’ used as a type"
      
      The solution is to track the distinction between type constructors and data
      constructors more carefully when printing single-element tuples.
      14b5982a
  8. Jan 17, 2023
  9. Jan 09, 2023
  10. Jan 05, 2023
    • Alan Zimmerman's avatar
      EPA: Do not collect comments from end of file · 22bb8998
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      In Parser.y semis1 production triggers for the virtual semi at the end
      of the file. This is detected by it being zero length.
      
      In this case, do not extend the span being used to gather comments, so
      any final comments are allocated at the module level instead.
      22bb8998
  11. Dec 23, 2022
  12. Dec 14, 2022
  13. Nov 25, 2022
    • Vladislav Zavialov's avatar
      Print unticked promoted data constructors (#20531) · 13d627bb
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      
      Before this patch, GHC unconditionally printed ticks before promoted
      data constructors:
      
      	ghci> type T = True  -- unticked (user-written)
      	ghci> :kind! T
      	T :: Bool
      	= 'True              -- ticked (compiler output)
      
      After this patch, GHC prints ticks only when necessary:
      
      	ghci> type F = False    -- unticked (user-written)
      	ghci> :kind! F
      	F :: Bool
      	= False                 -- unticked (compiler output)
      
      	ghci> data False        -- introduce ambiguity
      	ghci> :kind! F
      	F :: Bool
      	= 'False                -- ticked by necessity (compiler output)
      
      The old behavior can be enabled by -fprint-redundant-promotion-ticks.
      
      Summary of changes:
      * Rename PrintUnqualified to NamePprCtx
      * Add QueryPromotionTick to it
      * Consult the GlobalRdrEnv to decide whether to print a tick (see mkPromTick)
      * Introduce -fprint-redundant-promotion-ticks
      
      Co-authored-by: default avatarArtyom Kuznetsov <hi@wzrd.ht>
      13d627bb
  14. Nov 24, 2022
    • Vladislav Zavialov's avatar
      Check if the SDoc starts with a single quote (#22488) · 178c1fd8
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This patch fixes pretty-printing of character literals
      inside promoted lists and tuples.
      
      When we pretty-print a promoted list or tuple whose first element
      starts with a single quote, we want to add a space between the opening
      bracket and the element:
      
      	'[True]    -- ok
      	'[ 'True]  -- ok
      	'['True]   -- not ok
      
      If we don't add the space, we accidentally produce a character
      literal '['.
      
      Before this patch, pprSpaceIfPromotedTyCon inspected the type as an AST
      and tried to guess if it would be rendered with a single quote. However,
      it missed the case when the inner type was itself a character literal:
      
      	'[ 'x']  -- ok
      	'['x']   -- not ok
      
      Instead of adding this particular case, I opted for a more future-proof
      solution: check the SDoc directly. This way we can detect if the single
      quote is actually there instead of trying to predict it from the AST.
      The new function is called spaceIfSingleQuote.
      178c1fd8
  15. Oct 17, 2022
    • Alan Zimmerman's avatar
      Update the check-exact infrastructure to match ghc-exactprint · d80ad2f4
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      GHC tests the exact print annotations using the contents of
      utils/check-exact.
      
      The same functionality is provided via
      https://github.com/alanz/ghc-exactprint
      
      The latter was updated to ensure it works with all of the files on
      hackage when 9.2 was released, as well as updated to ensure users of
      the library could work properly (apply-refact, retrie, etc).
      
      This commit brings the changes from ghc-exactprint into
      GHC/utils/check-exact, adapting for the changes to master.
      
      Once it lands, it will form the basis for the 9.4 version of
      ghc-exactprint.
      
      See also discussion around this process at #21355
      d80ad2f4
  16. Sep 27, 2022
  17. Sep 19, 2022
    • Matthew Farkas-Dyck's avatar
      Scrub partiality about `NewOrData`. · c1f81b38
      Matthew Farkas-Dyck authored and Marge Bot's avatar Marge Bot committed
      Rather than a list of constructors and a `NewOrData` flag, we define `data DataDefnCons a = NewTypeCon a | DataTypeCons [a]`, which enforces a newtype to have exactly one constructor.
      
      Closes #22070.
      
      Bump haddock submodule.
      c1f81b38
  18. Sep 13, 2022
    • sheaf's avatar
      Diagnostic codes: acccept test changes · 362cca13
      sheaf authored and Marge Bot's avatar Marge Bot committed
      The testsuite output now contains diagnostic codes, so many tests need
      to be updated at once.
      We decided it was best to keep the diagnostic codes in the testsuite
      output, so that contributors don't inadvertently make changes to the
      diagnostic codes.
      362cca13
  19. Aug 11, 2022
  20. Jul 06, 2022
    • Rodrigo Mesquita's avatar
      Remove many GHC dependencies from L.H.S · fd379d1b
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Continue to prune the `Language.Haskell.Syntax.*` modules out of GHC
      imports according to the plan in the linked issue.
      
      Moves more GHC-specific declarations to `GHC.*` and brings more required
      GHC-independent declarations to `Language.Haskell.Syntax.*` (extending
      e.g. `Language.Haskell.Syntax.Basic`).
      
      Progress towards #21592
      
      Bump haddock submodule for !8308
      
      -------------------------
      Metric Decrease:
          hard_hole_fits
      -------------------------
      fd379d1b
  21. Jul 03, 2022
  22. Jun 27, 2022
  23. Jun 06, 2022
  24. May 26, 2022
  25. May 13, 2022
  26. May 11, 2022
  27. Apr 08, 2022
  28. Apr 01, 2022
  29. Mar 28, 2022
  30. Dec 22, 2021
  31. Nov 02, 2021
    • Alan Zimmerman's avatar
      EPA: Get rid of bare SrcSpan's in the ParsedSource · 39eed84c
      Alan Zimmerman authored
      The ghc-exactPrint library has had to re-introduce the relatavise
      phase.
      
      This is needed if you change the length of an identifier and want the
      layout to be preserved afterwards.
      
      It is not possible to relatavise a bare SrcSpan, so introduce `SrcAnn
      NoEpAnns` for them instead.
      
      Updates haddock submodule.
      39eed84c
  32. Oct 24, 2021
  33. Oct 13, 2021
  34. Oct 05, 2021
    • Vladislav Zavialov's avatar
      Bespoke TokenLocation data type · a7629334
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      The EpaAnnCO we were using contained an Anchor instead of EpaLocation,
      making it harder to work with.
      
      At the same time, using EpaLocation by itself isn't possible either,
      as we may have tokens without location information.
      
      Hence the new data type:
      	data TokenLocation = NoTokenLoc
      	                   | TokenLoc !EpaLocation
      a7629334
  35. Sep 28, 2021
  36. Sep 17, 2021
  37. Sep 08, 2021
Loading