|
27 | 27 | * #L% |
28 | 28 | */ |
29 | 29 |
|
30 | | -package org.scijava.ops.engine.matcher; |
| 30 | +package org.scijava.ops.engine.matcher.impl; |
31 | 31 |
|
32 | 32 | import static org.junit.jupiter.api.Assertions.assertThrows; |
33 | 33 | import static org.junit.jupiter.api.Assertions.assertTrue; |
|
44 | 44 |
|
45 | 45 | import org.junit.jupiter.api.Assertions; |
46 | 46 | import org.junit.jupiter.api.Test; |
47 | | -import org.scijava.ops.engine.matcher.impl.MatchingUtils; |
48 | 47 | import org.scijava.types.Nil; |
49 | 48 | import org.scijava.types.Types; |
50 | 49 | import org.scijava.types.infer.GenericAssignability; |
@@ -527,29 +526,31 @@ class Thing<T> {} |
527 | 526 | class StrangeThing<N extends Number, T> extends Thing<T> {} |
528 | 527 |
|
529 | 528 | /** |
530 | | - * {@link MatchingUtils#checkGenericOutputsAssignability(Type[], Type[], HashMap)} |
531 | | - * not yet fully implemented. If this is done, all the tests below should not |
532 | | - * fail. |
| 529 | + * Tests {@link MatchingUtils#checkGenericOutputsAssignability(Type[], Type[], HashMap)}. |
533 | 530 | */ |
534 | 531 | @Test |
535 | 532 | public <N> void testOutputAssignability() { |
536 | | -// Nil<N> n = new Nil<N>() {}; |
537 | | -// Nil<List<N>> ln = new Nil<List<N>>() {}; |
538 | | -// Nil<List<? extends Number>> lWildNum = new Nil<List<? extends Number>>() {}; |
539 | | -// Nil<List<Number>> lNum = new Nil<List<Number>>() {}; |
540 | | -// Nil<List<?>> lwild = new Nil<List<?>>() {}; |
541 | | -// |
542 | | -// HashMap<TypeVariable<?>, TypeVarInfo> typeBounds = new HashMap<>(); |
543 | | -// assertTrue(-1 == Types.isApplicable(new Type[]{Integer.class}, new Type[]{n.type()}, typeBounds)); |
544 | | -// Type[] toOuts = new Type[]{lWildNum.type()}; |
545 | | -// Type[] fromOuts = new Type[]{ln.type()}; |
546 | | -// assertTrue(-1 == MatchingUtils.checkGenericOutputsAssignability(fromOuts, toOuts, typeBounds)); |
547 | | -// |
548 | | -// toOuts = new Type[]{lNum.type()}; |
549 | | -// assertTrue(-1 == MatchingUtils.checkGenericOutputsAssignability(fromOuts, toOuts, typeBounds)); |
550 | | -// |
551 | | -// toOuts = new Type[]{lwild.type()}; |
552 | | -// assertTrue(-1 == MatchingUtils.checkGenericOutputsAssignability(fromOuts, toOuts, typeBounds)); |
| 533 | + Nil<N> n = new Nil<N>() {}; |
| 534 | + Nil<List<N>> ln = new Nil<List<N>>() {}; |
| 535 | + Nil<List<? extends Number>> lWildNum = new Nil<List<? extends Number>>() {}; |
| 536 | + Nil<List<Number>> lNum = new Nil<List<Number>>() {}; |
| 537 | + Nil<List<?>> lwild = new Nil<List<?>>() {}; |
| 538 | + |
| 539 | + HashMap<TypeVariable<?>, Types.TypeVarInfo> typeBounds = new HashMap<>(); |
| 540 | + assertTrue(-1 == Types.isApplicable(new Type[]{Integer.class}, new Type[]{n.type()}, typeBounds)); |
| 541 | + Type[] toOuts = new Type[]{lWildNum.type()}; |
| 542 | + Type[] fromOuts = new Type[]{ln.type()}; |
| 543 | + assertTrue(-1 == MatchingUtils.checkGenericOutputsAssignability(fromOuts, toOuts, typeBounds)); |
| 544 | + |
| 545 | + toOuts = new Type[]{lNum.type()}; |
| 546 | + assertTrue(-1 == MatchingUtils.checkGenericOutputsAssignability(fromOuts, toOuts, typeBounds)); |
| 547 | + |
| 548 | + toOuts = new Type[]{lwild.type()}; |
| 549 | + assertTrue(-1 == MatchingUtils.checkGenericOutputsAssignability(fromOuts, toOuts, typeBounds)); |
| 550 | + |
| 551 | + // TODO: Investigate how to finish implementing |
| 552 | + // checkGenericOutputAssignability properly, |
| 553 | + // such that the following test can pass. |
553 | 554 | // |
554 | 555 | // typeBounds = new HashMap<>(); |
555 | 556 | // assertTrue(-1 == Types.isApplicable(new Type[]{String.class}, new Type[]{n.type()}, typeBounds)); |
|
0 commit comments