-
Notifications
You must be signed in to change notification settings - Fork 295
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
Disallow using In/Out structs with From/As annotations #1060
Comments
Would love to pick up this issue. Suggested change in annotated.go. @tchung1118 Can you please add me as a contributor to uber/fx repo ?
|
sywhang
added a commit
that referenced
this issue
Apr 18, 2023
In #1053, we eased up the requirement for function signature for applying annotations to allow using In/Out structs with ResultTags/ParamTags. This had an unintended change in behavior where users are now able to use In/Out structs with From/As annotations. For example, the below code used to error out: > type Foo interface { ... } > type Bar struct { ... } // Bar implements Foo > struct Res { > fx.Out > > ABar Bar > } > fx.Annotate( > func() Res { ... }, > fx.As(new(Foo)), > ) Currently the code above applies the As annotation to ABar field and transforms the target function's signature accordingly. However, this was an unintended change in behavior, and we should have a design discussion about whether we actually want this before cutting a new release. Since it will require a breaking change to disable this after a new release is cut, I think the safe approach is to disable this for now and enable it after having decided that this is indeed what we want. Fixes #1060 --------- Co-authored-by: Sung Yoon Whang <sungyoonwhang@gmail.com> Co-authored-by: JacobOaks <jacoboaks.8@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In #1053, we eased up the requirement for function signature for applying annotations to allow using In/Out structs with ResultTags/ParamTags. This had an unintended change in behavior where users are now able to use In/Out structs with From/As annotations. For example, the below code used to error out:
Currently the code above applies the As annotation to
ABar
field and transforms the target function's signature accordingly. However, this was an unintended change in behavior, and we should have a design discussion about whether we actually want this before cutting a new release. Since it will require a breaking change to disable this after a new release is cut, I think the safe approach is to disable this for now and enable it after having decided that this is indeed what we want.The text was updated successfully, but these errors were encountered: