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

Rework IndexValueToU64 to allow more inputs to BigInts #86

Merged
merged 2 commits into from
Oct 3, 2024
Merged

Conversation

bvisness
Copy link
Collaborator

@bvisness bvisness commented Oct 2, 2024

Because IndexValueToU64 did not use ToBigInt, other values that could normally be converted to BigInt (such as strings and booleans) were not allowed. Unfortunately resolving this is impossible while using a WebIDL union of numeric type and bigint. This PR changes the WebIDL type to any, and changes IndexValueToU64 to accommodate this and preserve the [EnforceRange]-inspired semantics.

Resolves #85.

@bvisness bvisness requested a review from backes October 2, 2024 16:28
@bvisness bvisness self-assigned this Oct 2, 2024
Copy link
Member

@backes backes left a comment

Choose a reason for hiding this comment

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

Thanks, this looks like the right semantics! One comment for potential simplification, otherwise LGTM.

But someone more knowledgeable about WebIDL should take a look :)

document/js-api/index.bs Outdated Show resolved Hide resolved
Copy link
Contributor

@Ms2ger Ms2ger left a comment

Choose a reason for hiding this comment

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

Thanks. This is not fantastic, but probably the best we can do.

document/js-api/index.bs Show resolved Hide resolved
document/js-api/index.bs Outdated Show resolved Hide resolved
document/js-api/index.bs Outdated Show resolved Hide resolved
@bvisness bvisness merged commit c157e61 into main Oct 3, 2024
7 checks passed
@bvisness bvisness deleted the tobigint branch October 3, 2024 19:36
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.

Should IndexValueToU64 use ToBigInt64?
3 participants