Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
immutable/cmd/immutableGen: fix go/packages res and type-based res
We need to fight go/packages a bit to find the right package to use for type information (see golang/go#27910 for more details). Also, our logic for surfacing embedded fields where the embedded type had a valid go/types.Type was incorrect. It assumed that all such types must be external to the package being generated, and hence required that all fields be exported. However, it is possible for a package-local type to fully type check and therefore be valid. In this case, non-exported fields _are_ valid for surfacing. Also a small fix in cmd/gg whereby xtest packages were incorrectly being considered as not Done() because they were missing a hash (which they will never have). Added a failsafe that errors in case any work was left un-Done
- Loading branch information
Showing
7 changed files
with
364 additions
and
11 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,17 @@ | ||
package coretest_test | ||
|
||
import ( | ||
_ "myitcv.io/immutable/cmd/immutableGen/internal/coretest" | ||
) | ||
|
||
//go:generate gobin -m -run myitcv.io/immutable/cmd/immutableGen -licenseFile license.txt -G "echo \"hello world\"" | ||
|
||
type _Imm_xtestA struct { | ||
*XTestB | ||
|
||
age int | ||
} | ||
|
||
type _Imm_XTestB struct { | ||
Name string | ||
} |
29 changes: 27 additions & 2 deletions
29
immutable/cmd/immutableGen/internal/coretest/gen_core_immutableGen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.