Skip to content
Snippets Groups Projects
  1. Feb 25, 2024
  2. Feb 21, 2024
    • Andrei Borzenkov's avatar
      Namespacing for fixity signatures (#14032) · 77629e76
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      Namespace specifiers were added to syntax of fixity signatures:
        - sigdecl ::= infix prec ops | ...
        + sigdecl ::= infix prec namespace_spec ops | ...
      
      To preserve namespace during renaming MiniFixityEnv type
      now has separate FastStringEnv fields for names that should be
      on the term level and for name that should be on the type level.
      
      makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way:
       - signatures without namespace specifiers fill both fields
       - signatures with 'data' specifier fill data field only
       - signatures with 'type' specifier fill type field only
      
      Was added helper function lookupMiniFixityEnv that takes care about
      looking for a name in an appropriate namespace.
      
      Updates haddock submodule.
      
      Metric Decrease:
          MultiLayerModulesTH_OneShot
      77629e76
  3. Feb 19, 2024
    • Andrei Borzenkov's avatar
      Parser, renamer, type checker for @a-binders (#17594) · 0dbd729e
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      GHC Proposal 448 introduces binders for invisible type arguments
      (@a-binders) in various contexts. This patch implements @-binders
      in lambda patterns and function equations:
      
        {-# LANGUAGE TypeAbstractions #-}
      
        id1 :: a -> a
        id1 @t x = x :: t      -- @t-binder on the LHS of a function equation
      
        higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16)
        higherRank f = (f 42, f 42)
      
        ex :: (Int8, Int16)
        ex = higherRank (\ @a x -> maxBound @a - x )
                               -- @a-binder in a lambda pattern in an argument
                               -- to a higher-order function
      
      Syntax
      ------
      
      To represent those @-binders in the AST, the list of patterns in Match
      now uses ArgPat instead of Pat:
      
        data Match p body
           = Match {
               ...
      -        m_pats  :: [LPat p],
      +        m_pats  :: [LArgPat p],
               ...
         }
      
      + data ArgPat pass
      +   = VisPat (XVisPat pass) (LPat pass)
      +   | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass))
      +   | XArgPat !(XXArgPat pass)
      
      The VisPat constructor represents patterns for visible arguments,
      which include ordinary value-level arguments and required type arguments
      (neither is prefixed with a @), while InvisPat represents invisible type
      arguments (prefixed with a @).
      
      Parser
      ------
      
      In the grammar (Parser.y), the lambda and lambda-cases productions of
      aexp non-terminal were updated to accept argpats instead of apats:
      
        aexp : ...
      -        | '\\' apats '->' exp
      +        | '\\' argpats '->' exp
               ...
      -        | '\\' 'lcases' altslist(apats)
      +        | '\\' 'lcases' altslist(argpats)
               ...
      
      + argpat : apat
      +        | PREFIX_AT atype
      
      Function left-hand sides did not require any changes to the grammar, as
      they were already parsed with productions capable of parsing @-binders.
      Those binders were being rejected in post-processing (isFunLhs), and now
      we accept them.
      
      In Parser.PostProcess, patterns are constructed with the help of
      PatBuilder, which is used as an intermediate data structure when
      disambiguating between FunBind and PatBind. In this patch we define
      ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived
      data structure produced in isFunLhs and consumed in checkFunBind.
      
      Renamer
      -------
      
      Renaming of @-binders builds upon prior work on type patterns,
      implemented in 2afbddb0, which guarantees proper scoping and
      shadowing behavior of bound type variables.
      
      This patch merely defines rnLArgPatsAndThen to process a mix of visible
      and invisible patterns:
      
      + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn]
      + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where
      +   rnArgPatAndThen (VisPat x p)    = ... rnLPatAndThen ...
      +   rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ...
      
      Common logic between rnArgPats and rnPats is factored out into the
      rn_pats_general helper.
      
      Type checker
      ------------
      
      Type-checking of @-binders builds upon prior work on lazy skolemisation,
      implemented in f5d3e03c.
      
      This patch extends tcMatchPats to handle @-binders. Now it takes and
      returns a list of LArgPat rather than LPat:
      
        tcMatchPats ::
                    ...
      -             -> [LPat GhcRn]
      +             -> [LArgPat GhcRn]
                    ...
      -             -> TcM ([LPat GhcTc], a)
      +             -> TcM ([LArgPat GhcTc], a)
      
      Invisible binders in the Match are matched up with invisible (Specified)
      foralls in the type. This is done with a new clause in the `loop` worker
      of tcMatchPats:
      
        loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a)
        loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys)
          ...
          -- NEW CLAUSE:
          | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis
          = ...
      
      In addition to that, tcMatchPats no longer discards type patterns. This
      is done by filterOutErasedPats in the desugarer instead.
      
      x86_64-linux-deb10-validate+debug_info
      Metric Increase:
          MultiLayerModulesTH_OneShot
      0dbd729e
  4. Feb 08, 2024
    • Ben Gamari's avatar
      Move `base` to `ghc-internal` · 44f6557a
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we move a good deal of the implementation of `base` into a new
      package, `ghc-internal` such that it can be evolved independently
      from the user-visible interfaces of `base`.
      
      While we want to isolate implementation from interfaces, naturally, we
      would like to avoid turning `base` into a mere set of module re-exports.
      However, this is a non-trivial undertaking for a variety of reasons:
      
       * `base` contains numerous known-key and wired-in things, requiring
         corresponding changes in the compiler
      
       * `base` contains a significant amount of C code and corresponding
         autoconf logic, which is very fragile and difficult to break apart
      
       * `base` has numerous import cycles, which are currently dealt with via
         carefully balanced `hs-boot` files
      
       * We must not break existing users
      
      To accomplish this migration, I tried the following approaches:
      
      * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental
        migration of modules into ghc-internal: this knot is simply too
        intertwined to be easily pulled apart, especially given the rather
        tricky import cycles that it contains)
      
      * [Move-Core]: Moving the "core" connected component of base (roughly
        150 modules) into ghc-internal. While the Haskell side of this seems
        tractable, the C dependencies are very subtle to break apart.
      
      * [Move-Incrementally]:
      
        1. Move all of base into ghc-internal
        2. Examine the module structure and begin moving obvious modules (e.g.
           leaves of the import graph) back into base
        3. Examine the modules remaining in ghc-internal, refactor as necessary
           to facilitate further moves
        4. Go to (2) iterate until the cost/benefit of further moves is
           insufficient to justify continuing
        5. Rename the modules moved into ghc-internal to ensure that they don't
           overlap with those in base
        6. For each module moved into ghc-internal, add a shim module to base
           with the declarations which should be exposed and any requisite
           Haddocks (thus guaranteeing that base will be insulated from changes
           in the export lists of modules in ghc-internal
      
      Here I am using the [Move-Incrementally] approach, which is empirically
      the least painful of the unpleasant options above
      
      Bumps haddock submodule.
      
      Metric Decrease:
          haddock.Cabal
          haddock.base
      Metric Increase:
          MultiComponentModulesRecomp
          T16875
          size_hello_artifact
      44f6557a
  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. Nov 26, 2023
    • Vladislav Zavialov's avatar
      Term variable capture (#23740) · d1bf25c7
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This patch changes type variable lookup rules (lookupTypeOccRn) and
      implicit quantification rules (filterInScope) so that variables bound
      in the term namespace can be captured at the type level
      
        {-# LANGUAGE RequiredTypeArguments #-}
        f1 x = g1 @x                -- `x` used in a type application
        f2 x = g2 (undefined :: x)  -- `x` used in a type annotation
        f3 x = g3 (type x)          -- `x` used in an embedded type
        f4 x = ...
          where g4 :: x -> x        -- `x` used in a type signature
                g4 = ...
      
      This change alone does not allow us to accept examples shown above,
      but at least it gets them past the renamer.
      d1bf25c7
  8. Nov 01, 2023
    • Ryan Scott's avatar
      More robust checking for DataKinds · 9f9c9227
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      As observed in #22141, GHC was not doing its due diligence in catching code
      that should require `DataKinds` in order to use. Most notably, it was allowing
      the use of arbitrary data types in kind contexts without `DataKinds`, e.g.,
      
      ```hs
      data Vector :: Nat -> Type -> Type where
      ```
      
      This patch revamps how GHC tracks `DataKinds`. The full specification is
      written out in the `DataKinds` section of the GHC User's Guide, and the
      implementation thereof is described in `Note [Checking for DataKinds]` in
      `GHC.Tc.Validity`. In brief:
      
      * We catch _type_-level `DataKinds` violations in the renamer. See
        `checkDataKinds` in `GHC.Rename.HsType` and `check_data_kinds` in
        `GHC.Rename.Pat`.
      
      * We catch _kind_-level `DataKinds` violations in the typechecker, as this
        allows us to catch things that appear beneath type synonyms. (We do *not*
        want to do this in type-level contexts, as it is perfectly fine for a type
        synonym to mention something that requires DataKinds while still using the
        type synonym in a module that doesn't enable DataKinds.) See `checkValidType`
        in `GHC.Tc.Validity`.
      
      * There is now a single `TcRnDataKindsError` that classifies all manner of
        `DataKinds` violations, both in the renamer and the typechecker. The
        `NoDataKindsDC` error has been removed, as it has been subsumed by
        `TcRnDataKindsError`.
      
      * I have added `CONSTRAINT` is `isKindTyCon`, which is what checks for illicit
        uses of data types at the kind level without `DataKinds`. Previously,
        `isKindTyCon` checked for `Constraint` but not `CONSTRAINT`. This is
        inconsistent, given that both `Type` and `TYPE` were checked by `isKindTyCon`.
        Moreover, it thwarted the implementation of the `DataKinds` check in
        `checkValidType`, since we would expand `Constraint` (which was OK without
        `DataKinds`) to `CONSTRAINT` (which was _not_ OK without `DataKinds`) and
        reject it. Now both are allowed.
      
      * I have added a flurry of additional test cases that test various corners of
        `DataKinds` checking.
      
      Fixes #22141.
      9f9c9227
  9. Oct 14, 2023
    • sheaf's avatar
      Combine GREs when combining in mkImportOccEnv · ec3c4488
      sheaf authored and Marge Bot's avatar Marge Bot committed
      In `GHC.Rename.Names.mkImportOccEnv`, we sometimes discard one import
      item in favour of another, as explained in Note [Dealing with imports]
      in `GHC.Rename.Names`. However, this can cause us to lose track of
      important parent information.
      
      Consider for example #24084:
      
        module M1 where { class C a where { type T a } }
        module M2 ( module M1 ) where { import M1 }
        module M3 where { import M2 ( C, T ); instance C () where T () = () }
      
      When processing the import list of `M3`, we start off (for reasons that
      are not relevant right now) with two `Avail`s attached to `T`, namely
      `C(C, T)` and `T(T)`. We combine them in the `combine` function of
      `mkImportOccEnv`; as described in Note [Dealing with imports] we discard
      `C(C, T)` in favour of `T(T)`. However, in doing so, we **must not**
      discard the information want that `C` is the parent of `T`. Indeed,
      losing track of this information can cause errors when importing,
      as we could get an error of the form
      
        ‘T’ is not a (visible) associated type of class ‘C’
      
      We fix this by combining the two GREs for `T` using `plusGRE`.
      
      Fixes #24084
      ec3c4488
  10. Oct 04, 2023
  11. Sep 12, 2023
  12. Sep 01, 2023
  13. Aug 30, 2023
  14. Aug 28, 2023
  15. Aug 24, 2023
    • Antoine Leblanc's avatar
      Be more eager in TyCon boot validity checking · 1420b8cb
      Antoine Leblanc authored and Marge Bot's avatar Marge Bot committed
      This commit performs boot-file consistency checking for TyCons into
      checkValidTyCl. This ensures that we eagerly catch any mismatches,
      which prevents the compiler from seeing these inconsistencies and
      panicking as a result.
      
      See Note [TyCon boot consistency checking] in GHC.Tc.TyCl.
      
      Fixes #16127
      1420b8cb
  16. Aug 14, 2023
    • Bartłomiej Cieślar's avatar
      Report deprecated fields bound by record wildcards when used · 524c60c8
      Bartłomiej Cieślar authored and Marge Bot's avatar Marge Bot committed
      This commit ensures that we emit the appropriate warnings when
      a deprecated record field bound by a record wildcard is used.
      
      For example:
      
          module A where
          data Foo = Foo {x :: Int, y :: Bool, z :: Char}
      
          {-# DEPRECATED x "Don't use x" #-}
          {-# WARNING y "Don't use y" #-}
      
          module B where
          import A
      
          foo (Foo {..}) = x
      
      This will cause us to emit a "Don't use x" warning, with location the
      location of the record wildcard. Note that we don't warn about `y`,
      because it is unused in the RHS of `foo`.
      
      Fixes #23382
      524c60c8
  17. Jul 22, 2023
    • sheaf's avatar
      Finish migration of diagnostics in GHC.Tc.Validity · 7e05f6df
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This patch finishes migrating the error messages in GHC.Tc.Validity
      to use the new diagnostic infrastructure.
      
      It also refactors the error message datatypes for class and family
      instances, to common them up under a single datatype as much as possible.
      7e05f6df
  18. Jul 19, 2023
    • sheaf's avatar
      Prioritise Parent when looking up class sub-binder · 3bd4d5b5
      sheaf authored and Marge Bot's avatar Marge Bot committed
      When we look up children GlobalRdrElts of a given Parent, we sometimes
      would rather prioritise those GlobalRdrElts which have the right Parent,
      and sometimes prioritise those that have the right NameSpace:
      
        - in export lists, we should prioritise NameSpace
        - for class/instance binders, we should prioritise Parent
      
      See Note [childGREPriority] in GHC.Types.Name.Reader.
      
      fixes #23664
      3bd4d5b5
  19. Jul 17, 2023
    • sheaf's avatar
      Suggest similar names in imports · 1af2e773
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This commit adds similar name suggestions when importing. For example
      
        module A where { spelling = 'o' }
        module B where { import B ( speling ) }
      
      will give rise to the error message:
      
        Module ‘A’ does not export ‘speling’.
        Suggested fix: Perhaps use ‘spelling’
      
      This also provides hints when users try to import record fields defined
      with NoFieldSelectors.
      1af2e773
  20. Jul 16, 2023
    • Andrei Borzenkov's avatar
      Type patterns (#22478, #18986) · 2afbddb0
      Andrei Borzenkov authored
      Improved name resolution and type checking of type patterns in constructors:
      
      1. HsTyPat: a new dedicated data type that represents type patterns in
         HsConPatDetails instead of reusing HsPatSigType
      
      2. rnHsTyPat: a new function that renames a type
         pattern and collects its binders into three groups:
          - explicitly bound type variables, excluding locally bound
            variables
          - implicitly bound type variables from kind signatures
            (only if ScopedTypeVariables are enabled)
          - named wildcards (only from kind signatures)
      2a. rnHsPatSigTypeBindingVars: removed in favour of rnHsTyPat
      2b. rnImplcitTvBndrs: removed because no longer needed
      
      3. collect_pat: updated to collect type variable binders from type patterns
         (this means that types and terms use the same infrastructure to detect
         conflicting bindings, unused variables and name shadowing)
      3a. CollVarTyVarBinders: a new CollectFlag constructor that enables
          collection of type variables
      
      4. tcHsTyPat: a new function that typechecks type patterns, capable of
         handling polymorphic kinds.
         See Note [Type patterns: binders and unifiers]
      
      Examples of code that is now accepted:
      
         f = \(P @a) -> \(P @a) -> ...  -- triggers -Wname-shadowing
      
         g :: forall a. Proxy a -> ...
         g (P @a) = ...                 -- also triggers -Wname-shadowing
      
         h (P @($(TH.varT (TH.mkName "t")))) = ...
                                        -- t is bound at splice time
      
         j (P @(a :: (x,x))) = ...      -- (x,x) is no longer rejected
      
         data T where
           MkT :: forall (f :: forall k. k -> Type).
             f Int -> f Maybe -> T
         k :: T -> ()
         k (MkT @f (x :: f Int) (y :: f Maybe)) = ()
                                        -- f :: forall k. k -> Type
      
      Examples of code that is rejected with better error messages:
      
        f (Left @a @a _) = ...
        -- new message:
        --     • Conflicting definitions for ‘a’
        --       Bound at: Test.hs:1:11
        --                 Test.hs:1:14
      
      Examples of code that is now rejected:
      
        {-# OPTIONS_GHC -Werror=unused-matches #-}
        f (P @a) = ()
        -- Defined but not used: type variable ‘a’
      2afbddb0
  21. Jul 08, 2023
    • Oleg Grenrus's avatar
      Add warn_and_run test kind · a9bc20cb
      Oleg Grenrus authored and Marge Bot's avatar Marge Bot committed
      This is a compile_and_run variant which also captures the GHC's
      stderr. The warn_and_run name is best I can come up with,
      as compile_and_run is taken.
      
      This is useful specifically for testing warnings.  We want to test that
      when warning triggers, and it's not a false positive, i.e. that the
      runtime behaviour is indeed "incorrect".
      
      As an example a single test is altered to use warn_and_run
      a9bc20cb
  22. 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
  23. Jun 17, 2023
    • Andrei Borzenkov's avatar
      Type/data instances: require that variables on the RHS are mentioned on the LHS (#23512) · 800aad7e
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      GHC Proposal #425 "Invisible binders in type declarations" restricts the
      scope of type and data family instances as follows:
      
        In type family and data family instances, require that every variable
        mentioned on the RHS must also occur on the LHS.
      
      For example, here are three equivalent type instance definitions accepted before this patch:
      
        type family F1 a :: k
        type instance F1 Int = Any :: j -> j
      
        type family F2 a :: k
        type instance F2 @(j -> j) Int = Any :: j -> j
      
        type family F3 a :: k
        type instance forall j. F3 Int = Any :: j -> j
      
      - In F1, j is implicitly quantified and it occurs only on the RHS;
      - In F2, j is implicitly quantified and it occurs both on the LHS and the RHS;
      - In F3, j is explicitly quantified.
      
      Now F1 is rejected with an out-of-scope error, while F2 and F3 continue to be accepted.
      800aad7e
  24. Jun 15, 2023
    • Andrei Borzenkov's avatar
      Report scoped kind variables at the type-checking phase (#16635) · 78cd1132
      Andrei Borzenkov authored
      This patch modifies the renamer to respect ScopedTypeVariables in kind
      signatures. This means that kind variables bound by the outermost
      `forall` now scope over the type:
      
        type F = '[Right @a @() () :: forall a. Either a ()]
        --         ^^^^^^^^^^^^^^^          ^^^
        --          in scope here        bound here
      
      However, any use of such variables is a type error, because we don't
      have type-level lambdas to bind them in Core. This is described in the
      new Note [Type variable scoping errors during type check] in GHC.Tc.Types.
      78cd1132
    • Andrei Borzenkov's avatar
      Implement the -Wimplicit-rhs-quantification warning (#23510) · a71b60e9
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      GHC Proposal #425 "Invisible binders in type declarations" forbids
      implicit quantification of type variables that occur free on the
      right-hand side of a type synonym but are not mentioned on the left-hand side.
      The users are expected to rewrite this using invisible binders:
      
          type T1 :: forall a . Maybe a
          type T1    = 'Nothing :: Maybe a      -- old
          type T1 @a = 'Nothing :: Maybe a      -- new
      
      Since the @k-binders are a new feature, we need to wait for three releases
      before we require the use of the new syntax. In the meantime, we ought to
      provide users with a new warning, -Wimplicit-rhs-quantification, that would
      detect when such implicit quantification takes place, and include it in -Wcompat.
      a71b60e9
  25. Jun 13, 2023
  26. Jun 10, 2023
    • Andrei Borzenkov's avatar
      Fix -Wterm-variable-capture scope (#23434) · b84a2900
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      -Wterm-variable-capture wasn't accordant with type variable
      scoping in associated types, in type classes. For example,
      this code produced the warning:
        k = 12
      
        class C k a where
          type AT a :: k -> Type
      
      I solved this issue by reusing machinery of newTyVarNameRn function
      that is accordand with associated types: it does lookup for each free type
      variable when we are in the type class context. And in this patch I
      use result of this work to make sure that -Wterm-variable-capture warns
      only on implicitly quantified type variables.
      b84a2900
  27. May 19, 2023
  28. May 15, 2023
    • sheaf's avatar
      Migrate errors to diagnostics in GHC.Tc.Module · 4d29ecdf
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This commit migrates the errors in GHC.Tc.Module to use the new
      diagnostic infrastructure.
      
      It required a significant overhaul of the compatibility checks between
      an hs-boot or signature module and its implementation; we now use
      a Writer monad to accumulate errors; see the BootMismatch datatype
      in GHC.Tc.Errors.Types, with its panoply of subtypes.
      For the sake of readability, several local functions inside the
      'checkBootTyCon' function were split off into top-level functions.
      
      We split off GHC.Types.HscSource into a "boot or sig" vs "normal hs file"
      datatype, as this mirrors the logic in several other places where we
      want to treat hs-boot and hsig files in a similar fashion.
      
      This commit also refactors the Backpack checks for type synonyms
      implementing abstract data, to correctly reject implementations that
      contain qualified or quantified types (this fixes #23342 and #23344).
      4d29ecdf
    • sheaf's avatar
      Improve "ambiguous occurrence" error messages · 5ae81842
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This error was sometimes a bit confusing, especially when data families
      were involved. This commit improves the general presentation of the
      "ambiguous occurrence" error, and adds a bit of extra context in the
      case of data families.
      
      Fixes #23301
      5ae81842
  29. May 05, 2023
  30. May 04, 2023
  31. Apr 30, 2023
  32. Apr 27, 2023
    • Cheng Shao's avatar
      testsuite: add missing annotations for some tests · b174a110
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This patch adds missing annotations (req_th, req_dynamic_lib_support,
      req_rts_linker) to some tests. They were discovered when testing
      wasm32, though it's better to be explicit about what features they
      require, rather than simply adding when(arch('wasm32'), skip).
      b174a110
  33. Apr 25, 2023
  34. Apr 08, 2023
    • sheaf's avatar
      Renamer: don't call addUsedGRE on an exact Name · 3ba77b36
      sheaf authored and Marge Bot's avatar Marge Bot committed
      When looking up a record field in GHC.Rename.Env.lookupRecFieldOcc,
      we could end up calling addUsedGRE on an exact Name, which would then
      lead to a panic in the bestImport function: it would be incapable of
      processing a GRE which is not local but also not brought into scope
      by any imports (as it is referred to by its unique instead).
      
      Fixes #23240
      3ba77b36
  35. 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
  36. Apr 01, 2023
Loading