Skip to content

Commit

Permalink
Merge pull request #426 from laytan/fix-resolve-poly-proc-type
Browse files Browse the repository at this point in the history
fix resolve poly for proc types
  • Loading branch information
DanielGavin authored Jul 11, 2024
2 parents c09d18e + b77e2a9 commit 905716a
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/server/generics.odin
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ resolve_poly :: proc(
}
}
}
case ^ast.Struct_Type:
case ^ast.Dynamic_Array_Type:
if call_array, ok := call_node.derived.(^ast.Dynamic_Array_Type); ok {
if poly_type, ok := p.elem.derived.(^ast.Poly_Type); ok {
Expand Down Expand Up @@ -283,6 +282,7 @@ resolve_poly :: proc(
if n, ok := call_node.derived.(^ast.Ident); ok {
return true
}
case ^ast.Struct_Type, ^ast.Proc_Type:
case:
log.panicf("Unhandled specialization %v", specialization.derived)
}
Expand Down Expand Up @@ -434,6 +434,26 @@ find_and_replace_poly_type :: proc(
v.pos.file = expr.pos.file
v.end.file = expr.end.file
}
case ^ast.Proc_Type:
if v.params != nil {
for param in v.params.list {
if expr, ok := get_poly_map(param.type, poly_map); ok {
param.type = expr
param.pos.file = expr.pos.file
param.end.file = expr.end.file
}
}
}

if v.results != nil {
for result in v.results.list {
if expr, ok := get_poly_map(result.type, poly_map); ok {
result.type = expr
result.pos.file = expr.pos.file
result.end.file = expr.end.file
}
}
}
}

return visitor
Expand Down

0 comments on commit 905716a

Please sign in to comment.