Rejects puns in T2T
Consider this example
x = 42
f, g :: forall a -> ...
f (type x) = g x
The g x
function call is renamed as a term, so the x
refers to the top-level binding x = 42
, not to the type variable binding type x
, even though g
is expecting a type argument. Such behavior is well-defined, and GHC Proposal #281 goes to great lengths to specify it (see the "Resolved Syntax Tree" section). Nonetheless, users who are not intimately familiar with the compiler pipeline might find it surprising or confusing. We want a dedicated error message for such conflicts. So the proposal also says:
In the type checking environment, there should be no variable of the same name but from a different namespace, or else raise an ambiguity error (does not apply to constructors).
This ticket is to track the implementation of this side condition.