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

Difference in interpolated function calls #1397

Closed
xzyfer opened this issue Jul 27, 2015 · 4 comments
Closed

Difference in interpolated function calls #1397

xzyfer opened this issue Jul 27, 2015 · 4 comments

Comments

@xzyfer
Copy link
Contributor

xzyfer commented Jul 27, 2015

div {
  color: #{foo}(a, 1+2, c);
}

Ruby Sass

div {
  color: fooa, 3, c; }

LibSass

div {
  color: foo(a, 3, c); }

I'm not sure what the rationale behind this behaviour is. I've asked for an explanation upstream. However for the time being this is an inconsistency with an existing spec.

Spec https:/sass/sass-spec/tree/master/spec/libsass-todo-tests/libsass/interpolated-function-call

@xzyfer xzyfer changed the title Mismatch in interpolated function calls Difference in interpolated function calls Jul 27, 2015
@andrew-skybound
Copy link

I've run some additional tests and it looks like there are quite a few failing cases which are all likely related to the originally reported issue.

Here are six test cases, showing interpolation around a function call, and around a parenthesized expression. The first six declarations are the test cases themselves, the next six show the type-of(), and the last six show the length().

Input:

p {
    color: #{A}round(0.5);
    color: round(0.5)#{B};
    color: #{A}round(0.5)#{B};
    color: #{A}(B C);
    color: (B C)#{D};
    color: #{A}(B C)#{D};
    /* typeof */
    color: type-of(#{A}round(0.5));
    color: type-of(round(0.5)#{B});
    color: type-of(#{A}round(0.5)#{B});
    color: type-of(#{A}(B C));
    color: type-of((B C)#{D});
    color: type-of(#{A}(B C)#{D});
    /* lengths */
    color: length(#{A}round(0.5));
    color: length(round(0.5)#{B});
    color: length(#{A}round(0.5)#{B});
    color: length(#{A}(B C));
    color: length((B C)#{D});
    color: length(#{A}(B C)#{D});
}

Ruby Sass

p {
  color: A1;
  color: 1B;
  color: A1B;
  color: AB C;
  color: B CD;
  color: AB CD;
  /* typeof */
  color: string;
  color: string;
  color: string;
  color: string;
  color: string;
  color: string;
  /* lengths */
  color: 1;
  color: 1;
  color: 1;
  color: 1;
  color: 1;
  color: 1;
}

Libsass

p {
  color: Around(0.5);
  color: round0.5B;
  color: Around0.5B;
  color: A(B C);
  color: B CD;
  color: AB CD;
  /* typeof */
  color: string;
  color: list;
  color: list;
  color: string;
  color: list;
  color: list;
  /* lengths */
  color: 1;
  color: 2;
  color: 2;
  color: 1;
  color: 2;
  color: 2;
}

@xzyfer xzyfer added this to the 3.4 milestone Aug 4, 2015
@mgreter
Copy link
Contributor

mgreter commented Aug 23, 2015

IMHO the original issue can be boiled down to

div {
  color: foo(0); /* foo(0) */
  color: #{bar}(1); /* bar1 */
  color: #{b}az(2); /* baz(2) */
  color: b#{a}r(3); /* bar(3) */
  color: #{b}a#{z}(4); /* baz4 */
  color: #{b}a#{z} (5); /* baz 5 */
}

I guess the underlying reason is that an interpolation directly followed by a parenthese "stops" the parsing (seems like parentheses must be preceded by something identifier like). IMO it's related to the issues with "list is always space delimited". Not sure if ruby sass is correct here, but I think I start to see the pattern.

@mgreter
Copy link
Contributor

mgreter commented Aug 23, 2015

With #1474 it now renders to:

div {
  color: foo(0);
  color: bar 1;
  color: baz(2);
  color: bar(3);
  color: baz 4;
  color: baz 5; }

So it still adds a space that is not needed!
IMO this can now be closed in favor of #1396!

@mgreter mgreter modified the milestones: 3.3, 3.4 Aug 23, 2015
@mgreter mgreter self-assigned this Aug 23, 2015
@xzyfer
Copy link
Contributor Author

xzyfer commented Aug 24, 2015

This is partially fixed in #1474. The remainder of this issue is being tracked in #1396.

@xzyfer xzyfer closed this as completed Aug 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants