-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nilness: add unit test for generic instantiation.
Adds a unit test for generic instantiation to nilness. Currently the expected behavior is to ignore the instantiation as it is not added to builssa's SrcFuncs result. Updates golang/go#52463 Updates golang/go#48525 Change-Id: I7b214aae88c8aa26605abb5019591178f76a7cbb Reviewed-on: https://go-review.googlesource.com/c/tools/+/402054 Run-TryBot: Tim King <taking@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Tim King <taking@google.com> Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
- Loading branch information
1 parent
2548a8b
commit 825b661
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
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
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,14 @@ | ||
package c | ||
|
||
func instantiated[X any](x *X) int { | ||
if x == nil { | ||
print(*x) // not reported until _Instances are added to SrcFuncs | ||
} | ||
return 1 | ||
} | ||
|
||
var g int | ||
|
||
func init() { | ||
g = instantiated[int](&g) | ||
} |