Skip to content

C#/Java: build failure - duplicate name in enclosing local scope with valid and repeat #1275

@heinermann

Description

@heinermann

Version: 0.11

meta:
  id: csharp_dupename
seq:
  - id: v
    type: u1
    repeat: until
    repeat-until: _ == 255
    valid:
      expr: _ == 255 or _ <= 15

Generates the offending block where M_ is declared twice.

                byte M_;
                do {
                    M_ = m_io.ReadU1();
                    _v.Add(M_);
                    {
                        byte M_ = _v[i];
                        if (!( ((M_ == 255) || (M_ <= 15)) ))
                        {
                            throw new ValidationExprError(_v[i], m_io, "/seq/0");
                        }
                    }
                    i++;
                } while (!(M_ == 255));

With error: error CS0136: A local or parameter named 'M_' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter

EDIT: The same occurs for Java.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions