Skip to content

Compiler warning when using a variable bound in assert_receive #2798

@alco

Description

@alco

The following code causes the compiler to emit a warning:

assert_receive {:ok, num}  # line 10
assert ^num = 13           # line 11
test/exunit_export_test.exs:11: warning: variable num@1 exported from 'receive' (line 10)

Example repo with 2 tags: warning and no-warninghttps://github.com/alco/ex_unit-warning-exported-var

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions