`value-contract` is sometimes wrong with collapsibles
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 5.2k
- Forks
- 698
- Avg merge
- 18h 34m
- Merged PRs (30d)
- 5
Description
What version of Racket are you using?
8.2
What program did you run?
(define my-arrow/c
(make-contract
#:name 'my-arrow/c
#:projection
(λ (blm)
(λ (val)
(chaperone-procedure
val
values
impersonator-prop:contracted
my-arrow/c)))))
(define/contract (foo x)
(and/c my-arrow/c (-> integer? integer?))
x)
(value-contract foo)
What should have happened?
Should output (-> integer? integer?) since the second conjunct's wrapper is on the outside. Instead, you get #<contract: my-arrow/c>.
Please include any other relevant details
Within value-contract there is a cond that determines which property to use to retrieve the contract. We get this behavior since collapsibles don't actually set impersonator-prop:contracted and because of the way those cond arms are ordered.
It seems like setting impersonator-prop:contracted would be the right fix here, although given how this code is written, there might be some reason why that's not being done already.
Contributor guide
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 Racket program first, then read racket/collects/racket/contract/private/guts.rkt around the value-contract cond and racket/collects/racket/contract/private/arrow-higher-order.rkt around line 659. Trace how collapsibles expose contract properties and verify that value-contract selects the outer arrow contract rather than my-arrow/c. Done means the example reports (-> integer? integer?).
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100