Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type-unaware target collection #340

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions decoder/expr_any_ref_targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (a Any) ReferenceTargets(ctx context.Context, targetCtx *TargetContext) ref
}
}

if targetCtx == nil || len(targetCtx.ParentAddress) == 0 {
if targetCtx == nil || len(targetCtx.ParentAddress) == 0 || !targetCtx.AsExprType {
return reference.Targets{}
}

Expand All @@ -34,11 +34,6 @@ func (a Any) ReferenceTargets(ctx context.Context, targetCtx *TargetContext) ref
rangePtr = a.expr.Range().Ptr()
}

var refType cty.Type
if targetCtx.AsExprType {
refType = typ
}

return reference.Targets{
{
Addr: targetCtx.ParentAddress,
Expand All @@ -47,7 +42,7 @@ func (a Any) ReferenceTargets(ctx context.Context, targetCtx *TargetContext) ref
ScopeId: targetCtx.ScopeId,
RangePtr: rangePtr,
DefRangePtr: targetCtx.ParentDefRangePtr,
Type: refType,
Type: typ,
},
}
}
Expand Down
Loading