Merge branch 'frmdstryr-import-empty-file'

This commit is contained in:
Andrew Kelley 2020-10-26 16:07:46 -07:00
commit e2caf57527
4 changed files with 8 additions and 2 deletions

View File

@ -428,5 +428,7 @@ export fn stage2_fetch_file(
const max_file_size = std.math.maxInt(u32);
const contents = comp.stage1_cache_manifest.addFilePostFetch(file_path, max_file_size) catch return null;
result_len.* = contents.len;
// TODO https://github.com/ziglang/zig/issues/3328#issuecomment-716749475
if (contents.len == 0) return @intToPtr(?[*]const u8, 0x1);
return contents.ptr;
}

View File

@ -1988,7 +1988,7 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc
// behaviour when checking expected alignment with `@ptrToInt(fn_ptr)`
// or similar. This commit proposes to make `align` expressions a
// compile error when compiled to Wasm architecture.
//
//
// Some references:
// [1] [Mozilla: WebAssembly Tables](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format#WebAssembly_tables)
// [2] [Sunfishcode's Wasm Ref Manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md#indirect-call)
@ -9044,7 +9044,7 @@ static void resolve_llvm_types_optional(CodeGen *g, ZigType *type, ResolveStatus
8 * child_type->abi_align,
val_offset_in_bits,
ZigLLVM_DIFlags_Zero, child_llvm_di_type);
di_element_types[maybe_null_index] =
di_element_types[maybe_null_index] =
ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(type->llvm_di_type),
"maybe", di_file, line,
8*g->builtin_types.entry_bool->abi_size,

View File

@ -16,3 +16,7 @@ test "import in non-toplevel scope" {
};
expectEqual(@as(i32, 1234), S.foo());
}
test "import empty file" {
const empty = @import("import/empty.zig");
}

View File