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
[CodeCompletion] Improve StmtCondition recovery for code-completion
In the condition expressions of if, while and guard statements we were
throwing away the AST if there was a parse error in the condition, or
the brace statement was missing. This led to poor code-completion for
unresolved members (enums, options sets) because we couldn't find the
parent expression to type-check.
There are a few minor diagnostic changes because we now do more
type-checking of these conditions, particularly if they end up
containing an unused closure.
SR-2001
Copy file name to clipboardExpand all lines: test/stmt/if_while_var.swift
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,10 @@ class B {} // expected-note * {{did you mean 'B'?}}
25
25
classD:B{}// expected-note * {{did you mean 'D'?}}
26
26
27
27
// TODO poor recovery in these cases
28
-
iflet{} // expected-error {{expected '{' after 'if' condition}}
29
-
iflet x ={} // expected-error{{'{' after 'if'}} expected-error {{variable binding in a condition requires an initializer}}
28
+
iflet{} // expected-error {{expected '{' after 'if' condition}} expected-error {{pattern matching in a condition requires the 'case' keyword}}
29
+
iflet x ={} // expected-error{{'{' after 'if'}} expected-error {{variable binding in a condition requires an initializer}} expected-error{{initializer for conditional binding must have Optional type, not '() -> ()'}}
0 commit comments