Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int64/int64 not compile for JS, but for C. #23746

Open
litlighilit opened this issue Jun 20, 2024 · 4 comments
Open

int64/int64 not compile for JS, but for C. #23746

litlighilit opened this issue Jun 20, 2024 · 4 comments

Comments

@litlighilit
Copy link
Contributor

Description

the following compiles for C backend but not JS:

echo 1'i64 / 2'i64

or

echo 1.int64 / 2.int64

Nim Version

from 1.6.14, 2.0.6 to 2.1.1

Current Output

Error: type mismatch
Expression: 1'i64 / 2'i64
  [1] 1'i64: int64
  [2] 2'i64: int64

Expected one of (first mismatch at [position]):
[1] proc `/`(x, y: float): float
[1] proc `/`(x, y: float32): float32
[1] proc `/`(x, y: int): float

Expected Output

0.5

Possible Solution

No response

Additional Information

No response

@litlighilit
Copy link
Contributor Author

!nim js

echo 1'i64 / 2'i64

Copy link
Contributor

🐧 Linux bisect by @litlighilit (contributor)
devel 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-06-20T15:47:26
  • Finished 2024-06-20T15:47:26
  • Duration now

AST

stable 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-06-20T15:47:27
  • Finished 2024-06-20T15:47:27
  • Duration now

AST

2.0.4 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-06-20T15:47:30
  • Finished 2024-06-20T15:47:30
  • Duration now

AST

2.0.0 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-06-20T15:47:33
  • Finished 2024-06-20T15:47:33
  • Duration now

AST

1.6.20 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-06-20T15:47:36
  • Finished 2024-06-20T15:47:36
  • Duration

AST

1.4.8 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-06-20T15:47:39
  • Finished 2024-06-20T15:47:39
  • Duration now

AST

1.2.18 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-06-20T15:47:41
  • Finished 2024-06-20T15:47:41
  • Duration now

AST

1.0.10 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-06-20T15:47:44
  • Finished 2024-06-20T15:47:44
  • Duration now

AST

Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.3
  • Created 2024-06-20T15:40:49Z
  • Comments 1
  • Commands nim js -d:nodejs -d:nimExperimentalAsyncjsThen -d:nimExperimentalJsfetch --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

🤖 Bug found in 21 minutes bisecting 8 commits at 0 commits per second

@litlighilit
Copy link
Contributor Author

litlighilit commented Jun 20, 2024

not sure why in C backend it compiles,

as I found no / for int64, there seems to be only int/int in system.

@litlighilit
Copy link
Contributor Author

litlighilit commented Jun 20, 2024

not sure why in C backend it compiles,\n\nas I found no / for int64, there seems to be only int/int in system.

It compiles in C backend because, at least in x64 the operators of / is converted to int first, a.k.a. that's rewriten roughly as:

echo int(1.int64) / int(2.int64)

donno what will happened on 32 bit machine. 🤔

@litlighilit litlighilit changed the title Fail to compile int64/int64 when JS. int64/int64 not compile for JS, but for C. Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants