Editorial: Fix omitted return types of functions that can return empty #3434
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.
Certain functions may return
~empty~
, though this is not always reflected in the return type. Each identified error is presented alongside specific code examples, where scenarios include the presence of~empty~
values.All of these errors were discovered using ESMeta, so executing the provided code in ESMeta may help obtain a detailed execution path(Also note that some of the codes only compile in the dev branch).
Fixed functions
LabelledEvaluation
LabelledEvaluation of LabelledItem with argument newLabelSet can return
~empty~
because of the break statement, the return value can be~empty~
.Scenario:
Details (ESMeta)
CatchClauseEvaluation
The Completion(Evaluation of Block) could result in
~empty~
. Since it flows into B and returns immediately, the return type should account for~empty~
.Scenario:
Note that each line corresponds to the bug in the details.
Details (ESMeta)
EvaluateFunctionBody
Since the evaluation of a single block is an
~empty~
, an evaluation of the FunctionStatementList can be~empty~
too.Scenario:
Details (ESMeta)
EvaluateClassStaticBlockBody
Similar to EvaluateFunctionBody, this function can return
~empty~.
Scenario:
Details (ESMeta)