koka-lang / koka

Koka language compiler and interpreter
http://koka-lang.org
Other
3.16k stars 153 forks source link

interactive.c:5:10: error: ‘Infinity’ undeclared (first use in this function); did you mean ‘finite’? #318

Open heyarne opened 1 year ago

heyarne commented 1 year ago

I think I found a bug in the koka repl (using koka from nixpkgs):

# nix run nixpkgs#koka -- --version
Koka 2.4.0, 00:00:00 Jan  1 1980 (ghc release version)
version: 2.4.0
bin    : /nix/store/pqggp8ivqj70mcj739hj8gvpfdswssc3-koka-2.4.0/bin
lib    : /nix/store/pqggp8ivqj70mcj739hj8gvpfdswssc3-koka-2.4.0/lib/koka/v2.4.0
share  : /nix/store/pqggp8ivqj70mcj739hj8gvpfdswssc3-koka-2.4.0/share/koka/v2.4.0
output : .koka/v2.4.0/cc-debug
cc     : /nix/store/k04h29hz6qs45pn0mzaqbyca63lrz2s0-gcc-wrapper-11.3.0/bin/cc
Copyright 2012-2021, Microsoft Research, Daan Leijen.
This program is free software; see the source for copying conditions.
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty
of merchantability or fitness for a particular purpose.

In a REPL, when entering a large floating point number (e.g. 1e1000), the following error is raised:

 _         _ 
| |       | |
| | _ ___ | | _ __ _
| |/ / _ \| |/ / _' |  welcome to the koka interactive compiler
|   ( (_) |   ( (_| |  version 2.4.0, Jan  1 1980, libc x64 (cc)
|_|\_\___/|_|\_\__,_|  type :? for help, and :q to quit

loading: std/core
loading: std/core/types
loading: std/core/hnd

> 1e1000
check  : interactive
/tmp/.koka/v2.4.0/cc-debug/interactive.c: In function ‘kk_interactive__expr’:
/tmp/.koka/v2.4.0/cc-debug/interactive.c:5:10: error: ‘Infinity’ undeclared (first use in this function); did you mean ‘finite’?
    5 |   return Infinity;
      |          ^~~~~~~~
      |          finite
/tmp/.koka/v2.4.0/cc-debug/interactive.c:5:10: note: each undeclared identifier is reported only once for each function it appears in
failure during code generation:
  error  : command failed (exit code 1)
  command: /nix/store/k04h29hz6qs45pn0mzaqbyca63lrz2s0-gcc-wrapper-11.3.0/bin/cc -g -O1 -c -I /nix/store/pqggp8ivqj70mcj739hj8gvpfdswssc3-koka-2.4.0/share/koka/v2.4.0/kklib/include -DKK_MIMALLOC=8 -o /tmp/.koka/v2.4.0/cc-debug/interactive.o /tmp/.koka/v2.4.0/cc-debug/interactive.c
check  : interactive
/tmp/.koka/v2.4.0/cc-debug/interactive.c: In function ‘kk_interactive__expr’:
/tmp/.koka/v2.4.0/cc-debug/interactive.c:5:10: error: ‘Infinity’ undeclared (first use in this function); did you mean ‘finite’?
    5 |   return Infinity;
      |          ^~~~~~~~
      |          finite
/tmp/.koka/v2.4.0/cc-debug/interactive.c:5:10: note: each undeclared identifier is reported only once for each function it appears in
failure during code generation:
  error  : command failed (exit code 1)
  command: /nix/store/k04h29hz6qs45pn0mzaqbyca63lrz2s0-gcc-wrapper-11.3.0/bin/cc -g -O1 -c -I /nix/store/pqggp8ivqj70mcj739hj8gvpfdswssc3-koka-2.4.0/share/koka/v2.4.0/kklib/include -DKK_MIMALLOC=8 -o /tmp/.koka/v2.4.0/cc-debug/interactive.o /tmp/.koka/v2.4.0/cc-debug/interactive.c