Commit ca180d3f02

Andrew Kelley <superjoe30@gmail.com>
2017-02-11 21:06:20
std.io.parseUnsigned buf parameter is const
fixes padding in printf See #258
1 parent f7173f4
Changed files (3)
src/analyze.cpp
@@ -3302,7 +3302,7 @@ bool ir_get_var_is_comptime(VariableTableEntry *var) {
 }
 
 bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
-    assert(a->type == b->type);
+    assert(a->type->id == b->type->id);
     assert(a->special == ConstValSpecialStatic);
     assert(b->special == ConstValSpecialStatic);
     switch (a->type->id) {
std/io.zig
@@ -469,7 +469,7 @@ pub const InStream = struct {
     }
 };
 
-pub fn parseUnsigned(comptime T: type, buf: []u8, radix: u8) -> %T {
+pub fn parseUnsigned(comptime T: type, buf: []const u8, radix: u8) -> %T {
     var x: T = 0;
 
     for (buf) |c| {
test/run_tests.cpp
@@ -319,9 +319,9 @@ pub const b_text = a_text;
 const io = @import("std").io;
 
 pub fn main(args: [][]u8) -> %void {
-    %%io.stdout.printf("Hello, world!\n");
+    %%io.stdout.printf("Hello, world!\n{d4} {x3}\n", u32(12), u16(0x12));
 }
-    )SOURCE", "Hello, world!\n");
+    )SOURCE", "Hello, world!\n0012 012\n");
 
 
     add_simple_case_libc("number literals", R"SOURCE(