diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2020-10-04 20:46:41 +0100 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2020-10-20 08:35:34 +0100 |
commit | ea736839d85594c95490dcf02d3325c2bbc68f33 (patch) | |
tree | 6f6c0335e216f67b63caf9e4a46d3e5bb6e852af /compiler/GHC/Rename | |
parent | 59b08a5d192e102f66a6d9260cc8466d7428cffe (diff) | |
download | haskell-ea736839d85594c95490dcf02d3325c2bbc68f33.tar.gz |
API Annotations: Keep track of unicode for linear arrow notationwip/az/unicode-hsscaled
The linear arrow can be parsed as `%1 ->` or a direct single token unicode
equivalent.
Make sure that this distinction is captured in the parsed AST by using
IsUnicodeSyntax where it appears, and introduce a new API Annotation,
AnnMult to represent its location when unicode is not used.
Updated haddock submodule
Diffstat (limited to 'compiler/GHC/Rename')
-rw-r--r-- | compiler/GHC/Rename/HsType.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/GHC/Rename/HsType.hs b/compiler/GHC/Rename/HsType.hs index 77ece61c14..e04846ddde 100644 --- a/compiler/GHC/Rename/HsType.hs +++ b/compiler/GHC/Rename/HsType.hs @@ -624,11 +624,11 @@ rnHsTyKi env ty@(HsRecTy _ flds) 2 (ppr ty)) ; return [] } -rnHsTyKi env (HsFunTy _ mult ty1 ty2) +rnHsTyKi env (HsFunTy u mult ty1 ty2) = do { (ty1', fvs1) <- rnLHsTyKi env ty1 ; (ty2', fvs2) <- rnLHsTyKi env ty2 ; (mult', w_fvs) <- rnHsArrow env mult - ; return (HsFunTy noExtField mult' ty1' ty2' + ; return (HsFunTy u mult' ty1' ty2' , plusFVs [fvs1, fvs2, w_fvs]) } rnHsTyKi env listTy@(HsListTy _ ty) @@ -721,10 +721,10 @@ rnHsTyKi env (HsWildCardTy _) ; return (HsWildCardTy noExtField, emptyFVs) } rnHsArrow :: RnTyKiEnv -> HsArrow GhcPs -> RnM (HsArrow GhcRn, FreeVars) -rnHsArrow _env HsUnrestrictedArrow = return (HsUnrestrictedArrow, emptyFVs) -rnHsArrow _env HsLinearArrow = return (HsLinearArrow, emptyFVs) -rnHsArrow env (HsExplicitMult p) - = (\(mult, fvs) -> (HsExplicitMult mult, fvs)) <$> rnLHsTyKi env p +rnHsArrow _env (HsUnrestrictedArrow u) = return (HsUnrestrictedArrow u, emptyFVs) +rnHsArrow _env (HsLinearArrow u) = return (HsLinearArrow u, emptyFVs) +rnHsArrow env (HsExplicitMult u p) + = (\(mult, fvs) -> (HsExplicitMult u mult, fvs)) <$> rnLHsTyKi env p -------------- rnTyVar :: RnTyKiEnv -> RdrName -> RnM Name @@ -1847,7 +1847,7 @@ extract_lty (L _ ty) acc extract_hs_arrow :: HsArrow GhcPs -> FreeKiTyVars -> FreeKiTyVars -extract_hs_arrow (HsExplicitMult p) acc = extract_lty p acc +extract_hs_arrow (HsExplicitMult _ p) acc = extract_lty p acc extract_hs_arrow _ acc = acc extract_hs_for_all_telescope :: HsForAllTelescope GhcPs |