1. 14 Feb, 2019 7 commits
    • Simon Peyton Jones's avatar
      Fail fast in solveLocalEqualities · 5c1f268e
      Simon Peyton Jones authored
      This patch makes us fail fast in TcSimplify.solveLocalEqualities,
      and in TcHsType.tc_hs_sig_type, if there are insoluble constraints.
      Previously we ploughed on even if there were insoluble constraints,
      leading to a cascade of hard-to-understand type errors. Failing
      eagerly is much better; hence a lot of testsuite error message
      changes.  Eg if we have
                f :: [Maybe] -> blah
                f xs = e
      then trying typecheck 'f x = e' with an utterly bogus type
      is just asking for trouble.
      I can't quite remember what provoked me to make this change,
      but I think the error messages are notably improved, by
      removing confusing clutter and focusing on the real error.
    • Simon Peyton Jones's avatar
      Make a smart mkAppTyM · 68278382
      Simon Peyton Jones authored
      This patch finally delivers on Trac #15952.  Specifically
      * Completely remove Note [The tcType invariant], along with
        its complicated consequences (IT1-IT6).
      * Replace Note [The well-kinded type invariant] with:
            Note [The Purely Kinded Type Invariant (PKTI)]
      * Instead, establish the (PKTI) in TcHsType.tcInferApps,
        by using a new function mkAppTyM when building a type
        application.  See Note [mkAppTyM].
      * As a result we can remove the delicate mkNakedXX functions
        entirely.  Specifically, mkNakedCastTy retained lots of
        extremly delicate Refl coercions which just cluttered
        everything up, and(worse) were very vulnerable to being
        silently eliminated by (say) substTy. This led to a
        succession of bug reports.
      The result is noticeably simpler to explain, simpler
      to code, and Richard and I are much more confident that
      it is correct.
      It does not actually fix any bugs, but it brings us closer.
      E.g. I hoped it'd fix #15918 and #15799, but it doesn't quite
      do so.  However, it makes it much easier to fix.
      I also did a raft of other minor refactorings:
      * Use tcTypeKind consistently in the type checker
      * Rename tcInstTyBinders to tcInvisibleTyBinders,
        and refactor it a bit
      * Refactor tcEqType, pickyEqType, tcEqTypeVis
        Simpler, probably more efficient.
      * Make zonkTcType zonk TcTyCons, at least if they have
        any free unification variables -- see zonk_tc_tycon
        in TcMType.zonkTcTypeMapper.
        Not zonking these TcTyCons was actually a bug before.
      * Simplify try_to_reduce_no_cache in TcFlatten (a lot)
      * Combine checkExpectedKind and checkExpectedKindX.
        And then combine the invisible-binder instantation code
        Much simpler now.
      * Fix a little bug in TcMType.skolemiseQuantifiedTyVar.
        I'm not sure how I came across this originally.
      * Fix a little bug in TyCoRep.isUnliftedRuntimeRep
        (the ASSERT was over-zealous).  Again I'm not certain
        how I encountered this.
      * Add a missing solveLocalEqualities in
        I came across this when trying to get level numbers
    • Matthew Pickering's avatar
      Implement -Wredundant-record-wildcards and -Wunused-record-wildcards · 19626218
      Matthew Pickering authored
      -Wredundant-record-wildcards warns when a .. pattern binds no variables.
      -Wunused-record-wildcards warns when none of the variables bound by a ..
      pattern are used.
      These flags are enabled by `-Wall`.
    • Sylvain Henry's avatar
      NCG: fast compilation of very large strings (#16190) · 1d9a1d9f
      Sylvain Henry authored
      This patch adds an optimization into the NCG: for large strings
      (threshold configurable via -fbinary-blob-threshold=NNN flag), instead
      of printing `.asciz "..."` in the generated ASM source, we print
      `.incbin "tmpXXX.dat"` and we dump the contents of the string into a
      temporary "tmpXXX.dat" file.
      See the note for more details.
    • Sylvain Henry's avatar
      Add perf test for #16190 · 0f1eb88c
      Sylvain Henry authored
    • Alec Theriault's avatar
      Add `liftedTyped` to `Lift` class · 7f26b74e
      Alec Theriault authored
      Implements GHC proposal 43, adding a `liftTyped` method to the `Lift` typeclass.
      This also adds some documentation to `TExp`, describing typed splices and their
      advantages over their untyped counterparts.
      Resolves #14671.
    • Alexandre Esteves's avatar
      Fix typos [skip ci] · e40f00dc
      Alexandre Esteves authored
  2. 13 Feb, 2019 4 commits
  3. 12 Feb, 2019 5 commits
    • Ryan Scott's avatar
      Fix #16299 by deleting incorrect code from IfaceSyn · 8b476d82
      Ryan Scott authored
      GHCi's `:info` command was pretty-printing Haskell98-style data types
      with explicit return kinds if the return kind wasn't `Type`. This
      leads to bizarre output like this:
      λ> :i (##)
      data (##) :: TYPE ('GHC.Types.TupleRep '[]) = (##)
              -- Defined in ‘GHC.Prim’
      Or, with unlifted newtypes:
      λ> newtype T = MkT Int#
      λ> :i T
      newtype T :: TYPE 'IntRep = MkT Int#
              -- Defined at <interactive>:5:1
      The solution is simple: just delete one part from `IfaceSyn` where
      GHC mistakenly pretty-prints the return kinds for non-GADTs.
    • Richard Eisenberg's avatar
      Fix #16188 · 4a4ae70f
      Richard Eisenberg authored
      There was an awful lot of zipping going on in
      canDecomposableTyConAppOK, and one of the lists being zipped
      was too short, causing the result to be too short. Easily
      Also fixes #16204 and #16225
      test case: typecheck/should_compile/T16188
    • Ryan Scott's avatar
      Fix #16293 by cleaning up Proxy# infelicities · 012257c1
      Ryan Scott authored
      This bug fixes three problems related to `Proxy#`/`proxy#`:
      1. Reifying it with TH claims that the `Proxy#` type constructor has
         two arguments, but that ought to be one for consistency with
         TH's treatment for other primitive type constructors like `(->)`.
         This was fixed by just returning the number of
         `tyConVisibleTyVars` instead of using `tyConArity` (which includes
         invisible arguments).
      2. The role of `Proxy#`'s visible argument was hard-coded as nominal.
         Easily fixed by changing it to phantom.
      3. The visibility of `proxy#`'s kind argument was specified, which
         is different from the `Proxy` constructor (which treats it as
         inferred). Some minor refactoring in `proxyHashId` fixed ths up.
         Along the way, I had to introduce a `mkSpecForAllTy` function, so
         I did some related Haddock cleanup in `Type`, where that function
    • Matthew Pickering's avatar
    • Herbert Valerio Riedel's avatar
      Update array submodule · 093fa2ff
      Herbert Valerio Riedel authored
  4. 11 Feb, 2019 1 commit
  5. 10 Feb, 2019 9 commits
  6. 09 Feb, 2019 5 commits
  7. 08 Feb, 2019 9 commits
    • Simon Peyton Jones's avatar
      Minor refactor of CUSK handling · 9bb23d5f
      Simon Peyton Jones authored
      Previously, in getFamDeclInitialKind, we were figuring
      out whether the enclosing class decl had a CUSK very
      indirectly, via tcTyConIsPoly.  This patch just makes
      the computation much more direct and easy to grok.
      No change in behaviour.
    • Simon Peyton Jones's avatar
    • Simon Peyton Jones's avatar
      Comments only · 616b2ef5
      Simon Peyton Jones authored
    • Ömer Sinan Ağacan's avatar
      Remove a few undefined prel names · 0a4bbb52
      Ömer Sinan Ağacan authored
      - breakpointAuto
      - breakpointJump
      - breakpointCondJump
      - breakpointAutoJump
      These Ids are never defined, but there were definitions about those in
      PrelNames. Those are now removed.
    • Vladislav Zavialov's avatar
      Fix optSemi type in Parser.y · 071bef18
      Vladislav Zavialov authored
      The definition of 'optSemi' claimed it had type
      ([Located a],Bool)
      Note that its production actually returns ([Located Token],Bool):
        : ';' { ([$1],True) }   -- $1 :: Located Token
      Due to an infelicity in the implementation of 'happy -c', it effectively
      resulted in 'unsafeCoerce :: Token -> a'.
      See https://github.com/simonmar/happy/pull/134
      If any consumer of 'optSemi' tried to instantiate 'a' to something not
      representationally equal to 'Token', they would experience a segfault.
      In addition to that, this definition made it impossible to compile Parser.y
      without the -c flag (as it's reliant on this bug to cast 'Token' to 'forall
      a. a').
    • Sylvain Henry's avatar
      Cleanup in parser/Ctype.hs · ced729f6
      Sylvain Henry authored
      * GHC now performs constant folding on bit operations like (.|.) so we
      use them and we remove the misleading comment
      * we use Word8 instead of Int and we remove the useless conversion to
      Int32. Hopefully future releases of GHC could transform the big case in
      `charType` into a value table indexing instead of a jump table. Word8
      would make the table smaller.
      * we use INLINABLE pragma instead of INLINE on `is_ctype`: in my test,
      the latter *prevents* `is_ctype` to be inlined because `charType` is
      inlined into `is_ctype` (to call charType`s worker on the unboxed Char
    • Ben Gamari's avatar
      rts/ProfilerReportJson: Fix format string · 7ff127f9
      Ben Gamari authored
      This was warning on i386.
    • Alan Zimmerman's avatar
      Lexer: Alternate Layout Rule injects actual not virtual braces · c1cf2693
      Alan Zimmerman authored
      When the alternate layout rule is activated via a pragma, it injects
      tokens for { and } to make sure that the source is parsed properly.
      But it injects ITocurly and ITccurly, rather than their virtual
      counterparts ITvocurly and ITvccurly.
      This causes problems for ghc-exactprint, which tries to print these.
      Likewise, any injected ITsemi should have a zero-width SrcSpan.
      Test case (the existing T13087.hs)
          {-# LANGUAGE AlternativeLayoutRule #-}
          {-# LANGUAGE LambdaCase            #-}
          isOne :: Int -> Bool
          isOne = \case 1 -> True
                        _ -> False
          main = return ()
      Closes #16279
    • Alan Zimmerman's avatar
      API Annotations: parens anns discarded for `(*)` operator · 5e9888bd
      Alan Zimmerman authored
      The patch from https://phabricator.haskell.org/D4865 introduces
          go _ (HsParTy _ (dL->L l (HsStarTy _ isUni))) acc ann fix
            = do { warnStarBndr l
                 ; let name = mkOccName tcClsName (if isUni then "★" else "*")
                 ; return (cL l (Unqual name), acc, fix, ann) }
      which discards the parens annotations belonging to the HsParTy.
      Updates haddock submodule
      Closes #16265