-
Notifications
You must be signed in to change notification settings - Fork 424
PP0008
When an unknown value is used in an expression that will attempt to convert the value to a number, things can go wrong if the value turns out to be a Symbol or an object with a custom valueOf or toString or Symbol.toPrimitive method.
In particular, converting a symbol to Number throws a TypeError and calling a custom method might modify the global heap or may result in an exception. If this should happen, then the values of the heap computed by Prepack will be incomplete or wrong, with the result that running Prepack over a program changes its runtime behavior.
To make this error go away, consider refining the environment model so that Prepack can figure out that converting this value will not cause such changes. For example, by using an expressions such as __abstract("number")
rather than just __abstract()
for values that are known to always be numbers.