#:opaque allows passing higher-order values out with a flat contract, is unsound
Open
Nobody has claimed this yet.
unsound
- Dominant language
- Racket
- Stars
- 575
- Forks
- 106
- Avg merge
- 2h 1m
- Merged PRs (30d)
- 2
Description
This program errors in the typed module.
#lang racket
(module m1 racket
(provide f g)
(define (f x) #t)
(define (g x) (x 0)))
(module m2 typed/racket
(require/typed (submod ".." m1)
[#:opaque F f]
[g (F -> Any)])
(: fun : String -> String)
(define (fun z) (string-append "hi" z))
(if (f fun)
(g fun)
#t))
(require 'm2)
Possible solutions:
Fcould turn into(and/c any-wrap/c f)- we could generate some sort of cast at the site of the implicit upcast here (the call to
g). - ....
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
Run the Racket program in the issue to reproduce the unsound higher-order value flow. Start by tracing require/typed handling of #:opaque and the implicit upcast at the call to g. Done means the typed module no longer permits higher-order values to escape through a flat contract unsafely, with a sound behavior chosen and validated.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100