|
| 1 | +input: |
| 2 | + input.go: | |
| 3 | + package underlying |
| 4 | +
|
| 5 | + // goverter:converter |
| 6 | + // goverter:extend IntToString |
| 7 | + // goverter:useUnderlyingTypeMethods |
| 8 | + type C1 interface { C(source X[IntID]) X[StringID] } |
| 9 | +
|
| 10 | + // goverter:converter |
| 11 | + // goverter:extend IntToString |
| 12 | + // goverter:useUnderlyingTypeMethods |
| 13 | + type C2 interface { C(source X[IntID]) X[string] } |
| 14 | +
|
| 15 | + // goverter:converter |
| 16 | + // goverter:extend IntToString |
| 17 | + // goverter:useUnderlyingTypeMethods |
| 18 | + type C3 interface { C(source X[int]) X[string] } |
| 19 | +
|
| 20 | + // goverter:converter |
| 21 | + // goverter:extend IntToString |
| 22 | + // goverter:useUnderlyingTypeMethods |
| 23 | + type C4 interface { C(source X[int]) X[StringID] } |
| 24 | +
|
| 25 | + func IntToString(s int) string { return "" } |
| 26 | +
|
| 27 | + type IntID int |
| 28 | + type StringID string |
| 29 | +
|
| 30 | + type X[T any] struct { T T } |
| 31 | +success: |
| 32 | + - generated/generated.go: | |
| 33 | + // Code generated by github.com/jmattheis/goverter, DO NOT EDIT. |
| 34 | +
|
| 35 | + package generated |
| 36 | +
|
| 37 | + import execution "github.com/jmattheis/goverter/execution" |
| 38 | +
|
| 39 | + type C1Impl struct{} |
| 40 | +
|
| 41 | + func (c *C1Impl) C(source execution.X[execution.IntID]) execution.X[execution.StringID] { |
| 42 | + var underlyingX execution.X[execution.StringID] |
| 43 | + underlyingX.T = execution.StringID(execution.IntToString(int(source.T))) |
| 44 | + return underlyingX |
| 45 | + } |
| 46 | +
|
| 47 | + type C2Impl struct{} |
| 48 | +
|
| 49 | + func (c *C2Impl) C(source execution.X[execution.IntID]) execution.X[string] { |
| 50 | + var underlyingX execution.X[string] |
| 51 | + underlyingX.T = execution.IntToString(int(source.T)) |
| 52 | + return underlyingX |
| 53 | + } |
| 54 | +
|
| 55 | + type C3Impl struct{} |
| 56 | +
|
| 57 | + func (c *C3Impl) C(source execution.X[int]) execution.X[string] { |
| 58 | + var underlyingX execution.X[string] |
| 59 | + underlyingX.T = execution.IntToString(source.T) |
| 60 | + return underlyingX |
| 61 | + } |
| 62 | +
|
| 63 | + type C4Impl struct{} |
| 64 | +
|
| 65 | + func (c *C4Impl) C(source execution.X[int]) execution.X[execution.StringID] { |
| 66 | + var underlyingX execution.X[execution.StringID] |
| 67 | + underlyingX.T = execution.StringID(execution.IntToString(source.T)) |
| 68 | + return underlyingX |
| 69 | + } |
0 commit comments