list
This commit is contained in:
@@ -230,9 +230,10 @@ pub const Type = union(enum) {
|
||||
if (self.isSlice() and target.isSlice()) {
|
||||
return std.mem.eql(u8, self.slice_type.element_name, target.slice_type.element_name);
|
||||
}
|
||||
// Pointer types: compare pointee names by content, null (*void) → any pointer
|
||||
// Pointer types: compare pointee names by content, *void is universal (both directions)
|
||||
if (self.isPointer() and target.isPointer()) {
|
||||
if (std.mem.eql(u8, self.pointer_type.pointee_name, "void")) return true;
|
||||
if (std.mem.eql(u8, target.pointer_type.pointee_name, "void")) return true;
|
||||
return std.mem.eql(u8, self.pointer_type.pointee_name, target.pointer_type.pointee_name);
|
||||
}
|
||||
// Many-pointer types: compare element names by content
|
||||
@@ -240,9 +241,15 @@ pub const Type = union(enum) {
|
||||
return std.mem.eql(u8, self.many_pointer_type.element_name, target.many_pointer_type.element_name);
|
||||
}
|
||||
// *T → [*]T: pointer to element is implicitly convertible to many-pointer
|
||||
// null (*void) → [*]T is also allowed
|
||||
if (self.isPointer() and target.isManyPointer()) {
|
||||
if (std.mem.eql(u8, self.pointer_type.pointee_name, "void")) return true;
|
||||
return std.mem.eql(u8, self.pointer_type.pointee_name, target.many_pointer_type.element_name);
|
||||
}
|
||||
// [*]T → *void: any many-pointer converts to void pointer
|
||||
if (self.isManyPointer() and target.isPointer()) {
|
||||
return std.mem.eql(u8, target.pointer_type.pointee_name, "void");
|
||||
}
|
||||
|
||||
const src_float = self.isFloat();
|
||||
const dst_float = target.isFloat();
|
||||
|
||||
Reference in New Issue
Block a user