Repository navigation
v4.0.1 #68
minirang
announced in
Announcements
v4.0.1
#68
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Description
Behavior change: the body of a block written on its own lines must be indented. A line after
if ... do:,else do:,loop ... do:,with ... do:,func ... do:,class ... do:or anor_elsehandler that is not one level deeper than the header was accepted before, becauseendalone closes a block; it is a syntax error (E2-001) now, and the hint says to indent the body one level deeper. A line indented deeper than the rest of its body is also rejected (unexpected indentation). Unchanged: a body that is empty (endorelseright after thedo:line), the one-line form (if x is 1 do: print("one") end), and the lines of a bracketed list, map or argument list. The examples, the tests and the documentation already followed the rule, so nothing in them changed.Changed: the error report. The message now sits beside the marks, the line carries its number, and the hint follows after a blank line:
The marks cover the whole token the error is about (a name, a number, a string, an operator) instead of one column.
cuffcandcuffshstill printERROR:before the first line, and the error code stays on the first line. An error with no source line to draw keeps the message on the first line. A program that reads the report (rather than the code) has to expect the new layout; the line and column on the first line are as before.Fixed: errors that pointed at the wrong place. A call is reported at the function's name and not at its
(, a member or method at its name and not at the., an unknown class insetat the type, a wrong value or a bad constant name at the variable's name, andchangeof a variable that does not exist at that variable. The same holds inside an f-string.Added: tests.
syntax_test.cppchecks the rule for each kind of block, with tabs, and for the cases that stay allowed;tests/errors/syntax/block_body_not_indentedis the error case.This discussion was created from the release v4.0.1.
All reactions