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: Bitaccess for VAR_OUTPUT #1214

Merged
merged 34 commits into from
Jun 19, 2024
Merged

fix: Bitaccess for VAR_OUTPUT #1214

merged 34 commits into from
Jun 19, 2024

Conversation

volsa
Copy link
Member

@volsa volsa commented Apr 25, 2024

Resolves #1176

@volsa volsa force-pushed the output-bitaccess branch from aa33f84 to e6c4a73 Compare May 23, 2024 13:16
@volsa volsa force-pushed the output-bitaccess branch from e6c4a73 to 58cfcec Compare May 23, 2024 14:31
@volsa volsa force-pushed the output-bitaccess branch 2 times, most recently from a644e19 to e139df7 Compare May 27, 2024 11:19
@volsa volsa force-pushed the output-bitaccess branch from e139df7 to c2ef597 Compare May 27, 2024 13:43
@volsa volsa force-pushed the output-bitaccess branch from 3d55630 to efb36a9 Compare May 29, 2024 12:31
@volsa volsa marked this pull request as ready for review May 29, 2024 12:33
@volsa volsa force-pushed the output-bitaccess branch from efb36a9 to e809430 Compare June 3, 2024 07:30
@volsa volsa requested review from ghaith and mhasel June 3, 2024 07:31
Comment on lines +2833 to +2835
fn arguments_are_implicit(arguments: &[&AstNode]) -> bool {
!arguments.iter().any(|argument| argument.is_assignment() || argument.is_output_assignment())
}
Copy link
Member

@mhasel mhasel Jun 3, 2024

Choose a reason for hiding this comment

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

this might be problematic for #668, if we decide to allow it. Personally I am tending towards won't fix on that one, so not a show-stopper for me

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added a comment referencing #668

Copy link
Member

@mhasel mhasel left a comment

Choose a reason for hiding this comment

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

I like the solution of redirecting from the statement generator! Just have some open questions.

Comment on lines 682 to 689
// TODO: Can we this be simplified?
let rhs_type = {
let pou = self.index.find_pou(function_name).unwrap();
let pou_struct = &pou.find_instance_struct_type(self.index).unwrap().information;
let DataTypeInformation::Struct { members, .. } = pou_struct else { panic!() };

self.index.find_effective_type_by_name(&members[index as usize].data_type_name).unwrap()
};
Copy link
Member

Choose a reason for hiding this comment

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

are all these unwraps/panics intended or are they left over from prototyping?

Copy link
Member Author

Choose a reason for hiding this comment

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

Intended, because I'd argue these have to exist at codegen and otherwise expose a bug in our resolver / validator. Should I introduce a top-level comment / use expect to make it more transparent?

Copy link
Member

@mhasel mhasel Jun 6, 2024

Choose a reason for hiding this comment

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

I'm fine with the unwraps, I think these are just a matter of taste. I would change the panic into an unreachable if you want to convey that this branch is impossible to hit, otherwise make it a diagnostic.

tests/correctness/bitaccess.rs Show resolved Hide resolved
@volsa volsa requested a review from mhasel June 7, 2024 09:59
mhasel
mhasel previously approved these changes Jun 12, 2024
@volsa volsa merged commit c7f3d82 into master Jun 19, 2024
19 checks passed
@volsa volsa deleted the output-bitaccess branch June 19, 2024 13:51
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.

Cryptic codegen error when trying to assign boolean VAR_OUTPUT to specific bit of BYTE variable
3 participants