Commit cf196400 authored by Alan Zimmerman's avatar Alan Zimmerman Committed by Austin Seipp

The production for squals is incorrect; see D806 for specifics.

This diff depends on D803.

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D806

GHC Trac Issues: #10214
parent f1a4e42e
......@@ -2473,11 +2473,13 @@ squals :: { Located [LStmt RdrName (LHsExpr RdrName)] } -- In reverse order, b
-- one can "grab" the earlier ones
: squals ',' transformqual
{% addAnnotation (gl $ last $ unLoc $1) AnnComma (gl $2) >>
return (sLL $1 $> [L (getLoc $3) ((unLoc $3) (reverse (unLoc $1)))]) }
ams (sLL $1 $> ()) (fst $ unLoc $3) >>
return (sLL $1 $> [sLL $1 $> ((snd $ unLoc $3) (reverse (unLoc $1)))]) }
| squals ',' qual
{% addAnnotation (gl $ head $ unLoc $1) AnnComma (gl $2) >>
return (sLL $1 $> ($3 : unLoc $1)) }
| transformqual { sLL $1 $> [L (getLoc $1) ((unLoc $1) [])] }
| transformqual {% ams $1 (fst $ unLoc $1) >>
return (sLL $1 $> [L (getLoc $1) ((snd $ unLoc $1) [])]) }
| qual { sL1 $1 [$1] }
-- | transformquals1 ',' '{|' pquals '|}' { sLL $1 $> ($4 : unLoc $1) }
-- | '{|' pquals '|}' { sL1 $1 [$2] }
......@@ -2487,19 +2489,15 @@ squals :: { Located [LStmt RdrName (LHsExpr RdrName)] } -- In reverse order, b
-- consensus on the syntax, this feature is not being used until we
-- get user demand.
transformqual :: { Located ([LStmt RdrName (LHsExpr RdrName)] -> Stmt RdrName (LHsExpr RdrName)) }
transformqual :: { Located ([AddAnn],[LStmt RdrName (LHsExpr RdrName)] -> Stmt RdrName (LHsExpr RdrName)) }
-- Function is applied to a list of stmts *in order*
: 'then' exp {% ams (sLL $1 $> $ \ss -> (mkTransformStmt ss $2))
[mj AnnThen $1] }
| 'then' exp 'by' exp {% ams (sLL $1 $> $ \ss -> (mkTransformByStmt ss $2 $4))
[mj AnnThen $1,mj AnnBy $3] }
: 'then' exp { sLL $1 $> ([mj AnnThen $1], \ss -> (mkTransformStmt ss $2)) }
| 'then' exp 'by' exp { sLL $1 $> ([mj AnnThen $1,mj AnnBy $3],\ss -> (mkTransformByStmt ss $2 $4)) }
| 'then' 'group' 'using' exp
{% ams (sLL $1 $> $ \ss -> (mkGroupUsingStmt ss $4))
[mj AnnThen $1,mj AnnGroup $2,mj AnnUsing $3] }
{ sLL $1 $> ([mj AnnThen $1,mj AnnGroup $2,mj AnnUsing $3], \ss -> (mkGroupUsingStmt ss $4)) }
| 'then' 'group' 'by' exp 'using' exp
{% ams (sLL $1 $> $ \ss -> (mkGroupByUsingStmt ss $4 $6))
[mj AnnThen $1,mj AnnGroup $2,mj AnnBy $3,mj AnnUsing $5] }
{ sLL $1 $> ([mj AnnThen $1,mj AnnGroup $2,mj AnnBy $3,mj AnnUsing $5], \ss -> (mkGroupByUsingStmt ss $4 $6)) }
-- Note that 'group' is a special_id, which means that you can enable
-- TransformListComp while still using Data.List.group. However, this
......
......@@ -20,3 +20,9 @@ parallelListComp = [ x + y * z
| y <- [10..20]
| z <- [20..30]
]
oldest :: [Int] -> [String]
oldest tbl = [ "str"
| n <- tbl
, then id
]
......@@ -31,4 +31,4 @@ listcomps:
'$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc listcomps
./listcomps "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`"
.PHONY: clean annotations parseTree comments exampleTest listcops
.PHONY: clean annotations parseTree comments exampleTest listcomps
......@@ -22,7 +22,19 @@
ListComprehensions.hs:20:28-29, ListComprehensions.hs:20:32-33,
ListComprehensions.hs:21:22, ListComprehensions.hs:21:22-34,
ListComprehensions.hs:21:27-34, ListComprehensions.hs:21:28-29,
ListComprehensions.hs:21:32-33, <no location info>}
ListComprehensions.hs:21:32-33, ListComprehensions.hs:24:1-6,
ListComprehensions.hs:24:1-27, ListComprehensions.hs:24:11-15,
ListComprehensions.hs:24:11-27, ListComprehensions.hs:24:12-14,
ListComprehensions.hs:24:20-27, ListComprehensions.hs:24:21-26,
ListComprehensions.hs:25:1-6, ListComprehensions.hs:(25,1)-(28,14),
ListComprehensions.hs:25:8-10,
ListComprehensions.hs:(25,12)-(28,14),
ListComprehensions.hs:(25,14)-(28,14),
ListComprehensions.hs:25:16-20, ListComprehensions.hs:26:16,
ListComprehensions.hs:26:16-23,
ListComprehensions.hs:(26,16)-(27,22),
ListComprehensions.hs:26:21-23, ListComprehensions.hs:27:21-22,
<no location info>}
--------------------------------
[
(AK ListComprehensions.hs:1:1 AnnModule = [ListComprehensions.hs:6:1-6])
......@@ -71,7 +83,7 @@
(AK ListComprehensions.hs:(18,1)-(22,20) AnnFunId = [ListComprehensions.hs:18:1-16])
(AK ListComprehensions.hs:(18,1)-(22,20) AnnSemi = [ListComprehensions.hs:23:1])
(AK ListComprehensions.hs:(18,1)-(22,20) AnnSemi = [ListComprehensions.hs:24:1])
(AK ListComprehensions.hs:(18,20)-(22,20) AnnCloseS = [ListComprehensions.hs:22:20])
......@@ -111,6 +123,38 @@
(AK ListComprehensions.hs:21:27-34 AnnOpenS = [ListComprehensions.hs:21:27])
(AK <no location info> AnnEofPos = [ListComprehensions.hs:23:1])
(AK ListComprehensions.hs:24:1-27 AnnDcolon = [ListComprehensions.hs:24:8-9])
(AK ListComprehensions.hs:24:1-27 AnnSemi = [ListComprehensions.hs:25:1])
(AK ListComprehensions.hs:24:11-15 AnnCloseS = [ListComprehensions.hs:24:15])
(AK ListComprehensions.hs:24:11-15 AnnOpenS = [ListComprehensions.hs:24:11])
(AK ListComprehensions.hs:24:11-27 AnnRarrow = [ListComprehensions.hs:24:17-18])
(AK ListComprehensions.hs:24:20-27 AnnCloseS = [ListComprehensions.hs:24:27])
(AK ListComprehensions.hs:24:20-27 AnnOpenS = [ListComprehensions.hs:24:20])
(AK ListComprehensions.hs:(25,1)-(28,14) AnnEqual = [ListComprehensions.hs:25:12])
(AK ListComprehensions.hs:(25,1)-(28,14) AnnFunId = [ListComprehensions.hs:25:1-6])
(AK ListComprehensions.hs:(25,1)-(28,14) AnnSemi = [ListComprehensions.hs:29:1])
(AK ListComprehensions.hs:(25,14)-(28,14) AnnCloseS = [ListComprehensions.hs:28:14])
(AK ListComprehensions.hs:(25,14)-(28,14) AnnOpenS = [ListComprehensions.hs:25:14])
(AK ListComprehensions.hs:(25,14)-(28,14) AnnVbar = [ListComprehensions.hs:26:14])
(AK ListComprehensions.hs:26:16-23 AnnComma = [ListComprehensions.hs:27:14])
(AK ListComprehensions.hs:26:16-23 AnnLarrow = [ListComprehensions.hs:26:18-19])
(AK ListComprehensions.hs:(26,16)-(27,22) AnnThen = [ListComprehensions.hs:27:16-19])
(AK <no location info> AnnEofPos = [ListComprehensions.hs:29:1])
]
readFail042.hs:10:9:
readFail042.hs:9:9:
Unexpected transform statement in a list comprehension
Use TransformListComp
readFail042.hs:11:9:
readFail042.hs:9:9:
Unexpected transform statement in a list comprehension
Use TransformListComp
......
readFail043.hs:10:9:
readFail043.hs:9:9:
Unexpected transform statement in a list comprehension
Use TransformListComp
readFail043.hs:9:9:
Unexpected transform statement in a list comprehension
Use TransformListComp
readFail043.hs:9:9:
Unexpected transform statement in a list comprehension
Use TransformListComp
......@@ -9,18 +17,10 @@ readFail043.hs:10:23: Not in scope: ‘x’
readFail043.hs:10:25: Not in scope: ‘using’
readFail043.hs:11:9:
Unexpected transform statement in a list comprehension
Use TransformListComp
readFail043.hs:11:20: Not in scope: ‘by’
readFail043.hs:11:23: Not in scope: ‘x’
readFail043.hs:11:25: Not in scope: ‘using’
readFail043.hs:12:9:
Unexpected transform statement in a list comprehension
Use TransformListComp
readFail043.hs:12:20: Not in scope: ‘using’
......@@ -2,7 +2,7 @@
mc19.hs:10:31:
Couldn't match type ‘a’ with ‘[a]’
‘a’ is a rigid type variable bound by
a type expected by the context: [a] -> [a] at mc19.hs:10:26
a type expected by the context: [a] -> [a] at mc19.hs:10:10
Expected type: [a] -> [a]
Actual type: [a] -> [[a]]
In the expression: inits
......
......@@ -2,7 +2,7 @@
mc21.hs:12:26:
Couldn't match type ‘a’ with ‘[a]’
‘a’ is a rigid type variable bound by
a type expected by the context: [a] -> [[a]] at mc21.hs:12:9
a type expected by the context: [a] -> [[a]] at mc21.hs:11:9
Expected type: [a] -> [[a]]
Actual type: [[a]] -> [[a]]
In the expression: take 5
......
mc22.hs:10:9:
mc22.hs:9:9:
No instance for (Functor t) arising from a use of ‘fmap’
Possible fix:
add (Functor t) to the context of
......@@ -13,7 +13,7 @@ mc22.hs:10:9:
mc22.hs:10:26:
Couldn't match type ‘a’ with ‘t a’
‘a’ is a rigid type variable bound by
a type expected by the context: [a] -> [t a] at mc22.hs:10:9
a type expected by the context: [a] -> [t a] at mc22.hs:9:9
Expected type: [a] -> [t a]
Actual type: [t a] -> [t a]
Relevant bindings include foo :: [t [Char]] (bound at mc22.hs:8:1)
......
mc25.hs:9:24:
mc25.hs:9:10:
No instance for (Functor t1) arising from a use of ‘fmap’
Possible fix:
add (Functor t1) to the context of
......
......@@ -2,7 +2,7 @@
tcfail191.hs:11:26:
Couldn't match type ‘a’ with ‘[a]’
‘a’ is a rigid type variable bound by
a type expected by the context: [a] -> [[a]] at tcfail191.hs:11:9
a type expected by the context: [a] -> [[a]] at tcfail191.hs:10:9
Expected type: [a] -> [[a]]
Actual type: [[a]] -> [[a]]
In the expression: take 5
......
......@@ -2,7 +2,7 @@
tcfail193.hs:10:31:
Couldn't match type ‘a’ with ‘[a]’
‘a’ is a rigid type variable bound by
a type expected by the context: [a] -> [a] at tcfail193.hs:10:26
a type expected by the context: [a] -> [a] at tcfail193.hs:10:10
Expected type: [a] -> [a]
Actual type: [a] -> [[a]]
In the expression: inits
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment