Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors for overloaded function arguments #1496

Merged
merged 3 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions spec/core_functions/color/hsl/error/five_args.hrx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<===> input.scss
five-arg {
x: hsl(0, 100%, 50%, 0.5, 0);
<===> error/too_many_args/input.scss
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already in an error directory (spec/core_functions/color/hsl/error) so they don't need an additional error component here. I think it's fine to also leave off too_many_args, since there's only one meaningful test for passing five arguments anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points, fixed.

a {
b: hsl(0, 100%, 50%, 0.5, 0);
}

<===> error
Error: Only 1 argument allowed, but 5 were passed.
<===> error/too_many_args/error
Error: Only 4 arguments allowed, but 5 were passed.
,
2 | x: hsl(0, 100%, 50%, 0.5, 0);
2 | b: hsl(0, 100%, 50%, 0.5, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===> error-libsass
<===> error/too_many_args/error-libsass
Error: wrong number of arguments (5 for 3) for `hsl'
on line 2 of input.scss
>> x: hsl(0, 100%, 50%, 0.5, 0);
>> b: hsl(0, 100%, 50%, 0.5, 0);

-----^
40 changes: 20 additions & 20 deletions spec/core_functions/color/hsl/error/four_args.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,60 @@

<===>
================================================================================
<===> hue/type/input.scss
hue-type {
x: hsl("foo", 100%, 50%, 0.5);
<===> error/hue/type/input.scss
a {
b: hsl("foo", 100%, 50%, 0.5);
}

<===> hue/type/error
<===> error/hue/type/error
Error: $hue: "foo" is not a number.
,
2 | x: hsl("foo", 100%, 50%, 0.5);
2 | b: hsl("foo", 100%, 50%, 0.5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> saturation/type/input.scss
saturation-type {
x: hsl(0, "foo", 50%, 0.5);
<===> error/saturation/type/input.scss
a {
b: hsl(0, "foo", 50%, 0.5);
}

<===> saturation/type/error
<===> error/saturation/type/error
Error: $saturation: "foo" is not a number.
,
2 | x: hsl(0, "foo", 50%, 0.5);
2 | b: hsl(0, "foo", 50%, 0.5);
| ^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> lightness/type/input.scss
lightness-type {
x: hsl(0, 100%, "foo", 0.5);
<===> error/lightness/type/input.scss
a {
b: hsl(0, 100%, "foo", 0.5);
}

<===> lightness/type/error
<===> error/lightness/type/error
Error: $lightness: "foo" is not a number.
,
2 | x: hsl(0, 100%, "foo", 0.5);
2 | b: hsl(0, 100%, "foo", 0.5);
| ^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> alpha/unit/input.scss
.alpha-unit {
a: hsl(0, 0, 0, 0.5px);
<===> error/alpha/unit/input.scss
a {
b: hsl(0, 0, 0, 0.5px);
}

<===> alpha/unit/error
<===> error/alpha/unit/error
Error: $alpha: Expected 0.5px to have no units or "%".
,
2 | a: hsl(0, 0, 0, 0.5px);
2 | b: hsl(0, 0, 0, 0.5px);
| ^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet
100 changes: 50 additions & 50 deletions spec/core_functions/color/hsl/error/one_arg.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -5,150 +5,150 @@

<===>
================================================================================
<===> list/empty/input.scss
empty {
x: hsl(());
<===> error/list/empty/input.scss
a {
b: hsl(());
}

<===> list/empty/error
<===> error/list/empty/error
Error: Missing element $hue.
,
2 | x: hsl(());
2 | b: hsl(());
| ^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> list/comma_separated/input.scss
comma-separated {
x: hsl((0, 100%, 50%));
<===> error/list/comma_separated/input.scss
a {
b: hsl((0, 100%, 50%));
}

<===> list/comma_separated/error
<===> error/list/comma_separated/error
Error: $channels must be a space-separated list.
,
2 | x: hsl((0, 100%, 50%));
2 | b: hsl((0, 100%, 50%));
| ^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> list/bracketed/input.scss
bracketed {
x: hsl([0 100% 50%]);
<===> error/list/bracketed/input.scss
a {
b: hsl([0 100% 50%]);
}

<===> list/bracketed/error
<===> error/list/bracketed/error
Error: $channels must be an unbracketed list.
,
2 | x: hsl([0 100% 50%]);
2 | b: hsl([0 100% 50%]);
| ^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> list/one_element/input.scss
one-arg {
x: hsl(0);
<===> error/list/one_element/input.scss
a {
b: hsl(0);
}

<===> list/one_element/error
<===> error/list/one_element/error
Error: Missing element $saturation.
,
2 | x: hsl(0);
2 | b: hsl(0);
| ^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> list/two_elements/input.scss
two-elements {
x: hsl(0 100%);
<===> error/list/two_elements/input.scss
a {
b: hsl(0 100%);
}

<===> list/two_elements/error
<===> error/list/two_elements/error
Error: Missing element $lightness.
,
2 | x: hsl(0 100%);
2 | b: hsl(0 100%);
| ^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> list/four_elements/input.scss
four-elements {
x: hsl(0 100% 50% 0.4);
<===> error/list/four_elements/input.scss
a {
b: hsl(0 100% 50% 0.4);
}

<===> list/four_elements/error
<===> error/list/four_elements/error
Error: Only 3 elements allowed, but 4 were passed.
,
2 | x: hsl(0 100% 50% 0.4);
2 | b: hsl(0 100% 50% 0.4);
| ^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> type/hue/input.scss
hue-type {
x: hsl("foo" 100% 50%);
<===> error/type/hue/input.scss
a {
b: hsl("foo" 100% 50%);
}

<===> type/hue/error
<===> error/type/hue/error
Error: $hue: "foo" is not a number.
,
2 | x: hsl("foo" 100% 50%);
2 | b: hsl("foo" 100% 50%);
| ^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> type/saturation/input.scss
saturation-type {
x: hsl(0 "foo" 50%);
<===> error/type/saturation/input.scss
a {
b: hsl(0 "foo" 50%);
}

<===> type/saturation/error
<===> error/type/saturation/error
Error: $saturation: "foo" is not a number.
,
2 | x: hsl(0 "foo" 50%);
2 | b: hsl(0 "foo" 50%);
| ^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> type/lightness/input.scss
lightness-type {
x: hsl(0 100% "foo");
<===> error/type/lightness/input.scss
a {
b: hsl(0 100% "foo");
}

<===> type/lightness/error
<===> error/type/lightness/error
Error: $lightness: "foo" is not a number.
,
2 | x: hsl(0 100% "foo");
2 | b: hsl(0 100% "foo");
| ^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===>
================================================================================
<===> quoted_var_slash/input.scss
quoted-var-slash {
x: hsl(0 100% "var(--foo) / 0.4");
<===> error/quoted_var_slash/input.scss
a {
b: hsl(0 100% "var(--foo) / 0.4");
}

<===> quoted_var_slash/error
<===> error/quoted_var_slash/error
Error: $lightness: "var(--foo) / 0.4" is not a number.
,
2 | x: hsl(0 100% "var(--foo) / 0.4");
2 | b: hsl(0 100% "var(--foo) / 0.4");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet
42 changes: 21 additions & 21 deletions spec/core_functions/color/hsl/error/three_args.hrx
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
<===> hue/type/input.scss
hue-type {
x: hsl("foo", 100%, 50%);
<===> error/hue/type/input.scss
a {
b: hsl("foo", 100%, 50%);
}

<===> hue/type/error
<===> error/hue/type/error
Error: $hue: "foo" is not a number.
,
2 | x: hsl("foo", 100%, 50%);
2 | b: hsl("foo", 100%, 50%);
| ^^^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===> hue/type/error-libsass
<===> error/hue/type/error-libsass
Error: argument `$hue` of `hsl($hue, $saturation, $lightness)` must be a number
on line 2 of /sass/spec/core_functions/color/hsl/error/hue_type/input.scss, in function `hsl`
from line 2 of /sass/spec/core_functions/color/hsl/error/hue_type/input.scss
>> x: hsl("foo", 100%, 50%);
>> b: hsl("foo", 100%, 50%);

-----^

<===>
================================================================================
<===> saturation/type/input.scss
saturation-type {
x: hsl(0, "foo", 50%);
<===> error/saturation/type/input.scss
a {
b: hsl(0, "foo", 50%);
}

<===> saturation/type/error
<===> error/saturation/type/error
Error: $saturation: "foo" is not a number.
,
2 | x: hsl(0, "foo", 50%);
2 | b: hsl(0, "foo", 50%);
| ^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===> saturation/type/error-libsass
<===> error/saturation/type/error-libsass
Error: argument `$saturation` of `hsl($hue, $saturation, $lightness)` must be a number
on line 2 of /sass/spec/core_functions/color/hsl/error/saturation_type/input.scss, in function `hsl`
from line 2 of /sass/spec/core_functions/color/hsl/error/saturation_type/input.scss
>> x: hsl(0, "foo", 50%);
>> b: hsl(0, "foo", 50%);

-----^

<===>
================================================================================
<===> lightness/type/input.scss
lightness-type {
x: hsl(0, 100%, "foo");
<===> error/lightness/type/input.scss
a {
b: hsl(0, 100%, "foo");
}

<===> lightness/type/error
<===> error/lightness/type/error
Error: $lightness: "foo" is not a number.
,
2 | x: hsl(0, 100%, "foo");
2 | b: hsl(0, 100%, "foo");
| ^^^^^^^^^^^^^^^^^^^
'
input.scss 2:6 root stylesheet

<===> lightness/type/error-libsass
<===> error/lightness/type/error-libsass
Error: argument `$lightness` of `hsl($hue, $saturation, $lightness)` must be a number
on line 2 of /sass/spec/core_functions/color/hsl/error/lightness_type/input.scss, in function `hsl`
from line 2 of /sass/spec/core_functions/color/hsl/error/lightness_type/input.scss
>> x: hsl(0, 100%, "foo");
>> b: hsl(0, 100%, "foo");

-----^
Loading