Skip to content
  • Simon Peyton Jones's avatar
    Do SCC on instance declarations (fixes Trac #5715) · fa9fdc28
    Simon Peyton Jones authored
    The trouble here is that given
    
        {-# LANGUAGE DataKinds, TypeFamilies #-}
        data instance Foo a = Bar (Bar a)
    
    we want to get a sensible message that we can't use the promoted 'Bar'
    constructor until after its definition; it's a staging error.  Bud the
    staging mechanism that we use for vanilla data declarations don't work
    here.
    
    Solution is to perform strongly-connected component analysis on the
    instance declarations. But that in turn means that we need to track
    free-variable information on more HsSyn declarations, which is why
    so many files are touched.  All the changes are boiler-platey except
    the ones in TcInstDcls.
    fa9fdc28