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

More 'Duplicate key in map' errors #1296

Closed
okdana opened this issue Jun 24, 2015 · 15 comments
Closed

More 'Duplicate key in map' errors #1296

okdana opened this issue Jun 24, 2015 · 15 comments

Comments

@okdana
Copy link

okdana commented Jun 24, 2015

In the release notes for 3.2.4 and 3.2.5 i noticed several fixes for duplicate map key handling (#1187, #1195, and #1254). I was having an issue with 3.2.1 (the most recent stable version in Homebrew), so i thought that upgrading to the latest (libsass b078 and sassc 9d61) would fix it — unfortunately it hasn't. The issue i'm running into is this:

I'm trying to experiment with the legacy-direction() function described in this article. Having added it to my project, i find that it works fine when i compile with the Ruby-based sass, but sassc fails. The error i get is:

Error: Duplicate key "to right top" in map (to top: left, to top right: bottom right, to bottom right: bottom right, to bottom: top, to left: right).
        on line 58 of sass/functions/_misc.scss
>>  $conversion-map: (
   ------------------^

To clarify, this is the map it's having problems with:

  $conversion-map: (
    to top          : bottom,
    to top right    : bottom left,
    to right top    : left bottom,
    to right        : left,
    to bottom right : top left,
    to right bottom : left top,
    to bottom       : top,
    to bottom left  : top right,
    to left bottom  : right top,
    to left         : right,
    to left top     : right bottom,
    to top left     : bottom right
  );

I've only recently started using SASS, so maybe i'm misunderstanding something here — but the fact that the Ruby version compiles makes it seem like a bug?

@davidkpiano
Copy link

Probably the same issue as this: #1283

The keys 1 2 and 2 1 are distinct, as are to top right and to right top

@okdana
Copy link
Author

okdana commented Jun 24, 2015

Oh, that does sound like it. Should i close this in favour of the other one?

@mgreter
Copy link
Contributor

mgreter commented Jun 25, 2015

It sounds like @davidkpiano is right, but without an actual test case I unfortunately cannot tell you if it really fixes your issue. Can you provide a shortened and compilable (with ruby sass) example?

@okdana
Copy link
Author

okdana commented Jun 25, 2015

Is this OK?

% cat test-case.scss
@function bar() {
    $baz: (
        to top       : bottom,
        to top right : bottom left,
        to right top : left bottom,
        to right     : left
    );
    @return 0;
}
.foo { width: bar(); }

% sass test-case.scss
.foo {
  width: 0; }

% sassc test-case.scss
Error: Duplicate key "to right top" in map (to top: left, to top right: left bottom).
        on line 2 of test-case.scss
>>  $baz: (
   -------^

@mgreter
Copy link
Contributor

mgreter commented Jun 25, 2015

I can confirm it's the same issue, altough it exhibits a little different behavior. Had to update the hash function to something more sophisticated to get this passing too.

@xzyfer
Copy link
Contributor

xzyfer commented Jun 29, 2015

Merging this into #1283

@xzyfer xzyfer closed this as completed Jun 29, 2015
@xzyfer xzyfer added this to the 3.3 milestone Jun 29, 2015
@thebestako35
Copy link

just following the thread, just want to ask how did you fix this issue?

@mgreter
Copy link
Contributor

mgreter commented Aug 26, 2015

@thebestako35 there are some explanations in #1283 (changed the hashing function for these objects)

@thebestako35
Copy link

sorry just newbie in sass , can you enlight me with this code issue
$conversion-map: (
to top : bottom,
to top right : bottom left,
to right top : left bottom,
to right : left,
to bottom right : top left,
to right bottom : left top,
to bottom : top,
to bottom left : top right,
to left bottom : right top,
to left : right,
to left top : right bottom,
to top left : bottom right
);

@thebestako35
Copy link

im using gulp to compile my scss

@xzyfer
Copy link
Contributor

xzyfer commented Aug 27, 2015

@thebestako35 you need to wait until we ship 3.3.

As a work around for now you should be able to quote the map keys.

@helios1989
Copy link

hi gud evening , same issue here just want to ask what did i miss here
gulperror

@xzyfer
Copy link
Contributor

xzyfer commented Sep 14, 2015

what did i miss here

This is a 3.3 feature that hasn't been released yet.

@helios1989
Copy link

can you tell me what will be the work around for this issue?

@xzyfer
Copy link
Contributor

xzyfer commented Sep 14, 2015

It's different depending on the case. Usually quoting your keys will fix it. Alternatively don't use keys that that are also colours.

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

6 participants