SomMeri / less4j

Less language is an extension of css and less4j compiles it into regular css. Less adds several dynamic features into css: variables, expressions, nested rules, and so on. Less was designed to be compatible with css and any correct css file is also correct less file.
145 stars 47 forks source link

Regression in 1.15.x: Detached ruleset is not allowed outside of variable declaration #323

Closed gsmet closed 8 years ago

gsmet commented 8 years ago

Hi,

We found a regression introduced between 1.14.0 and 1.15.0.

The following snippet was parsed OK in 1.14.0 and throws an exception starting from 1.15.0 (and it's still present in master):

.print() {
  a:not(.btn) {
    text-decoration: none;
  }

  .make-grid(sm);
}

The exception thrown is the following:

org.junit.ComparisonFailure: src/test/resources/compile-basic-features/not/not.less expected:<[]> but was:<[Errors produced by compilation of testCase
ERROR 2:15 Detached ruleset is not allowed outside of variable declaration.
 1: .print() {
 2:   a:not(.btn) {
 3:     text-decoration: none;]>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at com.github.sommeri.less4j.AbstractFileBasedTest.assertCorrectErrors(AbstractFileBasedTest.java:94)
    at com.github.sommeri.less4j.AbstractFileBasedTest.compileAndCompare(AbstractFileBasedTest.java:64)

If we remove the :not(.btn), it works ok so it seems to be related to the presence of the :not().

Guillaume

SomMeri commented 8 years ago

I fixed the bug. I plan to do new release sometimes next week after #324 . If you need it faster, let me know and I will release within a day.

SomMeri commented 8 years ago

Fixed version was just released. If you have problem with it, please let me know.