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
illegal declarations should give error at declaration time, not later at instantiation time #3011
Comments
Yeah we know, duplicate of some other bug. |
BigBoneDaddy: Nope. |
As Araq points out, it seems the way the compiler is designed makes this difficult to catch at declaration time. As a compromise, maybe it's ok to have it detected at instantiation time, but create a better error message with more context information / better line numbers? This is not perfect, because a bad type declaration that is never used will never be caught, but that seems much less harmful than a bad type declaration that is used but the programmer is unable to debug. |
This issue has been automatically marked as stale because it has not had recent activity. If you think it is still a valid issue, write a comment below; otherwise it will be closed. Thank you for your contributions. |
Now it is even worse. It compiles since Nim v1.0 |
it compiles and the proc x return type is void. |
!nim c type
Type = ref object
context: ref object
type
Value = ref object
typ: Type
proc x(): Value =
nil |
@bung87 (collaborator) devel 👍 |
In the following snippet, context on line 3 has a bad type, but instead the compiler complains that line 9 is wrong:
test.nim(9, 18) Error: invalid type: 'object' in this context: 'proc (): Value'
- this is obviously very confusing! if Value is not used in the function declaration, no error at all is given!The text was updated successfully, but these errors were encountered: