1. 29 Nov, 2016 3 commits
  2. 28 Nov, 2016 5 commits
    • Simon Peyton Jones's avatar
      Comments only (related to #12789) · 3aa93689
      Simon Peyton Jones authored
      It took me some time to find the right Note for the
      fix to #12789.  This comment patch tries to add pointers
      from relevant places.
      3aa93689
    • Simon Peyton Jones's avatar
      Test Trac #12885 · 27a6bdf0
      Simon Peyton Jones authored
      ...which is fixed by
      
        commit 0476a64e
        Author: Simon Peyton Jones <simonpj@microsoft.com>
        Date:   Tue Oct 25 15:22:17 2016 +0100
      
          Fix a bug in mk_superclasses_of
      27a6bdf0
    • Simon Peyton Jones's avatar
      Test Trac #12776 · 605af54a
      Simon Peyton Jones authored
      605af54a
    • Gabor Greif's avatar
      Typos in comments only [ci skip] · 52388421
      Gabor Greif authored
      52388421
    • Simon Peyton Jones's avatar
      Fix an long-standing bug in OccurAnal · 6ec2304f
      Simon Peyton Jones authored
      This bug was beautifully characterised in Trac #12776,
      which showed a small program for which the inliner went
      into an infinite loop.  Eeek.
      
      It turned out to be a genuine and long-standing bug in
      the occurrence analyer, specifically in the bit that
      identifies loop breakers.  In this line
      
        pairs | isEmptyVarSet weak_fvs
              = reOrderNodes   0 bndr_set weak_fvs tagged_nodes []
              | otherwise
              = loopBreakNodes 0 bndr_set weak_fvs loop_breaker_edges []
      
      the 'tagged_nodes' should be 'loop_breaker_edges'.
      That's it!
      
      The diff looks a lot bigger because I did some work on
      comments and variable naming, but that's all it is.  We
      were using the wrong set of dependencies!
      
      I'm astonished that this bug has not caused more trouble.
      It dates back to at least 2011 and maybe further.
      6ec2304f
  3. 25 Nov, 2016 21 commits
    • Simon Peyton Jones's avatar
      Be a bit more selective about improvement · f8c966c7
      Simon Peyton Jones authored
      This patch makes [W] constraints not participate in
      improvement.   See Note [Do not do improvement for WOnly]
      in TcSMonad.
      
      Removes some senseless work duplication in some cases (notably
      Trac #12860); should not change behaviour.
      f8c966c7
    • Simon Peyton Jones's avatar
      A tiny bit more tc tracing · 086b4836
      Simon Peyton Jones authored
      086b4836
    • Simon Peyton Jones's avatar
      Fix inference of partial signatures · 1bfff60f
      Simon Peyton Jones authored
      When we had
        f :: ( _ ) => blah
      we were failing to call growThetaTyVars, as we do in the
      no-type-signature case, and that meant that we weren't generalising
      over the right type variables.  I'm quite surprised this didn't cause
      problems earlier.
      
      Anyway Trac #12844 showed it up and this patch fixes it
      1bfff60f
    • Simon Peyton Jones's avatar
      Refactor functional dependencies a bit · eb55ec29
      Simon Peyton Jones authored
      * Rename CoAxiom.Eqn = Pair Type to TypeEqn,
        and use it for fundeps
      
      * Use the FunDepEqn for injectivity, which lets us share a bit
        more code, and (more important) brain cells
      
      * When generating fundeps, take the max depth of the two
        constraints.  This aimed at tackling the strange loop in
        Trac #12860, but there is more to come for that.
      
      * Improve pretty-printing with -ddump-tc-trace
      eb55ec29
    • Simon Peyton Jones's avatar
      Improve pretty-printing of types · 5f349fe2
      Simon Peyton Jones authored
      In this commit
         commit 6c0f10fa
         Author: Ben Gamari <bgamari.foss@gmail.com>
         Date:   Sun Nov 13 16:17:37 2016 -0500
      
          Kill Type pretty-printer
      
      we switched to pretty-printing a type by converting it to an
      IfaceType and pretty printing that.  Very good.
      
      This patch fixes two things
      
      * The new story is terrible for debug-printing with -ddump-tc-trace,
        because all the extra info in an open type was discarded ty the
        conversion to IfaceType.
      
        This patch adds IfaceTcTyVar to IfaceType, to carry a TcTyVar in
        debug situations.  Quite an easy change, happily.  These things
        never show up in interface files.
      
      * Now that we are going via IfaceType, it's essential to tidy before
        converting; otherwise
           forall k_23 k_34. blah
        is printed as
           forall k k. blah
        which is very unhelpful.  Again this only shows up in debug
        printing.
      5f349fe2
    • Simon Peyton Jones's avatar
      Use TyVars in PatSyns · 12eff239
      Simon Peyton Jones authored
      I found that some TcTyVars were lurking in a PatSyn, because
      tc_patsyn_finish was using the TcType -> TcType zonker rather
      than the TcType -> Type zonker.  Eeek.
      
      I fixing this I also tided up function naming a bit (still not
      terrific), and removed the unused TcTyBinder type entirely.
      12eff239
    • Simon Peyton Jones's avatar
      Use TyVars in a DFunUnfolding · edbe8319
      Simon Peyton Jones authored
      En route to something else I discovered that TcInstDcls.addDFunPrags
      was building a DFunUnfolding that had TcTyVars in it.  They should
      never survive beyond type checking.  It was harmeless, but now affects
      type pretty-printing.
      
      This patch fixes it.
      edbe8319
    • Simon Peyton Jones's avatar
      Use 'v' instead of 'tpl' for template vars · bc35c3f9
      Simon Peyton Jones authored
      Just affects Id.mkTemplateLocal, and should make debug prints
      a little less voluminous.  No user-visible change here.
      bc35c3f9
    • Simon Peyton Jones's avatar
      Kill off ifaceTyVarsOfType · a5a39264
      Simon Peyton Jones authored
      IfaceTypes are really not well suited to finding free variables etc.
      Nevertheless, there was quite a lot of code to do just that; but it
      was only used to see if a kind is variable-free so as to decide
      whether to print a forall binder.
      
      This patch simplifies to deal with just that case, replacing all
      the free-vars stuff with just ifTypeIsVarFree
      a5a39264
    • Simon Peyton Jones's avatar
      Test Trac #12845 · 83a952d1
      Simon Peyton Jones authored
      83a952d1
    • Simon Peyton Jones's avatar
      Test Trac #12867 · f0f46826
      Simon Peyton Jones authored
      f0f46826
    • Simon Peyton Jones's avatar
      Fix a name-space problem with promotion · c1b4b769
      Simon Peyton Jones authored
      Trac #12686 showed that we were allowing a term variable into
      a type, by promotion.  I chose to squash this in the renamer.
      c1b4b769
    • Gabor Greif's avatar
      Typos in comments · e3194660
      Gabor Greif authored
      e3194660
    • Simon Peyton Jones's avatar
      Perf improvements in T6048, T10547 · 90a65ad0
      Simon Peyton Jones authored
      I think this wave of commits just made these two a little better;
      they must have been close to the threshold before.
      90a65ad0
    • Simon Peyton Jones's avatar
      Remove redundant kind check · 4431e48e
      Simon Peyton Jones authored
      The invariants for CTyEqCan mean that this check isn't needed.
      Turn it into an ASSERT.
      4431e48e
    • Simon Peyton Jones's avatar
      Allow TyVars in TcTypes · 18d0bdd3
      Simon Peyton Jones authored
      Up to now we've had a rule that a TyVar can't apppear in a type
      seen by the type checker; they should all be TcTyVars.  But:
      
      a) With -XTypeInType it becomes much harder to exclude them;
         see Note [TcTyVars in the typechecker] in TcType.
      
      b) It's unnecessary to exculde them; instead we can just treat
         a TyVar just like vanillaSkolemTv.
      
      This is what was causing an ASSERT error in
      indexed-types/should_fail/T12041, reported in Trac #12826.
      
      That patch allows a TyVar in a TcType.  The most significant
      change is to make Var.tcTyVarDetails return vanillaSkolemTv.
      In fact it already did, but (a) it was not documented, and
      (b) we never exploited it.  Now we rely on it.
      18d0bdd3
    • Simon Peyton Jones's avatar
      Another major constraint-solver refactoring · 1eec1f21
      Simon Peyton Jones authored
      This patch takes further my refactoring of the constraint
      solver, which I've been doing over the last couple of months
      in consultation with Richard.
      
      It fixes a number of tricky bugs that made the constraint
      solver actually go into a loop, including
      
        Trac #12526
        Trac #12444
        Trac #12538
      
      The main changes are these
      
      * Flatten unification variables (fmvs/fuvs) appear on the LHS
        of a tvar/tyvar equality; thus
                 fmv ~ alpha
        and not
                 alpha ~ fmv
      
        See Note [Put flatten unification variables on the left]
        in TcUnify.  This is implemented by TcUnify.swapOverTyVars.
      
      * Don't reduce a "loopy" CFunEqCan where the fsk appears on
        the LHS:
            F t1 .. tn ~ fsk
        where 'fsk' is free in t1..tn.
        See Note [FunEq occurs-check principle] in TcInteract
      
        This neatly stops some infinite loops that people reported;
        and it allows us to delete some crufty code in reduce_top_fun_eq.
        And it appears to be no loss whatsoever.
      
        As well as fixing loops, ContextStack2 and T5837 both terminate
        when they didn't before.
      
      * Previously we generated "derived shadow" constraints from
        Wanteds, but we could (and sometimes did; Trac #xxxx) repeatedly
        generate a derived shadow from the same Wanted.
      
        A big change in this patch is to have two kinds of Wanteds:
           [WD] behaves like a pair of a Wanted and a Derived
           [W]  behaves like a Wanted only
        See CtFlavour and ShadowInfo in TcRnTypes, and the ctev_nosh
        field of a Wanted.
      
        This turned out to be a lot simpler.  A [WD] gets split into a
        [W] and a [D] in TcSMonad.maybeEmitShaodow.
      
        See TcSMonad Note [The improvement story and derived shadows]
      
      * Rather than have a separate inert_model in the InertCans, I've
        put the derived equalities back into inert_eqs.  We weren't
        gaining anything from a separate field.
      
      * Previously we had a mode for the constraint solver in which it
        would more aggressively solve Derived constraints; it was used
        for simplifying the context of a 'deriving' clause, or a 'default'
        delcaration, for example.
      
        But the complexity wasn't worth it; now I just make proper Wanted
        constraints.  See TcMType.cloneWC
      
      * Don't generate injectivity improvement for Givens; see
        Note [No FunEq improvement for Givens] in TcInteract
      
      * solveSimpleWanteds leaves the insolubles in-place rather than
        returning them.  Simpler.
      
      I also did lots of work on comments, including fixing Trac #12821.
      1eec1f21
    • Simon Peyton Jones's avatar
      Add elemDVarEnv · 0123efde
      Simon Peyton Jones authored
      I need this in a later patch
      0123efde
    • Simon Peyton Jones's avatar
      Comments only in TcType · f04f1188
      Simon Peyton Jones authored
      f04f1188
    • Simon Peyton Jones's avatar
      Fix a bug in mk_superclasses_of · 0476a64e
      Simon Peyton Jones authored
      This bug meant that we were less eager about expanding
      tuple superclasses than we should have been; i.e. we stopped
      too soon.  That's not fatal, beause we expand more superclasses
      later, but it's less efficient.
      0476a64e
    • Simon Peyton Jones's avatar
      Make a panic into an ASSERT · 9a431e51
      Simon Peyton Jones authored
      9a431e51
  4. 24 Nov, 2016 2 commits
  5. 23 Nov, 2016 1 commit
  6. 22 Nov, 2016 2 commits
  7. 21 Nov, 2016 6 commits