According to Leaf, Dart 2 type inference prefers to infer type
which is asked for, even if a more specific type can be inferred
from arguments.
It means that for
testIterable({"x": 1, "y": 1}.keys, ["x", "y"]);
where
testIterable(Iterable iterable, List expected, [int depth = 0])
the inferred type of map is Map<String, int>, but inferred type
of list is List (as testIterable argument type is List).
So this test is fixed by specifying type arguments of 'expected'
lists explicitly.
Change-Id: I2deab160038ee7abaad587920cb8fc620e09ebdf
Reviewed-on: https://dart-review.googlesource.com/39441
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This reverts commit 09eed74a8a.
Reason for revert: Too much SDK code is not yet compliant.
Original change's description:
> Make `void` a static warning to use almost everywhere.
>
> Changed the hint to a StaticWarningCode, since that's the new spec'd
> error type and the hint is no longer needed.
>
> Added a new set of methods to test the cases.
>
> Didn't try to solve the problem generally ("all usages except ... are
> errors" means it easier, in theory, to make a ReportVoidExpressions
> style visitor that catches absolutely all types) because most of the
> work is actually about suppressing errors that are no longer needed.
> Ie, from NO_SUCH_METHOD to USAGE_OF_VOID_RESULT which means we have to
> put the void handling logic into each AST method specially anyway.
>
> Some redundant tests removed.
>
> Don't flag: ternaries, void -> void assignments, void returns in
> dynamic.
>
> Change-Id: Ief8035dcfe582b36b6372180ddcf4e453d320d9c
> Reviewed-on: https://dart-review.googlesource.com/37441
> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>
TBR=leafp@google.com,scheglov@google.com,mfairhurst@google.com
Change-Id: I13ee4c6939468d35506779ade637a040833632f4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/39848
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Changed the hint to a StaticWarningCode, since that's the new spec'd
error type and the hint is no longer needed.
Added a new set of methods to test the cases.
Didn't try to solve the problem generally ("all usages except ... are
errors" means it easier, in theory, to make a ReportVoidExpressions
style visitor that catches absolutely all types) because most of the
work is actually about suppressing errors that are no longer needed.
Ie, from NO_SUCH_METHOD to USAGE_OF_VOID_RESULT which means we have to
put the void handling logic into each AST method specially anyway.
Some redundant tests removed.
Don't flag: ternaries, void -> void assignments, void returns in
dynamic.
Change-Id: Ief8035dcfe582b36b6372180ddcf4e453d320d9c
Reviewed-on: https://dart-review.googlesource.com/37441
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.
Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
Reviewed-on: https://dart-review.googlesource.com/32541
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
From the docs of mixedInClass and mixin: the former is the direct thing that is
mixed in, but if it is a named mixin application it may not contain the actual
fields and procedures, instead the `.mixin` class does.
Change-Id: I049ced771925431d613b0b661154c1761fbe0a51
Reviewed-on: https://dart-review.googlesource.com/38161
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
* Change 'var iterable' to dynamic as type inference can only
infer Object type.
* Explicitly set result type of closures passed to reduce() to
make closure type compatible with parameter type expected by reduce().
* To modify List of Lists of int, add '[4]' instead of '4' to trigger
expected ConcurrentModificationError instead of type error.
* Remove splitting to multi-test.
* Format with dartfmt.
Change-Id: Ie1a35eececbf1133cb2384afad10e9d355016abe
Reviewed-on: https://dart-review.googlesource.com/36300
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
The _2.status files are not normalized properly, so our script missed this.
We need to follow up with some additional fixes to the .status files and to add
to our script a way to detect these issues (typically whenever we have a "Pass"
and can't find the line that said otherwise).
TBR=johnniwinther@google.com
Change-Id: Icd4a6c003df86c0bf5c0894e971be13bc927f4ba
Reviewed-on: https://dart-review.googlesource.com/36480
Reviewed-by: Sigmund Cherem <sigmund@google.com>
* double.compareTo(int) is fixed to handle integers which are not
precisely representable as doubles.
* int.compareTo(double) is fixed to properly handle doubles which
are clamped when converted to integers (with Dart 2.0 fixed-size
integers).
* Test for num.compareTo is updated for fixed-size integers; more corner
cases added.
Closes https://github.com/dart-lang/sdk/issues/31917
Change-Id: I8e98c3627f032082ab6a397713dece436585afd1
Reviewed-on: https://dart-review.googlesource.com/35004
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Two follow-on optimization would reduce the generated code to closer to the original size:
- It would be profitable to write an optimization the removes the type
information from any list when it can be proven the type information
is not used.
- Provided the split result list is not modified, we can strengthen
accesses to be non-null Strings.
Bug: https://github.com/dart-lang/sdk/issues/30548
Change-Id: I87ecdd129ec0227f982bd2e1f34193b3d6b0d81b
Reviewed-on: https://dart-review.googlesource.com/35081
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
The bare VM without the common front end (kernel) does not support Dart2
semantics, which are assumed in the corelib_2 and language_2 directories. For
now we still run the bare VM in checked mode on these tests, since that is
mostly compatible, and gives us better coverage.
R=vegorov@google.com
Change-Id: I1a1ca939d8a33503d19b683b0e5539e0fa6e9dc1
Reviewed-on: https://dart-review.googlesource.com/35160
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
Also fixes a variety of miscellaneous accidental strong mode compile time or runtime check violations.
Change-Id: Ia8a41ac291aff3689efae0b11a9c51a2db30ef33
Reviewed-on: https://dart-review.googlesource.com/34924
Reviewed-by: Bob Nystrom <rnystrom@google.com>
The goal is to renable it as soon as we migrate our constant-evaluator and
constant folding to use Bigint.
Change-Id: I3bba1bbe07517e9cb496896b3417f58173878d62
Reviewed-on: https://dart-review.googlesource.com/34302
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Zach Anderson <zra@google.com>