Skip to content
Snippets Groups Projects
  1. Jul 22, 2023
  2. Jul 21, 2023
    • Finley McIlwaine's avatar
      Insert documentation into parsed signature modules · b444c16f
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      Causes haddock comments in signature modules to be properly
      inserted into the AST (just as they are for regular modules)
      if the `-haddock` flag is given.
      
      Also adds a test that compares `-ddump-parsed-ast` output
      for a signature module to prevent further regressions.
      
      Fixes #23315
      b444c16f
    • Ben Gamari's avatar
      nativeGen: Set explicit section types on all platforms · db7f7240
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      db7f7240
    • Ben Gamari's avatar
      nativeGen: Explicitly set flags of text sections on Windows · 3ece9856
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      The binutils documentation (for COFF) claims,
      
      > If no flags are specified, the default flags depend upon the section
      > name. If the section name is not recognized, the default will be for the
      > section to be loaded and writable.
      
      We previously assumed that this would do the right thing for split
      sections (e.g. a section named `.text$foo` would be correctly inferred
      to be a text section). However, we have observed that this is not the
      case (at least under the clang toolchain used on Windows): when
      split-sections is enabled, text sections are treated by the assembler as
      data (matching the "default" behavior specified by the documentation).
      
      Avoid this by setting section flags explicitly. This should fix split
      sections on Windows.
      
      Fixes #22834.
      3ece9856
  3. Jul 20, 2023
  4. Jul 19, 2023
  5. Jul 18, 2023
    • Jaro Reinders's avatar
      Add StgFromCore and StgCodeGen linting · 257f1567
      Jaro Reinders authored and Marge Bot's avatar Marge Bot committed
      257f1567
    • Krzysztof Gogolewski's avatar
      Use extended literals when deriving Show · 787bae96
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      This implements GHC proposal
      https://github.com/ghc-proposals/ghc-proposals/pull/596
      
      Also add support for Int64# and Word64#; see testcase ShowPrim.
      787bae96
    • Krzysztof Gogolewski's avatar
      Core Lint: distinguish let and letrec in locations · 00648e5d
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      Lint messages were saying "in the body of letrec" even for non-recursive
      let.
      
      I've also renamed BodyOfLetRec to BodyOfLet in stg, since there's no
      separate letrec.
      00648e5d
    • sheaf's avatar
      Do primop rep-poly checks when instantiating · 889c2bbb
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This patch changes how we perform representation-polymorphism checking
      for primops (and other wired-in Ids such as coerce).
      When instantiating the primop, we check whether each type variable
      is required to instantiated to a concrete type, and if so we create a
      new concrete metavariable (a ConcreteTv) instead of a simple MetaTv.
      (A little subtlety is the need to apply the substitution obtained from
      instantiating to the ConcreteTvOrigins, see
      Note [substConcreteTvOrigin] in GHC.Tc.Utils.TcMType.)
      
      This allows us to prevent representation-polymorphism in non-argument
      position, as that is required for some of these primops.
      
      We can also remove the logic in tcRemainingValArgs, except for
      the part concerning representation-polymorphic unlifted newtypes.
      The function has been renamed rejectRepPolyNewtypes; all it does now
      is reject unsaturated occurrences of representation-polymorphic newtype
      constructors when the representation of its argument isn't a concrete
      RuntimeRep (i.e. still a PHASE 1 FixedRuntimeRep check).
      The Note [Eta-expanding rep-poly unlifted newtypes] in GHC.Tc.Gen.Head
      gives more explanation about a possible path to PHASE 2, which would be
      in line with the treatment for primops taken in this patch.
      
      We also update the Core Lint check to handle this new framework. This
      means Core Lint now checks representation-polymorphism in continuation
      position like needed for catch#.
      
      Fixes #21906
      
      -------------------------
      Metric Increase:
          LargeRecord
      -------------------------
      889c2bbb
    • Sylvain Henry's avatar
      JS: better implementation for plusWord64 (#23597) · b55a8ea7
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      b55a8ea7
    • Rodrigo Mesquita's avatar
      Split GHC.Platform.ArchOS from ghc-boot into ghc-platform · ddcdd88c
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Split off the `GHC.Platform.ArchOS` module from the `ghc-boot` package
      into this reinstallable standalone package which abides by the PVP, in
      part motivated by the ongoing work on `ghc-toolchain` towards runtime
      retargetability.
      ddcdd88c
    • sheaf's avatar
      Skip PMC for boring patterns · bea0e323
      sheaf authored and Marge Bot's avatar Marge Bot committed
      Some patterns introduce no new information to the pattern-match
      checker (such as plain variable or wildcard patterns). We can thus
      skip doing any pattern-match checking on them when the sole purpose
      for doing so was introducing new long-distance information.
      
      See Note [Boring patterns] in GHC.Hs.Pat.
      
      Doing this avoids regressing in performance now that we do additional
      pattern-match checking inside do notation.
      bea0e323
    • sheaf's avatar
      Propagate long-distance information in do-notation · 1d05971e
      sheaf authored and Marge Bot's avatar Marge Bot committed
      The preceding commit re-enabled pattern-match checking inside record
      updates. This revealed that #21360 was in fact NOT fixed by e74fc066.
      
      This commit makes sure we correctly propagate long-distance information
      in do blocks, e.g. in
      
      ```haskell
      data T = A { fld :: Int } | B
      
      f :: T -> Maybe T
      f r = do
        a@A{} <- Just r
        Just $ case a of { A _ -> A 9 }
      ```
      
      we need to propagate the fact that "a" is headed by the constructor "A"
      to see that the case expression "case a of { A _ -> A 9 }" cannot fail.
      
      Fixes #21360
      1d05971e
    • sheaf's avatar
      Re-instate -Wincomplete-record-updates · df706de3
      sheaf authored and Marge Bot's avatar Marge Bot committed
      Commit e74fc066 refactored the handling of record updates to use
      the HsExpanded mechanism. This meant that the pattern matching inherent
      to a record update was considered to be "generated code", and thus we
      stopped emitting "incomplete record update" warnings entirely.
      
      This commit changes the "data Origin = Source | Generated" datatype,
      adding a field to the Generated constructor to indicate whether we
      still want to perform pattern-match checking. We also have to do a bit
      of plumbing with HsCase, to record that the HsCase arose from an
      HsExpansion of a RecUpd, so that the error message continues to mention
      record updates as opposed to a generic "incomplete pattern matches in case"
      error.
      
      Finally, this patch also changes the way we handle inaccessible code
      warnings. Commit e74fc066 was also a regression in this regard, as we
      were emitting "inaccessible code" warnings for case statements spuriously
      generated when desugaring a record update (remember: the desugaring mechanism
      happens before typechecking; it thus can't take into account e.g. GADT information
      in order to decide which constructors to include in the RHS of the desugaring
      of the record update).
      We fix this by changing the mechanism through which we disable inaccessible
      code warnings: we now check whether we are in generated code in
      GHC.Tc.Utils.TcMType.newImplication in order to determine whether to
      emit inaccessible code warnings.
      
      Fixes #23520
      Updates haddock submodule, to avoid incomplete record update warnings
      df706de3
    • sheaf's avatar
      exactprint: silence incomplete record update warnings · 860f6269
      sheaf authored and Marge Bot's avatar Marge Bot committed
      860f6269
    • sheaf's avatar
      base: add COMPLETE pragma to BufferCodec PatSyn · 22565506
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This implements CLC proposal #178, rectifying an oversight in the
      implementation of CLC proposal #134 which could lead to spurious
      pattern match warnings.
      
      https://github.com/haskell/core-libraries-committee/issues/178
      https://github.com/haskell/core-libraries-committee/issues/134
      22565506
  6. Jul 17, 2023
    • Alan Zimmerman's avatar
      EPA: Store leading AnnSemi for decllist in al_rest · 654fdb98
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      This simplifies the markAnnListA implementation in ExactPrint
      654fdb98
    • 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
    • sheaf's avatar
      rnImports: var shouldn't import NoFldSelectors · c7bbad9a
      sheaf authored and Marge Bot's avatar Marge Bot committed
      In an import declaration such as
      
        import M ( var )
      
      the import of the variable "var" should **not** bring into scope record
      fields named "var" which are defined with NoFieldSelectors.
      Doing so can cause spurious "unused import" warnings, as reported in
      ticket #23557.
      
      Fixes #23557
      c7bbad9a
  7. Jul 16, 2023
    • sheaf's avatar
      Don't use substTyUnchecked in newMetaTyVar · eb1a6ab1
      sheaf authored and Marge Bot's avatar Marge Bot committed
      There were some comments that explained that we needed to use an
      unchecked substitution function because of issue #12931, but that
      has since been fixed, so we should be able to use substTy instead now.
      eb1a6ab1
    • 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
    • Vladislav Zavialov's avatar
      List and Tuple<n>: update documentation · 7f13acbf
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      Add the missing changelog.md entries and @since-annotations.
      7f13acbf
  8. Jul 15, 2023
Loading