diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2017-11-09 23:20:19 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2017-11-11 23:16:39 +0200 |
commit | e3ec2e7ae94524ebd111963faf34b84d942265b4 (patch) | |
tree | 022bca155b29cf0d1c40b25537bc238eec829db8 /compiler/rename/RnSource.hs | |
parent | 86c50a16e6a17349a7662067232236e38e46ba42 (diff) | |
download | haskell-e3ec2e7ae94524ebd111963faf34b84d942265b4.tar.gz |
WIP on combined Step 1 and 3 for Trees That Grow, HsExpr
See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow
Trees that grow extension points are added for
- HsExpr
Updates haddock submodule
Test Plan: ./validate
Reviewers: bgamari, goldfire
Subscribers: rwbarton, thomie, shayan-najd, mpickering
Differential Revision: https://phabricator.haskell.org/D4177
Diffstat (limited to 'compiler/rename/RnSource.hs')
-rw-r--r-- | compiler/rename/RnSource.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs index 7d69c87db2..0ca811424e 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/rename/RnSource.hs @@ -582,7 +582,7 @@ checkCanonicalInstances cls poly_ty mbinds = do isAliasMG MG {mg_alts = L _ [L _ (Match { m_pats = [], m_grhss = grhss })]} | GRHSs [L _ (GRHS [] body)] lbinds <- grhss , L _ EmptyLocalBinds <- lbinds - , L _ (HsVar (L _ rhsName)) <- body = Just rhsName + , L _ (HsVar _ (L _ rhsName)) <- body = Just rhsName isAliasMG _ = Nothing -- got "lhs = rhs" but expected something different @@ -1039,10 +1039,11 @@ validRuleLhs foralls lhs where checkl (L _ e) = check e - check (OpApp e1 op _ e2) = checkl op `mplus` checkl_e e1 `mplus` checkl_e e2 - check (HsApp e1 e2) = checkl e1 `mplus` checkl_e e2 - check (HsAppType e _) = checkl e - check (HsVar (L _ v)) | v `notElem` foralls = Nothing + check (OpApp _ e1 op e2) = checkl op `mplus` checkl_e e1 + `mplus` checkl_e e2 + check (HsApp _ e1 e2) = checkl e1 `mplus` checkl_e e2 + check (HsAppType _ e) = checkl e + check (HsVar _ (L _ v)) | v `notElem` foralls = Nothing check other = Just other -- Failure -- Check an argument @@ -1078,7 +1079,7 @@ badRuleLhsErr name lhs bad_e text "LHS must be of form (f e1 .. en) where f is not forall'd" where err = case bad_e of - HsUnboundVar uv -> text "Not in scope:" <+> ppr uv + HsUnboundVar _ uv -> text "Not in scope:" <+> ppr uv _ -> text "Illegal expression:" <+> ppr bad_e {- @@ -1092,7 +1093,7 @@ badRuleLhsErr name lhs bad_e rnHsVectDecl :: VectDecl GhcPs -> RnM (VectDecl GhcRn, FreeVars) -- FIXME: For the moment, the right-hand side is restricted to be a variable as we cannot properly -- typecheck a complex right-hand side without invoking 'vectType' from the vectoriser. -rnHsVectDecl (HsVect s var rhs@(L _ (HsVar _))) +rnHsVectDecl (HsVect s var rhs@(L _ (HsVar _ _))) = do { var' <- lookupLocatedOccRn var ; (rhs', fv_rhs) <- rnLExpr rhs ; return (HsVect s var' rhs', fv_rhs `addOneFV` unLoc var') |