-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from jmattheis/panic-typeparams
fix: panic with type params
- Loading branch information
Showing
8 changed files
with
73 additions
and
5 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
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,24 @@ | ||
input: | ||
input.go: | | ||
package structs | ||
// goverter:converter | ||
// goverter:extend Extend | ||
type Converter interface { | ||
Convert(source Input) (Output, error) | ||
} | ||
func Extend[T any](T) int { | ||
return 0 | ||
} | ||
type Input struct { Age string } | ||
type Output struct { Age int } | ||
error: |- | ||
error parsing 'goverter:extend' at | ||
@workdir/input.go:5:1 | ||
github.com/jmattheis/goverter/execution.Converter | ||
error parsing type: | ||
func github.com/jmattheis/goverter/execution.Extend[T any](T) int | ||
must not be generic |
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,31 @@ | ||
input: | ||
input.go: | | ||
package structs | ||
// goverter:converter | ||
type Converter interface { | ||
// goverter:map ID | ZeroIfNil | ||
Convert(source Input) Output | ||
} | ||
type Input struct { ID *int } | ||
type Output struct { ID int } | ||
func ZeroIfNil[T any](*T) T { | ||
var t T | ||
return t | ||
} | ||
success: | ||
- generated/generated.go: | | ||
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT. | ||
package generated | ||
import execution "github.com/jmattheis/goverter/execution" | ||
type ConverterImpl struct{} | ||
func (c *ConverterImpl) Convert(source execution.Input) execution.Output { | ||
var structsOutput execution.Output | ||
structsOutput.ID = execution.ZeroIfNil(source.ID) | ||
return structsOutput | ||
} |
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