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

Get "Cyclic references among variables" in 0.0.11 #88

Closed
DanielSvanstrom opened this issue Jan 14, 2013 · 3 comments
Closed

Get "Cyclic references among variables" in 0.0.11 #88

DanielSvanstrom opened this issue Jan 14, 2013 · 3 comments

Comments

@DanielSvanstrom
Copy link

Moving along. I have reduced this to a basic example.

Error:
Errors produced by compilation of main2.less
ERROR 8:9 Cyclic references among variables: @varc (8:9) -> @vara (3:16) -> @varc (4:8)
Could not compile the file main2.less

main2.less:
@vara: 0px;
@varb: 0px;
@varc: @varb + @vara;
@vara: @varb + @vara;

logo

{
width: @varc;
}

@SomMeri
Copy link
Owner

SomMeri commented Jan 14, 2013

Less language treats variables in a bit unusual way - if you define the same variable nultiple times within the same scope, only the last definition is used. All previous definitions are ignored.

First two lines in the above example are ignored:

@varA: 0px; // ignored line
@varB: 0px; // ignored line
@varC: @varB + @varA;
@varA: @varB + @varA;

#logo
{
  width: @varC;
}

The variable varA on the line 4 effectively references itself. It is impossible to evaluate it and an error is thrown. The error message should say @varC (8:9) -> @varA (3:16) -> @varA, I will fix that.

Less.js reports similar error on this input:

ERROR:
  type: Name
  message: Recursive variable definition for @varA
  filename: test.less
  index: 61
  line: 4
  column: 15
  extract: @varC: @varB + @varA;,@varA: @varB + @varA;,

Less.js issue database contains a long discussion about it: less/less.js#297

@SomMeri
Copy link
Owner

SomMeri commented Jan 14, 2013

The error message with 0.0.11 is Cyclic references among variables: @varA (3:16) -> @varA (4:16).

@SomMeri SomMeri closed this as completed Jan 14, 2013
@DanielSvanstrom
Copy link
Author

Our developer worked around this so it seems like we have something that is correctly generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants