This repository was archived by the owner on Apr 28, 2026. It is now read-only.
Fix i64.gt to return bool (#208)#209
Open
bibonix wants to merge 2 commits into
Open
Conversation
The lambda of `i64.gt` calls `phi.take('org.eolang.i64')`, which fails
with "Couldn't find object 'i64' from 'org.eolang.i64'" in standalone
contexts where `org.eolang.i64` is not registered. The test asserts
the comparison result dataized as `bool`, mirroring `number$gt`.
`i64.gt` wrapped its boolean comparison result in
`phi.take('org.eolang.i64').with(...)`, returning an `i64` instead of
a `bool` and crashing in standalone contexts where `org.eolang.i64`
isn't registered. Mirror `number$gt` and return `data.toObject(bool)`
directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@yegor256 this PR closes #208.
Problem
eo2js-runtime/src/objects/org/eolang/i64$gt.jswrapped its boolean comparison result inphi.take('org.eolang.i64').with({0: data.toObject(...)}), with two consequences:i64.gtreturned anorg.eolang.i64instead of abool, inconsistent withnumber.gt(which returnsdata.toObject(bool)directly).phi.take('org.eolang.i64')walksobjects/org/eolang/looking for ani64package ori64.jsfile, neither of which exists in the runtime, so any call toi64.gtaborted withError: Couldn't find object 'i64' from 'org.eolang.i64'.Fix
Mirror
number$gt.jsand returndata.toObject(bool)directly. The unusedphiimport is dropped.Tests
Added
eo2js-runtime/test/objects/org/eolang/i64$gt.test.jscovering both branches:7L > 3Ldataizes totrue5L > 10Ldataizes tofalseBoth tests fail on
masterwithCouldn't find object 'i64' from 'org.eolang.i64'and pass with this change. The full grunt task (mocha + eslint) is green locally and on CI (16/16 checks). Ready for merge.