Page MenuHomePhabricator

[mixins-guards] Investigate when() match failures for "greater than" and "less then"
Closed, ResolvedPublic

Description

If we try compiling the test.less file below, we get an error Unable to perform comparison. The test.less file is the test for mixins-guard which is gotten from lessjs v2.5.3

PHP Fatal error:  Uncaught Less_Exception_Compiler: Unable to perform comparison in .../less.php/lib/Less/Tree/Condition.php:45

Stack trace:
#0 .../less.php/lib/Less/Tree/Mixin/Definition.php(202): Less_Tree_Condition->compile(Object(Less_Environment))
#1 .../less.php/lib/Less/Tree/Mixin/Call.php(77): Less_Tree_Mixin_Definition->matchCondition(Array, Object(Less_Environment))
#2 .../less.php/lib/Less/Tree/Ruleset.php(149): Less_Tree_Mixin_Call->compile(Object(Less_Environment))
#3 .../less.php/lib/Less/Tree/Ruleset.php(91): Less_Tree_Ruleset->EvalMixinCalls(Object(Less_Tree_Ruleset), Object(Less_Environment), 13)
#4 .../less.php/lib/Less/Tree/Ruleset.php(96): Less_Tree_Ruleset->compile(Object(Less_Environment))
#5 .../less.php/lib/Less/Parser.php(182): Less_Tree_Ruleset->compile(Object(Less_Environment))
#6 .../less.php/bin/lessc(189): Less_Parser->getCss()
#7 {main}
  thrown in ../less.php/lib/Less/Tree/Condition.php on line 45

Details

Event Timeline

Krinkle triaged this task as Medium priority.Jan 5 2024, 2:22 PM

It looks like my fix for T357160 (https://gerrit.wikimedia.org/r/999959) also made the mixing-guard.less fixture no longer crash. However, it isn't yet passing, either.

As of today, master branch at 739bac9d62 test: Remove unversioned lessjs directory (2024-02-29), the spec failure is as follows:

... parse /Users/krinkle/Development/less.php/test/Fixtures/lessjs-2.5.3/less/mixins-guards.less Fail
--- actual
+++ /Users/krinkle/Development/less.php/test/Fixtures/lessjs-2.5.3/css/mixins-guards.css
@@ -81,12 +81,9 @@
 }
 .variouse-types-comparison {
   /**/
-  content: true is greater than false;
-  content: false is greater than true too;
   content: true is not equal to false;
   content: false is not equal to true too;
   /**/
-  content: true is less than 1 too;
   content: 1 is not equal to true;
   content: true is not equal to 1 too;
   /**/
@@ -113,11 +110,11 @@
   content: 6 is equal to 6;
   content: 6 is equal to 6 too;
   /**/
-  content: /* Sorry, can not do JavaScript evaluation in PHP... :( */ is not equal to 8;
-  content: 8 is not equal to /* Sorry, can not do JavaScript evaluation in PHP... :( */ too;
+  content: 8 is less than 9 too;
+  content: 9 is greater than 8;
+  content: 9 is not equal to 8;
+  content: 8 is not equal to 9 too;
   /**/
-  content: a is greater than b;
-  content: b is greater than a too;
   content: a is not equal to b;
   content: b is not equal to a too;
   /**/
@@ -171,7 +168,6 @@
 #guarded-caller {
   guarded: namespace;
   silent: namespace;
-  should: not match because namespace argument;
   guarded: with default;
 }
 #guarded-deeper {

The JavaScript evaluation is expected and may be overridden. The rest, depending on why it differs, is probably a bug or outdated implementation on our side.

Krinkle renamed this task from Investigate "Unable to perform comparison" in mixins-guard.less test case to [mixins-guards] Investigate when() match failures for "greater than" and "less then".Mar 4 2024, 8:45 PM

Change #1026463 had a related patch set uploaded (by Hokwelum; author: Hokwelum):

[mediawiki/libs/less.php@master] Fix failing mixins-guards failing test

https://gerrit.wikimedia.org/r/1026463

Hokwelum changed the task status from Open to In Progress.May 4 2024, 8:34 AM

Change #1026463 merged by jenkins-bot:

[mediawiki/libs/less.php@master] Fix failing mixins-guards failing test

https://gerrit.wikimedia.org/r/1026463