tools/gopls/internal/analysis/fillstruct
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
..
testdata/src gopls/internal/analysis/fillstruct: use package name (not path) in UI 2024-06-27 18:36:39 +00:00
fillstruct.go internal/analysisinternal: unify zero value function to typesinternal 2024-11-20 16:07:55 +00:00
fillstruct_test.go gopls/internal/golang: simplify "rewrite" code actions 2024-05-08 14:20:48 +00:00