[commit: ghc] ghc-8.0: Give a more verbose error message when desugaring a HsTypeOut (ddbb711)

git at git.haskell.org git at git.haskell.org
Mon Jan 25 15:57:34 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/ddbb7116495a7a5b52ace5429bea16da56d8a555/ghc

>---------------------------------------------------------------

commit ddbb7116495a7a5b52ace5429bea16da56d8a555
Author: Reid Barton <rwbarton at gmail.com>
Date:   Sat Jan 23 13:13:31 2016 +0100

    Give a more verbose error message when desugaring a HsTypeOut
    
    Reviewers: austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1826
    
    (cherry picked from commit 7cd37c599fa83817b51234ff2ff79e4e4896b117)


>---------------------------------------------------------------

ddbb7116495a7a5b52ace5429bea16da56d8a555
 compiler/deSugar/DsExpr.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/deSugar/DsExpr.hs b/compiler/deSugar/DsExpr.hs
index 22a8707..c3c17c7 100644
--- a/compiler/deSugar/DsExpr.hs
+++ b/compiler/deSugar/DsExpr.hs
@@ -732,10 +732,14 @@ dsExpr (EAsPat        {})  = panic "dsExpr:EAsPat"
 dsExpr (EViewPat      {})  = panic "dsExpr:EViewPat"
 dsExpr (ELazyPat      {})  = panic "dsExpr:ELazyPat"
 dsExpr (HsType        {})  = panic "dsExpr:HsType" -- removed by typechecker
-dsExpr (HsTypeOut     {})  = panic "dsExpr:HsTypeOut" -- handled in HsApp case
 dsExpr (HsDo          {})  = panic "dsExpr:HsDo"
 dsExpr (HsRecFld      {})  = panic "dsExpr:HsRecFld"
 
+-- Normally handled in HsApp case, but a GHC API user might try to desugar
+-- an HsTypeOut, since it is an HsExpr in a typechecked module after all.
+-- (Such as ghci itself, in #11456.) So improve the error message slightly.
+dsExpr (HsTypeOut {})
+  = panic "dsExpr: tried to desugar a naked type application argument (HsTypeOut)"
 
 findField :: [LHsRecField Id arg] -> Name -> [arg]
 findField rbinds sel



More information about the ghc-commits mailing list