tools/gopls/internal/analysis
Hongxiang Jiang e751756721 internal/analysisinternal: unify zero value function to typesinternal
Refactors the ZeroExpr and ZeroString functions to provide more
consistent and correct handling of zero values for input types.

- Refactor: Unify similar switch case statements in both functions with
exception of types.Tuple. ZeroExpr panic due to the lack of a valid
ast.Expr representation.
- Fixing an issue where ZeroExpr returned nil for types.Array instead of
a composite literal.
- Adding support for type parameters in ZeroExpr, similar to ZeroString.
- Consolidating tests for both functions into TestZeroValue.

Change-Id: Ic77ae17ea091cf51bd4d4642186fe13093e0d461
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627604
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Hongxiang Jiang <hxjiang@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-11-20 16:07:55 +00:00
..
deprecated internal/typeparams: delete OriginMethod 2024-03-07 17:26:57 +00:00
embeddirective internal/aliases: remove Alias and Unalias 2024-09-20 19:51:09 +00:00
fillreturns internal/analysisinternal: unify zero value function to typesinternal 2024-11-20 16:07:55 +00:00
fillstruct internal/analysisinternal: unify zero value function to typesinternal 2024-11-20 16:07:55 +00:00
fillswitch gopls/internal/analysis/fillswitch: use qualified type names 2024-07-09 13:40:23 +00:00
infertypeargs internal/versions: remove InitFileVersions 2024-10-07 18:12:27 +00:00
nonewvars x/tools: fset.File(file.Pos()) -> fset.File(file.FileStart) 2024-11-04 15:48:36 +00:00
noresultvalues x/tools: fset.File(file.Pos()) -> fset.File(file.FileStart) 2024-11-04 15:48:36 +00:00
simplifycompositelit x/tools: fset.File(file.Pos()) -> fset.File(file.FileStart) 2024-11-04 15:48:36 +00:00
simplifyrange x/tools: fset.File(file.Pos()) -> fset.File(file.FileStart) 2024-11-04 15:48:36 +00:00
simplifyslice x/tools: fset.File(file.Pos()) -> fset.File(file.FileStart) 2024-11-04 15:48:36 +00:00
unusedparams x/tools/gopls: delete code obsoleted by go1.23 2024-09-09 18:00:29 +00:00
unusedvariable x/tools: fset.File(file.Pos()) -> fset.File(file.FileStart) 2024-11-04 15:48:36 +00:00
useany internal/typeparams: eliminate remainining compatibility shims 2023-12-12 20:07:19 +00:00
yield gopls/internal/analysis/yield: analyzer for iterator (yield) mistakes 2024-11-14 19:44:45 +00:00