Skip to content

Commit 0cf97b8

Browse files
committed
Fix a bug where a double-configuration error wouldn't be emitted
Closes #2598
1 parent a42380f commit 0cf97b8

File tree

10 files changed

+27
-13
lines changed

10 files changed

+27
-13
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.90.0
2+
3+
* **Potentially breaking bug fix:** Fix a situation where Sass wasn't emitting
4+
an error when loading a `@forward`ed module with a configuration when that
5+
module had already been loaded with a different configuration *and* all
6+
configured variables in the new configuration had already been used.
7+
18
## 1.89.2
29

310
### Embedded Host

lib/src/configuration.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ final class Configuration {
5050
/// will be considered to have the same original config if they were created
5151
/// as a copy from the same base configuration.
5252
bool sameOriginal(Configuration that) =>
53-
_originalConfiguration == that._originalConfiguration;
53+
identical(_originalConfiguration, that._originalConfiguration);
5454

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

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

7676
// Only allow variables that are visible through the `@forward` to be

lib/src/module.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ abstract interface class Module<T extends AsyncCallable> {
3030
/// [AstNode.span] if the span isn't required, since some nodes need to do
3131
/// real work to manufacture a source span.
3232
///
33-
/// Implementations must ensure that this has the same keys as [variables] if
34-
/// it's not `null`.
33+
/// Implementations must ensure that this has the same keys as [variables].
3534
Map<String, AstNode> get variableNodes;
3635

3736
/// The module's functions.

lib/src/visitor/async_evaluate.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,8 @@ final class _EvaluateVisitor
854854
}) async {
855855
var url = stylesheet.span.sourceUrl;
856856

857+
var currentConfiguration = configuration ?? _configuration;
857858
if (_modules[url] case var alreadyLoaded?) {
858-
var currentConfiguration = configuration ?? _configuration;
859859
if (!_moduleConfigurations[url]!.sameOriginal(currentConfiguration) &&
860860
currentConfiguration is ExplicitConfiguration) {
861861
var message = namesInErrors
@@ -946,7 +946,7 @@ final class _EvaluateVisitor
946946
);
947947
if (url != null) {
948948
_modules[url] = module;
949-
_moduleConfigurations[url] = _configuration;
949+
_moduleConfigurations[url] = currentConfiguration;
950950
if (nodeWithSpan != null) _moduleNodes[url] = nodeWithSpan;
951951
}
952952

lib/src/visitor/evaluate.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// DO NOT EDIT. This file was generated from async_evaluate.dart.
66
// See tool/grind/synchronize.dart for details.
77
//
8-
// Checksum: a3068d04660dd2bed34b884aa6e1a21d423dc4e5
8+
// Checksum: 30755d20ab8cdb065eb2c24d27a5f8a248591fcd
99
//
1010
// ignore_for_file: unused_import
1111

@@ -862,8 +862,8 @@ final class _EvaluateVisitor
862862
}) {
863863
var url = stylesheet.span.sourceUrl;
864864

865+
var currentConfiguration = configuration ?? _configuration;
865866
if (_modules[url] case var alreadyLoaded?) {
866-
var currentConfiguration = configuration ?? _configuration;
867867
if (!_moduleConfigurations[url]!.sameOriginal(currentConfiguration) &&
868868
currentConfiguration is ExplicitConfiguration) {
869869
var message = namesInErrors
@@ -954,7 +954,7 @@ final class _EvaluateVisitor
954954
);
955955
if (url != null) {
956956
_modules[url] = module;
957-
_moduleConfigurations[url] = _configuration;
957+
_moduleConfigurations[url] = currentConfiguration;
958958
if (nodeWithSpan != null) _moduleNodes[url] = nodeWithSpan;
959959
}
960960

pkg/sass-parser/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.25
2+
3+
* No user-visible changes.
4+
15
## 0.4.24
26

37
* No user-visible changes.

pkg/sass-parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sass-parser",
3-
"version": "0.4.24",
3+
"version": "0.4.25",
44
"description": "A PostCSS-compatible wrapper of the official Sass parser",
55
"repository": "sass/sass",
66
"author": "Google Inc.",

pkg/sass_api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 15.8.0
2+
3+
* No user-visible changes.
4+
15
## 15.7.1
26

37
* No user-visible changes.

pkg/sass_api/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 15.7.1
5+
version: 15.8.0
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: ">=3.6.0 <4.0.0"
1111

1212
dependencies:
13-
sass: 1.89.2
13+
sass: 1.90.0
1414

1515
dev_dependencies:
1616
dartdoc: ^8.0.14

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.89.2
2+
version: 1.90.0
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

0 commit comments

Comments
 (0)