Skip to content

Commit 57eb2ac

Browse files
committed
jacob/inference: docstring improvements
1 parent 2b35184 commit 57eb2ac

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

gopls/internal/golang/completion/completion.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,17 +2337,19 @@ Nodes:
23372337
return inf
23382338
}
23392339

2340-
targs := c.getTypeArgs(node)
2341-
res := inferExpectedResultTypes(c, i)
2342-
substs := reverseInferTypeArgs(sig, targs, res)
2343-
inst := instantiate(sig, substs)
2344-
if inst != nil {
2345-
// TODO(jacobz): If partial signature instantiation becomes possible,
2346-
// make needsExactType only true if necessary.
2347-
// Currently ambigious cases resolve to a correct, but occassionally,
2348-
// superfluous conversion expression wrapping the completion.
2349-
inf.needsExactType = true
2350-
sig = inst
2340+
if sig.TypeParams().Len() > 0 {
2341+
targs := c.getTypeArgs(node)
2342+
res := inferExpectedResultTypes(c, i)
2343+
substs := reverseInferTypeArgs(sig, targs, res)
2344+
inst := instantiate(sig, substs)
2345+
if inst != nil {
2346+
// TODO(jacobz): If partial signature instantiation becomes possible,
2347+
// make needsExactType only true if necessary.
2348+
// Currently, ambigious cases always resolve to a conversion expression
2349+
// wrapping the completion, which is occassionally superfluous.
2350+
inf.needsExactType = true
2351+
sig = inst
2352+
}
23512353
}
23522354

23532355
inf = c.expectedCallParamType(inf, node, sig)

0 commit comments

Comments
 (0)