In a grammar with a union declaration, an action is referencing a Yacc symbol value that does not have a type associated with it.
Use %type type rule to assign a type to a rule, or %token type tokenname to assign a type to a token. Alternatively, you can use explicit types within the action, in the form $\fItypen.