[WIP] Typecheck procedure signatures + Various changes#1420
Open
Pieter12345 wants to merge 10 commits into
Open
[WIP] Typecheck procedure signatures + Various changes#1420Pieter12345 wants to merge 10 commits into
Pieter12345 wants to merge 10 commits into
Conversation
- Prevent injected `@arguments` variable overwriting an explicitly declared procedure parameter named `@arguments`. - Initialize procedure varargs parameter with an empty array if it matches no arguments. Prevents varargs parameter value being `CNull.UNDEFINED` when it has no matching arguments.
Generate compile error for missing return statements in any code path of non-void procedure code.
- Forward `null` return type during typechecking when the function won't return at all. - Return least specific type among possible return types in control flow functions with multiple possible outcomes. These essentially need to return a multi-type CClassType, but this is the best we can do in the current code base without introducing harm.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
@argumentsvariable overwriting an explicitly declared procedure parameter named@arguments.CNull.UNDEFINEDwhen it has no matching arguments.getReturnType()in control flow manipulating functions.WIP
This PR is marked as work-in-progress for the following reasons that should be addressed before merging:
dor()anddand()typechecking implementation needs to be implemented in order to prevent missing return errors for returns within them that are guaranteed to run.