Skip to content

Diagnose vector type aliases used as unit fields - #2495

Merged
evantypanski merged 2 commits into
zeek:mainfrom
dedsec-terminal:fix/2445-vector-alias-diagnostic
Sep 15, 2026
Merged

evantypanski merged 2 commits into
zeek:mainfrom
dedsec-terminal:fix/2445-vector-alias-diagnostic

Conversation

@dedsec-terminal

@dedsec-terminal dedsec-terminal commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

We would previously abort with an internal compiler error when a type alias resolving to vector<T> was used as a unit parsing field.

This patch updates the validator to diagnose this as an invalid sequence syntax error instead of aborting, matching the diagnostic produced for direct vector<T> field syntax.

Closes #2445.

We would previously abort with an internal compiler error when a
type alias resolving to vector<T> was used as a unit parsing field.

This patch updates the validator to diagnose this as an invalid sequence
syntax error instead of aborting, matching the diagnostic produced for
direct vector<T> field syntax.

Closes zeek#2445.
Copilot AI lite review requested due to automatic review settings September 11, 2026 20:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codspeed

codspeed Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 43 untouched benchmarks


Comparing dedsec-terminal:fix/2445-vector-alias-diagnostic (5da9852) with main (a36b8c4)

Open in CodSpeed

@evantypanski evantypanski left a comment

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.

Thanks for the fix

is there a reason this keeps the validation with the same error in parser.yy? I would prefer they both go through the same validation, since they're diagnosing the same thing. Might be worth a bit larger change to get that to work if it doesn't currently.

Remove the duplicate parser-time diagnostic so direct vector fields and type aliases use the same validation path. Refresh the direct-syntax regression to exercise that validator without unrelated obsolete attributes.
@dedsec-terminal

dedsec-terminal commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Good point, thanks. I pushed 5da9852 to remove the parser-time diagnostic, so direct vector fields and aliases now go through the same validator path. I also refreshed the existing direct-syntax regression to remove obsolete &length parse errors, ensuring it exercises that shared validation.

@evantypanski evantypanski left a comment

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.

LGTM, thanks :)

Seems like soon this'll be due for a cleanup, it's been a while since that syntax was supported. This fixes the internal error so I'm happy with this as-is.

@evantypanski
evantypanski merged commit 02ee409 into zeek:main Sep 15, 2026
21 checks passed
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.

Internal error with vector<type> usage in unit field

3 participants