|
41 | 41 | import org.scijava.ops.engine.matcher.impl.RuntimeSafeMatchingRoutine; |
42 | 42 | import org.scijava.ops.spi.Op; |
43 | 43 | import org.scijava.priority.Priority; |
| 44 | +import org.scijava.types.inference.GenericAssignability; |
44 | 45 |
|
45 | 46 | import java.lang.reflect.Type; |
46 | 47 | import java.lang.reflect.TypeVariable; |
@@ -75,23 +76,19 @@ public OpCandidate findMatch(MatchingConditions conditions, OpMatcher matcher, |
75 | 76 | for (final OpInfo info : env.infos(request.getName(), convertConditions |
76 | 77 | .hints())) |
77 | 78 | { |
78 | | - Map<TypeVariable<?>, Type> typeVarAssigns = new HashMap<>(); |
79 | 79 | Conversions.tryConvert(env, info, request).ifPresent(converted -> { |
80 | | - // TODO: This ConvertedOpInfo is built for the request - do we even |
81 | | - // need to check assignability? |
82 | | - boolean assignable = typesMatch( // |
83 | | - converted.opType(), // |
84 | | - convertConditions.request().getType(), // |
85 | | - typeVarAssigns // |
| 80 | + Map<TypeVariable<?>, Type> map = new HashMap<>(); |
| 81 | + GenericAssignability.inferTypeVariables( // |
| 82 | + new Type[] { converted.opType() }, // |
| 83 | + new Type[] { request.getType() }, // |
| 84 | + map // |
86 | 85 | ); |
87 | | - if (assignable) { |
88 | | - candidates.add(new OpCandidate( // |
89 | | - env, // |
90 | | - request, // |
91 | | - converted, // |
92 | | - typeVarAssigns // |
93 | | - )); |
94 | | - } |
| 86 | + candidates.add(new OpCandidate( // |
| 87 | + env, // |
| 88 | + request, // |
| 89 | + converted, // |
| 90 | + map // |
| 91 | + )); |
95 | 92 | }); |
96 | 93 | } |
97 | 94 | final List<OpCandidate> matches = filterMatches(candidates); |
|
0 commit comments