Properly represent abstract classes in Class and IfaceDecl
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Tue, 28 Feb 2017 07:48:30 +0000 (23:48 -0800)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Thu, 2 Mar 2017 23:59:02 +0000 (15:59 -0800)
commitfb5cd9d6d6185afe6d4ef2f3df3f895b6d0abf4c
treeba77538afca8be56c6c4ea77e6f7afda817df418
parente71068617d15b0fea65fe24e20c0ab0db9fc660f
Properly represent abstract classes in Class and IfaceDecl

Summary:
Previously, abstract classes looked very much like normal
classes, except that they happened to have no methods,
superclasses or ATs, and they came from boot files.  This
patch gives abstract classes a proper representation in
Class and IfaceDecl, by moving the things which are never
defined for abstract classes into ClassBody/IfaceClassBody.

Because Class is abstract, this change had ~no disruption
to any of the code in GHC; if you ask about the methods of
an abstract class, we'll just give you an empty list.

This also fixes a bug where abstract type classes were incorrectly
treated as representationally injective (they're not!)

Fixes #13347, and a TODO in the code.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, bgamari, austin

Subscribers: goldfire, thomie

Differential Revision: https://phabricator.haskell.org/D3236
14 files changed:
compiler/backpack/RnModIface.hs
compiler/iface/BuildTyCl.hs
compiler/iface/IfaceSyn.hs
compiler/iface/MkIface.hs
compiler/iface/TcIface.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/types/Class.hs
compiler/vectorise/Vectorise/Type/TyConDecl.hs
testsuite/tests/typecheck/should_compile/Makefile
testsuite/tests/typecheck/should_compile/Tc271.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/Tc271.hs-boot [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/Tc271a.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T