haskell / happy

The Happy parser generator for Haskell
Other
276 stars 84 forks source link

GHC cannot use --coerce #137

Closed int-index closed 5 years ago

int-index commented 5 years ago

Polymorphic non-terminals and --coerce don't play well together. As it stands, this is accepted, effectively coercing Int to Bool:

a :: { Bool }
   : n { $1 }

n :: { a }
  : { (0::Int) }

Besides the correctness issue, constraints don't work with --coerce either.

GHC cannot use --coerce because of this¹, suffering from a mild performance issue.

Please take a look at #134 which fixes the issue and adds a test case.

int-index commented 5 years ago

@simonmar, ping?