-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationgood first issueGood for newcomersGood for newcomers
Description
Previous ID | SR-10295 |
Radar | rdar://problem/45572606 |
Original Reporter | @xedin |
Type | Bug |
Status | In Progress |
Resolution |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, DiagnosticsQoI, StarterBug |
Assignee | @theblixguy |
Priority | Medium |
md5: 350070c7174a52610d975e704164ed3e
relates to:
- SR-1846 "Variable used in its own initial value" error when using a function (not a variable) of the same name
Issue Description:
Consider following example:
struct S {
func foo(x: Int) {}
func bar() {
let foo = foo(x: 42)
}
}
It produces following error:
variable used within its own initial value
Which doesn't really make much sense, instead it should produce an error which suggests to add `self.` before method or variable use e.g. `let foo = self.foo(x: 42)`
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationgood first issueGood for newcomersGood for newcomers