Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locational error reporting #142

Open
olwmc opened this issue Feb 25, 2022 · 3 comments
Open

Locational error reporting #142

olwmc opened this issue Feb 25, 2022 · 3 comments
Labels
enhancement Features that are directly related to the core tenet of Asteroid

Comments

@olwmc
Copy link
Collaborator

olwmc commented Feb 25, 2022

Consider the program:

function foo 
    with x:%integer do
        return 1.
    end

foo "string!".

Running this would return the error Error: <path>: 2: none of the function bodies unified with actual parameters

A nicer way of displaying errors would be something like this:

Error: <path>: 2: none of the function bodies unified with actual parameters

foo "string!".
^ 
@olwmc olwmc added the enhancement Features that are directly related to the core tenet of Asteroid label Feb 25, 2022
@lutzhamel
Copy link
Collaborator

lutzhamel commented Feb 25, 2022

Yes! Actually even better,

Error: <path>: 2: none of the function bodies unified with actual parameters

foo "string!".
 .....^

where it points to the offending token or structure.

I really don't like that error message, only folks who know about our semantics can understand that message. What would be a could general error message to post here? Something like,

Error: <path>: 2: actual argument not recognized.

foo "string!".
.....^

Any other suggestions?

@olwmc
Copy link
Collaborator Author

olwmc commented Feb 25, 2022

I think that works well! While writing this issue I was thinking the same thing. I'll add it to #126

@lutzhamel lutzhamel added this to the Release 1.1.0 milestone May 28, 2022
@lutzhamel lutzhamel removed this from the Release 1.1.0 milestone Aug 6, 2022
@lutzhamel
Copy link
Collaborator

in 1.1.4 the generated error message reads

lutz$ asteroid loc.ast
traceback (most recent call last):
loc.ast: 1: calling <toplevel>
loc.ast: 6: calling foo
error: loc.ast: 2: actual argument 'string!' not recognized by function 'foo'
lutz$ 

which is an improvement.

However, because recognizing an actual argument is pattern matching and therefore computation the error message is pointing into the function code rather than to the call site. Should we fix that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Features that are directly related to the core tenet of Asteroid
Projects
None yet
Development

No branches or pull requests

2 participants