-
-
Notifications
You must be signed in to change notification settings - Fork 715
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
Cyclic Type Checking #1
Comments
use a stack when you start into creating a type that not concrete yet, then each time you find a type used by value that's also not concrete (size unknown) walk up the stack and check if it is recursing and if not then push the new typ on the stack and finalize it once you are done finalizing pop it off the stack. That or a loop counter that when it reaches some high enough value (like the total number of struct types visible in that scope) creates an error. |
I've just implement a (crude) cyclic type checking system by calculating the alignment or size of the type and keeping a path of the types. If that type is already in that path, an error will be printed of the illegal declaration cycle. The cyclic checking should be done in the entity declaration stage but this works for now and is simpler to implement. |
Fix syntax error in core/os/os_linux.odin
Merge pull request #724 from Skytrias/master
At the moment, there is no cyclic type checking and if a type has a cyclical definition, it will cause the compiler to go into an infinite loop.
Examples:
The text was updated successfully, but these errors were encountered: