proper type for @each when single variable

This commit is contained in:
ConnorSkees 2020-04-26 15:02:36 -04:00
parent f1b60019a1
commit ce833b7c03
2 changed files with 22 additions and 7 deletions

View File

@ -39,6 +39,15 @@ impl Each {
};
if self.vars.len() == 1 {
if this_iterator.len() == 1 {
scope.insert_var(
&self.vars[0],
Spanned {
node: this_iterator[0].clone(),
span: self.vars[0].span,
},
)?;
} else {
scope.insert_var(
&self.vars[0],
Spanned {
@ -46,6 +55,7 @@ impl Each {
span: self.vars[0].span,
},
)?;
}
} else {
for (var, val) in self.vars.clone().into_iter().zip(
this_iterator

View File

@ -43,3 +43,8 @@ test!(
"a {\n @each $i in (1 2 3) {\n color: $i;\n }\n}\n",
"a {\n color: 1;\n color: 2;\n color: 3;\n}\n"
);
test!(
type_of_each_space_separated_single_var,
"a {\n @each $i in 1 2 3 {\n color: type-of($i);\n }\n}\n",
"a {\n color: number;\n color: number;\n color: number;\n}\n"
);