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
{{ message }}
Repository navigation
False error: comparing with a char literal other than a lowercase letter, digit or _ ('[', 'Z', ' ') is rejected as an invalid refinement expression #444
Impact: correct client code is rejected with a syntax error whenever it compares a char with a literal like '[', '{', ',', ' ' or 'Z', which is the everyday code of parsers and tokenizers. No annotations are involved. This is related to #398 (escaped literals such as '\r'), but it is broader: plain punctuation, the space and uppercase letters fail too.
Minimal reproducer
publicclassRepro {
staticintskipTo(Strings) {
inti = 0;
while (s.charAt(i) != '[')
i++;
returni;
}
}
The ones that pass are exactly the characters that can start an ID or an INT in RJ.g4, which has no char-literal token. That suggests the literal reaches the refinement parser as text. If so, '0' "passing" may also give it the value 0 rather than 48. I haven't checked that.
BufferedReaderin = newBufferedReader(newInputStreamReader(client.getInputStream()));
...
msg = "";
while ((tmp = in.readLine()) != null)
msg += tmp;
i = 0;
while (msg.charAt(i) != '[') // Syntax Error herei++;
The reader is used correctly, but the method can't be verified at all, so the typestate check of in never happens. JSON and CSV tokenizers (c == '{', c == ',', c == ' ') hit the same error.
Activity
Build char literals directly instead of parsing their text (#447)