Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.94.2

* Using `--fatal-deprecation 1.92.0` no longer emits warnings about
deprecations that are obsolete.

## 1.94.1

* No user-visible changes.
Expand Down
3 changes: 2 additions & 1 deletion lib/src/deprecation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ enum Deprecation {
var range = VersionRange(max: version, includeMax: true);
return {
for (var deprecation in Deprecation.values)
if (deprecation.deprecatedIn.andThen(range.allows) ?? false)
if ((deprecation.deprecatedIn.andThen(range.allows) ?? false) &&
deprecation.obsoleteIn == null)
deprecation,
};
}
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.35

* No user-visible changes.

## 0.4.34

* No user-visible changes.
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 @@
## 16.0.2

* No user-visible changes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about this (whether this is the Dart API or the JS API or both and if they were affected or not).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Deprecation.forVersion is only exposed in the Dart API. I've added a changelog entry for this to the main Dart Sass changelog


## 16.0.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: 16.0.1
version: 16.0.2
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass

environment:
sdk: ">=3.6.0 <4.0.0"

dependencies:
sass: 1.94.1
sass: 1.94.2

dev_dependencies:
dartdoc: ">=8.0.14 <10.0.0"
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.94.1
version: 1.94.2
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down
36 changes: 36 additions & 0 deletions test/deprecations_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ library;
import 'package:test/test.dart';

import 'package:sass/sass.dart';
import 'package:pub_semver/pub_semver.dart';

void main() {
// Deprecated in all version of Dart Sass
Expand Down Expand Up @@ -151,6 +152,41 @@ void main() {
);
});
});

group('Deprecation.forVersion', () {
test('includes deprecations as of that version', () {
final version = Version.parse('1.79.0');
final deprecations = Deprecation.forVersion(version);

expect(
deprecations,
contains(Deprecation.colorFunctions),
reason: 'color-functions deprecated in 1.79 (and not obsolete)',
);
});

test('excludes deprecations of newer versions', () {
final version = Version.parse('1.79.0');
final deprecations = Deprecation.forVersion(version);

expect(
deprecations,
isNot(contains(Deprecation.import)),
reason: 'import deprecated as of 1.80',
);
});

test('excludes deprecations that are obsolete', () {
final version = Version.parse('1.79.0');
final deprecations = Deprecation.forVersion(version);

expect(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just check that a couple of the currently obsolete deprecations are excluded here. We use deprecations.yaml in the language repo as a single-source of truth for the current list of deprecations and don't want to have to manually update the list anywhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand. I added two regression tests now (so that I don't break the current functionality) and one test for the intended fix (excluding obsolete deprecations).

deprecations,
isNot(contains(Deprecation.mixedDecls)),
reason: 'mixed-decls deprecated in 1.77.7 but obsolete in 1.92.0',
);
});
});
}

/// Confirms that [source] will error if [deprecation] is fatal.
Expand Down
Loading