Looks like JavaScript, feels like Ruby, and it is a script language fitting in C programmers.
This project is maintained by Kray-G
This section describes a testing for bug fixes.
This bug’s was caused by an invalid mod operation.
See also an additional test code in Basic Expressions in native.
native isPrime(n: int) {
for (var i = 2; i <= Math.sqrt(n); ++i) {
if (n % i == 0) return false;
}
return true;
}
System.println(isPrime(15) ? 'true' : 'false'); // false
System.println(isPrime(17) ? 'true' : 'false'); // true
false
true
This was found internally, so there is no issue id.
for (ypix in 0...24) {
System.print(":");
var y = ypix / 12 - 1;
for (xpix in 1...79) {
var x = xpix / 30 - 2;
var x0 = x;
var y0 = y;
var iter = 0;
while (iter < 11 && x0 * x0 + y0 * y0 <= 4) {
var x1 = (x0 * x0) - (y0 * y0) + x;
var y1 = 2 * x0 * y0 + y;
x0 = x1;
y0 = y1;
iter = iter + 1;
}
System.print(*(" .-:;+=xX$& "[iter]));
}
System.println("");
}
: .......------------------------:::::::::;;;;+=X X & ;:::::::------....
: ......------------------------::::::::::;;;;+==x& &x=+;;;::::::-------.
: ....------------------------::::::::::;;;;++=X X=;;;;;:::::------
: ...-----------------------::::::::::;;+++++==xX Xx=+++;;;;;:::----
: ..----------------------::::::::;;;;+x &XX & $x===x +;::---
: ..--------------------::::;;;;;;;;+++=x& $+;::--
: ..----------------::::;;;;;;;;;;++++=x$ $=+;;::-
: .-----------:::::;;= x+++++++++====xx& &xx+;:::
:.-----:::::::::;;;++=$ &$X$ &XXXxxXX& x+;::
:---:::::::::;;;;;;+==X$ & &=;;::
:-::::::::;;;;;;+=xxX$ x+;;::
:::;;:::++++++==xX& =+;;;::
: Xx=+;;;::
:::;;:::++++++==xX& =+;;;::
:-::::::::;;;;;;+=xxX$ x+;;::
:---:::::::::;;;;;;+==X$ & &=;;::
:.-----:::::::::;;;++=$ &$X$ &XXXxxXX& x+;::
: .-----------:::::;;= x+++++++++====xx& &xx+;:::
: ..----------------::::;;;;;;;;;;++++=x$ $=+;;::-
: ..--------------------::::;;;;;;;;+++=x& $+;::--
: ..----------------------::::::::;;;;+x &XX & $x===x +;::---
: ...-----------------------::::::::::;;+++++==xX Xx=+++;;;;;:::----
: ....------------------------::::::::::;;;;++=X X=;;;;;:::::------
: ......------------------------::::::::::;;;;+==x& &x=+;;;::::::-------.
This bug’s was caused by missing implementation.
function gt(a, b) { return a > b; }
function lt(a, b) { return a < b; }
function ge(a, b) { return a >= b; }
function le(a, b) { return a <= b; }
function lge(a, b) { return a <=> b; }
try { gt("a", "b"); System.println("Successful"); } catch (e) { System.println(e.what()); }
try { lt("a", "b"); System.println("Successful"); } catch (e) { System.println(e.what()); }
try { ge("a", "b"); System.println("Successful"); } catch (e) { System.println(e.what()); }
try { le("a", "b"); System.println("Successful"); } catch (e) { System.println(e.what()); }
try { lge("a", "b"); System.println("Successful"); } catch (e) { System.println(e.what()); }
Successful
Successful
Successful
Successful
Successful
This bug’s was caused by lack of consideration of a part of type propagation.
class A() {
public xxx() {
System.println("Successful");
}
}
function f(): A {
return new A(); // => Error: Expect return type (object) but (... unknown)
}
f().xxx();
Successful
This bug’s was caused by lack of the code which moves to the next opcode.
function test1(a) { return 10 >= a; }
function test2(a) { return -1 <= a; }
function test3(a) { return 100 < a; }
System.println(test1(10.5));
System.println(test2(10.5));
System.println(test3(10.5));
0
1
0
This bug’s was caused by an incorrect bytecode.
function test1(data) {
var [a, b, ...c] = data.split(',');
}
function test2(data) {
[a, b, ...c] = data.split(',');
}
function test3(data) {
const [a, b, ...c] = data.split(',');
}
test1("1,2,3,4,5,6,7,8,9");
test2("1,2,3,4,5,6,7,8,9");
test3("1,2,3,4,5,6,7,8,9");
System.println("Successful");
Successful
This bug’s was caused by incorrect extracting an object.
class A {
public toString() { return "A"; }
}
class B {
public toString() { return "\\\"B\""; }
}
System.println({ a: new A() }); // => {"a":"A"}
System.println({ b: new B() }); // => {"a":"A"}
{"a":"A"}
{"b":"\\\"B\""}
This bug’s was caused by missing to check the condition.
const A = 1;
const A = 2;
A = 3;
System.println(A);
Error: Symbol(A) has been already declared as 'const' near the <test.kx>:2
Error: Can not assign a value to the 'const' variable near the <test.kx>:3
This bug’s was caused by handling with pinned
as a const
.
var a = 10;
var { x: ^a, y } = { x: 10, y: 100 };
System.println(y);
var { x: ^a, y } = { x: 100, y: 100 };
System.println(y);
100
Uncaught exception: No one catch the exception.
NoMatchingPatternException: Pattern not matched
Stack Trace Information:
at <main-block>(test.kx:4)
This bug’s was caused by the incorrect scope for a variable with pin operator in function arguments.
var a = 10;
function test({ x: ^a, y }) { // The variable `a` should be handled
// as an outside variable by a lexical scope.
return y;
}
System.println(test({ x: 10, y: 100 }));
System.println(test({ x: 100, y: 100 }));
100
Uncaught exception: No one catch the exception.
NoMatchingPatternException: Pattern not matched
Stack Trace Information:
at function test(test.kx:2)
at <main-block>(test.kx:7)
This bug’s was caused by NULL dereference only with a Linux code.
var t = $env.NO_ENVVAR;
System.println("t = ", t);
t =
=~
or !~
This bug’s was caused by missing a pop operation.
var l = "aaaaaaa";
for (var i = 0; i < 1000; ++i) {
if (g = (l =~ /([b-z]+)/)) {
System.println(g[1].string);
} else if (g = (l =~ /([0-9]+)/)) {
System.println(g[1].string);
}
}
System.println("Successful");
Successful
This bug’s was caused by dereferencing uninitialized variable pointer.
var mem = [];
for (var i = 0; i < 10; ++i) {
mem[i] = i;
}
native func0(n:int):obj {
var r:int[];
for (var i = 0; i < n; ++i) {
r[i] = mem[i];
}
return r;
}
var res = func0(10);
System.println(res);
native func1(n:int):bin {
var r:bin;
for (var i = 0; i < n; ++i) {
r[i] = mem[i];
}
return r;
}
var res = func1(10);
System.println(res);
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
<0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09>