less4j icon indicating copy to clipboard operation
less4j copied to clipboard

Bug with mixins using (...) and (@arguments) special variable

Open twhoff opened this issue 8 years ago • 1 comments

Different behaviour in LESS and LESS4J, see following example:

CODE

.test {
    .test-base(arg1; arg2; arg3);
}

.test-base(...) {
    .test-1(@arguments);
    .test-2(@arguments);
    .test-3(@arguments);
    .test-4(@arguments);
}

// Extract from @arguments passed in as ... binder
.test-1(...) {
    len-check1: length(@arguments);
    test-extract1: extract(@arguments, 1);
}

// Extract from @arguments passed in with same name
.test-2(@arguments) {
    len-check2: length(@arguments);
    test-extract2: extract(@arguments, 1);
}

// Extract from @arguments passed in as @args
.test-3(@args) {
    len-check3: length(@args);
    test-extract3: extract(@args, 1);
}

// Extract from @arguments in parent scope
.test-4(@random) {
    len-check4: length(@arguments);
    test-extract4: extract(@arguments, 1);
}

OUTPUT LESS (correct)

.test {
  len-check1: 3;
  test-extract1: arg1;
  len-check2: 3;
  test-extract2: arg1;
  len-check3: 3;
  test-extract3: arg1;
  len-check4: 3;
  test-extract4: arg1;
}

OUTPUT LESS4J (incorrect)*

.test {
  len-check1: 1;
  test-extract1: arg1 arg2 arg3;
  len-check2: 3;
  test-extract2: arg1;
  len-check3: 3;
  test-extract3: arg1;
  len-check4: 1;
  test-extract4: arg1 arg2 arg3;
}

Test 1 and 4 fail in LESS4J.

twhoff avatar Apr 08 '16 14:04 twhoff

Thank you, I will have a look at this after #342.

SomMeri avatar Apr 10 '16 19:04 SomMeri