Commit Graph

443 Commits

Author SHA1 Message Date
Johnni Winther f26c0e2056 [cfe] Add explicit type argument to .map(...).toList()
Expressions like

  List<VariableDeclaration> variables = ...
  List<Expression> reads = variables.map((v) => VariableGet(v)).toList()

don't get the intended type argument `<Expression>` through inference,
but instead the type inferred from the return type of the closure, in
this case `<VariableGet>`.

This causes problems when used with the AST which assumes that
expressions are interchangeable wherever they are used, and is likely
the cause of https://github.com/flutter/flutter/issues/102077 .

This CL adds an explicit type argument in these cases.

TEST=general/infer_map

Change-Id: I0bcae21f06c54f290dc20686b0d84c065d8ea04c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241605
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-04-20 06:56:58 +00:00
Chloe Stefantsova abdd5765ee [cfe] Re-own TODOs assigned to 'dmitryas'
TEST=Only the comments were changed.

Change-Id: I8d4778746759466ea4c64f0eabe498da353fdd22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240041
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-04-05 09:04:53 +00:00
Alexander Markov d0e8ef9816 [vm,kernel] Move transformations maintained by the VM team from pkg/kernel to pkg/vm
These transformations are maintained by the VM team and keeping them
in pkg/kernel would put a burden on the CFE team after code reviews
are tightened to require OWNERS approval.

TEST=ci

Change-Id: I931033ba987d17a2c9c6d80a16dad09bfbaa0572
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234905
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-03-03 15:04:10 +00:00
Martin Kustermann f50b3a52e4 [vm] Make async lowering no longer use optional parameters
This CL

  * Makes :async_op only have two parameters: We take advantage
    of the fact that errors not only have exception != null but
    also stacktrace != null.
  * Makes :async_op have no optional parameters. This reduces
    code size significantly.
  * Removes unused parameter in _awaitHelper calls
  * Wrap the then callback instead of the error callback. (needed
    to make optional parameters required)

This results in 2% code savings on a big g3 app.
The size of :async_op shrinks on average by 11%

TEST=ci

Change-Id: I38d5fba4ebebc780b48dac5aa6a250d2c7952bfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233362
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-18 12:09:42 +00:00
Nate Bosch 33e174084a Replace Uri.scheme == with Uri.isScheme
Use `hasScheme` in place of comparing against the empty string, and
`isScheme` to compare against all other schemes.

TEST=No behavior changes.

Change-Id: Ifc9fd13c6cf37933ebd4a754c4b500dedbcb291b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231185
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-02-08 21:38:57 +00:00
Martin Kustermann 4eaacc3df9 [vm] Improve async performance by taking advantage of static types of returned values
In general any async function can return X or Future<X>. Though the
future implementation has to do different things depending on which case
we're in. It does so by using a `<obj> is Future<T>` test. This test is very
expensive if many different classes flow into `<obj>`.

Though most functions do not return `Future` objects from async
functions. We can determine that statically by looking if any returned
expression could be a future. If not, we can bypass the `is Future<T>`
test entirely.

Issue https://github.com/dart-lang/sdk/issues/48226
Issue https://github.com/dart-lang/sdk/issues/48235

TEST=pkg/front_end/testcases/general/async_function_returns_future_or.dart

Change-Id: If655bdbdddc214dd7b12be9905b3c788252547d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230662
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-04 22:06:59 +00:00
Liam Appelbe 9d79a890f3 [vm] Adding branch coverage RPC to source report
TEST=Unit tests and an integration test
Bug: https://github.com/dart-lang/coverage/issues/141
Change-Id: I84958091dc6f9753f5e9446bb3517a8099019981
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222541
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2022-01-12 19:12:04 +00:00
Clement Skau edc0675e6e [vm] Adds offsets to sync gen.
Sync generators contain two implicit wrappers (:sync_op_gen
and :sync_op), which do not directly correspond to any user
code - and therefore do not have fileOffsets.

Some tools however rely on fileOffsets to e.g. compute code
coverage, so this change adds fileOffset inherited from the
non-synthetic code to :sync_op_gen and :sync_op.

Bug: https://github.com/dart-lang/sdk/issues/47681
Change-Id: I0c54bc3eaf5892e591fead845b5d31d2dfc9481f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220543
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-11-18 12:31:16 +00:00
Johnni Winther c206ec38ce [cfe] Pass ReferenceFromIndex to value class transformation
This fixes fuzz testing for value_class/empty,
value_class/explicit_mixin, and value_class/value_mixin_error

Change-Id: Ia098b3ed5b8a028f1a28c5579fe5df11e5a92ff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217185
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-10-19 10:02:38 +00:00
Johnni Winther 5b7968346d [kernel] Add Field.fieldReference
This adds a third reference to Field declaration, so that we know have
three references, one for each use case:

1) fieldReference used for initialization; in FieldInitializer and as
   the key in the InstanceConstant.fieldValues map.
2) getterReference used for reading; in InstanceGet, StaticGet and
   SuperPropertyGet
3) setterReference used for writing; in InstanceSet, StaticSet and
   SuperPropertySet

TEST=existing

Change-Id: I223f130e808e7f19a831c1fe5e3a4725d1bcdc3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203770
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-09-24 12:01:08 +00:00
Sam Rawlins 8d04e49078 Remove redundant imports
Each of these imports removed is redundant with
'package:kernel/ast.dart'.

Bug: https://github.com/dart-lang/sdk/issues/44569
Change-Id: Ia9bc08b4ffd863572c84fe8a4fa465d2e8e04f7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213845
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-09-20 15:25:01 +00:00
Ben Konyi c51f885613 [ Debugger ] Allow for setting breakpoints on conditional statements
with simple boolean conditions

Fixes https://github.com/flutter/devtools/issues/3289

TEST=runtime/observatory/tests/service/breakpoint_on_simple_conditions_test.dart

Change-Id: I5ed0b78b4e462615d0d0c7dff1581b38dcf00aee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213421
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-16 16:12:17 +00:00
Johnni Winther d80cff6b2b [cfe] Rename isCovariant and isGenericCovariantImpl
- to isCovariantByDeclaration and isCovariantByClass, respectively.

This is done to align the terminology with the spec.

TEST=existing

Change-Id: I96b2e5d6e05caca431aad2b54545e928aee034e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213041
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-09-10 11:27:37 +00:00
Johnni Winther fbc70d8be6 [cfe] Don't replace concrete stubs with abstract methods in mixin transformation
Closes #46389
Closes #46390

Change-Id: If3446d08d0feaf8f778dc396bbed1ebb1c5c0bc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212745
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-09-08 12:43:35 +00:00
Johnni Winther 4ff04f641b [kernel] Add always_declare_return_types lint
Change-Id: Icdcc648f42393b28daf648f752e3b4d61f51aa10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212043
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-09-01 16:50:27 +00:00
Johnni Winther 097a511d9f [kernel] Add annotate_overrides lint
Change-Id: I1fffd60eeb14ecd6d5ba30cd584a75ddd4a8acfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212005
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-09-01 11:45:17 +00:00
Johnni Winther 5dc4d65114 [kernel] Add InvalidExpression.expression
... and use this to wrap expressions instead of Let

TEST=existing

Change-Id: I6d1f5cfa4693222840d6cb406790c39c6ae63e5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208580
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-08-04 08:40:18 +00:00
Johnni Winther cb3a9b0043 [cfe] Remove old method invocation encoding nodes
TEST=existing

Change-Id: I05ee649ecfa7945e2e0f5e5d09441d8916a9c46e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208185
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-07-28 15:44:04 +00:00
Clement Skau ffde1585da [VM] Removes types from reused temps in async.
When we detect that a temporary variable is being reused
with a different type, we change the type of the temp
to dynamic.
This allows us to retain types for any non-reused temps.

For any dynamic temps we still have type information available
for use sites, which we can pass on via unsafeCast.

One drawback of this approach is that we don't know ahead
of time which temps are reused, and get turned into dynamic,
so we have to unsafeCast all uses.


This change is similar to what was done in:
https://dart-review.googlesource.com/c/sdk/+/138500

TEST=Adds tests/language/vm/regress_flutter_85311_test.dart,
updates relevant expect files.

Bug: https://github.com/flutter/flutter/issues/85311
Change-Id: I821c5266327892d5c3fd5bae1bebba7f3fe3931b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205647
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-07-12 08:55:53 +00:00
Alexander Markov a9757d177a [vm, kernel] Cleanup support for old invocation nodes from the VM
This change concludes switching to the new invocation nodes in the VM.
Support for the old invocation nodes (MethodInvocation, PropertyGet
and PropertySet) is removed from the VM and VM-specific kernel
transformations.

TEST=ci

Closes https://github.com/dart-lang/sdk/issues/45340

Change-Id: I0717732feb1b9c6ebdf0f6079ed42a90d00970a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204741
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-06-24 16:17:50 +00:00
Johnni Winther 1adf5dc7c6 [cfe] Verify that only new method invocation nodes are generated when supported
Closes https://github.com/dart-lang/sdk/issues/46339

Change-Id: I404a8afd141f615cfcb6050f280a1410adaac0ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204580
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-06-23 09:41:35 +00:00
Alexander Markov dd1f384f23 [vm] Generate new invocation node in the VM-specific transformations
This change updates the remaining places in the VM-specific
transformations to generate new invocation nodes (InstanceInvocation,
EqualsNull, LocalFunctionInvocation) instead of old invocation
nodes such as MethodInvocation.
The old nodes will be deleted eventually.

TEST=existing tests

Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I00a845e8191f79584c250f57214dd5fb4d6241ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203443
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-06-14 17:09:33 +00:00
Devon Carew 8871c3cea2 Add Widget names to the information collected by the widget transformer.
Change-Id: I3401f22e907cddb12f8a122b1c824bc06372c42a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203291
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
2021-06-14 16:14:43 +00:00
Devon Carew 522629df12 Remove some older flutter_web support in the kernel transformer.
Change-Id: I7874617caadf91fdc8ae24ff50387c825385c81f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203281
Reviewed-by: Jacob Richman <jacobr@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-06-10 20:05:23 +00:00
Alexander Markov 6e989dfe35 [vm/kernel] Generate new invocation nodes in async transformers
This change replaces generation of old invocation AST nodes
(such as PropertyGet, PropertySet and MethodInvocation) in async
transformers with new nodes (InstanceGet, InstanceSet,
InstanceInvocation, LocalFunctionInvocation).
The old nodes will be deleted eventually.

TEST=existing tests

Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I8c2ead9509cfd2def2f75f9d82dc13b2a9490fdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202801
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-06-09 22:14:51 +00:00
Sam Rawlins 64c2dd6193 Remove "unnecessary" imports in pkg/kernel
In each library where an import is removed, the library uses some elements
provided by the import, BUT there is another import which provides all of the
same elements, and at least one more which the library uses.

In this change, we remove the imports which can be simply removed in favor of
the other already present imports.

See https://github.com/dart-lang/sdk/issues/44569 for more information.

Change-Id: Ifebf11894fd62280b20230aa6d66de41cf6baae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199462
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-05-14 20:18:18 +00:00
Alexander Markov df80241899 [vm] Handle new AST invocation nodes in VM kernel transformations
This change extends VM-specific kernel transformations to handle
new AST invocation nodes. The transformations may still generate
old nodes, but they should accept and handle new nodes coming from
the front-end.

TEST=Manual testing with new invocation nodes enabled.

Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I2de9f0eb00fcf844ba62fdc93b15a907c2d6b69d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197443
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-04 18:15:01 +00:00
Johnni Winther efe0ddccab [kernel] Reland: Migrate remaining bin/lib libraries in package:kernel
Change-Id: I5eacb92ea6ce00d83b3440a473cca8dad0892a87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197165
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-04-28 14:36:53 +00:00
Johnni Winther 3e44898e08 [kernel] Make FileUriNode.fileUri non-nullable
TEST=existing

Change-Id: I72583e500cb0b69d9352b040c3e2885f9e0450c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195681
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-04-19 08:03:30 +00:00
Johnni Winther 7e6692b20c Revert "[kernel] Migrate remaining bin/lib libraries in package:..."
Revert submission 195268

Reason for revert: Implicitly triggers running bin/* in sound null safety, revealing an unsafe use of List.length=

Reverted Changes:
I026ace4fd:[cfe] Migrate front_end libraries from wave 3-4
I9ba1f809b:[kernel] Migrate remaining bin/lib libraries in pa...

Change-Id: I3535c45d6eaf970dc5a17b6d7274cd9d6aa16ae2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195507
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-04-15 14:55:37 +00:00
Johnni Winther 9feb5330b9 [kernel] Migrate remaining bin/lib libraries in package:kernel
Change-Id: I9ba1f809b0340b6d45471d856f2a31cff9534de8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195264
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-04-15 12:04:28 +00:00
Johnni Winther 71293ec389 [kernel] Migrate scanner and value_class
Change-Id: Id4ff972a9a56e878a991680f76f6264b55db27eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195240
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-04-14 13:35:44 +00:00
Johnni Winther d8f2b7cc44 [kernel] Make .function non-nullable on Procedure, Constructor, and LocalFunction
TEST=existing

Change-Id: I4d0ae16291414e58207b7de0466d989d27997619
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195074
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-04-14 08:17:28 +00:00
Johnni Winther 64460ec47f [kernel] Make Member.name non-nullable
Change-Id: Id2befd868e93985d6af463c2ccd410cd56b68187
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194721
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-04-12 13:48:46 +00:00
Johnni Winther 9d80c4db57 [kernel,vm] Migrate vm transformations in package:kernel
TEST=existing

Change-Id: I86dfda23fa32ecb924fa6c202e7142cb8a258dc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192145
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-04-07 08:30:47 +00:00
Johnni Winther a26a140d88 [kernel,vm] Change async transformer to extend RemovingTransformer
Since some of the async transformers return `null`, signaling that they
remove nodes, they must extend the RemovingTransformer in order to
migrate to null safety where arbitrary node removal is not possible.

Change-Id: I8e20e2c61ce23699fe32c7450aacdd15467da5f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191923
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-04-07 08:30:47 +00:00
Alexander Markov 6239c434fb [vm,cfe] Avoid elimination of 'x as Function' type casts
Elimination of redundant type cast 'x as Function' where x is
a function type (such as 'void Function(int)') is not correct because
it changes semantics of a function call if such expression is
used as a receiver.

"Function" static type of receiver allows arbitrary function calls,
while known function type of the receiver means the call doesn't
need to check parameter types. Static type of receiver is currently
not stored in kernel AST but calculated from the receiver node,
so replacing 'x as Function' with 'x' changes static type of
the receiver from "Function" to function type.

TEST=tests/language/regress/regress45428_test.dart
Fixes https://github.com/dart-lang/sdk/issues/45428

Change-Id: If7148450526703daa63a442adf67a9e7a2dcea54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193524
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-03-31 15:57:29 +00:00
Johnni Winther 9e23810b77 [kernel] Migrate more libraries in package:kernel
Change-Id: I249c9fa9f2727544f940b3d954ce49bf38ee4918
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191402
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-18 11:06:18 +00:00
Johnni Winther 01b0947a6d [kernel] Update kernel encodings
* Add InstanceGetterInvocation for getter/field invocation in web
  backends
* Add localFunction getter to LocalFunctionInvocation
* Remove isNot from EqualsCall and EqualsNull - the encoding didn't
  carry its weight.
* Remove uses of Name.name
* Remove BottomType code from VM

TEST=existing

Change-Id: I99d05d35b9ef193d092cc151c99ad472dbd60834
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188725
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-08 11:29:51 +00:00
Johnni Winther dd1c3a3233 [vm] Make async transform resilient in context of invalid type and never type of iterables
The CFE can invoke transformations despite having compile-time errors.
The async transform was crashing the compiler if it hits for-in
iterables that have an invalid type or never type.

In case of an invalid type, the program has a compile-time error and
won't be able to run propertly. So we'll replace the entire for-in with
an invalid expression statement if the iterable is an invalid
expression.

In case of a never type, the program should compile fine, which this CL
also fixes.

This makes the newly added tests no longer result in DartkCrash but
rather in a compile-time error (invalid expression) or runtime-error
(never type).

Closes https://github.com/dart-lang/sdk/issues/45014

Change-Id: Ic50f68400b67b57dd4a2c0a125b08f0f3e0d8dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188463
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-03 11:58:08 +00:00
Johnni Winther 4e1c79d86b [cfe] Don't clone synthetic members into mixin applications
Change-Id: I8e92b95ae29f8cec16f69f59cc52c203bba5ea6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186140
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-22 16:17:29 +00:00
Johnni Winther c6e068aff0 [kernel,front_end] Part 1 of migration wave 2
Change-Id: I4c6413c2011da55ad1d82739130be750cc2b8b37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185380
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-02-18 20:04:40 +00:00
Johnni Winther 8467186ca0 [kernel] Initial migration of package kernel wave 1
This CL completes the migration of the first wave of
interdependent libraries in package:kernel, including ast.dart.

In order to ensure non-nullability on AST properties, the Transformer
has been split in 2 variants: Transformer which doesn't support
removal of nodes and RemovingTransformer which supports removal where
allowed by the context using 'removal sentinels'.

Start reviewing Transformer and RemovingTransformer in visitors.dart
since many of the changes are caused by the changes here.

Included in the migration are the mixin_deduplication.dart and
unreachable_code_elimination.dart since these needed porting to
the RemovingTransformer which was aided by opting in the libraries
which only depended on ast.dart.

TEST=existing

Change-Id: I9e63b985bd24896c25edd4ee51e37770187bcc17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184786
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-18 16:01:17 +00:00
Johnni Winther b38c72bc1f [kernel] Partial migration of package:kernel wave 1
Change-Id: Icb42c4cd870bf1830c7399d0f38501348c128028
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184240
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-10 15:55:53 +00:00
Johnni Winther ee0c0bcd57 Reland "[kernel] Ensure that visitors don't implicitly returns null"
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie8fa5d41b99850d9e4abb59634c72920c64128d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183691
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-10 07:51:52 +00:00
Johnni Winther b60e0aa5a1 Revert "[kernel] Ensure that visitors don't implicitly returns null"
This reverts commit ce81216885.

Reason for revert: Flutter dependency

Original change's description:
> [kernel] Ensure that visitors don't implicitly returns `null`
>
> This is in preparation to migrate package:kernel to null safety.
> For the visitor interfaces to support non-nullable return types, the
> implementations must avoid using `null` as return value in its base case.
>
> TEST=Refactoring
>
> Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>

TBR=jensj@google.com,johnniwinther@google.com

Change-Id: I61b838d3371e6b1de2427716d056324c120be499
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183689
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-09 12:41:12 +00:00
Johnni Winther ce81216885 [kernel] Ensure that visitors don't implicitly returns null
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-09 09:46:46 +00:00
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00
Jens Johansen 5fac8d3d71 [CFE] Reproduction and fix of duplicate string-named 'abstract member-signature'
Before this CL, the map we use to "reuse" references when doing
experimental invalidation mapped from String to Reference.
In bug #44523 two abstract member-signatures have the same textual
(String) name meaning that via the lookup one would get the correct
one, one would get the wrong one, they would get the same one
which eventually causes a crash when trying to serialize.

This CL fixes the issue by mapping via the Name instead, which
basically - for private names - wraps the name and the library
which disambiguates it.

This CL also includes the reproduction of #44523.

Fixes #44523.

TEST=Mostly relying on existing test coverage.

Change-Id: Ib62ebca0b7f5092f0b8410d3c458663c3032eca1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177704
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-07 13:11:18 +00:00
Johnni Winther 5ed4e5becd [cfe] Pass references instead of fields/procedures
TEST=refactoring

Change-Id: I6e2d46af9bd58673bda847ea5cf981616e1118b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176667
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-29 11:46:15 +00:00