Skip to content

Parser: a parameter named it fails with "expected pattern" and no hint that it is reserved #2382

Closed

Description

@ehartford

Repro (installed compiler):\n\n\nfn f(it: i32) -> i32: it\n\nActual: error: expected pattern at the parameter. it is the pipeline/closure placeholder, so refusing it as a declared name is fine, but the diagnostic should say that — e.g. 'it is the implicit closure/pipeline parameter and cannot be declared'. The generic wording cost real debugging time twice: it made a trait bound (I: Iter[&T] with an (it: I) parameter) look unparseable in #2271, and again today while re-checking that issue (the bound parses fine once the parameter is renamed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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