Skip to content

Commit 6fa7456

Browse files
committed
Fix --fatal-deprecation adding obsolete ones
Using `--fatal-deprecation 1.92.0` would emit: "Warning: mixed-decls deprecation is obsolete, so does not need to be made fatal". This commit avoids these warnings by excluding obsolete deprecations. See also #2647
1 parent 52fc718 commit 6fa7456

File tree

7 files changed

+52
-4
lines changed

7 files changed

+52
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.94.2
2+
3+
* Using `--fatal-deprecation 1.92.0` no longer emits warnings about
4+
deprecations that are obsolete.
5+
16
## 1.94.1
27

38
* No user-visible changes.

lib/src/deprecation.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ enum Deprecation {
224224
var range = VersionRange(max: version, includeMax: true);
225225
return {
226226
for (var deprecation in Deprecation.values)
227-
if (deprecation.deprecatedIn.andThen(range.allows) ?? false)
227+
if ((deprecation.deprecatedIn.andThen(range.allows) ?? false) &&
228+
deprecation.obsoleteIn == null)
228229
deprecation,
229230
};
230231
}

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.35
2+
3+
* No user-visible changes.
4+
15
## 0.4.34
26

37
* No user-visible changes.

pkg/sass_api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 16.0.2
2+
3+
* No user-visible changes.
4+
15
## 16.0.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: 16.0.1
5+
version: 16.0.2
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.94.1
13+
sass: 1.94.2
1414

1515
dev_dependencies:
1616
dartdoc: ">=8.0.14 <10.0.0"

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.94.1
2+
version: 1.94.2
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

test/deprecations_test.dart

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ library;
88
import 'package:test/test.dart';
99

1010
import 'package:sass/sass.dart';
11+
import 'package:pub_semver/pub_semver.dart';
1112

1213
void main() {
1314
// Deprecated in all version of Dart Sass
@@ -151,6 +152,39 @@ void main() {
151152
);
152153
});
153154
});
155+
156+
group('Deprecation.forVersion', () {
157+
test('excludes deprecations that are obsolete', () {
158+
final version = Version.parse('1.79.0');
159+
final deprecations = Deprecation.forVersion(version);
160+
161+
expect(
162+
deprecations,
163+
equals({
164+
Deprecation.callString,
165+
Deprecation.elseif,
166+
Deprecation.mozDocument,
167+
Deprecation.relativeCanonical,
168+
Deprecation.newGlobal,
169+
Deprecation.colorModuleCompat,
170+
Deprecation.slashDiv,
171+
Deprecation.bogusCombinators,
172+
Deprecation.strictUnary,
173+
Deprecation.functionUnits,
174+
Deprecation.duplicateVarFlags,
175+
Deprecation.nullAlpha,
176+
Deprecation.absPercent,
177+
Deprecation.fsImporterCwd,
178+
Deprecation.cssFunctionMixin,
179+
Deprecation.featureExists,
180+
Deprecation.color4Api,
181+
Deprecation.colorFunctions,
182+
Deprecation.legacyJsApi
183+
}),
184+
reason: 'mixed-decls obsolete as of 1.92.0',
185+
);
186+
});
187+
});
154188
}
155189

156190
/// Confirms that [source] will error if [deprecation] is fatal.

0 commit comments

Comments
 (0)