sema/ir: kill remaining s64 fallbacks (sema Type + getRefType)
- types.Type: add dedicated `unresolved` variant (mirrors ir.TypeId.unresolved) with eql/displayName arms; bridgeType maps it to TypeId.unresolved. - sema.inferExprType + signature/field resolution: every Type.fromTypeExpr / fromName / symbol lookup miss and call/field/index fallthrough now yields Type.unresolved instead of a fabricated s(64). A variadic `..xs: []T` slice element is taken from T, not a guessed "s32". Genuine literal defaults (int=>s64, float=>f32, .len=>s64) kept. - Builder.getRefType: an unlocatable ref (no active function / out-of-range) returns .unresolved, not .s64 -- this is the accurate type source the pack mono / binop / null-cmp fixes rely on, so it must not fabricate. 236 examples + unit tests (incl sema) green.
This commit is contained in:
@@ -29,6 +29,11 @@ pub const Type = union(enum) {
|
||||
optional_type: OptionalTypeInfo,
|
||||
meta_type: MetaTypeInfo,
|
||||
tuple_type: TupleTypeInfo,
|
||||
/// Type resolution failed (sema couldn't infer/resolve). A dedicated
|
||||
/// sentinel — never a legitimate type — so callers can't mistake it for a
|
||||
/// real result the way a fabricated `s(64)` would be. Mirrors
|
||||
/// `ir.TypeId.unresolved`.
|
||||
unresolved,
|
||||
|
||||
pub const SliceTypeInfo = struct {
|
||||
element_name: []const u8,
|
||||
@@ -84,7 +89,7 @@ pub const Type = union(enum) {
|
||||
return switch (self) {
|
||||
.signed => |w| w == other.signed,
|
||||
.unsigned => |w| w == other.unsigned,
|
||||
.f32, .f64, .void_type, .boolean, .string_type, .any_type, .usize_type, .isize_type => true,
|
||||
.f32, .f64, .void_type, .boolean, .string_type, .any_type, .usize_type, .isize_type, .unresolved => true,
|
||||
.enum_type => |n| std.mem.eql(u8, n, other.enum_type),
|
||||
.struct_type => |n| std.mem.eql(u8, n, other.struct_type),
|
||||
.union_type => |n| std.mem.eql(u8, n, other.union_type),
|
||||
@@ -555,6 +560,7 @@ pub const Type = union(enum) {
|
||||
.any_type => "Any",
|
||||
.usize_type => "usize",
|
||||
.isize_type => "isize",
|
||||
.unresolved => "<unresolved>",
|
||||
.enum_type => |name| name,
|
||||
.struct_type => |name| name,
|
||||
.union_type => |name| name,
|
||||
|
||||
Reference in New Issue
Block a user