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

Make fromTo and friends return VWord when appropriate #1436

Merged
merged 1 commit into from
Sep 17, 2022
Merged

Conversation

RyanGlScott
Copy link
Contributor

Previous, fromTo and related functions would always return a VSeq. If the type happened to be a Bit, this would violate the internal invariant that sequences of Bits are always represented with VWords, leading to the panics observed in #1435. This patch fixes the issue by using the mkSeq smart constructor, which chooses between VWord and VSeq depending on the sequence type.

Fixes #1435.

Previous, `fromTo` and related functions would always return a `VSeq`. If the
type happened to be a `Bit`, this would violate the internal invariant that
sequences of `Bit`s are always represented with `VWord`s, leading to the panics
observed in #1435. This patch fixes the issue by using the `mkSeq` smart
constructor, which chooses between `VWord` and `VSeq` depending on the sequence
type.

Fixes #1435.
@RyanGlScott RyanGlScott requested a review from yav September 16, 2022 22:50
Copy link
Member

@yav yav left a comment

Choose a reason for hiding this comment

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

Looks good to me. Not for this PR, but I wonder how hard it would be to make the value type abstract, so that we ensure that this sort of bug doesn't happen. We could use pattern synonyms to expose just the patterns, not the constructors.

@RyanGlScott
Copy link
Contributor Author

Not for this PR, but I wonder how hard it would be to make the value type abstract, so that we ensure that this sort of bug doesn't happen.

I've opened #1437 for this.

@RyanGlScott RyanGlScott merged commit 4367eee into master Sep 17, 2022
@RyanGlScott RyanGlScott deleted the T1435 branch September 17, 2022 14:48
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.

Panic - not a word value ccatV left and ccatV right
2 participants