FStarLang / FStarLang/FStar

Effects on branches of a match

Open
#2,185 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
F*
Stars
3.1k
Forks
267
Avg merge
10h 45m
Merged PRs (30d)
54

Description

```fstar
val q : unit -> Dv unit
let q () = ()

let test () =
(match () with
| () -> q) ()
```
This fails and requires an annotation, but looks like it should just work. It's harder to provide a good annotation when `q` has two arguments.
```fstar
open FStar.All

assume val ff : int -> int -> ML int
assume val gg : int -> int -> ML int

let rw_test4 (b:bool) : ML int =
(match b with
| true -> ff
| false -> gg
) 100 200
```
```
FStar.All.ML int is not a subtype of the expected type Prims.Tot (*?u64*) _
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the two F* examples from the issue, beginning with the match expressions in test and rw_test4 and their reported type errors. Trace the compiler's effect inference for match branches and verify that both examples typecheck without the extra annotation while retaining the expected Dv unit and ML int types.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.