-
Notifications
You must be signed in to change notification settings - Fork 220
Description
If you create a package like this:
name: foo
version: 1.0.0
environment:
sdk: '>=3.0.0 <4.0.0'
dependencies:
dev_dependencies:
test: ^1.26.2
Then run pub downgrade
, you end up unable to run tests:
Failed to build test:test:
/D:/Caches/Pub/Cache/hosted/pub.dev/watcher-1.0.0/lib/src/constructable_file_system_event.dart:7:57: Error: The class 'FileSystemEvent' can't be extended, implemented, or mixed in outside of its library because it's a sealed class.
abstract class _ConstructableFileSystemEvent implements FileSystemEvent {
This is because you get pkg:watcher
v1.0 which is broken on Dart 3 because FileSystemEvent
is marked sealed (watcher correctly says it's not compatible with 3.0, but because of this it is treated like it is). The reason you get pkg:watcher
v1.0 is because pkg:analyzer
up until v6.4.0 allows it.
Therefore, I think it would be sensible to bump the analyzer version constraint here to a minimum of 6.4.0.
However, if you force that, you then get:
Failed to build test:test:
/D:/Caches/Pub/Cache/hosted/pub.dev/file-6.0.0/lib/src/interface/file.dart:15:16: Error: The method 'File.create' has fewer named arguments than those of overridden method 'File.create'.
Future<File> create({bool recursive = false});
Because pkg:file
is also broken before 6.1.3. This is allowed by pkg:glob
v2.0, but fixed in pkg:glob
v2.1.1.
So, the following works:
dev_dependencies:
test: ^1.26.2
# these are needed to avoid failures to run `test` if you run `pub downgrade`
glob: ">=2.1.1"
analyzer: ">=6.4.0"
While it's probably not common to run pub downgrade
, I think it would be sensible for new versions of pkg:test
to have these minimums so someone depending on the latest version of test
can't get broken transitive dependencies if there's nothing else pulling them up.
@jakemac53 fyi - I'm filing this instead of a PR because there may be reasons not to do this or I may have misunderstood something, but I'm happy to open a PR if this sounds sensible.
(cc @FMorschel who found this after using pub downgrade
to try and reproduce/fix some issues reported by pana
that were affecting Pub package scores).