Repository navigation
Void-return function handling - #2933
Open
jbdoderlein wants to merge 4 commits into
Open
jbdoderlein wants to merge 4 commits into
jbdoderlein wants to merge 4 commits into
Conversation
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2933 +/- ##
=======================================
Coverage 45% 45%
+ Complexity 6814 6812 -2
=======================================
Files 844 844
Lines 68823 68846 +23
Branches 10038 10049 +11
=======================================
+ Hits 31429 31442 +13
Misses 35003 35003
- Partials 2391 2401 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.



This PR try to provide error for current interpreter and for the type checker to the use of void returning function where a value is expected, like variable initialization, keyword default field or string interpolation. This is exactly the error that happen in #2905 .
I tried to be exhaustive as possible on place where this could happen (one test for each in type checker), but maybe i forgot some case.
Interpreter
For the runtime, clear unexpected type is raised when a void would be used for initialization.
Example of current runtime behavior :
New behavior :
Type checker
I added/changed some check for void to handle these case, especially the overloaded function case : if any overloaded function would return void, an error is reported.