Skip to content

How to handle mixed unit math #3047

@seven-phases-max

Description

@seven-phases-max
div {
    @value: 1px;
    a: @value * 1rem;       // 1px  - ok
    b: @value * 1px * 1rem; // 1px  - ok
    d: @value / 1px;        // 1px  - ok
    c: @value / 1px * 1rem; // 1rem - unexpected
    e: @value / 1px + 0rem; // 1rem - unexpected
}

c and d results above contradict with http://lesscss.org/features/#features-overview-feature-operations stating the result should have a leftmost unit of an expression (i.e. all expressions above should produce 1px). Tests cover only a / b / c expression which accidentally produces the expected result.
Related to #2418 and #2472.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions