Commit 4b9e1dd438

Andrew Kelley <superjoe30@gmail.com>
2016-01-25 22:04:29
fix tests and add %% operator test
1 parent 6db6609
Changed files (2)
src/analyze.cpp
@@ -498,7 +498,7 @@ static void resolve_function_proto(CodeGen *g, AstNode *node, FnTableEntry *fn_t
 
     // next, loop over the parameters again and compute debug information
     // and codegen information
-    bool first_arg_return = handle_is_ptr(return_type);
+    bool first_arg_return = !fn_proto->skip && handle_is_ptr(return_type);
     // +1 for maybe making the first argument the return value
     LLVMTypeRef *gen_param_types = allocate<LLVMTypeRef>(1 + src_param_count);
     // +1 because 0 is the return type and +1 for maybe making first arg ret val
test/run_tests.cpp
@@ -1254,6 +1254,29 @@ pub fn main(args: [][]u8) %void => {
         stdout.printf("BAD\n");
     }
     stdout.printf("OK\n");
+}
+    )SOURCE", "OK\n");
+
+    add_simple_case("%% binary operator", R"SOURCE(
+import "std.zig";
+error ItBroke;
+fn g(x: bool) %isize => {
+    if (x) {
+        error.ItBroke
+    } else {
+        10
+    }
+}
+pub fn main(args: [][]u8) %void => {
+    const a = g(true) %% 3;
+    const b = g(false) %% 3;
+    if (a != 3) {
+        stdout.printf("BAD\n");
+    }
+    if (b != 10) {
+        stdout.printf("BAD\n");
+    }
+    stdout.printf("OK\n");
 }
     )SOURCE", "OK\n");
 }