diff options
author | HE, Tao <sighingnow@gmail.com> | 2018-01-31 21:40:03 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-01-31 23:29:31 -0500 |
commit | ced9fbd3913e1316498961bc389bfb1e141221a1 (patch) | |
tree | c10546df39d77c02bab6ac37d8922343cf9eb364 /compiler/parser | |
parent | e4ab65bd57b2c39f4af52879654514bb6d5b42a0 (diff) | |
download | haskell-ced9fbd3913e1316498961bc389bfb1e141221a1.tar.gz |
UnboxedTuples can't be used as constraints
Fixes #14740.
Test Plan: make test TEST="14740"
Reviewers: bgamari, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, thomie, carter
GHC Trac Issues: #14740
Differential Revision: https://phabricator.haskell.org/D4359
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/RdrHsSyn.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index fcb1fede20..357d22438a 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -849,11 +849,22 @@ checkBlockArguments expr = case unLoc expr of $$ text "You could write it with parentheses" $$ text "Or perhaps you meant to enable BlockArguments?" +-- | Validate the context constraints and break up a context into a list +-- of predicates. +-- +-- @ +-- (Eq a, Ord b) --> [Eq a, Ord b] +-- Eq a --> [Eq a] +-- (Eq a) --> [Eq a] +-- (((Eq a))) --> [Eq a] +-- @ checkContext :: LHsType GhcPs -> P ([AddAnn],LHsContext GhcPs) checkContext (L l orig_t) = check [] (L l orig_t) where - check anns (L lp (HsTupleTy _ ts)) -- (Eq a, Ord b) shows up as a tuple type + check anns (L lp (HsTupleTy HsBoxedOrConstraintTuple ts)) + -- (Eq a, Ord b) shows up as a tuple type. Only boxed tuples can + -- be used as context constraints. = return (anns ++ mkParensApiAnn lp,L l ts) -- Ditto () -- don't let HsAppsTy get in the way |