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

Add ability to cast to type #4980

Merged
merged 1 commit into from
Jan 15, 2024
Merged

Add ability to cast to type #4980

merged 1 commit into from
Jan 15, 2024

Conversation

mattnibs
Copy link
Collaborator

Closes #4714

@mattnibs mattnibs requested a review from a team January 11, 2024 19:41
Comment on lines 1 to 15
zed: 'yield type(this)'

input: |
"<int64>"
"<{x:string}>"
"1"
1.

output: |
<int64>
<{x:string}>
error({message:"cannot cast to type",on:"1"})
error({message:"cannot cast to type",on:1.})
Copy link
Member

Choose a reason for hiding this comment

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

Put these tests in TestCasts in runtime/expr/expr_test.go so they're with the bulk of the other cast tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually think it's toss up between whether there are more cast tests in expr_test or in the ztests directory. Personally I think its easier to find tests if they're ztests rather than buried in go tests. I kind of rather see that we move the tests in expr_test into ztests.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree. Much prefer ztests and remember fighting expr_test when we made changes. At some point we should have a better way to ztest lots of different combos of things in one file.

runtime/expr/cast.go Outdated Show resolved Hide resolved
runtime/expr/cast.go Outdated Show resolved Hide resolved
@mattnibs mattnibs merged commit e87d3e8 into main Jan 15, 2024
3 checks passed
@mattnibs mattnibs deleted the cast-type branch January 15, 2024 17:43
nwt added a commit that referenced this pull request Jan 15, 2024
nwt added a commit that referenced this pull request Jan 15, 2024
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.

Cast to "type" type
3 participants