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
Describe the bug
When Amber shows a code based error message, for example caused by a syntax error, it terminates the last line:
hwalters@Ghostwheel ~/git/amber (master)
$ amber glob.ab
ERROR Function 'glob' does not exist
at glob.ab:4:20
3|
4| loop file in trust glob("*.txt") {
5| echo "Found file {file}"
hwalters@Ghostwheel ~/git/amber (master)
However, when it shows a text error message, for example caused by a missing source file, it does not:
hwalters@Ghostwheel ~/git/amber (master)
$ amber missing.ab
ERROR No such file or directory (os error 2)hwalters@Ghostwheel ~/git/amber (master)
To Reproduce
Run Amber from the command line, with arguments as above.
Expected behavior
Amber should terminate the last line in both cases.
Additional context
I tracked this down to Message::show() in the Heraclitus compiler:
pub fn show(&self) {
// If this error is based in code
if !self.trace.is_empty() {
Logger::new(self.kind.clone(), &self.trace)
.header(self.kind.clone())
.line(self.message.clone()) // <=================== Logger::line() calls eprintln!()
.path()
.snippet(self.code.clone())
.line(self.comment.clone());
}
// If this error is a message error
else {
Logger::new(self.kind.clone(), &self.trace)
.header(self.kind.clone())
.text(self.message.clone()) // <=================== Logger::text() calls eprint!()
.padded_line(self.comment.clone());
}
}
The text was updated successfully, but these errors were encountered:
Describe the bug
When Amber shows a code based error message, for example caused by a syntax error, it terminates the last line:
However, when it shows a text error message, for example caused by a missing source file, it does not:
To Reproduce
Run Amber from the command line, with arguments as above.
Expected behavior
Amber should terminate the last line in both cases.
Additional context
I tracked this down to
Message::show()
in the Heraclitus compiler:The text was updated successfully, but these errors were encountered: