diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-10-28 05:29:44 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-10-28 05:50:38 -0400 |
| commit | 23f9be141bb0f7dc5eb35f395d5cf4011edac836 (patch) | |
| tree | 0a49750e76553865431aa4803eee5e4b993e2eb0 /src/server/analysis.odin | |
| parent | ffb7b58d3841cf50103ab21148b814a3ad29afa4 (diff) | |
Correctly resolve enum types that are array values
Diffstat (limited to 'src/server/analysis.odin')
| -rw-r--r-- | src/server/analysis.odin | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 32d38eb..8cd75d6 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2287,12 +2287,29 @@ resolve_implicit_selector_comp_literal :: proc( return resolve_type_expression(ast_context, type) case SymbolFixedArrayValue: - //This will be a comp_lit for an enumerated array - //EnumIndexedArray :: [TestEnum]u32 { - // .valueOne = 1, - // .valueTwo = 2, - //} - return resolve_type_expression(ast_context, v.len) + if position_in_node(v.len, position_context.position) { + return resolve_type_expression(ast_context, v.len) + } else if position_in_node(v.expr, position_context.position) { + return resolve_type_expression(ast_context, v.expr) + } + if _, _, ok := unwrap_enum(ast_context, v.len); ok { + for elem in comp_lit.elems { + if position_in_node(elem, position_context.position) { + if field, ok := elem.derived.(^ast.Field_Value); ok { + if position_in_node(field.field, position_context.position) { + return resolve_type_expression(ast_context, v.len) + } + return resolve_type_expression(ast_context, v.expr) + } + return resolve_type_expression(ast_context, v.len) + } + } + } + return resolve_type_expression(ast_context, v.expr) + case SymbolSliceValue: + return resolve_type_expression(ast_context, v.expr) + case SymbolDynamicArrayValue: + return resolve_type_expression(ast_context, v.expr) case SymbolMapValue: for elem in comp_lit.elems { if position_in_node(elem, position_context.position) { |