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

feat: give access to the program result type definition #262

Merged
merged 5 commits into from
May 31, 2023

Conversation

fuchsnj
Copy link
Member

@fuchsnj fuchsnj commented May 31, 2023

closes: #240

The type definition of both the result and target of VRL programs is known, but only the target was exposed to users. This gives access to both. It is a minor breaking change.

This is useful for things such as Vector VRL conditions to be able to verify at compile time that programs return a boolean. It will also help with fuzz testing.

let type_state = result.program.final_type_state();
let expected_kind = type_state.external.target_kind();
let type_state = result.program.final_type_info();
let expected_kind = type_state.state.external.target_kind();
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking nit: another ...state.state call here that looks awkward.

@fuchsnj fuchsnj enabled auto-merge (squash) May 31, 2023 18:23
@fuchsnj fuchsnj merged commit 2bbe672 into main May 31, 2023
@fuchsnj fuchsnj deleted the fuchsnj/result_typedefinition branch May 31, 2023 18:26
itkovian pushed a commit to itkovian/vrl that referenced this pull request Jun 1, 2023
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.

Program doesn't give the type definition of the program result
2 participants