Skip to content

fix: add a validation for non-integer array bounds#1679

Merged
ghaith merged 8 commits intomasterfrom
PRG-2966
Apr 23, 2026
Merged

fix: add a validation for non-integer array bounds#1679
ghaith merged 8 commits intomasterfrom
PRG-2966

Conversation

@ghaith
Copy link
Copy Markdown
Collaborator

@ghaith ghaith commented Apr 17, 2026

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

Build Artifacts

🪟 Windows

Artifact Link Size
stdlib.lib Download 4.3 MB
stdlib.dll Download 0.1 MB
plc.exe Download 38.4 MB

From workflow run

🐧 Linux

Artifact Link Size
deb-x86_64 Download 38.4 MB
schema Download 0.0 MB
stdlib Download 32.4 MB
plc-x86_64 Download 43.6 MB
deb-aarch64 Download 30.9 MB
plc-aarch64 Download 43.5 MB

From workflow run

Comment thread src/validation/tests/array_validation_test.rs
Comment thread src/validation/types.rs Outdated
Comment on lines +145 to +146
matches!(expr.get_stmt(), AstStatement::Literal(AstLiteral::Integer(_)))
|| !matches!(expr.get_stmt(), AstStatement::Literal(_))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

((1)) will probably not work since you need to peel it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did some basic tests, it seems to be fine, but i'll push a followup with a peel

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or not there's a merge conflict anyway

Comment thread src/validation/types.rs
matches!(expr.get_stmt(), AstStatement::Literal(AstLiteral::Integer(_)))
|| !matches!(expr.get_stmt(), AstStatement::Literal(_))
} else {
type_info.is_int() && !type_info.is_bool() && !type_info.is_date_or_time_type()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a comment that bool and date/time are also resolved as integers in the type info hence the explicit check

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add in a followup

volsa
volsa previously approved these changes Apr 22, 2026
volsa
volsa previously approved these changes Apr 23, 2026
@ghaith ghaith enabled auto-merge April 23, 2026 08:31
@ghaith ghaith added this pull request to the merge queue Apr 23, 2026
Merged via the queue into master with commit ce9532b Apr 23, 2026
20 checks passed
@ghaith ghaith deleted the PRG-2966 branch April 23, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants