match macro: list-no-order loses type information on bound variables
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- compilers
Research direction
Start by running the supplied #lang typed/racket reproducer and compare it with the working list pattern. Investigate the match macro's list-no-order handling of the bound variable x. Done means the original program typechecks and outputs 5 without an explicit type annotation.
Written by the indexing model from the issue text.
Description
What version of Racket are you using?
v6.12
What program did you run?
#lang typed/racket
(: id (-> Integer Integer))
(define (id x) x)
(match '(5)
((list-no-order (? integer? x)) (id x)))
What should have happened?
The program should output 5.
If list-no-order is changed to list, the program typechecks successfully.
If you got an error message, please include it here.
a.rkt:7:38: Type Checker: type mismatch
expected: Integer
given: Any
in: x
Normally, changing x to #{x : Integer} works around issues with the match macro, but this is not available here:
a.rkt:6:0: Type Checker: Polymorphic function `car' could not be applied to arguments:
Types: (Pairof a b) -> (a : ((! (car (0 0)) False) | (: (car (0 0)) False)) : (car (0 0)))
(Listof a) -> a
Arguments: (Listof Any)
Expected result: Integer
- Dominant language
- Racket
- Stars
- 575
- Forks
- 106
- Avg merge
- 2h 1m
- Merged PRs (30d)
- 2
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.
More from racket/typed-racket
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
racket/typed-racket#1512 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
racket/typed-racket#1505 · 13 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
racket/typed-racket#1516 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
racket/typed-racket#1506 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
racket/typed-racket#1493 · 1 comment ·
All issues in racket/typed-racket
Similar issues
-
mlir
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
llvm/llvm-project#224908 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
area-CodeGen-coreclr untriaged
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
secondlife/sl-vscode-plugin#147 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
objectionary/phie#149 ·