You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strike VarDecls in Pattern Binding Initializers From Overloads
We would previously consider the VarDecls bound by a particular pattern
binding initializer context when performing overload resolution. This
would lead to circular validation. Validation was tacitly breaking the
cycle by returning an error type (but, crucially, not setting that
interface type). Instead, pre-reject circular candidates.
This greatly improves the diagnostic we emit here in truly circular
cases since we can ride on `UR_InstanceMemberOnType` to yield
struct PatternBindingWithTwoVars2 { var x = y, y = 3 }
// cannot use instance member 'y' within property initializer; property initializers run before 'self' is available
Copy file name to clipboardExpand all lines: test/decl/overload.swift
+16-8
Original file line number
Diff line number
Diff line change
@@ -571,23 +571,23 @@ enum SR_10084_E_8 {
571
571
}
572
572
573
573
enumSR_10084_E_9{
574
-
case A // expected-note {{found this candidate}} // expected-note {{'A' previously declared here}}
575
-
staticletA:SR_10084_E_9=.A // expected-note {{found this candidate}} // expected-error {{invalid redeclaration of 'A'}} // expected-error {{ambiguous use of 'A'}}
574
+
case A // expected-note {{'A' previously declared here}}
575
+
staticletA:SR_10084_E_9=.A // expected-error {{invalid redeclaration of 'A'}}
576
576
}
577
577
578
578
enumSR_10084_E_10{
579
-
staticletA:SR_10084_E_10=.A // expected-note {{found this candidate}} // expected-note {{'A' previously declared here}} // expected-error {{ambiguous use of 'A'}}
580
-
case A // expected-note {{found this candidate}} // expected-error {{invalid redeclaration of 'A'}}
case A // expected-error {{invalid redeclaration of 'A'}}
581
581
}
582
582
583
583
enumSR_10084_E_11{
584
-
case A // expected-note {{found this candidate}} // expected-note {{'A' previously declared here}}
585
-
staticvarA:SR_10084_E_11=.A // expected-note {{found this candidate}} // expected-error {{invalid redeclaration of 'A'}} // expected-error {{ambiguous use of 'A'}}
584
+
case A // expected-note {{'A' previously declared here}}
585
+
staticvarA:SR_10084_E_11=.A // expected-error {{invalid redeclaration of 'A'}}
586
586
}
587
587
588
588
enumSR_10084_E_12{
589
-
staticvarA:SR_10084_E_12=.A // expected-note {{found this candidate}} // expected-note {{'A' previously declared here}} // expected-error {{ambiguous use of 'A'}}
590
-
case A // expected-note {{found this candidate}} // expected-error {{invalid redeclaration of 'A'}}
0 commit comments