fix: resolve distinct type factory backings
This commit is contained in:
@@ -3032,6 +3032,15 @@ infer_call_comptime_values :: proc(
|
||||
{type_call=true, final=true},
|
||||
}
|
||||
for pass in evidence_passes {
|
||||
if pass.final {
|
||||
all_bound = true
|
||||
for value_bound in bound {
|
||||
all_bound = all_bound && value_bound
|
||||
}
|
||||
if all_bound {
|
||||
continue
|
||||
}
|
||||
}
|
||||
for arg_id, source_index in args {
|
||||
param_index := call_param_index(mapping, source_index)
|
||||
if param_index >= len(function.params) || param_index >= len(actual_args) {
|
||||
@@ -4540,6 +4549,12 @@ validate_type_nodes :: proc(checker: ^Checker) {
|
||||
node_count := len(checker.module.types.nodes)
|
||||
for index in 0..<node_count {
|
||||
item := checker.module.types.nodes[index]
|
||||
if item.kind == .Distinct {
|
||||
resolved := type_from_syntax(
|
||||
checker, item.child, ast.Package_Id(item.pkg), ast.File_Id(item.file),
|
||||
)
|
||||
checker.module.types.nodes[index].child = resolved
|
||||
}
|
||||
if item.kind != .Struct && item.kind != .Union {
|
||||
continue
|
||||
}
|
||||
@@ -7747,7 +7762,8 @@ sequence_item :: proc(value: types.Type, store: ^types.Store) -> (types.Node, bo
|
||||
}
|
||||
|
||||
find_struct_field :: proc(checker: ^Checker, struct_type: types.Type, name: symbol.Id) -> (int, types.Field, bool) {
|
||||
for field, index in types.fields_for(&checker.module.types, struct_type) {
|
||||
record_type := types.runtime_representation(struct_type, &checker.module.types)
|
||||
for field, index in types.fields_for(&checker.module.types, record_type) {
|
||||
if field.name == u32(name) {
|
||||
return index, field, true
|
||||
}
|
||||
@@ -7811,20 +7827,22 @@ find_struct_field_default :: proc(
|
||||
}
|
||||
|
||||
find_tuple_field :: proc(checker: ^Checker, tuple_type: types.Type, index: u64) -> (int, types.Field, bool) {
|
||||
item, ok := types.node(&checker.module.types, tuple_type)
|
||||
record_type := types.runtime_representation(tuple_type, &checker.module.types)
|
||||
item, ok := types.node(&checker.module.types, record_type)
|
||||
if !ok || item.kind != .Struct || !item.tuple || index >= u64(item.field_count) {
|
||||
return 0, {}, false
|
||||
}
|
||||
fields := types.fields_for(&checker.module.types, tuple_type)
|
||||
fields := types.fields_for(&checker.module.types, record_type)
|
||||
return int(index), fields[index], true
|
||||
}
|
||||
|
||||
find_struct_field_slot :: proc(checker: ^Checker, struct_type: types.Type, name: symbol.Id) -> (int, types.Field, bool) {
|
||||
item, ok := types.node(&checker.module.types, struct_type)
|
||||
record_type := types.runtime_representation(struct_type, &checker.module.types)
|
||||
item, ok := types.node(&checker.module.types, record_type)
|
||||
if !ok || (item.kind != .Struct && item.kind != .Union) {
|
||||
return -1, {}, false
|
||||
}
|
||||
for field, index in types.fields_for(&checker.module.types, struct_type) {
|
||||
for field, index in types.fields_for(&checker.module.types, record_type) {
|
||||
if field.name == u32(name) {
|
||||
return int(item.field_start)+index, field, true
|
||||
}
|
||||
|
||||
@@ -1332,6 +1332,7 @@ emit_instruction_stream :: proc(
|
||||
if types.is_pointer(base_type, &emitter.module.types) {
|
||||
base_type = types.child_type(base_type, &emitter.module.types)
|
||||
}
|
||||
base_type = types.runtime_representation(base_type, &emitter.module.types)
|
||||
if types.kind(base_type, &emitter.module.types) == .Fallible {
|
||||
fmt.sbprintf(&emitter.builder, " %%v%d = getelementptr i8, ptr %%v%d, i64 %d\n", instruction_index, instruction.a, types.fallible_payload_offset(base_type, &emitter.module.types, emitter.module.target))
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user