Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Maybe/else pattern erroneously triggering 'bound variable in pattern' error #1527

@eproxus

Description

@eproxus

Describe the bug
A Bound variable in pattern: Var error is generated for maybe expressions that bind a variable in their else patterns:

foo() ->
    maybe
        foo ?= bar()
    else
        e = Error -> Error
          % ^- Bound variable in pattern: Error
    end.

To Reproduce
Use the code above.

Expected behavior
No 'bound variable in pattern' hint is generated.

Actual behavior
A 'bound variable in pattern' hint is generated even though the variable is not already bound.

Context

  • erlang_ls version (tag/sha): Version: 0.52.0+build.1987.ref8700e96
  • Editor used: Zed v0.139.3
  • LSP client used: Zed v0.139.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions