fix(selfhost-sema): allow func-typed assignment via tekFunc refType comparison
ci / build (ubuntu) (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled

This commit is contained in:
2026-07-28 23:04:52 +03:00
parent a23388cd0d
commit f21002d258
2 changed files with 12 additions and 0 deletions
+9
View File
@@ -1788,6 +1788,15 @@ module HirLower {
// Unary
if kind == ekUnary {
// `&NamedFunc` — the ident already lowers to the fat-pointer value
// (BuxFn_* struct init via __adapt_); taking its address would yield
// a pointer-to-struct where the struct value is expected.
if expr.intValue == tkAmp && expr.child1 != null as *Expr && expr.child1.kind == ekIdent {
let ampSym: Symbol = Scope_Lookup(ctx.scope, expr.child1.strValue);
if ampSym.kind == skFunc {
return Lcx_LowerExpr(ctx, expr.child1);
}
}
// Overflow checking: in @[Checked] mode, lower negation on signed integers to checked call
if ctx.checkedFunc && !ctx.releaseFunc && expr.intValue == tkMinus {
var isSignedInt: bool = false;
+3
View File
@@ -232,6 +232,9 @@ module Sema {
}
return true;
}
// Func-typed values: `&Func` reports tyPointer as its kind while its
// refType is tekFunc — accept when both sides are func-typed.
if toTe.kind == tekFunc && fromTe != null as *TypeExpr && fromTe.kind == tekFunc { return true; }
if fromKind == toKind { return true; }
if Sema_IsStrictNumeric(fromKind) && Sema_IsStrictNumeric(toKind) { return true; }
if Sema_IsBool(fromKind) && Sema_IsBool(toKind) { return true; }