Found a compiler bug, thanks Aedan!

This commit is contained in:
2023-03-17 14:01:16 +11:00
parent 4b83f1f0d6
commit 2edfbbe3ef
4 changed files with 82 additions and 3 deletions

27
scripts/example.toy Normal file
View File

@@ -0,0 +1,27 @@
var colors = [
"red",
"orange",
"yellow",
"green",
"blue",
"violet",
"indigo"
];
fn getRainbowColor(index) {
return colors[index];
}
import standard;
import random;
var rng: opaque = createRandomGenerator(hash(clock()));
print getRainbowColor(rng.generateRandomNumber() % colors.length());
print getRainbowColor(rng.generateRandomNumber() % colors.length());
print getRainbowColor(rng.generateRandomNumber() % colors.length());
print getRainbowColor(rng.generateRandomNumber() % colors.length());
print getRainbowColor(rng.generateRandomNumber() % colors.length());