contracts for "overlapping" parametric types
Open
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?
6.7
6.10.1
head
What program did you run?
#lang typed/racket/base
(require/typed racket/base
((values id)
(All (A) (-> (Un (Vectorof (Pairof Boolean A))
(Vectorof (Pairof String A)))
Any))))
((inst id Symbol) (make-vector 1 (cons #true 'A)))
What should have happened?
No error
If you got an error message, please include it here.
id: contract violation;
none of the branches of the or/c matched
given: '#((#t . A))
in: the 1st argument of
(parametric->/c
(A4)
(->*
((or/c (vectorof ...) (vectorof ...)))
()
(values g10)))
contract from: (interface for id)
Thoughts
- this should succeed because only one of the 2 or/c clauses could possibly match.
- related to: https://groups.google.com/forum/#!topic/racket-users/xJlDo2KKY2I
- 6.10.1 accidentally fixes this for HashTable by merging the types into a contract for
(HashTable (U Boolean String) A). (But #575 reverts that fix.) I guess we could use that "merging" solution but it would better to remove all merging instead of adding more.
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 with the typed/racket/base reproduction in the issue and inspect how require/typed generates contracts for the overlapping parametric vector types. Confirm the behavior across the listed Racket versions and related HashTable case; done means the shown call succeeds without a contract violation while preserving correct contract checking.
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
- 35/100