Quasisyntax inconsistently infers "Syntaxof Any" vs. Syntax
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
(: x Symbol)
(define x 'x)
(: f (-> Syntax Any))
(define (f x) (syntax->datum x))
(f #`#,x) ; Syntax, prints as 'x
(f #''x) ; Syntax, prints as ''x
(f #`(quote #,x)) ; Syntaxof Any, prints as ''x
What should have happened?
In the third call to f, the argument is inferred as Syntaxof Any. This can be narrowed to Syntax, as evidenced by the second call, which represents the same value but has a narrower type.
The corresponding S-expression version compiles:
#lang typed/racket
(: x Symbol)
(define x 'x)
(: f (-> Sexp Any))
(define (f x) x)
(f `,x)
(f ''x)
(f `(quote ,x))
If you got an error message, please include it here.
a.rkt:11:5: Type Checker: type mismatch
expected: Syntax
given: (Syntaxof Any)
in: (quote (unsyntax x))
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
Start by running the provided typed/racket reproducer and comparing the three quasisyntax calls with the corresponding S-expression examples. Trace how the type checker infers the third call's argument; done means it is accepted where Syntax is expected without changing the intended inferred types of the other examples.
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
- 38/100