Impossible type error involving Sexp
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 575
- Forks
- 106
- Avg merge
- 2h 1m
- Merged PRs (30d)
- 2
Description
What version of Racket are you using?
v6.12
What program did you run?
#lang typed/racket
(struct x ())
(struct y ([ x : (U #f x)]))
(: shrink-x (-> x Sexp))
(define (shrink-x a) 'x)
(: compile-y (-> y Sexp))
(define (compile-y y)
`(x ,(shrink-x (y-x y))))
What should have happened?
In the above program, the typechecker correctly catches the erroneous application of shrink-x to a value of type (U #f x).
However, it also produces a useless "impossible" type error. Since a (List 'x Sexp) is also an Sexp, its diagnosis expected: Sexp, given: (List 'x Sexp) must be incorrect.
It seems that only the first error should be reported.
If you got an error message, please include it here.
a.rkt:11:17: Type Checker: type mismatch
expected: x
given: (U False x)
in: (y-x y)
a.rkt:11:2: Type Checker: type mismatch
expected: Sexp
given: (List 'x Sexp)
in: (quasiquote (x (unquote (shrink-x (y-x y)))))
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the supplied #lang typed/racket program on v6.12 and inspect how the type checker handles the quasiquoted (x ...) expression. Done means the invalid (y-x y) application still reports its error without also reporting the spurious expected Sexp/given (List 'x Sexp) mismatch.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100