UnitTestBot / UnitTestBot/usvm

Incorrect mkNumericExpr implementation

Open
#280 0 comments 0 reactions 1 assignee View on GitHub

@CaelmBleidd is already working on this.

Since May 22, 2025.

Dominant language
Kotlin
Stars
33
Forks
27
Avg merge
4d 3h
Merged PRs (30d)
15

Description

There are several rules for variables transformation into a number. For now, only few of them are supported.

    7.1.4 ToNumber ( argument )
    
    1. If argument is a Number, return argument.
    **2. If argument is either a Symbol or a BigInt, throw a TypeError exception.**
    3. If argument is undefined, return NaN.
    4. If argument is either null or false, return +0𝔽.
    5. If argument is true, return 1𝔽.
    **6. If argument is a String, return StringToNumber(argument).**
    7. Assert: argument is an Object.
    **8. Let primValue be ToPrimitive(argument, "number").**
    **9. Assert: primValue is not an Object.**
    **10. Return ToNumber(primValue).**

Now for objects it always returns NaN which is incorrect, for example, for [0] or objects with toString returning a string with a number inside.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.