PropertyKey does not accurately check conversions from Strings #183
Labels
bug
Something isn't working
good first issue
Good for newcomers
technical
Requires building something new and exciting in Rust
We rely on an assumption that number-like
PropertyKey
s show up asInteger
and that property keys can be compared by-value so that eg."0" == 0
but theFrom
andTryFrom
implementations ofPropertyKey
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>
andFrom<String>
type of conversions forPropertyKey
are invalid: We cannot freely and cheaply convert a string into aPropertyKey
without first checking its contents. It would thus be better to remove theseString
andValue
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.The text was updated successfully, but these errors were encountered: