aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/stmt.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 16:03:48 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 16:03:48 +0330
commit29eb9e50d33d417035e133dcebb7111074a23b24 (patch)
treeda4a1614bae228dc0b7675b287643c64e8720530 /src/compiler/stmt.zc
parentmerge: llvm auto-build (opt-in on x86-64), mode stamp (diff)
parentconformance: b.2.8 is documented behavior; keep the conformance run out of te... (diff)
merge: seven self-hosted compiler fixes from conformance
Diffstat (limited to 'src/compiler/stmt.zc')
-rw-r--r--src/compiler/stmt.zc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/stmt.zc b/src/compiler/stmt.zc
index 4dafe4f..3ecb81b 100644
--- a/src/compiler/stmt.zc
+++ b/src/compiler/stmt.zc
@@ -571,7 +571,7 @@ int kw_switch() {
if (!accept(s_comma)) break;
}
expect(s_rp);
- if (nb != pm_nf[gi]) serr("a case binds every field of its member");
+ if (nb && nb != pm_nf[gi]) serr("a case binds every field of its member"); // member() with no names matches by tag (spec 4.7.3)
v = pm_tag[gi];
if (v < 63) cov = cov | (1 << v);
laddr(lslot[tmp]); op(O_LD); op(O_LD); lit(v); op(O_SUB);
@@ -649,7 +649,7 @@ int kw_return() {
}
if_ret(xty, xzero);
if (fty && fty != tvoid) fcoerce(fty);
- if (fty == tvoid) tcerr("return value", tvoid, xty);
+ if (fty == tvoid) { tcerr("return value", tvoid, xty); op(O_DROP); lit(0); } // typecheck off: the value is ignored (spec 4.8.3)
else if (fty && !compat(fty, xty)) tcerr("return value", fty, xty);
}
if (nclo) {