Skip to content

Confusing boolean logic #4399

@uncenter

Description

@uncenter

To reproduce:

The Less preview doesn't want me to use the correct share link so here's the Less for it:

@foo: 1;
@bar: a;
@foo-is-one: boolean(@foo = 1);
@bar-is-a: boolean(@bar = a);
@is-qar: boolean(@foo-is-one = @bar-is-a);
/* @is-baz: boolean((@foo = 1) = (@bar = a)); */

:root {
  --qar: @is-qar;
/*   --baz: @is-baz; */
}

Current behavior:

Commenting in the @is-baz variable on line 6 (and line 10 to use it in an expression) causes the error variable @is-baz is undefined. As you can see, the expression @is-baz contains is the same is the (working) @is-qar expression, but inlines the @foo-is-one and @bar-is-a checks.

Expected behavior:

There shouldn't be any undefined variable, because the variable is defined — I should be allowed to inline boolean expressions / logical comparisons like so.

Environment information:

  • less version: latest
  • nodejs version: n/a
  • operating system: n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions