Open spebbe opened 6 years ago
Hello, I'm glad to hear this is useful to someone!
I thought that 44a2293119c3c4983680d0bc48ce2e3b7c59782c would do the trick regarding dart 2 compatibility. Is something else needed? (I haven't followed dart 2 closely but since https://pub.dartlang.org/packages/propcheck#-analysis-tab- says that it passes analysis for 2.0.0-dev.63.0 I thought it was enough.)
The thing that breaks in dart 2 though is that enumerators rely on the fact that dart 1 integers overflow to bigints. In dart 2 there's a bigint library instead, but it has no dart 1 backport. So I need to maintain two branches: a dart 2 one that uses bigints as a library, and a dart 1 one.
Sadly, only parts of the type system in dart 2 is implemented in the static analyzer, with major parts implemented as runtime checks. Up until recently, the runtime checks were only implemented in DDC, the new incremental js transpiler, but recent versions of the dart vm also run with them on by default.
The consequence is that, in dart 2, it is very easy to construct a program that passes static analysis, executes perfectly with runtime type checks disabled, but still fails with runtime checks enabled :-(
You are right that the most tricky parts probably are in enumerators
rather than in propcheck
itself. However, once the BigInt problems are bypassed, things start to fall apart in combinators.dart
, starting in listsOf
and productsOf
and trickling down into LList
and beyond. It could be that a couple of well placed explicit type annotations and casts would work wonders, but I haven't delved deep enough yet to be sure.
I have PRs for enumerators and propcheck to migrate to Dart 2. Only issues is a runtime error in enumerators. See the PR for more info
Once that is resolve, propcheck and enumerators shouldn't have any issues.
@Stargator, that's awesome!
Fixing the runtime error that you are seeing should just be a matter of adding Enumeration<A>
as an explicit type annotation on line 43. However, that will reveal a new chain of runtime errors as described in my previous comment. Not sure how deep it goes though. Unless any of you get to it first, I'd be happy to take a stab at it, but it might be a while before I find the spare time to do it.
Wow, thank you @Stargator! I've merged some of your requests and I've commented on Regarding https://github.com/polux/enumerators/pull/1.
Hi and thanks for propcheck! I use it in the majority of the test suites in https://github.com/spebbe/dartz/ and also at work.
I'm currently in the process of developing a Dart 2-compatible version of dartz, fixing the things that can be fixed and removing the things that cannot be salvaged. It would be fantastic to be able to continue to use propcheck for the tests, but currently both propcheck and enumerators fail to run on the Dart 2 VM (as of 2.0.0-dev.66.0) with full runtime type checks enabled.
Do you have plans to release a Dart 2 compatible version? No pressure :-)
Thanks,
/Björn