Comments (7)
I'm pretty sure this is because of dart-lang/sdk#30339, so the tests should not have been passing earlier :)
These tests rely on re-ified types, if I'm not mistaken, so should only run in DDC or Dart 2.0 tools.
from async.
So the tests should be annotated so they only run in strong mode or on DDC. There are no status files for package:test tests, so I think the annotations have to go on the tests themselves. Until this is done, the tests will be failing on the package waterfall.
from async.
For reference, the failures we're seeing are of the form:
01:05 +833 -9: [VM] test/typed_wrapper/stream_test.dart: with valid types,
forwards where() [E]
type 'List<Object>' is not a subtype of type 'List<int>' of 'function result'
where
List is from dart:core
Object is from dart:core
Object is from dart:core
Object is from dart:core
List is from dart:core
int is from dart:core
package:async/src/typed/stream.dart 104:7 TypeSafeStream.toList
test/typed_wrapper/stream_test.dart 297:44 main.<fn>.<fn>
===== asynchronous gap ===========================
dart:async _Completer.completeError
package:async/src/typed/stream.dart 104:54 TypeSafeStream.toList
===== asynchronous gap ===========================
dart:async _asyncThenWrapperHelper
package:async/src/typed/stream.dart 103:34 TypeSafeStream.toList
test/typed_wrapper/stream_test.dart 297:44 main.<fn>.<fn>
The code throwing the error is:
Future<List<T>> toList() async =>
DelegatingList.typed<T>(await _stream.toList());
In Dart 1.0 semantics, I would expect this to ignore the type parameter on DelegatingList.typed()
and thus return a Future<List<dynamic>>
, which is a subtype of Future<List<T>>
. It seems that it's instead returning a Future<List<Object>>
, which indicates that this might be broken for real-world users. @leafpetersen, can you shed light on why this is a List<Object>
?
from async.
Maybe because of this:
static List<E> typed<E>(List base) =>
base is List<E> ? base : new TypeSafeList<E>(base);
On the VM, this will always return base
, no? Presumably here, base
has type List<Object>
.
from async.
If DelegatingList.typed()
is returning base
as-is, that means base is List<int>
is true
. But if that's the case, shouldn't base
be a valid return type for toList()
?
from async.
We're talking about Dart 1.0, right?
In Dart 1.0 semantics, I would expect this to ignore the type parameter on DelegatingList.typed()
it does, so the question that is being asked at runtime is base is List<dynamic>
, which is always true. This test program when run on the VM prints "true":
bool foo<T>(base) {
return base is List<T>;
}
void main() {
print(foo<int>(<String>[]));
}
from async.
Oh, right. In that case, I guess the test is legitimately 2.0-only, since we really do want to test what happens when the underlying type is Object
. We don't currently have a way to mark that in test, since test doesn't actually support any Dart 2.0 platforms currently, so maybe the thing to do is just to skip the test for now...
from async.
Related Issues (20)
- Change the default of `propagateCancel` argument in CancelableOperation.then HOT 2
- Reset method for AsyncMemoizer HOT 1
- Make it easier to safely hold a reference that can cancel an operation without holding the whole operation HOT 1
- Clarify `StreamQueue.next` will fail just after `hasNext` in API document.
- Consider to make second invocation of `streamQueue.hasNext` be postponed concluding the result until the first invocation of `q.next` , unless the stream is closed. HOT 6
- Deprecate StreamQueue.hasNext and StreamQueue.next
- Future.wait() but with Records HOT 4
- Bad State error while trying to reject a StreamQueueTransaction
- Dart 3 incompatibilty: `DelegatingStream<T> extends StreamView` but `StreamView` is `base class` HOT 5
- Add `whereNotNull` for `Stream`
- CancelableOperation value is not propagating errors, so they cannot be catched and app is crashing HOT 3
- There should be cancellable versions of Stream.firstWhere etc.
- Migrate the Result type to sealed classes HOT 2
- Make `ParallelWaitError` Include Error Details HOT 1
- Async Cache is caching exceptions HOT 5
- AsyncMemoizer is caching exceptions HOT 2
- Add an API wrapping runZonedGuarded that surfaces the first error HOT 4
- Clarify `CancelableOperation` docs HOT 4
- Inconsistent behavior of `Stream.listen` on broadcast streams HOT 1
- [Proposal] Add a CountDownLatch implementation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.