Skip to content

linear lambda claims to consume unrelated binder #364

@MarcelineVQ

Description

@MarcelineVQ

Idris 2, version 0.1.0-b617cae88

Steps to Reproduce

foo1 : (1 f : (1 x : a) -> b) -> Maybe Char
foo1 f = Just 'c' >>= (\arr => ?foo1_rhs)

foo2 : (1 f : (1 x : a) -> b) -> Maybe Char
foo2 f = Just 'c' >>= (\1 arr => ?foo2_rhs)

Examine hole foo1_rhs and foo2_rhs

Expected Behavior

Both holes should have 1 f : (1 x : a) -> b and foo2_rhs should additionally have 1 arr : Char

Observed Behavior

foo2_rhs has 1 arr : Char but also has 0 f : (1 x : a) -> b
f is shown as having been consumed, which is incorrect as I understand it.
But further, this is not actually the case, as:

foo2 : (1 f : (1 x : a) -> b) -> Maybe Char
foo2 f = Just 'c' >>= (\1 arr => Just arr)

will give a correct error of There are 0 uses of linear name f. Meaning that f isn't really consumed but just being wrongly reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions