c3lang / c3c

Compiler for the C3 language
https://c3-lang.org
GNU Lesser General Public License v3.0
3.01k stars 184 forks source link

Better backtrace? #1598

Closed sa-tasche closed 2 weeks ago

sa-tasche commented 3 weeks ago

Hello.

I stumbled upon the error @require "types::@comparable_value(a) && types::@comparable_value(b)" violated. The problem is that the triggering code is not mentioned.

lerno commented 3 weeks ago

What code triggered it?

sa-tasche commented 3 weeks ago

[!NOTE] I used c3c --test compile or c3c --test -C compile.

Anything like HashMap.set (...).

Different error but same problem.

I think the problem is just the error message does not show a backtrace.

lerno commented 3 weeks ago

Yes, so typically these should show a backtrace, the question is why they don't.

lerno commented 3 weeks ago

Oh, they do. You just used --test which only shows the error. If you run the same the normal way it works.

sa-tasche commented 2 weeks ago

Yes, that is correct. Is there no documentation for the compiler flag? From that point of view[^1] it is practical, but unfortunately not as I thought. If I only want to test individual files, it is practical if I also know the location of the trigger.

[^1]: If it is used by an editor or IDE (language-server).

lerno commented 2 weeks ago

What are you using --test for? The primary use is for the compiler test suite.

sa-tasche commented 2 weeks ago

It is used by c3-lsp. And this is used by the vs-code extension.

lerno commented 2 weeks ago

Yes, well then that is a question for the c3-lsp to request support, and presumably a special mode. --test will only show this one error. Even if --test would show the trace, c3-lsp would not be able to put them together because there isn't such a concept.

lerno commented 2 weeks ago

c3-lsp should get its own json output to use on errors, in that case this would be simple enough to add.