Skip to content

Commit c8be771

Browse files
authored
bugfix for DownFlows() & UpFlows() (#29)
1 parent 55ec7ef commit c8be771

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

nject.go

+14-4
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,15 @@ func (fm provider) DownFlows() ([]reflect.Type, []reflect.Type) {
364364
}
365365
t := v.Type()
366366
if t.Kind() == reflect.Func {
367-
if fm.group == finalGroup {
367+
switch fm.group {
368+
case finalGroup:
368369
return typesIn(t), nil
370+
default:
371+
return effectiveOutputs(t)
369372
}
370-
return effectiveOutputs(t)
373+
}
374+
if fm.group == invokeGroup && t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Func {
375+
return nil, typesIn(t.Elem())
371376
}
372377
return nil, []reflect.Type{t}
373378
}
@@ -443,10 +448,15 @@ func (fm provider) UpFlows() ([]reflect.Type, []reflect.Type) {
443448
}
444449
t := v.Type()
445450
if t.Kind() == reflect.Func {
446-
if fm.group == finalGroup {
451+
switch fm.group {
452+
case finalGroup:
447453
return nil, typesOut(t)
454+
default:
455+
return effectiveReturns(t)
448456
}
449-
return effectiveReturns(t)
457+
}
458+
if fm.group == invokeGroup && t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Func {
459+
return typesOut(t.Elem()), nil
450460
}
451461
return nil, []reflect.Type{t}
452462
}

0 commit comments

Comments
 (0)