summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--6/isel.c4
-rw-r--r--test/constslice.myr14
2 files changed, 14 insertions, 4 deletions
diff --git a/6/isel.c b/6/isel.c
index a06b8bf..5d584ea 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -1054,10 +1054,10 @@ static void writeexprs(FILE *fd, Htab *globls, Htab *strtab, Node **e, size_t n)
static size_t getintlit(Node *n, char *failmsg)
{
if (exprop(n) != Olit)
- fatal(n->line, "%s");
+ fatal(n->line, "%s", failmsg);
n = n->expr.args[0];
if (n->lit.littype != Lint)
- fatal(n->line, "%s");
+ fatal(n->line, "%s", failmsg);
return n->lit.intval;
}
diff --git a/test/constslice.myr b/test/constslice.myr
index 4b43a37..2065220 100644
--- a/test/constslice.myr
+++ b/test/constslice.myr
@@ -1,11 +1,21 @@
use std
-const sl = array[1:3]
+const slpart = array[1:3]
+const slfull = array[:]
+const slinline = [6,7,8][:]
const array = [1,2,3,4,5]
const main = {
/* expected output 23 */
- for x in sl
+ for x in slpart
+ std.put("%i", x)
+ ;;
+ /* expected output 12345 */
+ for x in slfull
+ std.put("%i", x)
+ ;;
+ /* expected output 678 */
+ for x in slinline
std.put("%i", x)
;;
std.put("\n")