Fatal error: exception Failure("[mk_expr m]: op should've been caught")
- Dominant language
- OCaml
- Stars
- 519
- Forks
- 73
- Avg merge
- 2h 58m
- Merged PRs (30d)
- 1
Description
I was trying to write a test with a higher-order function (it won't work of course, I later realized), but it triggered a crash, so posting here
```fstar
module Op
module U32 = FStar.UInt32
// Type annotations only due to add being partially defined and F* otherwise inferring a Tot.
let ap2
(f : (x:U32.t -> y:U32.t ->
Pure U32.t (requires UInt.size (U32.v x + U32.v y) 32)
(ensures fun c -> U32.v c = U32.v x + U32.v y)))
x y :
Pure U32.t (requires UInt.size (U32.v x + U32.v y) 32)
(ensures fun c -> U32.v c = U32.v x + U32.v y)
= f x y
let main () =
let c : UInt32.t = ap2 FStar.UInt32.add 4ul 2ul in
if FStar.Int.Cast.uint32_to_int32 c = 6l
then 0l
else 1l
```
Removing the `ap2` makes it work. I guess failing here is fine, just maybe with a more benign error.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the crash with the supplied Op module and higher-order ap2 example. Trace the path that emits "[mk_expr m]: op should've been caught" and compare it with the behavior when ap2 is removed; done means the unsupported construct produces a benign diagnostic instead of a fatal exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100