-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug with type aliases to structs
@max-melentyev found in #843 that type aliases to structs were being rendered as a struct literal. The problem was that we need the type of the right hand side of the alias definition, not the underlying type itself.
- Loading branch information
1 parent
55e1e90
commit 3cef7fd
Showing
7 changed files
with
165 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
package type_alias | ||
|
||
import "github.com/vektra/mockery/v2/pkg/fixtures/type_alias/subpkg" | ||
|
||
type Type = int | ||
type S = subpkg.S | ||
|
||
type Interface1 interface { | ||
Foo() Type | ||
} | ||
|
||
type Interface2 interface { | ||
F(Type, S, subpkg.S) | ||
} |
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
70 changes: 70 additions & 0 deletions
70
pkg/fixtures/type_alias/mock_Interface2WithResolvedAlias_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
pkg/fixtures/type_alias/mock_Interface2WithUnresolvedAlias_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,5 @@ | ||
package subpkg | ||
|
||
type S struct { | ||
A int | ||
} |
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