Tidy up handling of coercion variables
authorSimon Peyton Jones <simonpj@microsoft.com>
Thu, 24 Mar 2016 17:31:12 +0000 (17:31 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Thu, 24 Mar 2016 17:31:51 +0000 (17:31 +0000)
commitcb08f8da37ff5fb99e1d02b8afdcb802d23e9a8d
tree4b9249f146bac2069dcd1f3b646bb4dbbb318a5c
parent2b5929cc4390d03de2c4ae950d7e2a69b5065f2a
Tidy up handling of coercion variables

* Comments to explain that a CoVar, whose IdInfo is CoVarId,
  is always unlifted (but may be nominal or representational role)

  And TyCoRep.isCoercionType picks out only those unlifted
  types, NOT the lifted versions

* Introduce Var.NcId for non-co-var Ids
  with predicate isNonCoVarId

* Add assertions in CoreSubst that the Id env is only
  used for NcIds

* Fix lurking bug in CSE which extended the
  CoreSubst Id env with a CoVar

* Fix two bugs in Specialise.spec_call, which wrongly treated
  CoVars like NcIds
    - needed a varToCoreExpr in one place
    - needed extendSubst not extendIdSubst in another
  This was the root cause of Trac #11644

Minor refactoring

* Eliminate unused mkDerivedLocalCoVarM, mkUserLocalCoVar
* Small refactor in mkSysLocalOrCoVar
compiler/basicTypes/Id.hs
compiler/basicTypes/IdInfo.hs
compiler/basicTypes/Var.hs
compiler/coreSyn/CoreLint.hs
compiler/coreSyn/CoreSubst.hs
compiler/simplCore/CSE.hs
compiler/specialise/Specialise.hs
compiler/types/TyCoRep.hs
testsuite/tests/simplCore/should_compile/T11644.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/all.T