File: bug001.ly

package info (click to toggle)
happy 1.18.9-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,024 kB
  • sloc: haskell: 6,327; xml: 3,388; yacc: 809; makefile: 263
file content (21 lines) | stat: -rw-r--r-- 402 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
> %name parse
> %tokentype { Token }
> %token Int { TokenInt }
> %%

> Expr :: { Int }
> Expr : Term { $1 }

The constant in the next rule would be defaulted to Integer, but it is
forced to Int by the type signature of Expr above.  This test exposed
a bug in the unsafeCoerce method.

> Term : Int { 42 }

> {
> main = print (parse [TokenInt])
> 
> data Token = TokenInt
> 
> happyError = error ""
> }