Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2020-01-01
18:29 • New ticket [7cc2239087] continuation lines \<newline> produce wrong line n... artifact: 3cfb0aa00e user: anonymous

continuation lines \<newline> produce wrong line numbers in tracebacks

Open7cc223908762351c613244a0914a2d13acf7cfd2Created 7 years agoUpdated 7 years ago
Descriptionplain2020-01-01 18:29:44
When using continuation lines with the \<newline> substitution
rule, it causes error trace-backs to have the wrong line numbers
and [info body] doesn't return the original script as is, but
only after the substitution, thus also affecting line numbers.

For example, this script

proc foo {args} {
	set bar [string repeat \
	"blah" \
	50]
	expr 1/0
}
foo

will report a divide by zero error on line 3 of foo, not line 5.
 
Also, [info body] will return the command changed as so:

	set bar [string repeat "blah" 50]

which can also affect the reporting of line numbers. 

The problem is likely that the saving of the script for a
proc is done after the \<newline> pre-process pass rather
than before. This probably causes traceback to miscount 
<newlines> while scanning the script text to find the line
in error.
Log in (anonymous is fine) to add a comment.