-
Notifications
You must be signed in to change notification settings - Fork 326
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
Can we try reporting a more relevant error if autoscope constructor meets missing type annotation? #10147
Comments
If I modify the main =
foo (..A)
bar (..A) and execute the program, the error is:
which is far more verbose than the error message provided by you @radeusgd. From that I'd conclude the problem isn't in the error, but in the way p = Panic.recover Any <| some_action
IO.println p.to_text formats it. I don't think the problem has much to do with compiler. Passing to libraries. |
We have a misunderstanding here. I'm aware that My issue was: the error To do so we need to distinguish an unresolved method call on an Either way we need either:
|
I guess it is enough to just change |
Jaroslav Tulach reports a new STANDUP for yesterday (2024-06-25): Progress: - #10147 fixed by merging: #10328
|
Repro showing the problem/context:
Currently yields:
What I can see from this is that the
No_Such_Method
instance seems to 'see' that this is not any function but that this is in fact an instance of an autoscoped constructor. Thus it seems likely that we could report a more relevant error for it.We could for example report something along the lines of 'Calling a method on an autoscoped constructor that was not resolved. Probably missing a type annotation. Please add the annotation or use the qualified name.'. This would tell the user much more clearly what happened and what they can do to fix it.
Of course this is not a made up problem - I've been encountering it in several places in std-lib. We are slowly moving towards using autoscoping, especially for
on_problems
. I've tried using..Report_Error
as an argument, but some of our older functions were not yet updated to contain theon_problems : Problem_Behavior
type annotation - thus the autoscoping was not kicking in and I was getting errors like:Of course we also need to 'just' update our stdlib with missing annotations to make it work. But I think it is useful to still improve the error reporting as we may always miss some places. It will also help with places where autoscoping was not expected (places expecting
Any
, likefill_missing
etc.) but the user did not know and used it anyway. Or in user-made libraries.The text was updated successfully, but these errors were encountered: