Commit Graph

4012 Commits

Author SHA1 Message Date
Alexander Markov 37a25d9100 [vm/bytecode] Add a compile-time error if there are too many arguments.
Issue: https://github.com/dart-lang/sdk/issues/37305
Change-Id: I9dac7c1b7b49fca8531ca2bf83b1c309d8217969
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106984
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-24 16:02:05 +00:00
Jens Johansen 31599c1e64 No --mode=legacy in incremental_perf_test
Fixes #37302.

Change-Id: I69f07848ab20922628df0d01ea7b9c75fe8a5bb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106905
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-06-24 13:45:52 +00:00
Johnni Winther 77668f4e58 [CFE] Preserve errors in unevaluated and unused arguments and locals
Change-Id: If8c23ac2f374ee863fd8df4c241195c0a115e69d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104980
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-06-21 13:53:17 +00:00
Dmitry Stefantsov 0a4d47de3c [fasta][nnbd] Add nullability modifiers to DartType
Change-Id: Ica2e5e250831573453c1d469571d9d001e7702a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106642
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-06-21 11:43:26 +00:00
Jens Johansen 153683b1be [cfe] Get rid of 'strong' in incremental compiler tests
Fixes #37302.

Change-Id: Id8e83dfa86dcd188e5541e0465fab08a51e39882
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106900
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-06-21 09:53:36 +00:00
Dan Rubel a4b67bd6ce add regression test for issue 37285
Change-Id: Ieb2636ba8404c95a6b3027bd5fccf02876940933
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106501
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-20 21:04:37 +00:00
Dan Rubel 683ea6dc67 add fasta extension method test
Change-Id: I8de4f01463aa141ac4104d98b8ba42f970e32021
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103881
Commit-Queue: Dan Rubel <danrubel@google.com>
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-06-20 20:55:07 +00:00
Alexander Markov da8cb470cc [vm/bytecode] Represent classes, libraries, scripts and recursive types in bytecode
Size of a large application:
Before: 26628600
After: 21480120 (-19.3%)

Size of snapshots:

isolate_snapshot_framework.bin
Before: 9322496
After: 6782976 (-27.2%)

isolate_snapshot_product_framework.bin
Before: 9166848
After: 6602752 (-27.9%)

Regressions in tests:

1) Test language_2/type_alias_equality_test/04 fails similarly to default mode, as VM
does not implement comparison of function types according to the specification.
Previously this test was passing as function types were canonicalized in bytecode,
which was not always correct. This CL fixes the problem with canonicalization of
function types in bytecode and the test starts failing again.

2) Tests standalone_2/entrypoints_verification_test, standalone_2/io/test_extension_test,
standalone_2/io/test_extension_fail_test fail as native extensions are not supported
in bytecode yet. These tests start passing after df5e7aac17,
which switched bytecode tests to kernel service (on x64), because kernel service doesn't
drop ASTs. This CL switches from reading AST library declarations to bytecode even if
AST is not removed, so tests fail again.

Change-Id: I8b7ba44bfa49d0b1599b2509553ff7c831a4e244
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104700
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-20 18:27:21 +00:00
Kevin Millikin 5ade5079b1 [cfe] Remove the set-literals experimental flag
This flag has been enabled since Dart 2.2.0.

Change-Id: I18e77e1659d4be1aaf06e1c2a6262ae9e8c7f922
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104760
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-06-19 15:06:05 +00:00
Jens Johansen e6647f0769 [cfe] Fixes to part with parts
Before this CL we could both crash and add wrong metadata to "part"
nodes when a part defined other parts.
This CL fixes it by
a) Not resetting a counter so *every* part in a part will be out of
   bounds when trying to reference it; and
b) Check if a part directive is in bounds and ignore it if it isn't
   (an error should already have been issued).

Change-Id: I3d31f2577b2120df6461c9cc1002131dbee9dbbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106641
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-06-19 11:25:05 +00:00
Jens Johansen a878514cf5 Add frontend testcases for part with part(s) in it
Currently there's at least two issues:
* We can crash
* We can add metadata to things they weren't meant for

Change-Id: I4e277ea614ce9faa25b2bf1c5a16a5e877df225b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106640
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-06-19 10:56:55 +00:00
Jens Johansen c6426e134b [cfe] Pass fileUri to more things when issuing problems
The library builders uri might not be correct as the problems can
originate in parts.

Fixes #36990

Change-Id: I1c39a31052b88013df38033a49b662ce5bb86aad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106083
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-06-19 07:20:12 +00:00
Jens Johansen b9e005f4b9 [fasta] messages_test automatically wraps examples in part
Update the message_test to automatically create an example that wrappes
all already defined examples in a part.
For instance, if the example is

main.dart: main() { print("hello world"); }

create an additional example that is basically

main_wrapped.dart: part 'main.dart';
main.dart: part of 'main_wrapped.dart'; main() { print("hello world"); }
(as well as some additional comments to push any actual positions in the
main file ot of scope for valid positions in the wrapper file.

This doesn't work for everything, e.g. if the original main imports or
exports anything, the new test will fail. That's okay, the status file
has been updated accordingly.

The reason for adding it is that we currently have some bugs that causes
us to crash in situations like this, i.e. situations where a message is
coming from a position in a part where the same position doesn't exist
in the non-part file.
The status file has been updated for that too, although not in sorted order.

Change-Id: Ib67f85fca5e81e0b9e93cf2d79ab50c38cae4936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106082
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-06-18 10:01:58 +00:00
danrubel a2f32ebe87 finish cleanup ErrorToken parsing
Change-Id: I876c4805561d29b289184ce696fe4db2038bc362
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106005
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-14 13:40:17 +00:00
danrubel 6bd64ff8b2 cleanup StringScanner references
Change-Id: Ic75305c7a76860c5b96032d4f8c8fff695006f22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106004
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-14 13:39:47 +00:00
danrubel 1a9801e9fa mark ExperimentalFeature bogus_enabled and bogus_disabled as deprecated
... and update comment and test output to indicate how files should be
regenerated from tools/experimental_features.yaml

Change-Id: I369b93c35b91f7a93c915f0abf9cebdd00c13f8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106003
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-06-13 21:30:05 +00:00
Dan Rubel c530c333bb Update null-aware nnbd "?.[" operator recovery
This sets the "?.[" endGroup to "]" for proper token stream structure
and parser recovery.

Change-Id: Ie4147ac5dedcc273ea6cfda6dafc5d91e892b1a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-13 16:53:26 +00:00
Dan Rubel 45f39fe70d update scanner/parser to handle null-aware index operator
This adds support for the nnbd `?.[` operator as specified in
https://github.com/dart-lang/language/pull/293/files#diff-dbeaf678924df9f8a2ca9f5d12e26d3eR11513

Change-Id: I11547cf875439fef9fe22d4f4ac5ab912b3759d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105902
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-13 16:53:26 +00:00
danrubel d6f5a245b2 parser error token cleanup
This removes one location where ErrorToken processing is no longer needed
in the parser, and updates the analyzer parser tests to use scanString
rather than instantiating the scanner directly.

Change-Id: I399d771004af7f9fe25d19c1065fbfd425416edc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-13 14:30:10 +00:00
danrubel 8adde6b603 make extension declaration name optional
This CL updates the parser to parse extension declarations where
the extension name is omitted. For more details, see
https://github.com/dart-lang/language/pull/303/files#diff-9b84d2e3c88265bde2eb43544ddb757dR66

This change explicitly does not handle the case `extension on on on { … }`.
A subsequent CL should either make `on` a builtin
or add more lookahead in the parser to allow this edge case.

Change-Id: Ided821192770f88a51a3300fed8cb0fdef9eea3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-13 14:29:40 +00:00
Aske Simon Christensen 50efd7f187 [Kernel] Add list of unused arguments to InstanceCreation nodes.
During constant evaluation, unused arguments to a const constructor are
thrown away after evaluation, since their values do not affect the
resulting instance constant. If such an unused argument ends up
unevaluated, any errors that would arise in the final evaluation are
not reported.

This CL adds space in the Kernel AST for saving these unevaluated
expressions so they can be checked during final constant evaluation.

Even though this is an incompatible change, no update is needed to the
VM code (except for the version bump), since the VM does not support
InstanceCreation nodes in the first place.

Change-Id: I4752562c1164efbba79eb018c15b07ed8354ce5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105761
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-06-13 09:42:26 +00:00
Sigmund Cherem 7c7160f022 Move isRedirectingFactory to CFE and add unit test for it.
Eventually it should be handled by Procedure.isRedirectingFactoryConstructor, but that is
currently broken for patch files.

It appears the VM has no patches of that kind, but dart2js does.

Change-Id: I0b64379f16089ad0d98ecd4df1ed9282ed6bc0e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98523
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2019-06-11 22:00:10 +00:00
Jens Johansen 801ad8b521 [cfe] Remember if finalizeExports was done
Before this CL, whenever a dill library builder was asked to compute
the outline it would finalize its exports - even if it was already done.
This is not really a problem (it mostly puts stuff into maps --- doing
it again will just overwrite what's already there with the same thing
again), but when having many dill library builders, and asking them to
compute the outline again and again because we've added a few new ones
(e.g. via kernel worker) it adds up to a lot of wasted time.

This CL adds a boolean to the dill library builders to avoid re-doing
this already done work.

An internal benchmark via kernel worker of lots of outline
calculations in worker mode with reuse and the incremental compiler
(and lots of dill loaded dependencies) goes from ~149 seconds to
~143 seconds.

Change-Id: I19cadbf64ff5e0ff117bad4df86c83832a1f28fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105243
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-06-11 11:32:34 +00:00
Vijay Menon 612a3f8978 [dartdevc] enable sdk compilation from dartdevc
Kernel mode only

Build with:
> dart bin/dartdevc.dart -k --compile-sdk dart:core --modules amd -o dart_sdk.js

For now, this doesn't support building only parts of the SDK - dart:core brings everything in.

Change-Id: I23cda3064408778dc93c9b3d4be757f1e99bae0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104811
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2019-06-06 21:59:21 +00:00
Brian Wilkerson 30390c6ba1 Prepare to compute the documentation URL for diagnostics
Change-Id: Ib1b7e4887e18b90c1552f3f8501948ee8d8d2c1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105260
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-06-06 16:41:46 +00:00
Dan Rubel 4a27605fdc generate kernel experimental flags
Change-Id: I9430d95c012b752bc4ca0530d79252b8b032a26b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104841
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Auto-Submit: Dan Rubel <danrubel@google.com>
2019-06-06 14:03:29 +00:00
Aske Simon Christensen c8ee114beb [cfe] Pass triple-shift flag to scanner.
Fixes https://github.com/dart-lang/sdk/issues/37082

Change-Id: I3aead7432b64433a040d4586623e13d8ac5388ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104004
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-06-06 12:00:24 +00:00
Jens Johansen 1e6f08d41c Fix crash when non-class is given as supertype
Before this CL this code would crash fasta:
```
class A extends Function() {}
```

Now it produces a compile time error instead:

```
t.dart:1:7: Error: Can't use a function type as supertype.
class A extends Function() {}
      ^
```

(technically it already issued it, but crashed before doing so).

Bug: #36824

Change-Id: Iaeb9dc8390d4a9ab7b473848c3311f08a4dbba6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101283
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-06-06 11:33:24 +00:00
Jens Johansen b4d190f5cd [incremental compiler] Streamline processing of reused/removed builders
Suprisingly this doesn't seem to affect performance, but doing basically
the same thing in two different ways is suboptimal.

Change-Id: I1cc52bceb05a0af4d0e0d0574c3599c063cf42a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105242
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-06-06 11:31:55 +00:00
Jens Johansen 5eff2a0374 Split CanonicalNameError, no warning if CanonicalNameSdkError
Prior to this CL, we would issue a warning whenever a CanonicalNameError
was encountered.
This is in principal a good thing, but because we currently have no way
to detect if the sdk we get is the one we expect
(by any other measure than when it issues a CanonicalNameError) we often
issue these warnings for no "real reason" whenever, for instance,
the flutter sdk changes.

This CL splits the CanonicalNameError in two such that errors with
references to the sdk ("dart:" libraries) issue CanonicalNameSdkError
instead, an we then handle that differently. Namely we silently ignore
the error (i.e. don't issue a warning) and just don't initialize from
dill.

This should remedy the situation and be strictly better than to always
swallow CanonicalNameErrors.

Bug: 36032
Change-Id: Idbae0b5ee5b9843a5dbeb49b3c65ae25f5962e36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105240
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-06-06 10:10:46 +00:00
Dan Rubel 4181185070 parse nullable function typed formal parameter
Change-Id: I502d4c6649a8974883b9ded038ce8927d34eea10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-05 13:37:01 +00:00
Vijay Menon 3b5a187726 [dartdevc] move ddc internal libraries under sdk
Note, this has the effect of including all DDC Dart sources with the
shipped SDK: we ship everything under sdk/lib.

This should enable https://github.com/dart-lang/build/issues/2262

Change-Id: If66bc7c620034e7f2acf7d2c3e9524a408417681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104383
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-06-04 13:47:29 +00:00
Kevin Millikin bd60fa1ad5 [cfe] Write constant field initializers into outlines
For constant field initializers, compile the initializer expression
to Kernel, perform local type inference, and perform necessary
rewrites during outline construction.  This will support constant
evaluation during separate compilation.

Change-Id: I65fe601595c04c45d586d0bac97c2ade6ab15a90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104564
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2019-06-04 13:14:29 +00:00
Jens Johansen 422553798e [incremental compiler] Don't process dill libraries twice
An internal benchmark via kernel worker of lots of outline
calculations in worker mode with reuse and the incremental compiler
(and lots of dill loaded dependencies) goes from ~160 seconds to ~150 seconds.

Change-Id: I80afa10caacef5e14e569928a1d421bd3e8ab342
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104003
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-06-04 11:33:29 +00:00
Kevin Millikin 907f31e6de Reland "[cfe] Build some annotations during outlining"
Reland the change to build some annotations during outlining, with a
bug fix.  Annotations from patch classes and procedures were not
applied to the actual class or procedure, which is fixed.

The original commit was reviewed at
https://dart-review.googlesource.com/c/sdk/+/103806

The revert was reviewed at
https://dart-review.googlesource.com/c/sdk/+/104220

The original commit message was:

    During the outline phase, after top-level type inference, compile
    annotations for libraries, classes, fields, procedures, and
    constructors.

Change-Id: I836160ddad4114ded72701e8a3938f703228931c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104560
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-06-03 10:20:15 +00:00
danrubel 6f2f92f578 improve extension method declaration recovery
Address comment in https://dart-review.googlesource.com/c/sdk/+/103580

Change-Id: Ie92e4fa752eaf851fec9465565d640524b569760
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-31 23:30:25 +00:00
Dan Rubel 2938630937 update parser to handle "!." in nnbd expressions
Fix https://github.com/dart-lang/sdk/issues/37111

Change-Id: I6e156a804085c9be12e5e7a0d0019cfeb77c9128
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104187
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-31 11:37:44 +00:00
Vyacheslav Egorov 39ec9fc4f3 Revert "[cfe] Build some annotations during outlining"
This reverts commit 1df5fb3d57.

Reason for revert: large regressions on Flutter microbenchmarks. Reverting to prevent this reaching Flutter.

Original change's description:
> [cfe] Build some annotations during outlining
> 
> During the outline phase, after top-level type inference, compile
> annotations for libraries, classes, fields, procedures, and
> constructors.
> 
> Change-Id: I95ca65fd58ad88d9452a28d5a0652bee44aeda3a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103806
> Commit-Queue: Kevin Millikin <kmillikin@google.com>
> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>

TBR=alexmarkov@google.com,dmitryas@google.com,askesc@google.com,kmillikin@google.com

Change-Id: I67c0719f9175c1bd75b609d7d5c0cea5c294bd6d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104220
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2019-05-30 08:46:55 +00:00
Kevin Millikin 1df5fb3d57 [cfe] Build some annotations during outlining
During the outline phase, after top-level type inference, compile
annotations for libraries, classes, fields, procedures, and
constructors.

Change-Id: I95ca65fd58ad88d9452a28d5a0652bee44aeda3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103806
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-05-30 07:29:12 +00:00
Aske Simon Christensen d5405d06f4 [cfe] Allow local const variables as annotations.
Fixes https://github.com/dart-lang/sdk/issues/37065

Change-Id: If902bd22fc6e0925c361a31e22b32d046ea4754e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103628
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-05-29 09:21:39 +00:00
danrubel fee615c5a5 consolidate multiple modifier error codes
This consolidates the following error codes into MODIFIER_OUT_OF_ORDER

* COVARIANT_AFTER_VAR
* EXTERNAL_AFTER_CONST
* EXTERNAL_AFTER_FACTORY
* EXTERNAL_AFTER_STATIC
* STATIC_AFTER_CONST
* STATIC_AFTER_FINAL
* STATIC_AFTER_VAR

Change-Id: I3f8c41bacc65ebc5d9255806cbee89cddb5ffeb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103880
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-28 17:01:16 +00:00
Dmitry Stefantsov 39dbaecfc1 Remove tests relying on contravariant uses of varaibles in supertypes
Change-Id: Ie614d8f96bbe534117f83528b41fe63fdfa9c9c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103525
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2019-05-28 09:56:43 +00:00
Dmitry Stefantsov e6e2020fb2 [fasta] Allow only covariant uses of type parameters in supertypes
Closes #35792.

Bug: http://dartbug.com/35792
Change-Id: I1c647c74e1e8f8892fd76b735085b457e770f5b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103521
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-05-28 09:56:43 +00:00
Aske Simon Christensen 25033cee32 [CFE] Control inlining of const variables from backend.
Needed for https://github.com/dart-lang/sdk/issues/36535

Also preserve StaticGet of unavailable constants not in const context,
rather than wrapping it in an unevaluated constant.

Change-Id: Ifac6f251ea9a90a17d06014be12c0d387a32d757
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99020
Reviewed-by: Vijay Menon <vsm@google.com>
2019-05-27 11:45:08 +00:00
Jens Johansen ae944a68ed [Incremental compiler] Only re-check package-uris if base-uri changed
When the .packages file has changed we need to re-check all package-uris
to see if we need to invalidate the builders (if the file uri for a
package uri library (e.g. if the package was upgrade) has changed we
have to invalidate it).
This translation is semi-expensive though, so if we can avoid it that
would be a good thing.

This CL caches the "base URI" for packages from the previous run,
so we can start by comparing the base-URIs: If the base-uri for a
specific package hasn't changed, nor will the actual translation.
Only if the base uri has changed we do the actual translation,
and thus save many package-to-file-uri translations.

An internal benchmark via kernel worker of lots of outline
calculations in worker mode with reuse and the incremental compiler
(where the .packages file change every time and we have lots of
package-uri libraries) goes from ~185 seconds to ~162 seconds.

Change-Id: I3ed48b23a590dbf66f8a2379bb88e1b177f1f034
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103804
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-05-27 10:46:18 +00:00
Jens Johansen d911d9b5ff Cleanup "libraries" field in DillTarget when their invalidated
Before this CL we removed from from the builders map, but left them in
the libraries list.
When using the incremental compiler via kernel worker (where we
continually replace dill builders) that meant that this list would just
keep growing.

This CL cleans it up and the builders map and the list should now be
in sync

An internal benchmark via kernel worker of lots of outline
calculations in worker mode with reuse and the incremental compiler
goes from ~215 seconds to ~185 seconds.

Change-Id: I254558d517f544fe31b5673e0dc8748048f0c5ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103630
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-05-27 10:46:18 +00:00
Jens Johansen eb131c3d68 [kernel worker] Don't do unnecessary computeCanonicalNames
This was a left-over from when unbinding, and should no longer be needed.
An internal benchmark of lots of outline calculations in worker mode with
reuse and the incremental compiler goes from ~248 seconds to ~215 seconds.

Change-Id: Iedb6a3fb11504610c061503efb741e35919f0d32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103629
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-05-27 10:46:18 +00:00
Sigmund Cherem 64ed4bf664 Changes to bazel worker to support modular testing.
This includes:
 * accepting null values like sdk-summary or .packages (which are not used when building kernel for the sdk itself)
 * allow enabling language experiments
 * only exclude-non-sources on the non-incremental code path if that's requested

Change-Id: I08eeb643676f1f1406f0f3030c341d68179d42a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103574
Reviewed-by: Nate Bosch <nbosch@google.com>
2019-05-24 19:09:12 +00:00
Dan Rubel f4f2c77d4a improve missing body error messages
This builds on the prior CL to improve the error messages
for missing switch statement body, missing finally clause body,
and others.

Change-Id: Ia2def1f3a75d5581356c12aee4705ef21870f749
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103571
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-24 17:03:25 +00:00
Dan Rubel ec1ddcdb83 improve extension message missing body error message
This improves the missing class, mixin, and extension method body
error messages and lays the groundwork for improving other
missing body error messages such as switch statement, finally clause,
and others.

Change-Id: I0a4d1338fe91eee3cfe7d61652e168df1302d212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103570
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-24 17:03:25 +00:00