Skip to content

Scoping bug with patterns in binders #4040

@mtzguido

Description

@mtzguido
type box t = | Box of t

let unbox (Box x) = x

let works (Box a : box int) (Box x : box int {x > 0}) : pos = x
let fails (Box a : box int) (Box x : box int {a + x > 0}) : pos = a+x

The last definition fails pointing to the a in the refinement with:

* Error 230 at Parsing.fst(8,46-8,47):
  - Variable "a" not found

This also fails the same way:

let fails (Box a : box int) (_ : unit {a > 0}) : pos = a

And this one fails more interestingly:

let fails (Box a : box int) (_ : squash (a > 0)) : pos = a
* Error 189 at Parsing.fst(8,41-8,42):
  - Expected expression of type Prims.int got expression a of type box Prims.int
  - See also Parsing.fst(8,11-8,16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions