aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/4-statements/if_else_binds_nearest.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/conformance/4-statements/if_else_binds_nearest.zc')
-rw-r--r--tests/conformance/4-statements/if_else_binds_nearest.zc8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/conformance/4-statements/if_else_binds_nearest.zc b/tests/conformance/4-statements/if_else_binds_nearest.zc
new file mode 100644
index 0000000..0c9f235
--- /dev/null
+++ b/tests/conformance/4-statements/if_else_binds_nearest.zc
@@ -0,0 +1,8 @@
+// expect: 2/
+// spec 4.3: else binds to the nearest if
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ if (1) if (0) pn(1); else pn(2);
+ return 0;
+}