Skip to content

fix: preprocess property datatypes#1696

Open
volsa wants to merge 2 commits intomasterfrom
vosa/preprocess-properties
Open

fix: preprocess property datatypes#1696
volsa wants to merge 2 commits intomasterfrom
vosa/preprocess-properties

Conversation

@volsa
Copy link
Copy Markdown
Member

@volsa volsa commented Apr 23, 2026

Pre-process property datatypes such that they can be queried by the index and used in the valdiation.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 23, 2026

Build Artifacts

🐧 Linux

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

From workflow run

🪟 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

@volsa
Copy link
Copy Markdown
Member Author

volsa commented Apr 23, 2026

@codex code review this

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f73569d09

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/validation/types.rs Outdated
Comment thread compiler/plc_ast/src/pre_processor.rs
@volsa
Copy link
Copy Markdown
Member Author

volsa commented Apr 23, 2026

@codex re-review the changes

@volsa volsa force-pushed the vosa/preprocess-properties branch from 7f73569 to 81a9c88 Compare April 23, 2026 12:39
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f73569d09

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/validation/types.rs Outdated
Comment thread src/validation/types.rs Outdated
Comment on lines +277 to +281
&& types_match(
index,
index.get_effective_type_or_void_by_name(left_inner),
index.get_effective_type_or_void_by_name(right_inner),
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Break recursive types_match cycles

types_match recurses through pointer/array/struct inner types without any visited-pair guard, so comparing isomorphic recursive types can recurse indefinitely and overflow the stack during validation. A concrete case is two distinct recursive structs (A containing pointer to A, B containing pointer to B) encountered in signature comparison; each step keeps re-entering types_match(A, B) through the pointer branch. Track visited (left,right) type-name pairs (or short-circuit on repeats) before recursing.

Useful? React with 👍 / 👎.

Comment thread src/validation/pou.rs Outdated
let l_type_info = left.get_type_information();
let r_type_info = right.get_type_information();
if l_type_info == r_type_info {
if types_match(self.context.index, left, right) {
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.

The fast path logic of types_match seems to match the same match-arm pairs that validate_types does to emit diagnostics if the types do not match.

Specifically, the Pointer and SubRange arms seem to re-implement the recursive unwrapping that types_match already does.

Does that mean we have to keep them both in sync about what classifies as a matching type now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I refactored a bit given this was sloppy work from the LLM. I created a generic are_equal_types function which currently is being used for properties only. I plan to eventually integrated it for other validations as well, such that we do not need to maintain >1 locations with duplicated logic.

@volsa volsa force-pushed the vosa/preprocess-properties branch from 78de3a5 to ddf205e Compare April 24, 2026 10:25
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