-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Labels
Description
Rigid variables can escape their scope:
#lang hackett
(def weird
(λ (x)
(: (λ (y) (if True x y))
(∀ (A) (-> A A)))))
;;;
> (#:type weird)
: (forall (A1618) {A9 -> A1618 -> A1618})Weird scenarios can arise when rigid variables escape their scope. Here, A9 refers to a out-of-scope rigid variable. It will fail to unify with anything else but it is clearly not bound by the final forall.
The algorithm in Complete and Easy Bidirectional Typechecking prevents this by keeping a close eye on the scopes of rigid and solver variables.