diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2018-04-18 23:55:14 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2018-04-27 15:38:46 +0200 |
commit | c3823cba2147c74b2c727b5458b9e95350496988 (patch) | |
tree | e9afa7f5fd6b1a3f2f1a2ee87d659342803e6a2d /compiler/typecheck/TcBinds.hs | |
parent | 313720a453889ddd05da02f4f2c31eb3bc3734d2 (diff) | |
download | haskell-c3823cba2147c74b2c727b5458b9e95350496988.tar.gz |
TTG : complete for balance of hsSyn AST
Summary:
- remove PostRn/PostTc fields
- remove the HsVect In/Out distinction for Type, Class and Instance
- remove PlaceHolder in favour of NoExt
- Simplify OutputableX constraint
Updates haddock submodule
Test Plan: ./validate
Reviewers: goldfire, bgamari
Subscribers: goldfire, thomie, mpickering, carter
Differential Revision: https://phabricator.haskell.org/D4625
Diffstat (limited to 'compiler/typecheck/TcBinds.hs')
-rw-r--r-- | compiler/typecheck/TcBinds.hs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 5355cc9dbf..980185c0fe 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -1243,20 +1243,20 @@ tcVect :: VectDecl GhcRn -> TcM (VectDecl GhcTcId) -- during type checking. Instead, constrain the rhs of a vectorisation declaration to be a single -- identifier (this is checked in 'rnHsVectDecl'). Fix this by enabling the use of 'vectType' -- from the vectoriser here. -tcVect (HsVect s name rhs) +tcVect (HsVect _ s name rhs) = addErrCtxt (vectCtxt name) $ do { var <- wrapLocM tcLookupId name ; let L rhs_loc (HsVar noExt (L lv rhs_var_name)) = rhs ; rhs_id <- tcLookupId rhs_var_name - ; return $ HsVect s var (L rhs_loc (HsVar noExt (L lv rhs_id))) + ; return $ HsVect noExt s var (L rhs_loc (HsVar noExt (L lv rhs_id))) } -tcVect (HsNoVect s name) +tcVect (HsNoVect _ s name) = addErrCtxt (vectCtxt name) $ do { var <- wrapLocM tcLookupId name - ; return $ HsNoVect s var + ; return $ HsNoVect noExt s var } -tcVect (HsVectTypeIn _ isScalar lname rhs_name) +tcVect (HsVectType (VectTypePR _ lname rhs_name) isScalar) = addErrCtxt (vectCtxt lname) $ do { tycon <- tcLookupLocatedTyCon lname ; checkTc ( not isScalar -- either we have a non-SCALAR declaration @@ -1266,25 +1266,21 @@ tcVect (HsVectTypeIn _ isScalar lname rhs_name) scalarTyConMustBeNullary ; rhs_tycon <- fmapMaybeM (tcLookupTyCon . unLoc) rhs_name - ; return $ HsVectTypeOut isScalar tycon rhs_tycon + ; return $ HsVectType (VectTypeTc tycon rhs_tycon) isScalar } -tcVect (HsVectTypeOut _ _ _) - = panic "TcBinds.tcVect: Unexpected 'HsVectTypeOut'" -tcVect (HsVectClassIn _ lname) +tcVect (HsVectClass (VectClassPR _ lname)) = addErrCtxt (vectCtxt lname) $ do { cls <- tcLookupLocatedClass lname - ; return $ HsVectClassOut cls + ; return $ HsVectClass cls } -tcVect (HsVectClassOut _) - = panic "TcBinds.tcVect: Unexpected 'HsVectClassOut'" -tcVect (HsVectInstIn linstTy) +tcVect (HsVectInst linstTy) = addErrCtxt (vectCtxt linstTy) $ do { (cls, tys) <- tcHsVectInst linstTy ; inst <- tcLookupInstance cls tys - ; return $ HsVectInstOut inst + ; return $ HsVectInst inst } -tcVect (HsVectInstOut _) - = panic "TcBinds.tcVect: Unexpected 'HsVectInstOut'" +tcVect (XVectDecl {}) + = panic "TcBinds.tcVect: Unexpected 'XVectDecl'" vectCtxt :: Outputable thing => thing -> SDoc vectCtxt thing = text "When checking the vectorisation declaration for" <+> ppr thing |