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
typesanitizer opened this issue
Dec 13, 2020
· 2 comments
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfparserArea → compiler: The legacy C++ parser
I would have expected the expected_rbrace_in_getset diagnostic to fire on missing a closing brace, but I don't see any test cases for it, and I can't figure out how to exercise that code path. Looks like the parsing code in parseGetSet doesn't recover gracefully in the presence of unbalanced braces. For example, the compiler trips up at the following two examples but it doesn't trigger expected_rbrace_in_getset :
structS {
varx : Int {
get { 0
}
}
// expected '}' in struct
and it also trips up on seeing other things:
structT {
varx : Int {
get { 0
}
funcf() {}
//^ expected 'get', 'set', 'willSet', or 'didSet' keyword to start an accessor definition
}
I understand that this is difficult to get right in the general case, but it would be nice to have a test case for the diagnostic, as well as have it fire more often.
The text was updated successfully, but these errors were encountered:
I guess one simple way of trigger it is to not have a closing brace immediately after. But still, this needs some tests and arguably some better handling...
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfparserArea → compiler: The legacy C++ parser
Additional Detail from JIRA
md5: b6e0e3b7b6cb09db588ec657fa874d07
Issue Description:
I would have expected the
expected_rbrace_in_getset
diagnostic to fire on missing a closing brace, but I don't see any test cases for it, and I can't figure out how to exercise that code path. Looks like the parsing code inparseGetSet
doesn't recover gracefully in the presence of unbalanced braces. For example, the compiler trips up at the following two examples but it doesn't triggerexpected_rbrace_in_getset
:and it also trips up on seeing other things:
I understand that this is difficult to get right in the general case, but it would be nice to have a test case for the diagnostic, as well as have it fire more often.
The text was updated successfully, but these errors were encountered: