Skip to content

Commit

Permalink
Resolve type of enum literal in container field init
Browse files Browse the repository at this point in the history
  • Loading branch information
FnControlOption committed Jul 17, 2023
1 parent ab1b7b5 commit 92dc4f3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/analysis.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3122,6 +3122,13 @@ pub fn resolveExpressionTypeFromAncestors(
.handle = handle,
});
}
} else if (tree.fullContainerField(ancestors[0])) |container_field| {
if (node == container_field.ast.value_expr) {
return try analyser.resolveTypeOfNode(.{
.node = ancestors[0],
.handle = handle,
});
}
} else if (tree.fullIf(ancestors[0])) |if_node| {
if (node == if_node.ast.then_expr or node == if_node.ast.else_expr) {
return try analyser.resolveExpressionType(
Expand Down

0 comments on commit 92dc4f3

Please sign in to comment.