ref: 188127af82ebd9fbd729419c525ba459d3a779f4
parent: 4a9ebe2a52eaf6d632f8f092fcb5a860205b026c
author: Ori Bernstein <[email protected]>
date: Fri Jul 27 15:52:42 EDT 2012
Add tests for dereferencing assignment.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -563,7 +563,7 @@
break;
case Oderef: /* *@a* -> @a */
t = unify(st, n, type(st, args[0]), mktyptr(n->line, mktyvar(n->line)));
- settype(st, n, t);
+ settype(st, n, t->sub[0]);
break;
case Oidx: /* @a[@b::tcint] -> @a */
t = mktyidxhack(n->line, mktyvar(n->line));
--- /dev/null
+++ b/test/derefassign.myr
@@ -1,0 +1,8 @@
+const main = {
+ var p
+ var v
+
+ p = &v
+ *p = 123
+ -> v
+}
--- a/test/tests
+++ b/test/tests
@@ -22,6 +22,7 @@
B trunccast E 15
B zwidencast E 99
B swidencast E 99
+B derefassign E 123
B ptrpreinc E 9
B struct1 E 12
B struct E 42