Skip to content

Diagnostics: match-binding shadowing error at 1:1; impl member loop silently ends at an unrecognized member line #1738

Closed

Description

@ehartford

Two diagnostics bugs met while testing D69 (gen-push-fixes); both reproduce on main's installed compiler.

  1. A match-arm binding that shadows a local is reported at 1:1 of the file instead of the pattern:
fn f() -> Result[i32, str]:
    Ok(1)
fn main:
    let v = 3
    match f():
        Ok(v) => print(f"{v}")
        Err(e) => print(e)
error: shadowing is not allowed for 'v' (bound earlier in this scope)
 --> r/shadow.w:1:1

(unused-label warnings in spec_ss13_5b_goto.w also point at 1:1.)

  1. The impl/extend member loop ends silently at a line it does not recognize, and the rest of the indented block is parsed as top-level declarations. Before 06957a94, impl W: followed by an indented gen fn upto() -> i32: produced "undefined variable self" and "unknown method 'upto'", never a parse error at the gen line. A member line the loop does not accept inside an indented body should be a parse error at that line.

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