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

PropertyKey does not accurately check conversions from Strings #183

Open
aapoalas opened this issue May 14, 2024 · 0 comments
Open

PropertyKey does not accurately check conversions from Strings #183

aapoalas opened this issue May 14, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers technical Requires building something new and exciting in Rust

Comments

@aapoalas
Copy link
Collaborator

We rely on an assumption that number-like PropertyKeys show up as Integer and that property keys can be compared by-value so that eg. "0" == 0 but the From and TryFrom implementations of PropertyKey do not actually check if strings are number-like.

As a result, ProperyKey::from("0") != PropertyKey::from(0) which is of course not correct.

This sort of points to the direction that the From<Value> and From<String> type of conversions for PropertyKey are invalid: We cannot freely and cheaply convert a string into a PropertyKey without first checking its contents. It would thus be better to remove these String and Value conversions and instead implement functions that do the same but also take an &Agent parameter so as to be capable of checking the string data.

@aapoalas aapoalas added bug Something isn't working good first issue Good for newcomers technical Requires building something new and exciting in Rust labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers technical Requires building something new and exciting in Rust
Projects
None yet
Development

No branches or pull requests

1 participant