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

Make the "has no type (or is ambiguous)" error a little more helpful #19654

Open
ijustlovemath opened this issue Mar 29, 2022 · 4 comments
Open

Comments

@ijustlovemath
Copy link

Summary

I'm brand new to Nim, and while using the "discard" keyword, I made some code changes where the procedure I called was no longer returning anything. This lead to the "has no type (or is ambiguous)" compiler error, which I now understand to mean "this procedure doesn't return anything, are you trying to discard its value, or assign the result to a variable? Consider dropping any use of the return value of this procedure."

Description

Maybe add some wording in to make it clear how to fix this fairly confusing error, which I took a whack at. If there are more situations where this crops up than just this one, it might be worth it to split this into a separate error?

Alternatives

Not making any changes to existing error messages.

Additional Information

Here's where I personally ran into this issue: euantorano/serial.nim#46 (comment)

@Araq
Copy link
Member

Araq commented Mar 29, 2022

Fair enough I guess.

@ijustlovemath
Copy link
Author

Like I said, I'm brand new to Nim and don't know the full scope under which this error message appears! But if it really only ever means "don't try to use the return value," that may be more helpful. Thanks for being open to feedback!

@distantforest1
Copy link

Also new and also just ran into this error and spent too long trying to figure out that the return function no longer returned anything since I made some modifications. I kept thinking the compiler was bugging out and couldn't find the proc for some reason. Since the phrasing "Has no type (or is ambiguous)" could mean the proc call itself, as in the proc is ambiguous and could not be found. Would be good to have a clearer error to distinguish say that the signature does not match or there is no return value that matches what is available, or something even clearer.

@Araq
Copy link
Member

Araq commented Nov 25, 2023

Well the "or" in the error message gives it away. The error message should be better, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants