Fix error reporting for contexts during deriving (Trac 958)