fix(container): issue with multiple dependencies coming from an output struct (#11912)
This commit is contained in:
parent
324da02ba9
commit
10af6f9d82
|
@ -214,9 +214,10 @@ func (c *container) addNode(provider *ProviderDescriptor, key *moduleKey) (inter
|
|||
}
|
||||
|
||||
vr = &simpleResolver{
|
||||
node: sp,
|
||||
typ: typ,
|
||||
graphNode: typeGraphNode,
|
||||
node: sp,
|
||||
typ: typ,
|
||||
graphNode: typeGraphNode,
|
||||
idxInValues: i,
|
||||
}
|
||||
c.resolvers[typ] = vr
|
||||
}
|
||||
|
|
|
@ -461,6 +461,7 @@ type TestOutput struct {
|
|||
container.Out
|
||||
|
||||
X string
|
||||
Y int64
|
||||
}
|
||||
|
||||
func TestStructArgs(t *testing.T) {
|
||||
|
@ -485,11 +486,12 @@ func TestStructArgs(t *testing.T) {
|
|||
))
|
||||
|
||||
require.NoError(t, container.Run(
|
||||
func(x string) {
|
||||
func(x string, y int64) {
|
||||
require.Equal(t, "A", x)
|
||||
require.Equal(t, int64(-10), y)
|
||||
},
|
||||
container.Provide(func() (TestOutput, error) {
|
||||
return TestOutput{X: "A"}, nil
|
||||
return TestOutput{X: "A", Y: -10}, nil
|
||||
}),
|
||||
))
|
||||
|
||||
|
|
Loading…
Reference in New Issue