shithub: mc

Download patch

ref: a73b2d8351853bdfde84b2792b8b231472271284
parent: ee843124f9aa7623d0d241d0fe3bfe9b7cfdf290
parent: 932320f93ec0266a53c3e50600d73d3d23e1db76
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Feb 5 16:08:55 EST 2016

Merge branch 'rvallen' of https://github.com/andrewchambers/mc

--- a/6/simp.c
+++ b/6/simp.c
@@ -295,7 +295,7 @@
 static Node *slicelen(Simp *s, Node *sl)
 {
 	/* *(&sl + sizeof(size_t)) */
-	return load(addk(addr(s, sl, tyintptr), Ptrsz));
+	return load(addk(addr(s, rval(s, sl, NULL), tyintptr), Ptrsz));
 }
 
 Node *loadvar(Simp *s, Node *n, Node *dst)
--- /dev/null
+++ b/test/rvaldotlen.myr
@@ -1,0 +1,21 @@
+use std
+
+const f1 = { -> byte[:]
+	-> [1, 2, 3][:]
+}
+
+const f2 = { -> byte[3]
+	-> [1, 2, 3]
+}
+
+
+const main = {
+	if f1().len != 3
+		-> void
+	;;
+	if f2().len != 3
+		-> void
+	;;
+	std.put("pass\n")
+}
+
--- a/test/tests
+++ b/test/tests
@@ -154,3 +154,4 @@
 B voideffect	P	pass
 B foroptexpr	P	pass
 B bounds	E	134
+B rvaldotlen	P	pass