The class hierarchy analysis maintains, for each class, a map from raw
supertypes to actual, parameterized supertypes. As an optimization, it
can share these maps between a class and one of its subclasses.
However, the sharing/copying mechanism sometimes ends up with entries
in the map that should not have been there.
This commit removes the optimization and always uses a separate map
for each class.
Closes https://github.com/dart-lang/sdk/issues/31996
Change-Id: I4c641d9c7d15706035791dd2b586a24045afceaa
Reviewed-on: https://dart-review.googlesource.com/39765
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
This was unintentionally regressed during a fix to field init order. It
does not typically show up in Dart code because undefined and null are
both handled, but it can break JS interop.
Change-Id: I771895826ee09bb6c5e2f9b016eb7673caf61cd1
Reviewed-on: https://dart-review.googlesource.com/40202
Reviewed-by: Vijay Menon <vsm@google.com>
(and get rid of a TODO(redemption) that I should have fixed eons ago...)
Change-Id: I218a7bddcc8256ff84b4ec03b54a858e8f5d8687
Reviewed-on: https://dart-review.googlesource.com/40180
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
This CL corrects handling of overflows in range analysis to
account for wrap-around (which happens with new integer semantics).
* If there is an overflow while doing computations in range
analysis, the resulting range is approximated as full int64 range.
* For symbolic range boundaries 'symbol + offset', offset is checked
to stay within [kMinInt64 - kSmiMin, kMaxInt64 - kSmiMax] in order
to guarantee that overflow doesn't occur.
Issue: https://github.com/dart-lang/sdk/issues/31920
Change-Id: I2c16adbe3597e9b718ed2f6ce7210426fcc9e6a6
Reviewed-on: https://dart-review.googlesource.com/39423
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
* Send fewer files to shards by not including co19_2 in the file set.
Change-Id: I317a8fc44cf60e0489e23514cf9bf119afa827ee
Reviewed-on: https://dart-review.googlesource.com/39941
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Kernel has a global variable globalDebuggingNames which contains
NameSystem. NameSystem permanently holds certain kernel AST objects
(via various Namers). Calling toString() on a kernel AST object may
permanently add it to a global NameSystem, leaking memory.
It becomes a problem when gen_kernel is used in batch mode by
test tool. In such case, resident gen_kernel process is reused
to perform multiple compilations, and globalDebuggingNames
accumulates garbage kernel AST objects from finished compilations.
In this CL, globalDebuggingNames is reset after each compilation
in batch mode of gen_kernel.
Change-Id: Ie05635750fb149bb0e32415f03802e0c66f06a27
Reviewed-on: https://dart-review.googlesource.com/39883
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This change helps in confining flag manipulation to just the embedder.
When we are ready to turn all dart 2 flags to true by default, the
change can be confined to just the VM.
Change-Id: I4ac550c331b1f236a2bd9d0453b7c567eb0c05d3
Reviewed-on: https://dart-review.googlesource.com/38881
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This CL updates the fasta parser to report three additional
errors in constructor initializers:
* ExpectedAnInitializer
* MissingAssignmentInInitializer
* RedirectingConstructorWithBody
I also added a comment from a discussion about
https://dart-review.googlesource.com/c/sdk/+/39320
Change-Id: Iecb6fe97e3612a11ccc89864a4fc9f353846504c
Reviewed-on: https://dart-review.googlesource.com/40040
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
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>
I neglected to update this when I removed unnecessary typeNeeded
booleans from the type inference engine
(d031b0aecf).
Change-Id: I08b6ebe14c3c03cbc1480c5139162e997ac24f4a
Reviewed-on: https://dart-review.googlesource.com/39541
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Maybe later extract it into a caching wrapper around AnalysisSession?
R=brianwilkerson@google.com
Change-Id: I0f4c962467c6622bc558f7d9abd318024aec7945
Reviewed-on: https://dart-review.googlesource.com/39920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Also fixes some issues with field initializers; stepping and hover
tooltips should work reasonably now.
Change-Id: I2d0e9e7e14a52ee8c020902f80f835a913f494f3
Reviewed-on: https://dart-review.googlesource.com/39860
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
for a still unfinalized type argument vector (fixes#31944).
Update status files.
Change-Id: Ib603cd702891dc93775a5fbd09c341bb36922ab3
Reviewed-on: https://dart-review.googlesource.com/39855
Reviewed-by: Ryan Macnak <rmacnak@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>