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
error: Expected type i32, found type str<5>
┌─ src/main.nr:92:9
│
92 │ unquote!(q);
│ -----------
Like that, it's impossible to understand how to fix the error.
Expected Behavior
Ideally the error points at exactly the "source location" of the error. I'm not sure how we can do that. But for example consider macros in Crystal:
macromy_macro(name)
{{name}} =1
{{name}}.length()
end
my_macro(x)
When we call my_macro that generates this code:
name =1
name.length()
The error Crystal gives is this:
There was a problem expanding macro 'my_macro'
Code in foo.cr:6:1
6 | my_macro(x)
^
Called macro defined in foo.cr:1:1
1 | macro my_macro(name)
Which expanded to:
> 1 | x = 1
> 2 | x.length()
^-----
Error: undefined method 'length' for Int32
The way Crystal does this is by associating the expanded macro location to a virtual location (and storing the virtual source). Then when an error happens in a virtual location its get the virtual source, shows it and shows the error.
I don't know if we could do the same, but it's just an idea.
Bug
The error cannot be understood without being able to see the generated source code.
To Reproduce
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Nargo Version
No response
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered:
Aim
Given this code:
We get this error:
Like that, it's impossible to understand how to fix the error.
Expected Behavior
Ideally the error points at exactly the "source location" of the error. I'm not sure how we can do that. But for example consider macros in Crystal:
When we call
my_macro
that generates this code:The error Crystal gives is this:
The way Crystal does this is by associating the expanded macro location to a virtual location (and storing the virtual source). Then when an error happens in a virtual location its get the virtual source, shows it and shows the error.
I don't know if we could do the same, but it's just an idea.
Bug
The error cannot be understood without being able to see the generated source code.
To Reproduce
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Nargo Version
No response
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: