feat: implement compile-time field selection reflection
This commit is contained in:
@@ -398,7 +398,14 @@ compile proc(
|
||||
}
|
||||
resolution := try sema.resolve_packages(compilation.allocator, &tree, roots.items, imports.items, &compilation.strings, diagnostic_store)
|
||||
defer sema.deinit(&resolution)
|
||||
elaborated := try specialize.elaborate(compilation.allocator, &compilation.builder, compilation.module_root?, &resolution, diagnostic_store)
|
||||
elaborated := try specialize.elaborate(
|
||||
compilation.allocator,
|
||||
&compilation.builder,
|
||||
compilation.module_root?,
|
||||
&resolution,
|
||||
&compilation.strings,
|
||||
diagnostic_store,
|
||||
)
|
||||
defer specialize.deinit(&elaborated)
|
||||
tree = ast.view(&compilation.builder, compilation.module_root?)
|
||||
checked := try typecheck.check_elaborated(compilation.allocator, &tree, &resolution, elaborated.constraints.items, diagnostic_store)
|
||||
|
||||
@@ -138,8 +138,8 @@ recompiles_specialized_calls_without_borrowing_previous_ir test {
|
||||
` config struct { counts [2]mut usize, bias i16 } := { counts = [0, 0], bias = 0 }
|
||||
` original :: config
|
||||
` for (usize(0)..2) |index| {
|
||||
` config.counts[index] = index + 1
|
||||
` config.bias = config.bias + 21
|
||||
` field!(config, "counts")[index] = index + 1
|
||||
` field!(config, "bias") = field!(config, "bias") + 21
|
||||
` }
|
||||
` return struct {
|
||||
` values [config.counts[1]]i16
|
||||
@@ -232,7 +232,7 @@ recompiles_specialized_calls_without_borrowing_previous_ir test {
|
||||
` if (same_type_array.values[0] + same_type_array.values[1] + same_type_array.bias != 42) return 0
|
||||
` boundary BoundaryType(TypeRows()) :: { values = [19, 21] }
|
||||
` same_boundary BoundaryType(TypeRows()) :: boundary
|
||||
` if (same_boundary.values[0] + same_boundary.values[1] + same_boundary.bias != 42) return 0
|
||||
` if (same_boundary.values[0] + same_boundary.values[1] + field!(same_boundary, "bias") != 42) return 0
|
||||
` if (copy_type_rows(TypeRows())[0][0] != u8 or copy_type_rows(TypeRows())[1][0] != i16) return 0
|
||||
` if (TypeRows()[0][0] != i16) return 0
|
||||
` if (read_type_rows(TypeRows(), 40) != 42 or read_type_rows(TypeRows(), 40) != 42) return 0
|
||||
|
||||
Reference in New Issue
Block a user