diff options
author | Michael Sloan <mgsloan@gmail.com> | 2018-07-12 10:07:28 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-07-12 15:04:05 -0400 |
commit | 0f79b0ef140e086a48d1aa5b945ad5a3754ccdd1 (patch) | |
tree | ab69d7ca75deac90c285e0e982c4a1bd3a92a288 /compiler/hsSyn | |
parent | 234093cf1562d032b38382a5cc08be8dd71c4fe3 (diff) | |
download | haskell-0f79b0ef140e086a48d1aa5b945ad5a3754ccdd1.tar.gz |
Fix handling of unbound constructor names in TH #14627
Also adds a comment to UnboundVarE clarifying that it also is used for
unbound constructor identifiers, since that isn't very clear from the
name.
Test Plan: testsuite/tests/th/T14627.hs
Reviewers: goldfire, bgamari
Reviewed By: goldfire
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4923
Diffstat (limited to 'compiler/hsSyn')
-rw-r--r-- | compiler/hsSyn/Convert.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs index c64cb7c662..84e45948d2 100644 --- a/compiler/hsSyn/Convert.hs +++ b/compiler/hsSyn/Convert.hs @@ -913,7 +913,11 @@ cvtl e = wrapL (cvt e) flds ; return $ mkRdrRecordUpd e' flds' } cvt (StaticE e) = fmap (HsStatic noExt) $ cvtl e - cvt (UnboundVarE s) = do { s' <- vName s; return $ HsVar noExt (noLoc s') } + cvt (UnboundVarE s) = do -- Use of 'vcName' here instead of 'vName' is + -- important, because UnboundVarE may contain + -- constructor names - see #14627. + { s' <- vcName s + ; return $ HsVar noExt (noLoc s') } cvt (LabelE s) = do { return $ HsOverLabel noExt Nothing (fsLit s) } {- Note [Dropping constructors] |