[commit: ghc] master: Give a more verbose error message when desugaring a HsTypeOut (7cd37c5)

git at git.haskell.org git at git.haskell.org
Sat Jan 23 12:43:15 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7cd37c599fa83817b51234ff2ff79e4e4896b117/ghc

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

commit 7cd37c599fa83817b51234ff2ff79e4e4896b117
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


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

7cd37c599fa83817b51234ff2ff79e4e4896b117
 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