Skip to content

Wrong line reported for Error: invalid operands for multiplication #1751

@strarsis

Description

@strarsis

When an invalid operand is used in a multiplication
and that operand being a variable,
the line where the variable has been defined is reported
instead the place where the multiplication itself is attempted.

SCSS for reproducing the issue:

$test: 'abc';
// other lines
// ...
@debug $test * 10;

Current libsass (3.3.2) with node-sass (3.4.2) will then report the following:

[...]
Error: invalid operands for multiplication
        on line 1 of stdin
>> $test: 'abc';
   -------^
[...]

In contrast to ruby sass, where a more helpful error message is produced:

[...]
[...] (Line 4: Undefined operation: ""abc" times 10".)
[...]

Also variables that were defined in functions,
which are called for the value to be used in the multiplication,
are reported instead, which can be very confusing.

This issue does occur also only with multiplication operations,
not with other operations like division (/), addition(+) or substraction(-) purely used,
then resulting in the defined math formula as string with the variables concatenated,
and without reporting an error (in ruby sass + libsass).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions