Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow generic named types to be directly used as a provider #22

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

arcturial
Copy link
Contributor

Using a generic function as a provider cased issued when the func had named types like so:

type TestFunc[T any, C any] func(a T, c C) string
type GenericStringType = TestFunc[exchange.Model, string]

type Backends interface { 
    GenericStringFunc() GenericStringType
}

When generating the weld code, it would fail since it tried to generate the function signature like this:

func (b *backendsImpl) GenericStringFunc() exchange_ops.TestFunc[example/exchange.Model, string] {
	return b.genericStringFunc
}

The type arguments were not included in the template "package replacement" code. It would only go over the exchange_ops.TestFunc, but not it's arguments.

Adding the type arguments to the Named type clause seems to solve this issue and it not correctly replaces the example/ directory from the package name.

Copy link

@arcturial arcturial merged commit 4a41c43 into main Oct 14, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants