Upper bounds are finalized in two steps, canonicalization coming second.
Change-Id: I0d7df9353fc26d91623eb7d8ee59a2c33a6eebf1
Reviewed-on: https://dart-review.googlesource.com/52200
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Implements a new strategy for closed world computation that takes
the static type of the receiver into account when processing dynamic
calls.
For this to work, the J-model needs to only contain live members,
meaning queries can no longer assume that a J-model member exists for
instance for JSString.split because it might not be live.
This is the initial implementation which only uses
ir.MethodInvocation.invocationTarget. Later we will use the static
type of the expression on ir.MethodInvocation, ir.PropertyGet, and
ir.PropertySet.
Change-Id: I2dcc5a9148f27127d4e89c414a7d24f90f9cf2a4
Reviewed-on: https://dart-review.googlesource.com/48480
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
To enable bytecode generation, toggle kEnableKernelBytecode flag at
the beginning of pkg/vm/lib/bytecode/gen_bytecode.dart.
This will also enable generation of bytecode in platform dill files.
Also, bytecode generation can be enabled using --gen-bytecode option of
pkg/vm/tool/gen_kernel.
In kernel binaries, the generated bytecode and constant pool are
placed into 'vm.bytecode' metadata attached to members.
pkg/vm/tool/dump_kernel tool can be used to disassemble
bytecode and print constant pool.
Differences between generated bytecode and original DBC are
described in pkg/vm/lib/bytecode/dbc.dart.
Format of constant pool is described in
pkg/vm/lib/bytecode/constant_pool.dart.
Currently, only a small subset of Dart language is supported.
Bytecode generator will not emit vm.bytecode metadata for a
member if its body has an unsupported operation.
Change-Id: I27d9a361dc779ea115e5676508ee757c1754e05d
Reviewed-on: https://dart-review.googlesource.com/49600
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
When recovering from an invalid annotation in a type variable
(e.g. "< @Foo.bar T >"), the parser could get stuck in an
infinite loop trying to recover. This fixes that situation.
Change-Id: If01e43b9eec575824329808eeb93437432830654
Reviewed-on: https://dart-review.googlesource.com/52300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
A<dynamic> is _not_ a subtype of A<int> in Dart 2
Change-Id: I0d1185b38192a06aaf9d8622a78c7384dfc287dc
Reviewed-on: https://dart-review.googlesource.com/52106
Reviewed-by: Sigmund Cherem <sigmund@google.com>
I see however that linter/test/rule_test.dart uses it, but as far as I
can see, that's it. All other usages are from analyzer and
analysis_server.
R=brianwilkerson@google.com
Change-Id: I2b82870a4a4ec6f155326d8ee6dc1c1028f84793
Reviewed-on: https://dart-review.googlesource.com/52265
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
The values returned from calling sync*, async and async* are now parameterised.
Simple cases where the type has no type parameters are handled.
The next step is to introduce a signature-like j-model entity to compute the type in more complex cases.
Change-Id: I2e43088cc6383a70e3a3d3067ec7542694ee2d0a
Reviewed-on: https://dart-review.googlesource.com/51421
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
One thing to be careful of here is that function type bounds may be
left unbounded. However, their parameters and return type cannot refer
to a type parameter for resolve-to-bounds to work.
There are also a large number of ways that this can loop infinitely, and
a number of new guards had to be added (as well as some test cases) to
catch them all.
Change-Id: I14322f5f71d1f7b73b27a870553e5c588b2c7e2e
Reviewed-on: https://dart-review.googlesource.com/52062
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
* when building IL from Kernel use canonical double representation
instead of allocating new double objects;
* in constant propagation canonicalize immutable primitive constants
(strings, mints and doubles) before replacing instruction with its
constant value;
This relands 5909932d38 with the part
that was causing timeouts on flutter_test reverted.
See https://github.com/dart-lang/sdk/issues/32904 for more details.
TBR=aam@google.com
Change-Id: I0c128e44dd6c9689c4b7e9dd91832408214847f3
Reviewed-on: https://dart-review.googlesource.com/51460
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Rename the TypeInfo constants and related constants in preparation
for refactoring and improving type argument and type parameter parsing.
Change-Id: I5a741ee06f373800973942c233490fe83916e39c
Reviewed-on: https://dart-review.googlesource.com/52140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This improves recovery when parsing conditional import expressions
by repositioning the synthetic closing ')' that was inserted by the
scanner in a less than optimal location.
This approach relies on the beforeSynthetic field being set correctly.
While the scanner still sets the 'next' and 'beforeSynthetic' fields
directly for efficiency, most other functions which update an existing
token stream have been revised to call 'setNext()' rather than setting
the 'next' field directly. This ensures that the 'beforeSynthetic' field
will be correctly updated.
Change-Id: Id631fd600c64d1feaf00593acb74a7070e354f07
Reviewed-on: https://dart-review.googlesource.com/52120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
All fixes are related to the requirement that a concrete class must
implement its entire interface or have a non-trivial noSuchMethod
implementation.
Change-Id: I015e0565e5dd9cfa324c38bb43696e365c58329a
Reviewed-on: https://dart-review.googlesource.com/51880
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This CL updates SyntheticToken to have a new beforeSynthetic field
and the fasta scanner to set that field for synthetic ")", "]", and "}" tokens.
This makes it much more efficient for the parser to move a synthetic
closer when the scanner has inserted it in a less than optimal location
in the token stream.
This CL also addresses a comment in
Address comment in https://dart-review.googlesource.com/c/sdk/+/51561
Change-Id: I7f056ac25f2ca4cf5edb0ef4bce7f1e9dd76de9a
Reviewed-on: https://dart-review.googlesource.com/52040
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Tests contained erroneously abstract methods and non-abstract classes
that made them not proper Dart 2.
Change-Id: Ie04935f3ffd4aa4e9756048de9668c5481553733
Reviewed-on: https://dart-review.googlesource.com/51845
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Makes debug mode more useful.
Change-Id: Iccdb1be03d4abe23424cfb993c566fecb3d74ced
Reviewed-on: https://dart-review.googlesource.com/52021
Reviewed-by: Zach Anderson <zra@google.com>
Previously we would omit a field if it was never the element
in a codegen WorkItem. However, almost all fields fail this test
because field getters are inlined in the optimizer.
Change-Id: I34de218dadb5937885d77dd429237584d1a8be2c
Reviewed-on: https://dart-review.googlesource.com/51581
Commit-Queue: Harry Terkelsen <het@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Make all lists returned by ast_from_binary growable so the ast is more consistent with the ast generated by parsing dart code which generally contains growable lists as opposed to fixed-length lists.
This fixes a bug in the Flutter --track-widget-creation transform
where it would fail on an AST if it was deserialized from a binary file
rather than parsed from source code.
Change-Id: I4e6b199ed98df1b72d8d6844829341975a2c29c9
Reviewed-on: https://dart-review.googlesource.com/51780
Commit-Queue: Jacob Richman <jacobr@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
This CL improves recovery given invalid or malformed formal parameter
types and identifiers. This accomplished by switching the
parseFormalParameter method to use computeType rather than parseType,
improving recovery when parsing field initializers, and in the process,
further reducing the size of parseType and eliminating 6 unused
TypeContinuation elements.
Change-Id: I6f05d8018bf8d9f2c256e5a64408c29db006a8e2
Reviewed-on: https://dart-review.googlesource.com/52000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>