Skip to content
Snippets Groups Projects
Commit 87058d73 authored by Vladislav Zavialov's avatar Vladislav Zavialov
Browse files

Ignore forall visibility in eqType (#22762)

Prior to this change, the equality relation on types took ForAllTyFlag
into account, making a distinction between:

	1. forall a.   blah
	2. forall a -> blah

Not anymore.

This distinction is important in surface Haskell, but it has no meaning
in Core where type abstraction and type application are always explicit.
At the same time, if we are not careful to track this flag, Core Lint
will fail, as reported in #22762:

	*** Core Lint errors : in result of TcGblEnv axioms ***
	From-kind of Cast differs from kind of enclosed type
	From-kind: forall (b :: Bool) -> *
	Kind of enclosed type: forall {b :: Bool}. *

The solution is to compare types for equality modulo visibility (ForAllTyFlag).
Updated functions:

	nonDetCmpType   (worker for eqType)
	eqDeBruijnType
	tc_eq_type      (worker for tcEqType)
	can_eq_nc

In order to retain the distinction between visible and invisible forall
in user-written code, we introduce new ad-hoc checks:

	checkEqForallVis       (in checking mode)
	cteForallKindVisDiff   (in inference mode)
parent 7612dc71
No related merge requests found
Pipeline #62772 passed
Showing
with 362 additions and 57 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment