Skip to content

Commit ce781ab

Browse files
committed
Merge branch 'ConditionProblem' into 'master'
TODO COND marker for problem with shortcut conditions See merge request exedio/cope!1939
2 parents 17dfd9d + a8b6283 commit ce781ab

8 files changed

Lines changed: 21 additions & 21 deletions

File tree

runtime/patternsrc/com/exedio/cope/pattern/MultiItemField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ public Condition is(final E value)
401401
final ItemField<?> component = componentByValue(value);
402402
return
403403
component!=null
404-
? component.isCasted(value) // bug: just selecting one component does not work for not
405-
: Condition.ofFalse(); // bug: ofFalse without canBe does not work for not
404+
? component.isCasted(value) // TODO COND bug: just selecting one component does not work for not
405+
: Condition.ofFalse(); // TODO COND bug: ofFalse without canBe does not work for not
406406
}
407407

408408
@Override

runtime/src/com/exedio/cope/CompositeCondition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public static <E> Condition in(final Function<E> function, final E... values)
210210
switch(values.length)
211211
{
212212
case 0 -> {
213-
return ofFalse();
213+
return ofFalse(); // TODO COND bug: ofFalse.not() with null
214214
} case 1 -> {
215215
return function.is(values[0]);
216216
} default -> {
@@ -231,7 +231,7 @@ public static <E> Condition in(final Function<E> function, final Collection<? ex
231231
switch(values.size())
232232
{
233233
case 0 -> {
234-
return ofFalse();
234+
return ofFalse(); // TODO COND bug: ofFalse.not() with null
235235
} case 1 -> {
236236
return function.is(values.iterator().next());
237237
} default -> {

runtime/src/com/exedio/cope/DoubleField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public Condition is(final Double value)
315315
// TODO does not work with BindFunction
316316
final double valuePrimitive = value;
317317
if(valuePrimitive<minimum || valuePrimitive>maximum)
318-
return Condition.ofFalse();
318+
return Condition.ofFalse(); // TODO COND bug: ofFalse.not() with null
319319
else
320320
return super.is(value);
321321
}
@@ -341,7 +341,7 @@ public Condition isNot(final Double value)
341341
// TODO does not work with BindFunction
342342
final double valuePrimitive = value;
343343
if(valuePrimitive<minimum || valuePrimitive>maximum)
344-
return Condition.ofTrue();
344+
return Condition.ofTrue(); // TODO COND bug: ofTrue.not() with null
345345
else
346346
return super.isNot(value);
347347
}

runtime/src/com/exedio/cope/IntegerField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public Condition is(final Integer value)
486486
// TODO does not work with BindFunction
487487
final int valuePrimitive = value;
488488
if(valuePrimitive<minimum || valuePrimitive>maximum)
489-
return Condition.ofFalse();
489+
return Condition.ofFalse(); // TODO COND bug: ofFalse.not() with null
490490
else
491491
return super.is(value);
492492
}
@@ -512,7 +512,7 @@ public Condition isNot(final Integer value)
512512
// TODO does not work with BindFunction
513513
final int valuePrimitive = value;
514514
if(valuePrimitive<minimum || valuePrimitive>maximum)
515-
return Condition.ofTrue();
515+
return Condition.ofTrue(); // TODO COND bug: ofTrue.not() with null
516516
else
517517
return super.isNot(value);
518518
}

runtime/testsrc/com/exedio/cope/DoubleFieldRangeTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ public DoubleFieldRangeTest()
5353
{
5454
final var f = AnItem.field;
5555

56-
assertIt(of( ), of(iMin, iNrm, iMax, iNul), f.is(19.9)); // TODO iNul is wrong because of bug: ofFalse.not() with null
56+
assertIt(of( ), of(iMin, iNrm, iMax, iNul), f.is(19.9)); // TODO COND iNul is wrong because of bug: ofFalse.not() with null
5757
assertIt(of(iMin), of( iNrm, iMax ), f.is(20.0));
5858
assertIt(of(iNrm), of(iMin, iMax ), f.is(25.0));
5959
assertIt(of( ), of(iMin, iNrm, iMax ), f.is(26.0));
6060
assertIt(of(iMax), of(iMin, iNrm ), f.is(30.0));
61-
assertIt(of( ), of(iMin, iNrm, iMax, iNul), f.is(30.1)); // TODO iNul is wrong because of bug: ofFalse.not() with null
61+
assertIt(of( ), of(iMin, iNrm, iMax, iNul), f.is(30.1)); // TODO COND iNul is wrong because of bug: ofFalse.not() with null
6262
assertIt(of(iNul), of(iMin, iNrm, iMax ), f.is((Double)null));
6363

64-
assertIt(of(iMin, iNrm, iMax, iNul), of( ), f.isNot(19.9)); // TODO iNul is wrong because of bug: ofTrue.not() with null
64+
assertIt(of(iMin, iNrm, iMax, iNul), of( ), f.isNot(19.9)); // TODO COND iNul is wrong because of bug: ofTrue.not() with null
6565
assertIt(of( iNrm, iMax ), of(iMin), f.isNot(20.0));
6666
assertIt(of(iMin, iMax ), of(iNrm), f.isNot(25.0));
6767
assertIt(of(iMin, iNrm, iMax ), of( ), f.isNot(26.0));
6868
assertIt(of(iMin, iNrm ), of(iMax), f.isNot(30.0));
69-
assertIt(of(iMin, iNrm, iMax, iNul), of( ), f.isNot(30.1)); // TODO iNul is wrong because of bug: ofTrue.not() with null
69+
assertIt(of(iMin, iNrm, iMax, iNul), of( ), f.isNot(30.1)); // TODO COND iNul is wrong because of bug: ofTrue.not() with null
7070
assertIt(of(iMin, iNrm, iMax ), of(iNul), f.isNot((Double)null));
7171
}
7272

runtime/testsrc/com/exedio/cope/InConditionBorderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public InConditionBorderTest()
5656
assertIn(asList(i1, i2, iN), asList( i3 ), asList(V1, V2, null));
5757
assertIn(asList(i1 ), asList( i2, i3 ), asList(V1 ));
5858
assertIn(asList(i1, iN), asList( i2, i3 ), asList(V1, null));
59-
assertIn(asList( ), asList(i1, i2, i3, iN), asList( )); // TODO iN is wrong because of bug: ofFalse.not() with null
59+
assertIn(asList( ), asList(i1, i2, i3, iN), asList( )); // TODO COND iN is wrong because of bug: ofFalse.not() with null
6060
assertIn(asList( iN), asList(i1, i2, i3 ), asList( (YEnum)null));
6161
}
6262

runtime/testsrc/com/exedio/cope/IntegerFieldRangeTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ public IntegerFieldRangeTest()
5353
{
5454
final var f = AnItem.field;
5555

56-
assertIt(of( ), of(iMin, iNrm, iMax, iNul), f.is(19)); // TODO iNul is wrong because of bug: ofFalse.not() with null
56+
assertIt(of( ), of(iMin, iNrm, iMax, iNul), f.is(19)); // TODO COND iNul is wrong because of bug: ofFalse.not() with null
5757
assertIt(of(iMin), of( iNrm, iMax ), f.is(20));
5858
assertIt(of(iNrm), of(iMin, iMax ), f.is(25));
5959
assertIt(of( ), of(iMin, iNrm, iMax ), f.is(26));
6060
assertIt(of(iMax), of(iMin, iNrm ), f.is(30));
61-
assertIt(of( ), of(iMin, iNrm, iMax, iNul), f.is(31)); // TODO iNul is wrong because of bug: ofFalse.not() with null
61+
assertIt(of( ), of(iMin, iNrm, iMax, iNul), f.is(31)); // TODO COND iNul is wrong because of bug: ofFalse.not() with null
6262
assertIt(of(iNul), of(iMin, iNrm, iMax ), f.is((Integer)null));
6363

64-
assertIt(of(iMin, iNrm, iMax, iNul), of( ), f.isNot(19)); // TODO iNul is wrong because of bug: ofTrue.not() with null
64+
assertIt(of(iMin, iNrm, iMax, iNul), of( ), f.isNot(19)); // TODO COND iNul is wrong because of bug: ofTrue.not() with null
6565
assertIt(of( iNrm, iMax ), of(iMin), f.isNot(20));
6666
assertIt(of(iMin, iMax ), of(iNrm), f.isNot(25));
6767
assertIt(of(iMin, iNrm, iMax ), of( ), f.isNot(26));
6868
assertIt(of(iMin, iNrm ), of(iMax), f.isNot(30));
69-
assertIt(of(iMin, iNrm, iMax, iNul), of( ), f.isNot(31)); // TODO iNul is wrong because of bug: ofTrue.not() with null
69+
assertIt(of(iMin, iNrm, iMax, iNul), of( ), f.isNot(31)); // TODO COND iNul is wrong because of bug: ofTrue.not() with null
7070
assertIt(of(iMin, iNrm, iMax ), of(iNul), f.isNot((Integer)null));
7171
}
7272

runtime/testsrc/com/exedio/cope/pattern/MultiItemFieldConditionTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ public MultiItemFieldConditionTest()
6161
@Test void test()
6262
{
6363
final var f = AnItem.field;
64-
assertIt(of(iA1a, iA1b), of( iA2a ), f.is(vA1)); // TODO iB1a is missing in expectedNot because of bug: just selecting one component does not work for not
65-
assertIt(of(iA2a), of(iA1a, iA1b ), f.is(vA2)); // TODO iB1a is missing in expectedNot because of bug: just selecting one component does not work for not
66-
assertIt(of(iB1a), of( ), f.is(vB1)); // TODO iA1? is missing in expectedNot because of bug: just selecting one component does not work for not
67-
assertIt(of( ), of(iA1a, iA1b, iA2a, iB1a, iNul), f.is(vXX)); // TODO iNul is wrong because of bug: ofFalse without canBe does not work for not
64+
assertIt(of(iA1a, iA1b), of( iA2a ), f.is(vA1)); // TODO COND iB1a is missing in expectedNot because of bug: just selecting one component does not work for not
65+
assertIt(of(iA2a), of(iA1a, iA1b ), f.is(vA2)); // TODO COND iB1a is missing in expectedNot because of bug: just selecting one component does not work for not
66+
assertIt(of(iB1a), of( ), f.is(vB1)); // TODO COND iA1? is missing in expectedNot because of bug: just selecting one component does not work for not
67+
assertIt(of( ), of(iA1a, iA1b, iA2a, iB1a, iNul), f.is(vXX)); // TODO COND iNul is wrong because of bug: ofFalse without canBe does not work for not
6868
assertIt(of(iNul), of(iA1a, iA1b, iA2a, iB1a ), f.is(null));
6969
}
7070

0 commit comments

Comments
 (0)