[tools] gopls/internal/golang: fall back when ( is not a dynamic function call

2 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
12:35 AM (4 hours ago) 12:35 AM
to goph...@pubsubhelper.golang.org, Mani Zeygham, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

gopls/internal/golang: fall back when ( is not a dynamic function call

When implementation is requested at the "(" paren of a call, implFuncs first checks whether the call is dynamic. For calls that are not dynamic function calls (for example, method calls), that check fails.

Instead of returning a hard error, return errNotHandled so the request falls back to the regular method-set implementation path.

This restores the fallback behavior that regressed in 25a90befcdf96d15f13dd947b7395c8531dc67de.

Fixes golang/go#77784
Change-Id: I88fecfdddc4057887ce8ad3f25374988112799e4
GitHub-Last-Rev: d082b3ca9835f862d2d871f373831bb69eeb0ec3
GitHub-Pull-Request: golang/tools#617

Change diff

diff --git a/gopls/internal/golang/implementation.go b/gopls/internal/golang/implementation.go
index 9b47dea..eac0f7f 100644
--- a/gopls/internal/golang/implementation.go
+++ b/gopls/internal/golang/implementation.go
@@ -940,7 +940,7 @@
if inToken(n.Lparen, "(", start, end) {
t := dynamicFuncCallType(info, n)
if t == nil {
- return nil, fmt.Errorf("not a dynamic function call")
+ return nil, errNotHandled
}
// Case 2b: dynamic call of function value.
// Report declarations of corresponding concrete functions.
diff --git a/gopls/internal/test/marker/testdata/implementation/issue74305.txt b/gopls/internal/test/marker/testdata/implementation/issue74305.txt
index 916a6d3..473fb28 100644
--- a/gopls/internal/test/marker/testdata/implementation/issue74305.txt
+++ b/gopls/internal/test/marker/testdata/implementation/issue74305.txt
@@ -8,4 +8,4 @@
-- a/a.go --
package a

-var _ = undefined() //@ diag("undefined", re"undefined"), implementation("(", err="not a dynamic function call")
+var _ = undefined() //@ diag("undefined", re"undefined"), implementation("(", err="no identifier found")
diff --git a/gopls/internal/test/marker/testdata/implementation/signature.txt b/gopls/internal/test/marker/testdata/implementation/signature.txt
index 054e169..daa02f9 100644
--- a/gopls/internal/test/marker/testdata/implementation/signature.txt
+++ b/gopls/internal/test/marker/testdata/implementation/signature.txt
@@ -69,12 +69,11 @@
struct{x Nullary}{}.x() //@ loc(fieldCall, "("), implementation("(", nullaryFunc)

// Calls that are not dynamic function calls:
- _ = len("") //@ implementation("(", err="not a dynamic function call")
- _ = int(0) //@ implementation("(", err="not a dynamic function call")
- _ = error.Error(nil) //@ implementation("(", err="not a dynamic function call")
- _ = err.Error() //@ implementation("(", err="not a dynamic function call")
- _ = f4(0) //@ implementation("(", err="not a dynamic function call"), loc(f4Call, "(")
+ _ = len("") //@ implementation("(", err="no identifier found")
+ _ = int(0) //@ implementation("(", err="no identifier found")
+ _ = error.Error(nil) //@ implementation("(", err="no identifier found")
+ _ = err.Error() //@ implementation("(", err="no identifier found")
+ _ = f4(0) //@ implementation("(", err="no identifier found"), loc(f4Call, "(")
}


-

Change information

Files:
  • M gopls/internal/golang/implementation.go
  • M gopls/internal/test/marker/testdata/implementation/issue74305.txt
  • M gopls/internal/test/marker/testdata/implementation/signature.txt
Change size: S
Delta: 3 files changed, 7 insertions(+), 8 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I88fecfdddc4057887ce8ad3f25374988112799e4
Gerrit-Change-Number: 748740
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-CC: Mani Zeygham <mani...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
12:35 AM (4 hours ago) 12:35 AM
to Mani Zeygham, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gopher Robot added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Gopher Robot . unresolved

I spotted some possible problems with your PR:

  1. You have a long 205 character line in the commit message body. Please add line breaks to long lines that should be wrapped. Lines in the commit message body should be wrapped at ~76 characters unless needed for things like URLs or tables. (Note: GitHub might render long lines as soft-wrapped, so double-check in the Gerrit commit message shown above.)

Please address any problems by updating the GitHub PR.

When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.

To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.

For more details, see:

(In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: I88fecfdddc4057887ce8ad3f25374988112799e4
    Gerrit-Change-Number: 748740
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Mani Zeygham <mani...@gmail.com>
    Gerrit-Comment-Date: Wed, 25 Feb 2026 05:35:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Gopher Robot (Gerrit)

    unread,
    12:37 AM (4 hours ago) 12:37 AM
    to Mani Zeygham, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Message from Gopher Robot

    Congratulations on opening your first change. Thank you for your contribution!

    Next steps:
    A maintainer will review your change and provide feedback. See
    https://go.dev/doc/contribute#review for more info and tips to get your
    patch through code review.

    Most changes in the Go project go through a few rounds of revision. This can be
    surprising to people new to the project. The careful, iterative review process
    is our way of helping mentor contributors and ensuring that their contributions
    have a lasting impact.

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: I88fecfdddc4057887ce8ad3f25374988112799e4
    Gerrit-Change-Number: 748740
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Mani Zeygham <mani...@gmail.com>
    Gerrit-Comment-Date: Wed, 25 Feb 2026 05:37:45 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    12:52 AM (4 hours ago) 12:52 AM
    to Mani Zeygham, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #2 to this change.
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: I88fecfdddc4057887ce8ad3f25374988112799e4
    Gerrit-Change-Number: 748740
    Gerrit-PatchSet: 2
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages