Skip to content

Division and remainder operator#290

Merged
CaelmBleidd merged 8 commits into
mainfrom
caelmbleidd/division
Jun 18, 2025
Merged

Division and remainder operator#290
CaelmBleidd merged 8 commits into
mainfrom
caelmbleidd/division

Conversation

@CaelmBleidd
Copy link
Copy Markdown
Member

No description provided.

@CaelmBleidd CaelmBleidd requested a review from Lipen June 11, 2025 11:11
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/division branch from f1e1a50 to 05b3d09 Compare June 18, 2025 10:28
@Lipen Lipen requested a review from Copilot June 18, 2025 13:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the TypeScript division (/) and remainder (%) operators across the interpreter, sample code, and tests.

  • Introduces Division.ts and Remainder.ts samples in the TypeScript test resources
  • Extends TsBinaryOperator (and TsExprResolver) with Div and Rem cases
  • Enhances mkNumericExpr in ExprUtil.kt to handle “fake” JS objects

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
usvm-ts/src/test/resources/samples/operators/Remainder.ts New TS sample for % operator with various operand types
usvm-ts/src/test/resources/samples/operators/Division.ts New TS sample for / operator with various operand types
usvm-ts/src/test/kotlin/org/usvm/util/TsMethodTestRunner.kt Added solverType = SolverType.YICES to test runner defaults
usvm-ts/src/test/kotlin/org/usvm/samples/operators/Remainder.kt Kotlin tests for %, some cases still disabled
usvm-ts/src/test/kotlin/org/usvm/samples/operators/Division.kt Kotlin tests for /
usvm-ts/src/main/kotlin/org/usvm/machine/operator/TsBinaryOperator.kt Added Div and Rem operator implementations
usvm-ts/src/main/kotlin/org/usvm/machine/expr/TsExprResolver.kt Wire up EtsDivExpr/EtsRemExpr to new operators
usvm-ts/src/main/kotlin/org/usvm/machine/expr/ExprUtil.kt Enhanced mkNumericExpr for fake-object branching
Comments suppressed due to low confidence (2)

usvm-ts/src/test/resources/samples/operators/Remainder.ts:3

  • The variable res is used without declaration, which creates a global. Please declare it (e.g. const res = a % b;).
        res = a % b;

usvm-ts/src/test/resources/samples/operators/Division.ts:3

  • The variable res is undeclared, causing a global leak. Use const res = a / b; or let res.
        res = a / b;

Comment thread usvm-ts/src/main/kotlin/org/usvm/machine/expr/ExprUtil.kt Outdated
Comment thread usvm-ts/src/test/resources/samples/operators/Remainder.ts
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/TsMethodTestRunner.kt
@CaelmBleidd CaelmBleidd merged commit 5719f00 into main Jun 18, 2025
10 of 11 checks passed
@CaelmBleidd CaelmBleidd deleted the caelmbleidd/division branch June 18, 2025 13:56
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.

4 participants