diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-08-31 16:03:33 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-08-31 16:34:53 -0400 |
commit | 043604c7232adb698d5008a46d3f29d532acd12d (patch) | |
tree | 450796a5b10d64d2e04f55151955104438080e99 /compiler/rename/RnEnv.hs | |
parent | e9b0bf4ed52114852dbaf6af556514610a895f88 (diff) | |
download | haskell-043604c7232adb698d5008a46d3f29d532acd12d.tar.gz |
RnExpr: Fix ApplicativeDo desugaring with RebindableSyntax
We need to compare against the local return and pure, not returnMName
and pureAName.
Fixes #12490.
Test Plan: Validate, add testcase
Reviewers: austin, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2499
GHC Trac Issues: #12490
Diffstat (limited to 'compiler/rename/RnEnv.hs')
-rw-r--r-- | compiler/rename/RnEnv.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index b0a728176c..63b1f1f102 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -25,7 +25,8 @@ module RnEnv ( lookupFieldFixityRn, lookupTyFixityRn, lookupInstDeclBndr, lookupRecFieldOcc, lookupFamInstName, lookupConstructorFields, - lookupSyntaxName, lookupSyntaxNames, lookupIfThenElse, + lookupSyntaxName, lookupSyntaxName', lookupSyntaxNames, + lookupIfThenElse, lookupGreAvailRn, getLookupOccRn,mkUnboundName, mkUnboundNameRdr, isUnboundName, addUsedGRE, addUsedGREs, addUsedDataCons, @@ -1600,6 +1601,16 @@ lookupIfThenElse ; return ( Just (mkRnSyntaxExpr ite) , unitFV ite ) } } +lookupSyntaxName' :: Name -- ^ The standard name + -> RnM Name -- ^ Possibly a non-standard name +lookupSyntaxName' std_name + = do { rebindable_on <- xoptM LangExt.RebindableSyntax + ; if not rebindable_on then + return std_name + else + -- Get the similarly named thing from the local environment + lookupOccRn (mkRdrUnqual (nameOccName std_name)) } + lookupSyntaxName :: Name -- The standard name -> RnM (SyntaxExpr Name, FreeVars) -- Possibly a non-standard name lookupSyntaxName std_name |