Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(define-type … (Instance X)) breaks when X is a parametric type synonym, since Racket 8.7 #1304

Open
capfredf opened this issue Feb 3, 2023 · 0 comments

Comments

@capfredf
Copy link
Sponsor Member

capfredf commented Feb 3, 2023

What version of Racket are you using?

8.8

What program did you run?

@scolobb reports on Discourse:

(define my-class%
  (class object%
    #:forall (A)
    (super-new)
    (init-field [x : A])
    (define/public (get-x) x)))

I can define a synonym for the type of this class and then use it like so:

(define-type (MyClass% A) (Class (field (x A)) (get-x (-> A))))
(: a (Instance (MyClass% Boolean)))
(define a (new (inst my-class% Boolean) [x #t]))

(define-type (MyClassInstance A) (Instance (Class (field (x A)) (get-x (-> A)))))

but the following type alias causes an error

(define-type (MyClassInstance A) (Instance (MyClass% A)))

What should have happened?

The type system shouldn't have complained.

If you got an error message, please include it here.

; Type Checker: parse error in type;
; expected a class type for argument to Instance
; given: (MyClass% A)
; in: (Instance (MyClass% A))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant