Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: false-positive downcast warnings #1114

Merged
merged 26 commits into from
Mar 18, 2024
Merged

fix: false-positive downcast warnings #1114

merged 26 commits into from
Mar 18, 2024

Conversation

mhasel
Copy link
Member

@mhasel mhasel commented Mar 1, 2024

Fixes false-positive downcast warnings on integrally promoted expressions. This is achieved by checking each element's type in the expression individually and comparing it to the resulting type rather than checking the expression's type as a whole and mirrors the behaviour of CodeSys.

resolves #828

Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 92.66055% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 95.63%. Comparing base (3e84974) to head (1b4cb0e).

Files Patch % Lines
src/validation.rs 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1114      +/-   ##
==========================================
+ Coverage   95.59%   95.63%   +0.04%     
==========================================
  Files         148      148              
  Lines       43500    43585      +85     
==========================================
+ Hits        41583    41684     +101     
+ Misses       1917     1901      -16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Fixes false-positive downcast warnings on integrally promoted expressions. This is achieved by checking
each element's type in the expression individually and comparing it to the resulting type rather than checking
the expression's type as a whole.
@mhasel mhasel marked this pull request as ready for review March 4, 2024 16:19
@mhasel mhasel marked this pull request as draft March 4, 2024 16:28
@mhasel mhasel marked this pull request as ready for review March 5, 2024 12:36
@mhasel mhasel requested review from ghaith, volsa and riederm March 5, 2024 13:30
these tests try to trick the validator to believe that a DINT updscale
is happening.
src/validation/statement.rs Outdated Show resolved Hide resolved
src/validation.rs Outdated Show resolved Hide resolved
@mhasel
Copy link
Member Author

mhasel commented Mar 18, 2024

@riederm when you get the chance, could you please take a look at the changes I've made since your last review?

Copy link
Collaborator

@riederm riederm left a comment

Choose a reason for hiding this comment

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

I think I need some clarification with the is_builtin_call flag in the context, rest of PR is good.

src/validation/statement.rs Outdated Show resolved Hide resolved
@mhasel mhasel merged commit b357a05 into master Mar 18, 2024
17 checks passed
@mhasel mhasel deleted the wrong-downcast branch March 18, 2024 12:52
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.

Wrong downcast warning
3 participants