Describe the bug
When a numeric predicate is applied to a negative literal (odd? -1) and paired with something like an if form, ClojureDart produces compilation errors.
Failing test to recreate the problem:
(deftest test-negative-preds
; These pass
(is (odd? 5))
(is (even? 4))
(is (odd? -5))
(is (even? -4))
(is (not (odd? 4)))
(is (not (even? 5)))
(is (odd? -5))
(is (even? -4))
; These fail to compile (not expands to an "if" form)
(is (not (odd? -4)))
(is (not (even? -5)))
)
Console output on ./run-tests
00:14 +1 -13: loading test/cljd-out/cljd/test-clojure/predicates_test.dart [E]
Failed to load "test/cljd-out/cljd/test-clojure/predicates_test.dart":
test/cljd-out/cljd/test-clojure/predicates_test.dart:1381:66: Error: The operator 'unary-' isn't defined for the class 'bool'.
Try correcting the operator to an existing operator, or defining a 'unary-' operator.
final dc.dynamic values$8915_$AUTO_$9=(lcoc_core.list.$_invoke$1(-4.isOdd, ));
^
test/cljd-out/cljd/test-clojure/predicates_test.dart:1432:67: Error: The operator 'unary-' isn't defined for the class 'bool'.
Try correcting the operator to an existing operator, or defining a 'unary-' operator.
final dc.dynamic values$8915_$AUTO_$10=(lcoc_core.list.$_invoke$1(-5.isEven, ));
^
Does your problem persist after clj -M:cljd clean && flutter clean?
No cljd clean command on ClojureDart repo
To Reproduce
Steps to reproduce the behavior:
- Add the
test-negative-preds test above to a test file in the ClojureDart repo
- Execute
./run-tests
- The error above appears in console output
Expected behavior
All tests above pass with no compilation errors
Additional context
This seems to only happen when working with negative numeric literals. If a negative is assigned to a symbol, for example, everything seems to work fine.
Additionally, as demonstrated by the tests, the problem only presents itself when paired with something like an if; executing something like (odd? -5) on its own doesn't appear to cause any issues.
Describe the bug
When a numeric predicate is applied to a negative literal
(odd? -1)and paired with something like anifform, ClojureDart produces compilation errors.Failing test to recreate the problem:
Console output on
./run-testsDoes your problem persist after
clj -M:cljd clean && flutter clean?No
cljd cleancommand on ClojureDart repoTo Reproduce
Steps to reproduce the behavior:
test-negative-predstest above to a test file in the ClojureDart repo./run-testsExpected behavior
All tests above pass with no compilation errors
Additional context
This seems to only happen when working with negative numeric literals. If a negative is assigned to a symbol, for example, everything seems to work fine.
Additionally, as demonstrated by the tests, the problem only presents itself when paired with something like an
if; executing something like(odd? -5)on its own doesn't appear to cause any issues.