| author | |
| committer | |
| log | e3db210cf1007f87930c97c072c54b2fb8ae0b8c |
| tree | c11e1e47dbf59e745aef594a9e446f100b839efe |
| parent | 1cfad29f10a557df986fc940dcce7620bbd5d4d9 |
| signature |
When lowering a decl value we verify whether its owner decl index
equals to the decl index of the decl being lowered. When this is not
the case, we are lowering an alias. So instead, we will now lower
the owner decl instead and call its symbol to ensure its type
is being correctly generated.2 files changed, 12 insertions(+), 5 deletions(-)
src/arch/wasm/CodeGen.zig+11| ... | ... | @@ -3008,6 +3008,17 @@ fn lowerDeclRefValue(func: *CodeGen, tv: TypedValue, decl_index: Module.Decl.Ind |
| 3008 | 3008 | } |
| 3009 | 3009 | |
| 3010 | 3010 | const decl = mod.declPtr(decl_index); |
| 3011 | // check if decl is an alias to a function, in which case we | |
| 3012 | // want to lower the actual decl, rather than the alias itself. | |
| 3013 | if (decl.val.getFunction(mod)) |func_val| { | |
| 3014 | if (func_val.owner_decl != decl_index) { | |
| 3015 | return func.lowerDeclRefValue(tv, func_val.owner_decl, offset); | |
| 3016 | } | |
| 3017 | } else if (decl.val.getExternFunc(mod)) |func_val| { | |
| 3018 | if (func_val.decl != decl_index) { | |
| 3019 | return func.lowerDeclRefValue(tv, func_val.decl, offset); | |
| 3020 | } | |
| 3021 | } | |
| 3011 | 3022 | if (decl.ty.zigTypeTag(mod) != .Fn and !decl.ty.hasRuntimeBitsIgnoreComptime(mod)) { |
| 3012 | 3023 | return WValue{ .imm32 = 0xaaaaaaaa }; |
| 3013 | 3024 | } |
test/behavior.zig+1-5| ... | ... | @@ -158,6 +158,7 @@ test { |
| 158 | 158 | _ = @import("behavior/enum.zig"); |
| 159 | 159 | _ = @import("behavior/error.zig"); |
| 160 | 160 | _ = @import("behavior/eval.zig"); |
| 161 | _ = @import("behavior/export_self_referential_type_info.zig"); | |
| 161 | 162 | _ = @import("behavior/field_parent_ptr.zig"); |
| 162 | 163 | _ = @import("behavior/floatop.zig"); |
| 163 | 164 | _ = @import("behavior/fn.zig"); |
| ... | ... | @@ -241,7 +242,6 @@ test { |
| 241 | 242 | if (builtin.zig_backend != .stage2_arm and |
| 242 | 243 | builtin.zig_backend != .stage2_x86_64 and |
| 243 | 244 | builtin.zig_backend != .stage2_aarch64 and |
| 244 | builtin.zig_backend != .stage2_wasm and | |
| 245 | 245 | builtin.zig_backend != .stage2_c and |
| 246 | 246 | builtin.zig_backend != .stage2_spirv64) |
| 247 | 247 | { |
| ... | ... | @@ -250,8 +250,4 @@ test { |
| 250 | 250 | _ = @import("behavior/bugs/14198.zig"); |
| 251 | 251 | _ = @import("behavior/export.zig"); |
| 252 | 252 | } |
| 253 | ||
| 254 | if (builtin.zig_backend != .stage2_wasm) { | |
| 255 | _ = @import("behavior/export_self_referential_type_info.zig"); | |
| 256 | } | |
| 257 | 253 | } |