aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRoy Frostig <[email protected]>2010-07-19 19:06:55 -0700
committerRoy Frostig <[email protected]>2010-07-19 19:06:55 -0700
commitae515c017c0aadb2a4c691804f1bc3b8b343dd67 (patch)
tree162a9bce32a712db96d45ed20f7c8e2e20355ae3 /src/test
parentAutoderef objects when passing them as implicit (indirect) arg upon vtbl-disp... (diff)
downloadrust-ae515c017c0aadb2a4c691804f1bc3b8b343dd67.tar.xz
rust-ae515c017c0aadb2a4c691804f1bc3b8b343dd67.zip
ctxt_auto_deref_lval decides whether to autoderef the entire lval, not its base.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/autoderef-full-lval.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/run-pass/autoderef-full-lval.rs b/src/test/run-pass/autoderef-full-lval.rs
new file mode 100644
index 00000000..956a7eb4
--- /dev/null
+++ b/src/test/run-pass/autoderef-full-lval.rs
@@ -0,0 +1,18 @@
+// -*- rust -*-
+
+type clam = rec(@int x, @int y);
+type fish = tup(@int);
+
+fn main() {
+ let clam a = rec(x=@1, y=@2);
+ let clam b = rec(x=@10, y=@20);
+ let int z = a.x + b.y;
+ log z;
+ check (z == 21);
+
+ let fish forty = tup(@40);
+ let fish two = tup(@2);
+ let int answer = forty._0 + two._0;
+ log answer;
+ check (answer == 42);
+}