Skip to content

Commit 0a4d0fc

Browse files
committed
Fix --fatal-deprecation adding obsolete ones
See also #2647
1 parent 20a59ee commit 0a4d0fc

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

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
}

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)