-
Notifications
You must be signed in to change notification settings - Fork 37
feature: Upgrade TypeMatcher, deprecate isInstanceOf #88
Conversation
Very much in the spirit of #86 |
4b55693
to
8c42876
Compare
40deffe
to
a19c028
Compare
8c42876
to
e4c7d12
Compare
4ff649f
to
2fc1ab2
Compare
@natebosch – now this is ready for review! |
@natebosch only a handful of breaks in pkg:test tests – due to expected strings in one file. Easy find-replace to fix |
TypeMatcher - No longer abstract - Added type argument - Deprecate the existing `name` parameter, tell folks to the type arg - Moved to its own file - Added `having` method which allows chained validation of features - Eliminated 13 private implementations from the package - Just use it directly. Deprecate isInstanceOf class. - Tell folks to use TypeMatcher<T> instead - Run away from weirdly named classes Tests - centralizing tests in type_matcher_test - Removed isInstanceOf tests from core_matchers_test
2fc1ab2
to
52a53e9
Compare
This broke a bunch of stuff in Flutter. Can we revert it and/or talk about why this is a good idea? |
Did it actually break something or are you failing on deprecation warnings? @Hixie |
If this is all deprecation warnings, we're not going to revert. All existing functionality is intact. We cannot hold back responsible API evolution (with proper deprecations, etc) because users have strict analysis checks. We've gone through a number of our packages and fixed up the usage. This is progress. |
It broke things because switching to TypeMatcher conflicts with our own TypeMatcher. It also is less idiomatic. expect(foo, isInstanceOf<Foo>()); ...reads nicely. expect(foo, TypeMatcher<Foo>()); ...makes no sense, in the Also, are you never going to remove it? If you're ever going to remove it, then that's a backwards-incompatible change, and that's what I object to. If you're never going to remove it then why deprecate it? Our users write tests and we can't just be willy-nilly breaking them without good reason. What's the good reason for removing |
First, I was a bit harsh in my first reply. My apologies. Breaks from "dot" releases suck. You guys are trying to move fast. I want to help you. Conflicting type names – that's a painful edge of the breaking change rule. If adding a class (or a member, if you worry about subclassing) was considered a breaking change, we'd have a bigger mess. I'm not sure there is anything we can do there. Do we create some sort of package try bot to validate API updates for frequently used packages before changing APIs? Might be a good idea. RE I'm certainly open to doing a major release of pkg:matcher (which means a major release of pkg:test) where |
I'd be fine with turning it into a function; that would be a transparent change assuming that people have already removed the "new". It's when it gets renamed that there's a breaking change. |
I've submitted a PR to revert us to the 0.12.2 version for now (flutter/flutter#18614), on the assumption that matcher will eventually just export isInstanceOf as a function. Right now tests that use flutter_test can do so (I've exported an |
Nothing was renamed. A new class was added and a class was deprecated. The breakage from conflicting imports is an edge of the Dart semver approach that has some sharp edges like this, but we do not think it's feasible to restrict ourselves from ever adding new symbols to the top level namespace for
You'll still want to clean up the places were we conflict with
This is very unlikely to happen and would be breaking for lots of code. If anything we will consider adding the top level method
Did you do this with a breaking version bump? Is there guaranteed to be no code still using |
I will note that if you want |
Code using |
…tcher#88) `TypeMatcher` - No longer abstract - Added type parameter - Deprecate the existing `name` parameter, tell folks to the type param - Added `having` method which allows chained validation of features - Eliminated 13 private implementations from the package - Just use it directly. - Moved to its own file Deprecate `isInstanceOf` class. - Tell folks to use `TypeMatcher<T>` instead - Run away from weirdly named classes Tests - centralizing tests in type_matcher_test - Removed isInstanceOf tests from core_matchers_test
TypeMatcher
name
parameter, tell folks to the type paramhaving
method which allows chained validation of featuresDeprecate
isInstanceOf
class.TypeMatcher<T>
insteadTests