-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor/satisfy/find: composite lits may have type parameter type
Fix an oversight in the satisfaction check: composite lits may indeed have type parameter type, and therefore we must consider their core type. Fixes golang/go#61614 Change-Id: I2119ba308816d02742d8e790f8cd00c4d862e789 Reviewed-on: https://go-review.googlesource.com/c/tools/+/513775 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Findley <rfindley@google.com>
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
gopls/internal/regtest/marker/testdata/rename/issue61614.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
This test renames a method of a type in a package that uses type parameter | ||
composite lits. Previous iterations of the satisfy analysis did not account for | ||
this language feature. | ||
|
||
See issue #60789. | ||
|
||
-- flags -- | ||
-min_go=go1.18 | ||
|
||
-- go.mod -- | ||
module example.com | ||
go 1.20 | ||
|
||
-- a.go -- | ||
package a | ||
|
||
type I int | ||
|
||
func (I) m() {} //@rename("m", M, mToM) | ||
|
||
func _[P ~[]int]() { | ||
_ = P{} | ||
} | ||
|
||
-- @mToM/a.go -- | ||
package a | ||
|
||
type I int | ||
|
||
func (I) M() {} //@rename("m", M, mToM) | ||
|
||
func _[P ~[]int]() { | ||
_ = P{} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters