WI #2520 Check variables used in EVALUATE / WHEN#2834
Open
Conversation
fm-117
requested changes
Feb 17, 2026
TypeCobol.Test/Parser/Programs/Cobol85/EvaluateWhenCompatibility.PGM.txt
Outdated
Show resolved
Hide resolved
added 2 commits
February 18, 2026 11:22
Finou1404
previously approved these changes
Feb 18, 2026
fm-117
requested changes
Feb 20, 2026
Contributor
fm-117
left a comment
There was a problem hiding this comment.
I think we should simplify the grammar using a single definition for WHEN code elements whether they appear in EVALUATE or SEARCH.
- this should avoid odd cases where alphanumeric comparison variables/expressions are wrapped as
BooleanComparisonVariable
We should also improve the checks performed on ConditionalExpression as we'll have multiple visits
| var selectionSubject = selectionSubjects[index]; | ||
| var selectionObject = selectionObjects[index]; | ||
| ConditionChecker.CheckWhenStatement(evaluate, when, selectionSubject, selectionObject, index); | ||
| ConditionChecker.CheckWhenStatement(evaluate, when, selectionSubject, selectionObject, index + 1); |
Contributor
There was a problem hiding this comment.
Please add a comment explaining the + 1 on index.
fm-117
requested changes
Feb 20, 2026
| { | ||
| DataDefinition dataDefinition = node.GetDataDefinitionFromStorageAreaDictionary(storageArea, true); | ||
|
|
||
| return new SelectionInfo(dataDefinition?.DataType ?? DataType.Unknown); |
Contributor
There was a problem hiding this comment.
var dataType = dataDefinition?.DataType;
return dataType != null ? new SelectionInfo(dataType) : Unknown;
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.
Handles partially #2520 for statements EVALUATE and WHEN
Still TO DO :
Check that USAGE are compatible