-
Notifications
You must be signed in to change notification settings - Fork 27
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
Undefined variables results in the rule just not being outputted #34
Comments
The "not being printed" part is because sass considers a property being set to a null value being equivalent to a property not being set at all, and an empty rule should not be printed. So that part reflects the specification. I agree that having an error returned when trying to use an undefined variable would be helpfull, but I'm afraid it would go against the sass specification. Or would it? The first step here should probably be to find an example of an undefined variable in the sass specification test suite, then we "just" have to make sure that rsass passes that test ... Maybe the proper thing to do would be to print a warning? |
I found a couple of tests here: https://github.com/sass/sass-spec/search?q=undefined+variable It does seem to be an error case when a variable ends up undefined. |
I also checked with several of the existing implementations and they all appear to produce errors for when a variable is not defined. |
Great, then rsass should indeed also produce an error on use of an undefined variable. Do you want to write the changes? Note: the automatic test-converter |
I would need some mentoring instructions to get started. :) If we reach out to the broader community (and we have some instructions), someone may volunteer to help out. I'd be happy to help get the word out. :) |
Sass-spec reports 1645 of 3440 tests for sass 3.6 passed. * Improve support for `transparent`. * PR #45 from @glebm: Automatically update passing / failing tests Hardkoded skiplists in spectest.rs is cleared apart for tests where rsass panics. * Issue 43: Normalize newlines in tests. * PR #44 from @glebm: Update to Rust 2018 Edition, Rust v1.31.0+ * Issue #39, PR #40 from @glebm: Parser CallArgs: Allow trailing spacelike sans "," * Issue #32: Make the selectors module pub. * Issue #34, PR #35 from @glebm: Accessing an undefined variable is an error. * Allow input starting with UTF-8 U+FEFF BOM. * Target sass spec version 3.6. Thanks to contributors @glebm, @maxbrunsfeld and @sunjay for code and suggestions.
Sass-spec reports 1645 of 3440 tests for sass 3.6 passed. * Improve support for `transparent`. * PR #45 from @glebm: Automatically update passing / failing tests Hardkoded skiplists in spectest.rs is cleared apart for tests where rsass panics. * Issue 43: Normalize newlines in tests. * PR #44 from @glebm: Update to Rust 2018 Edition, Rust v1.31.0+ * Issue #39, PR #40 from @glebm: Parser CallArgs: Allow trailing spacelike sans "," * Issue #32: Make the selectors module pub. * Issue #34, PR #35 from @glebm: Accessing an undefined variable is an error. * Allow input starting with UTF-8 U+FEFF BOM. * Target sass spec version 3.6. Thanks to contributors @glebm, @maxbrunsfeld and @sunjay for code and suggestions.
Thanks for working on this crate!
This is a case where I would expect an error to be produced, but instead I just get nothing at all.
Here's an example program with
rsass 0.9.6
and Rust 1.32.0:It prints:
Despite the
$does-not-exist
variable not being defined, I get no error. The rule just isn't produced.I would really like it if errors like this were made part of the
Error
enum so I could handle them properly instead of being surprized when things suddenly don't work because of something like this. If ignoring malformed rules is expected behaviour, it would be nice to at least make that configurable in case that isn't desired.The text was updated successfully, but these errors were encountered: