Skip to content

Fix a bug where a double-configuration error wouldn't be emitted #2600

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.90.0

* **Potentially breaking bug fix:** Fix a situation where Sass wasn't emitting
an error when loading a `@forward`ed module with a configuration when that
module had already been loaded with a different configuration *and* all
configured variables in the new configuration had already been used.

## 1.89.2

### Embedded Host
Expand Down
4 changes: 2 additions & 2 deletions lib/src/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class Configuration {
/// will be considered to have the same original config if they were created
/// as a copy from the same base configuration.
bool sameOriginal(Configuration that) =>
_originalConfiguration == that._originalConfiguration;
identical(_originalConfiguration, that._originalConfiguration);

/// The empty configuration, which indicates that the module has not been
/// configured.
Expand All @@ -70,7 +70,7 @@ final class Configuration {

/// Creates a new configuration from this one based on a `@forward` rule.
Configuration throughForward(ForwardRule forward) {
if (isEmpty) return const Configuration.empty();
if (isEmpty) return this;
var newValues = _values;

// Only allow variables that are visible through the `@forward` to be
Expand Down
3 changes: 1 addition & 2 deletions lib/src/module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ abstract interface class Module<T extends AsyncCallable> {
/// [AstNode.span] if the span isn't required, since some nodes need to do
/// real work to manufacture a source span.
///
/// Implementations must ensure that this has the same keys as [variables] if
/// it's not `null`.
/// Implementations must ensure that this has the same keys as [variables].
Map<String, AstNode> get variableNodes;

/// The module's functions.
Expand Down
4 changes: 2 additions & 2 deletions lib/src/visitor/async_evaluate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ final class _EvaluateVisitor
}) async {
var url = stylesheet.span.sourceUrl;

var currentConfiguration = configuration ?? _configuration;
if (_modules[url] case var alreadyLoaded?) {
var currentConfiguration = configuration ?? _configuration;
if (!_moduleConfigurations[url]!.sameOriginal(currentConfiguration) &&
currentConfiguration is ExplicitConfiguration) {
var message = namesInErrors
Expand Down Expand Up @@ -946,7 +946,7 @@ final class _EvaluateVisitor
);
if (url != null) {
_modules[url] = module;
_moduleConfigurations[url] = _configuration;
_moduleConfigurations[url] = currentConfiguration;
if (nodeWithSpan != null) _moduleNodes[url] = nodeWithSpan;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/src/visitor/evaluate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// DO NOT EDIT. This file was generated from async_evaluate.dart.
// See tool/grind/synchronize.dart for details.
//
// Checksum: a3068d04660dd2bed34b884aa6e1a21d423dc4e5
// Checksum: 30755d20ab8cdb065eb2c24d27a5f8a248591fcd
//
// ignore_for_file: unused_import

Expand Down Expand Up @@ -862,8 +862,8 @@ final class _EvaluateVisitor
}) {
var url = stylesheet.span.sourceUrl;

var currentConfiguration = configuration ?? _configuration;
if (_modules[url] case var alreadyLoaded?) {
var currentConfiguration = configuration ?? _configuration;
if (!_moduleConfigurations[url]!.sameOriginal(currentConfiguration) &&
currentConfiguration is ExplicitConfiguration) {
var message = namesInErrors
Expand Down Expand Up @@ -954,7 +954,7 @@ final class _EvaluateVisitor
);
if (url != null) {
_modules[url] = module;
_moduleConfigurations[url] = _configuration;
_moduleConfigurations[url] = currentConfiguration;
if (nodeWithSpan != null) _moduleNodes[url] = nodeWithSpan;
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/sass-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.25

* No user-visible changes.

## 0.4.24

* No user-visible changes.
Expand Down
2 changes: 1 addition & 1 deletion pkg/sass-parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sass-parser",
"version": "0.4.24",
"version": "0.4.25",
"description": "A PostCSS-compatible wrapper of the official Sass parser",
"repository": "sass/sass",
"author": "Google Inc.",
Expand Down
4 changes: 4 additions & 0 deletions pkg/sass_api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 15.8.0

* No user-visible changes.

## 15.7.1

* No user-visible changes.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sass_api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: sass_api
# Note: Every time we add a new Sass AST node, we need to bump the *major*
# version because it's a breaking change for anyone who's implementing the
# visitor interface(s).
version: 15.7.1
version: 15.8.0
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass

environment:
sdk: ">=3.6.0 <4.0.0"

dependencies:
sass: 1.89.2
sass: 1.90.0

dev_dependencies:
dartdoc: ^8.0.14
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sass
version: 1.89.2
version: 1.90.0
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down
Loading