Lack of bidirectionality with records
Open
Nobody has claimed this yet.
- Dominant language
- F*
- Stars
- 3.1k
- Forks
- 267
- Avg merge
- 10h 45m
- Merged PRs (30d)
- 54
Description
noeq
type inj (t1 t2 : Type) = {
f : t1 -> t2;
}
let double (x:nat) : inj nat nat = {
f = (fun x -> x+1);
}
This fails with
- Subtyping check failed
- Expected type inj nat nat got type inj int int
The annotation on double should force the right instantiation for the implicits of the record constructor. Note this also fails even if we annotate that x is a nat:
- Subtyping check failed
- Expected type inj nat nat got type inj nat int
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
Start by running the two F* reproducer snippets and inspect how the record constructor instantiates its implicit types under the annotated return type. Trace the bidirectional type-checking path for the function field; done means both examples typecheck as inj nat nat without subtyping failures.
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