Skip to content

No fix-it for mutation of function parameter #81308

Open
@AnthonyLatsis

Description

@AnthonyLatsis

Description

We could offer to declare a mutable var x = x copy above the failing expression below.

Reproduction

func f(x: Int) {
  x = 3
  x += 3
}

Expected behavior

Fix-it to declare a variable.

Environment

Swift version 6.2-dev (LLVM 736ebbfa5fe3371, Swift d033eec)

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationexpressionsFeature: expressionsfix-itsFeature: diagnostic fix-itsfunction parametersFeature → declarations: function parametersmutabilityFeature: storage mutabilityswift 6.2type checkerArea → compiler: Semantic analysis

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions