Commit graph

21836 commits

Author SHA1 Message Date
Johnni Winther 5e263044e8 Enable StrongModeWorldStrategy
This makes closed world computation take the static type of the receiver
into account and removes non-live members from the J-world.

Change-Id: I5547aaae4685c6417a94916df0bc4e621296ce8d
Reviewed-on: https://dart-review.googlesource.com/72643
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-10 07:09:07 +00:00
Konstantin Shcheglov 9e3bcc4cec Report MIXIN_INSTANTIATE when a mixin is instantiated.
R=brianwilkerson@google.com

Change-Id: Ia19d69bd7f0212bcdfb37f228046c727a36d62e3
Reviewed-on: https://dart-review.googlesource.com/74042
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-09 17:04:48 +00:00
Paul Berry c925fa6b00 Lay the groundwork for comparing language_2 compilation results between analyzer and CFE.
This CL just adds the compiler=compareAnalyzerCfe option to the test
framework, and updates the status files so that no language_2 failures
are expected when this "compiler" is used.  A placeholder executable
has been added to sdk/bin, but it is not wired up yet--that will be
done in a future CL.

In a future CL I will wire up the placeholder executable to the code
in pkg/analyzer_fe_comparison, and fill in the methods in
CompareAnalyzerCfeCommandOutput to process the output accordingly.

Change-Id: I27439de4ac609cb8b003f157a0ff88d181bfbcae
Reviewed-on: https://dart-review.googlesource.com/73561
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2018-09-08 15:25:05 +00:00
Paul Berry 9795cd9613 Remove uses of DartType from const expression serialization.
These types were used long ago when we sometimes generated summaries
from an element model; they haven't been used in a long time.

Change-Id: I73d5e52cc3c35ce1d5ebb68bae59c8a795ce279f
Reviewed-on: https://dart-review.googlesource.com/74013
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-08 00:02:59 +00:00
Paul Berry 13efc4f8d8 Convert test_strategies.dart to triple-slash comment style.
Change-Id: Ia6c1756d147040fec07aaed1f547b6b2c4a495b2
Reviewed-on: https://dart-review.googlesource.com/74011
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-07 23:14:11 +00:00
Johnni Winther 134bb884de Handle generic types in native behavior
Previous implementation didn't include subtypes of the specified type.
For instance `JS('Rectangle', ...)` should have triggered the inclusion
of `_DomRect` but the use of this-type in the subtype test,
`_DomRect <: Rectangle<T>`, prohibited this.

This fix is to use the raw type instead of the this-type. The subtype test
will therefore be `_DomRect <: Rectangle<dynamic>` which correctly
includes `_DomRect`.

The change has the effect that `JS('List', ...)` now actually includes subtypes of
`List`. For this reason uses of `List` have been updated to use `JSArray` or
explicitly use `returns:...` to avoid unintended inclusion of native lists such
as the native typed arrays.

Change-Id: I06ab55d9bf694829596875d9c3a0a6c954d396b7
Reviewed-on: https://dart-review.googlesource.com/73903
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-07 22:28:37 +00:00
Jenny Messerly be5cd6307f fix #34296, generic function instantiation should be checked eagerly
Change-Id: I8c6e0980c23d8ca2cb22db9411028b59be5eb8db
Reviewed-on: https://dart-review.googlesource.com/72545
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-09-07 21:34:36 +00:00
Konstantin Shcheglov c29ec5994c Resolve super invocations in mixin declarations.
R=brianwilkerson@google.com

Change-Id: I81dddc8187a13a17db91f77dc0df19248db7d45b
Reviewed-on: https://dart-review.googlesource.com/74007
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-07 20:06:21 +00:00
danrubel a9cc6f0f19 Revise with clause event handling
This replaces the begin/endMixinApplication events which were used in both
```
  class A = B with M;
```
and
```
  class A extends B with M { }
``
with different events for each of the above situations.
This change facilitates properly handling class declarations of the form
```
  class A with M { }
```

Removed event:
* beginMixinApplication
* endMixinApplication

Added events:
* handleNamedMixinApplicationWithClause
* handleClassWithClause
* handleClassNoWithClause

Change-Id: Ifa0ecfd7ff8c408087ad78036ad35ba4a00728c6
Reviewed-on: https://dart-review.googlesource.com/73940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-07 19:33:51 +00:00
Alexander Markov 9c8e9f02a3 [vm/kernel] Support CheckLibraryIsLoaded node in kernel constant evaluator
Change-Id: I5530c54ce86a61e1545c727215ca561c77b86e99
Reviewed-on: https://dart-review.googlesource.com/73840
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-09-07 19:32:11 +00:00
Konstantin Shcheglov 1e65a6fa7f Check for conflicts of constructors and static members.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34371
Change-Id: I55494cbb770dbdc1418cac9c74672ebbab7ab24d
Reviewed-on: https://dart-review.googlesource.com/74004
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-07 18:33:15 +00:00
Brian Wilkerson 2aca0b8b67 Fix a test broken on Windows
Change-Id: I2612573bee93ec04e769cd627a4f4f0031937883
Reviewed-on: https://dart-review.googlesource.com/73980
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-09-07 18:22:22 +00:00
Brian Wilkerson fe5a99dd75 Add hover support for mixin declarations
Change-Id: Ia42f39aec7b001264ae69043fe76ceb2c79b76cb
Reviewed-on: https://dart-review.googlesource.com/73960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-09-07 17:52:45 +00:00
Jens Johansen 1e4b3e9754 Train kernel-service on Windows
Now, on Windows:
hello.dart (hello world script): ~0.33s, ~0.33s, ~0.29s, ~0.28s, ~0.29s
pkg\complier\bin\dart2js.dart --help: ~3.37s, ~3.36s, ~3.40s, ~3.50s, ~3.41s

Before, on Windows:
hello.dart (hello world script): ~0.85s, ~0.87s, ~0.86s, ~0.90s, ~0.91s
pkg\complier\bin\dart2js.dart --help: ~6.12s, ~6.20s, ~6.26s, ~6.13s, ~6.04s

So...:
hello.dart (hello world script): -65.3759% +/- 4.15274% at 95.0% confidence
pkg\complier\bin\dart2js.dart --help: -44.5854% +/- 1.68273% at 95.0% confidence

Change-Id: I6679a7fff68c146390ef70832278ece6eb120c7c
Reviewed-on: https://dart-review.googlesource.com/73921
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-09-07 14:31:03 +00:00
Konstantin Shcheglov cbab413950 Collect super-invoked names for mixin declarations.
We need this to support the following requirement in the mixin
specification:

It's a compile-time error to apply a mixin containing super-invocations
to a class that doesn't have a concrete implementation of the
super-invoked members.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ib683794fe7101222863b34956619773e2af52d1a
Reviewed-on: https://dart-review.googlesource.com/73780
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-07 14:25:45 +00:00
Peter von der Ahé ff70ea2fd5 Update analysis options
Change-Id: I40237c72d0fdb7ab8143dbb8236a3b7d58f63128
Reviewed-on: https://dart-review.googlesource.com/73881
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-07 09:10:37 +00:00
Peter von der Ahé e0b6a2edb7 Don't create growable lists for non-Kernel objects
Change-Id: Iaf44a0073f6641e0f8f47e252818fcbfa010140b
Reviewed-on: https://dart-review.googlesource.com/73481
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-07 07:12:17 +00:00
Peter von der Ahé 196687f0ef Refactor handling of formals
Change-Id: I5e4279d5f0668d5d770be93cc14fc866862761cd
Reviewed-on: https://dart-review.googlesource.com/73460
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-07 07:12:17 +00:00
Peter von der Ahé 51dc3aa370 Improve handling of catch parameters
Change-Id: I216b352e6c140a364930d4005f8d9f9d3809d257
Reviewed-on: https://dart-review.googlesource.com/73420
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-07 07:12:17 +00:00
Lasse Reichstein Holst Nielsen f0172a4c41 Export Future and Stream from dart:core.
This allows `async` and `async*` functions to be typed without importing `dart:async`.
All other async types still need to be imported, including `FutureOr` and `Zone`,
but pure `async`/`await` based code can be written with no imports.

Fixes #26162.

Bug: http://dartbug.com/26162
Change-Id: Iaf36631ef5b3251a688e495a9d238b2f8787f14c
Reviewed-on: https://dart-review.googlesource.com/71480
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-09-07 06:14:32 +00:00
danrubel d761e97178 Remove WithWithoutExtends error code
Change-Id: I1bfe3721200493945580fa1e687ff565a7a79cf0
Reviewed-on: https://dart-review.googlesource.com/73820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-07 04:15:28 +00:00
Paul Berry 2fb058e873 Skip non-const expressions when performing one-phase summarization.
The only reason to include non-const expressions in an unlinked
summary is for type inference, but for one-phase summarization, we're
going to perform type inference directly based on the source AST.  So
skip non-const expressions when doing one-phase summarization.

This requires modifying several summary tests so that they no longer
expect the non-const expressions to be present in the unlinked
summary.  It also causes a few tests of one-phase summarization to
start failing, since the AST-based type inference logic hasn't been
implemented yet.  This is ok because one-phase summarization isn't
exposed to customers yet; it will be fixed in follow-up CLs.

Change-Id: I7455fd82b64c59362439206a05a9eb3691c8e397
Reviewed-on: https://dart-review.googlesource.com/73688
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-07 00:54:54 +00:00
Dan Rubel 7905136e64 Allow with clause without extends clause
This removes the code the generates an error when a `with` clause
is used without an `extends` clause as in
```
   class C with M { }
```
This is the first of several CLs to update the parser
as this CL only prevents the error from being generated.

Change-Id: I1d5c8577902e253a4c83cda2f6a1d4ab98319903
Reviewed-on: https://dart-review.googlesource.com/73687
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-07 00:25:58 +00:00
Brian Wilkerson 8255ac0b76 Do not show mixins in the extends clause
Change-Id: I1e1d757958cb12fc25e2805524cf3fb325634973
Reviewed-on: https://dart-review.googlesource.com/73690
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-09-07 00:03:48 +00:00
Brian Wilkerson fdcbe5dc93 Rename test files to be recognized by test.py
Change-Id: Id302623c9ff257647981f713c7229120bd70ada8
Reviewed-on: https://dart-review.googlesource.com/73800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-09-06 23:31:32 +00:00
Konstantin Shcheglov e13197d192 Update checks for conflicting class members.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34371
Change-Id: Ic056ff4b2f7c7105d12e9b439fcc0cd268cd5ac1
Reviewed-on: https://dart-review.googlesource.com/73301
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-06 22:56:06 +00:00
Kevin Millikin 3224afe9fe Fix a bug in valid return detection
We had implemented the rule for invalid returns in asynchronous
non-generator functions with return type T and a return expression
with static type S:

  is an error if flatten(T) is void and flatten(S) is not void,
  dynamic, or Null

and the actual rule should be:

  is an error if T is void and flatten(S) is not void, dynamic, or
  Null

which requires T to be exactly void and so signals fewer errors.

Change-Id: I296bb8a607d6e5ad862017674091eafe0f6016da
Reviewed-on: https://dart-review.googlesource.com/73740
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-09-06 21:50:43 +00:00
Konstantin Shcheglov ffc716addf Check that mixin superclass constraints are satisfied.
R=brianwilkerson@google.com

Change-Id: If0957b0868da7c7330bd561b6e91dfb0379fa226
Reviewed-on: https://dart-review.googlesource.com/73720
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-06 21:17:51 +00:00
Paul Berry 6ce37c6541 Convert summarize_ast.dart to triple-slash comment style.
I anticipate heavily modifying this file, and I don't want to have to
mix comment styles when I do so.

Change-Id: Ib93bf5489f080456da81f03f82bd7e850498748c
Reviewed-on: https://dart-review.googlesource.com/73683
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-06 21:09:40 +00:00
Brian Wilkerson 39535676c8 Add completion support inside the on clause
Change-Id: I55a118a6e2d684ad917b2371d640c658119e3559
Reviewed-on: https://dart-review.googlesource.com/73700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-09-06 20:02:48 +00:00
Konstantin Shcheglov 230ff965da Report a compile-time error when type arguments after the constructor name with implicit new.
Bug: https://github.com/dart-lang/sdk/issues/34270
Change-Id: I38e919847f25d204c26ec74d04fa49cc46063434
Reviewed-on: https://dart-review.googlesource.com/73600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-06 19:54:50 +00:00
Paul Berry a5d9eb01c2 Convert link.dart to triple-slash comment style.
I'm going to be adding a lot of new functionality to this file, and I
don't want to have to mix comment styles when I do so.

Change-Id: I35fb7b93b2cfc200995364028ea10bab9c8f1245
Reviewed-on: https://dart-review.googlesource.com/73640
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-06 19:52:26 +00:00
Brian Wilkerson e20064b8bf Add syntax highlighting support for the new mixin syntax
Change-Id: I4d6cfdfe0cd8d9c5be82c6efabeb642c4ca87e72
Reviewed-on: https://dart-review.googlesource.com/70902
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-09-06 19:49:20 +00:00
Konstantin Shcheglov 8d9320f777 Test for mixin named 'on'.
Remove explicit _checkForImplementsDeferredClass(), some other mixin checks.

R=brianwilkerson@google.com

Change-Id: I134200d1e78315c19218cf7a9ff4efba7fc50fb8
Reviewed-on: https://dart-review.googlesource.com/73660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-06 19:47:12 +00:00
Paul Berry 66863ea6e2 Avoid a "missing_return" warning in flattenName.
The analyzer can't tell that `unhandled` is guaranteed not to return,
so it thinks that `flattenName` might exit without returning a value.
An easy workaround is to return the result of calling `unhandled`.

This is needed to roll kernel into the internal Google codebase, in
which the "missing_return" warning causes build failures.

Change-Id: I38133db0c2058d687c2f408cc8c8dbf224551408
Reviewed-on: https://dart-review.googlesource.com/73560
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-06 17:52:20 +00:00
Alexander Markov cdd18e6811 [vm/bytecode] Support dynamic invocation forwarders and omit checks in bytecode
This CL adds support for _dynamic_ calls (which are routed through
dynamic invocation forwarders) to bytecode pipeline.

This allows to skip argument type checks for non-covariant and
non-generic-convarint-impl parameters in bytecode when calling instance
members through known interface targets. In case of dynamic call, dynamic
invocation forwarders perform type checks which are otherwise skipped.

This CL also corrects argument type checks in forwarding stubs.
Forwarding stubs are synthetic methods, introduced by front-end to ensure
type safety if some of the argument type checks are skipped.
The specifics of forwarding stubs is that they should use parameter types
of a *target* of a stub for the argument type checks.

This change unifies how argument type checks are performed in bytecode
and in the VM in JIT mode. This allows to mix bytecode methods with
methods JIT-compiled from kernel AST in more cases.

Change-Id: I3a2720a488c8bbb91de1b189eb36ee8c51684a78
Reviewed-on: https://dart-review.googlesource.com/72543
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-06 17:23:12 +00:00
Paul Berry e72fd5294a Deprecate unneeded fields from PackageBundle.
Change-Id: I071a44499ef20a32388eea7ba04264c8c9b8e1c9
Reviewed-on: https://dart-review.googlesource.com/73285
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-06 14:16:10 +00:00
Peter von der Ahé d6cd15b80b Restore types to aid refactoring
Change-Id: Ib58e4cad0727f3b0556f21395bd0dddff3fc66de
Reviewed-on: https://dart-review.googlesource.com/73380
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-06 10:25:15 +00:00
Peter von der Ahé b62eef3d8b Use LocatedMessage for invalid types
Change-Id: Ib233b40211d1893b1de6bea36e84c91c81a49fa9
Reviewed-on: https://dart-review.googlesource.com/73343
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-06 10:25:15 +00:00
Peter von der Ahé 2782266d5c Unify QualifiedName and Identifier
Change-Id: Ie7e7131c58186efd5ed4e81e2f010cc240ce8d03
Reviewed-on: https://dart-review.googlesource.com/73341
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-06 08:57:07 +00:00
Peter von der Ahé 04d3e448dd Clean up KernelFormalParameterBuilder
Change-Id: Id0fce5cc75996fd5f88e22a5182b2dc1061d2beb
Reviewed-on: https://dart-review.googlesource.com/73320
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-06 07:27:50 +00:00
Johnni Winther c715e8125d Refactor global inference data to prepare for serialization
Change-Id: If88b948ca80b1a7915d87a49ba4e1d05de669282
Reviewed-on: https://dart-review.googlesource.com/72401
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-06 07:11:44 +00:00
Johnni Winther f9bb407eba Delete analyze_dart_test
- this tested Dart 1 semantics of the dart2js implementation

Change-Id: Ib80b3a056f552e9826b5c97a88dab9df3e15570e
Reviewed-on: https://dart-review.googlesource.com/72821
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-06 07:10:04 +00:00
Peter von der Ahé d1e2ee28f3 Remove addCompileTimeError in favor of addProblem
Replace most methods with names containing CompileTimeError with corresponding
Problem methods.

Also make Severity.error the default severity.

Change-Id: I4f47bf71dec02347407f2ce4ccfdb04730daf51b
Reviewed-on: https://dart-review.googlesource.com/73221
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-06 06:56:42 +00:00
Paul Berry a2f4ab5b52 Add an API for generating analyzer summaries in one step.
Currently, analyzer summaries are generated in a two-step process,
translating compilation units into unlinked summaries and then linking
the unlinked summaries together to form linked summaries.  In order to
support full unrestricted type inference, we'll need to build
summaries in one step, so that the full AST of initializers is
available for inference during linking.

This CL introduces a new API for one-step summarizing, along with test
cases to exercise it.  For now, the one-step summary logic just
invokes the old two-step summary process.  In future CLs I'll rework
it to be a true one-step summarizer so that the type inference
restrictions can be lifted.

Change-Id: Ic8d55850972f4697b5c6cc6fabe5d26dc7c1288c
Reviewed-on: https://dart-review.googlesource.com/73300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-06 04:18:46 +00:00
danrubel dc0aae5c44 Improve super initializer recovery
This CL addresses one of the issues in https://github.com/dart-lang/sdk/issues/34041
by fixing an AstBuilder crash and improving recovery of super constructor calls
in a constructor initializer list.

In addition, this adds a TestDescriptor adjustValidUnitBeforeComparison field
to support the new recovery tests.

Change-Id: I9e687aed34ea293700bd45d7c13ce36e83a00a05
Reviewed-on: https://dart-review.googlesource.com/73286
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-06 01:16:55 +00:00
Konstantin Shcheglov 169949985a Move CONST_WITH_TYPE_PARAMETERS reporting to ConstantVerifier.
Linter also should be updated to check for this error in HasConstantErrorListener.

R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33612
Change-Id: If4a2535ffe04d965bbd46b5c92679e6132bf500e
Reviewed-on: https://dart-review.googlesource.com/73283
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-05 20:51:10 +00:00
Paul Berry 370c7b54f5 Further refactoring of summary tests
This CL makes the following changes:

- Makes `linkerInputs` private to the strategy classes (the only thing
  needed by tests is `testDartUri`).

- Changes the return type of addNamedSource to `void` (no caller was
  using the return value).

- Generalizes _FilesToLink so that it can be re-used for one-phase
  summary generation (where the inputs will be CompilationUnit objects
  rather than UnlinkedUnitBuilder objects).

- Moves _parseText to top level so that it can be more easily reused.

Change-Id: I333b278b9a157b5013199d0c21cc4c8d3423dbe7
Reviewed-on: https://dart-review.googlesource.com/73281
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-05 20:31:12 +00:00
Alexander Aprelev aec5abc95a [vm] Tweak path/uri so test passes on Windows.
This is follow-up to https://dart-review.googlesource.com/c/sdk/+/72540.

Change-Id: Ibcef2c8571dbf4ee9761a3c43686e395a65ae8e9
Reviewed-on: https://dart-review.googlesource.com/73282
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-09-05 20:30:32 +00:00
Konstantin Shcheglov 732a5e3ea8 Give import prefix type 'dynamic' when it is used as an expression.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34209
Change-Id: I6c393af70342037c496adebefaaf66c7a685852a
Reviewed-on: https://dart-review.googlesource.com/73240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-05 19:47:00 +00:00
Konstantin Shcheglov e7be010971 Safer FileSystemState.hasUri
SourceFactory.forUri2() can return null.

R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33859
Bug: https://github.com/dart-lang/sdk/issues/33233
Change-Id: I34908cd9d04050cc2afcdc716c6bb68d4f177702
Reviewed-on: https://dart-review.googlesource.com/73242
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-05 19:46:58 +00:00
Alexander Aprelev e07af58238 When compiled delta is rejected, reset incremental compiler back to last known good state(last accepted state).
This is needed so that compileExpression requests are serviced from that accepted state.

Bug: https://github.com/dart-lang/sdk/issues/34025
Change-Id: I592d2af50e59a721e1feb1699c6d56bcd568465f
Reviewed-on: https://dart-review.googlesource.com/72540
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-05 18:58:29 +00:00
Konstantin Shcheglov 239bd1383b Report MEMBER_WITH_CLASS_NAME for static getter/setter with the enclosing class name.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34289
Change-Id: I8b593b4a652547e54ed06c80e34e82c11a14d7e8
Reviewed-on: https://dart-review.googlesource.com/73241
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-05 18:11:00 +00:00
Konstantin Shcheglov b443c9f72f Parse static get/set with name of the enclosing class as getters/setters.
R=brianwilkerson@google.com, danrubel@google.com

Change-Id: I97015fbc3bc49c70a022a2edabf4fcdcc34405ad
Reviewed-on: https://dart-review.googlesource.com/73020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-05 15:43:48 +00:00
Konstantin Shcheglov 0898620787 Fix constant computing for negative shift left/right and remainder.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33481
Change-Id: I0cc1b07b222f1fe739df6c720d7357a2453ee1b9
Reviewed-on: https://dart-review.googlesource.com/73040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-05 15:41:58 +00:00
Martin Kustermann dcf1f0a145 Revert "Remove addCompileTimeError in favor of addProblem"
This reverts commit f872c17a85.

Reason for revert: After the CQ was green someone else made changes which this CL is not compatible with. The CQ lands if the tests passed
and doesn't rebase before doing so. 


Original change's description:
> Remove addCompileTimeError in favor of addProblem
> 
> Replace most methods with names containing CompileTimeError with corresponding
> Problem methods.
> 
> Also make Severity.error the default severity.
> 
> Change-Id: I85a340168848cd3b4375b3f53cb0361251ed6e5d
> Reviewed-on: https://dart-review.googlesource.com/73100
> Commit-Queue: Peter von der Ahé <ahe@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>

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

Change-Id: I3ea736a9752805adb3bacc8b67e8eb1435c1bf69
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/73181
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-09-05 14:13:48 +00:00
Jens Johansen 4cbe28035d Better context message on SyntheticForwarder in MissingImplementation
Previously we could get something like this:
```
regress_32660_test_06.dart:9:7: Context: 'foo' is defined here.
class I extends G implements H {
      ^^^
```

because a SyntheticForwarder was added with a file location of the
class.

It now instead goes to the forwarding stub target and says
```
regress_32660_test_06.dart:6:3: Context: 'foo' is defined here.
  foo(int x, {int y}) => y;
  ^^^
```

Change-Id: I6fb1b958f58635c9afffa8e58cd49eb69df28afd
Reviewed-on: https://dart-review.googlesource.com/72680
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-09-05 14:05:33 +00:00
Peter von der Ahé f872c17a85 Remove addCompileTimeError in favor of addProblem
Replace most methods with names containing CompileTimeError with corresponding
Problem methods.

Also make Severity.error the default severity.

Change-Id: I85a340168848cd3b4375b3f53cb0361251ed6e5d
Reviewed-on: https://dart-review.googlesource.com/73100
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-05 13:47:23 +00:00
Jens Johansen 49ca2fcaf9 Detect cycles in type variable bounds
Fixes #32989.

Change-Id: I809d67a4c0cbbb24446ace6fd56bb3b1a4c1364a
Reviewed-on: https://dart-review.googlesource.com/73120
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-05 13:16:46 +00:00
Jens Johansen 416ef3fc4e Setter with name of class is error
Fixes #34225.

Change-Id: I1efd39ad1739f49a60d724ca13d916623b9fff09
Reviewed-on: https://dart-review.googlesource.com/72841
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-09-05 13:00:20 +00:00
Peter von der Ahé 2667a3e123 Regression test for issue 34291
See https://github.com/dart-lang/sdk/issues/34291

Change-Id: I3a3d621efac939a8005707283c1d7105c7d4d8b4
Reviewed-on: https://dart-review.googlesource.com/73140
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-05 12:40:45 +00:00
Daniel Hillerström 3d4f28b23a Disallow default values in redirecting factory constructors.
Closes https://github.com/dart-lang/sdk/issues/34160

Change-Id: Idf6ee172b5fe81aa17920d12b68525a37a3c2231
Reviewed-on: https://dart-review.googlesource.com/72660
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-05 05:41:04 +00:00
Paul Berry 2b995b2654 Drop SummaryBuilder constructor's optional "strong" parameter.
Note that although this change is inside analyzer/lib/src, in practice
it is a breaking change to the analyzer API, since several clients
invoke the SummaryBuilder constructor.  Fortunately we can make
breaking changes now since we have not yet published version 0.33.* of
the analyzer.

To my knowledge, all clients that we care about keeping synchronized
to the bleeding edge version of the analyzer have been modified so
that they no longer pass in the optional parameter.  The remaining
clients shouldn't be affected since their pubspecs still point to
analyzer version 0.32.*.

Change-Id: I627bb7b1242e8e36ec82927ed8fe722b5b249fd6
Reviewed-on: https://dart-review.googlesource.com/73000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-04 21:57:56 +00:00
Konstantin Shcheglov eedc31e111 Fix for for-in when iterable does not have a type.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33370
Change-Id: I22ee3c5861ecaa3e6b2bc0f00e7f04191bcd7e78
Reviewed-on: https://dart-review.googlesource.com/72960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-04 21:19:39 +00:00
pq e6b3cdf16f Bump protobuf dep to ^0.9.0.
Change-Id: I7fd77cec83ba302ff8ac61b58bf3e47a6f58f672
Reviewed-on: https://dart-review.googlesource.com/72902
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2018-09-04 21:10:57 +00:00
Konstantin Shcheglov 48a1504b2f Stop reporting CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER and CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER.
These errors were removed from the spec.
See also https://github.com/dart-lang/sdk/issues/33235

R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34331
Change-Id: Ibc675aa48165300ddac32a8d6ddef4d84d41952a
Reviewed-on: https://dart-review.googlesource.com/72903
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-04 20:29:06 +00:00
Paul Berry e0b1576288 Avoid a "missing_return" warning in isValidImplementation.
The analyzer can't tell that `unhandled` is guaranteed not to return,
so it thinks that `isValidImplementation` might exit without returning
a value.  An easy workaround is to turn the call to `unhandled` into a
`throw`.

This is needed to roll kernel into the internal Google codebase, in
which the "missing_return" warning causes build failures.

Change-Id: Ia88b6cdef3693ab4646470616c7f868c5bad0502
Reviewed-on: https://dart-review.googlesource.com/72900
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-09-04 20:19:53 +00:00
Konstantin Shcheglov d65a0ee361 Report more errors for mixin declarations.
I added a fix for parsing static methods in mixins.

R=brianwilkerson@google.com, danrubel@google.com

Change-Id: Ib3c91f6cd5a2eb333f88102609f709fcac1ab9e7
Reviewed-on: https://dart-review.googlesource.com/72901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-04 19:41:25 +00:00
Paul Berry 4160d34ad7 Compare types between analyzer and front_end.
Change-Id: I8d0c0eba60a2c2a1fe5a3e4e0c72249941d252d6
Reviewed-on: https://dart-review.googlesource.com/72880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-04 18:28:41 +00:00
Konstantin Shcheglov a52b40041b Report MIXIN_DECLARES_CONSTRUCTOR and FINAL_NOT_INITIALIZED for mixins.
I renamed the previous error const to MIXIN_CLASS_DECLARES_CONSTRUCTOR.

R=brianwilkerson@google.com

Change-Id: If06f264e61b7d3e7c254eb457f4b2dc45ef76174
Reviewed-on: https://dart-review.googlesource.com/72860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-04 17:17:07 +00:00
Danny Tuppeny f53964c944 Unskip Windows analysis server integration tests
Bug: https://github.com/dart-lang/sdk/issues/32356
Change-Id: Iec178a071a030864d71fc0413f8a35f7c360b3f1
Reviewed-on: https://dart-review.googlesource.com/72641
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-09-04 17:16:57 +00:00
Kevin Millikin 9bdf2489b5 Signal errors and warnings for invalid returns
Implement the feature spec for checking returns against inferred
function return types:

https://github.com/dart-lang/sdk/blob/master/docs/language/informal/invalid_returns.md

with the change that an invalid return without a subexpression is
a warning, not an error.  This is because it is a warning in the
analyzer and it would be a breaking change to turn it into an
error.

The check for valid returns is moved to exactly where we handle
returns, rather than in ensureAssignable which is used as a
helper in a lot of places. A bug in type inference was fixed: we
would use `void` for the type of return without a subexpression
instead of `null`.  To accommodate that we would use a
non-standard subtyping relation for returns.  This could lead to
us inferring a return type of `void` in cases where we should
not.

Change-Id: Iee9ece9c722f47efa305f49490d3022d0bbb9f44
Reviewed-on: https://dart-review.googlesource.com/72403
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-09-04 16:50:51 +00:00
Devon Carew 9a1f783007 Normalize with the internal verison of this file.
Change-Id: I27d56a0f61bb68bfe9f0386dc7b140cdebba4522
Reviewed-on: https://dart-review.googlesource.com/72542
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-09-04 16:19:45 +00:00
Aske Simon Christensen 35eacd1afc Type arguments to a constructor is an error.
Fixes https://github.com/dart-lang/sdk/issues/34159

Change-Id: Ib4cca43f4181f2557560fa45ca41dd059c8b5b06
Reviewed-on: https://dart-review.googlesource.com/71521
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-09-04 12:06:14 +00:00
Peter von der Ahé e2574d9d6f Remove references to stale bug
Change-Id: I445048f5366a27f2e9e57ef148f511f2aa4bbd3f
Reviewed-on: https://dart-review.googlesource.com/63146
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-09-04 12:04:11 +00:00
Jens Johansen 40864cc698 Fasta: Signature change with and without noSuchMethod
The below code is not okay, even if we add a noSuchMethod to C.

```
class B {
  foo(int x) => x;
}

class C extends B {
  foo(int x, {int y});
}
```

Issue #32660.

Change-Id: I1ace4443c3732fdd5faefa50e0d2cb68023e97c4
Reviewed-on: https://dart-review.googlesource.com/72106
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-04 10:21:10 +00:00
Jens Johansen 015840d31f Fasta: Wrong number of type parameters is an error
E.g. `new Map<String>` is now reported as an error.

Note that this does not add a check for whether correct types are given,
so e.g.

```
class Foo<X extends num> {}
main() {
  new Foo<String>();
}
```

is not caught by this fix.

Fixes #32972, #32281.

Change-Id: I57513b5c13865a828890775c8e14f7433d00bdbe
Reviewed-on: https://dart-review.googlesource.com/72382
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-04 10:10:32 +00:00
Konstantin Shcheglov 7a7ab6410d Resolve using mixin(s) in 'with' clauses.
This also allows searching for mixin(s), which we test now.

R=brianwilkerson@google.com

Change-Id: I6c1944db0e6ecbc0f7352188968e53ef38603426
Reviewed-on: https://dart-review.googlesource.com/72554
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-04 01:02:13 +00:00
Vyacheslav Egorov d01d6f454c [vm] Fix a bug in the specialization of implicit setters
CallSpecializer::TryInlineInstanceSetter was using IsReceiver to determine
type check could be skipped. However it is incorrect to use IsReceiver,
because it uses SSA notion of the receiver - rather than a syntactic
notion and all strong mode guarantees apply at syntactic level.

Additionally this CL expands support for exactness tracking to PropertySet
operations and uses it to eliminate checks on setters.

Change-Id: Idce559c4ca4c88f5788d3b6b9955b5af076bd7eb
Reviewed-on: https://dart-review.googlesource.com/72442
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-09-03 13:43:41 +00:00
Peter von der Ahé 23dd0cccb2 Remove OutlineListener.
Revert "Store named types resolution during outline building."

This reverts commit 82947cccc9.

Revert "Store reference/type for invalid types."

This reverts commit 9fb6c09015.

Revert "Clear ShadowX references that are not required after compilation."

This reverts commit 6c39bc38f3.

Revert "Store constructor field initializera when the target is not a field."

This reverts commit 12326c10e1.

Revert "Don't rewrite error Severity for special cases of front-end testing."

This reverts commit 4bb3fb6cae.

Revert "Translate ConstructorElement(s) of parameterized InterfaceType(s) to ConstructorMember(s)."

This reverts commit 62a2752b96.

Revert "Store resolution for out of range integer literals."

This reverts commit 8df84c0a00.

Revert "Infer original expression in SyntheticExpressionJudgment."

This reverts commit cec29e4aa8.

Revert "Resolve invalid 'as' constant expression."

This reverts commit 77202bf2b0.

Revert "Resolve invalid return from constructor."

This reverts commit 737e546939.

Revert "Store import prefix offset into metadata and resynthesize."

This reverts commit c30af508a4.

Revert "Get documentation comments before metadata as well."

This reverts commit 29401573d5.

Revert "Put fileEndOffset into ArgumentsJudgment and use to report argument errors."

This reverts commit d69a354026.

Revert "Return SourceSpan with actual length from _CompilationMessage."

This reverts commit ac973e5ba7.

Revert "Store codeOffset / codeLength for classes."

This reverts commit 28583df3ee.

Revert "Store and resynthesize codeOffset/codeLength for functions and methods."

This reverts commit 5a2a13c8bf.

Revert "Fix analyzer/FE integration of invalid assignments to classes."

This reverts commit a814614cf4.

Revert "Fix analyzer/FE integration of assignments to non-l-values."

This reverts commit d10204f3a0.

Revert "Fix analyzer/FE integration of assignments to ambiguous types."

This reverts commit e87efdffb4.

Revert "Fix analyzer/FE integration of assignments to ambiguous types."

This reverts commit 1b5d273fd7.

Revert "Fix analyzer/FE integration of assignment with synthetic LHS."

This reverts commit 55aa031404.

Revert "Revert "Fix analyzer/FE integration of assignments to ambiguous types.""

This reverts commit 9f795883f1.

Revert "Store code range for constructors."

This reverts commit 675b296d49.

Revert "Store codeOffset/length code fields and top-level variables."

This reverts commit 9ef53bde19.

Revert "Re-land "Fix analyzer/FE integration of assignments to ambiguous types.""

This reverts commit 40d72aec8c.

Revert "Resolve metadata for part-of directives."

This reverts commit cf1cd3eba0.

Revert "Fix analyzer/FE integration of assignment with synthetic LHS, inside class method."

This reverts commit 43a8f1d0d6.

Revert "Fix analyzer/FE integration of prefix/postfix increment of non-l-values."

This reverts commit e2aceb692e.

Revert "Fix analyzer/FE integration of postfix-of-postfix and prefix-of-prefix increments."

This reverts commit ad6f89f13b.

Revert "Fix analyzer/FE integration of some obscure invalid assignment cases."

This reverts commit f074f3c120.

Revert "Resolve namespace combinators."

This reverts commit 7e39d07916.

Revert "Fix analyzer/CFE integration of some more obscure invalid assignment cases."

This reverts commit a94e43af7c.

Revert "Refactor duplicate code in ContextAwareGenerator."

This reverts commit 1f82d37124.

Revert "Resolve required arguments after named."

This reverts commit b255f0fab6.

Change-Id: I44616db9b8ef037a2580a1ab35050da7e72ff7d8
Reviewed-on: https://dart-review.googlesource.com/72642
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-03 11:45:33 +00:00
Daniel Hillerström a56203041f Checks whether the type of a switch expression is assignable to the
types of its case expressions.

Resolves the first part of
https://github.com/dart-lang/sdk/issues/34207. According to the
language team the second part may soon become irrelevant.

Change-Id: Ifce38f2a62c293156dafa94f16799d5a126c6b9c
Reviewed-on: https://dart-review.googlesource.com/71981
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-09-03 11:03:56 +00:00
danrubel 4cd69887e3 Fix parsing postfix expressions with type parameters
Fix https://github.com/dart-lang/sdk/issues/34315

Change-Id: Id6b1749070473ed5a04a3f024276f9985f82da6e
Reviewed-on: https://dart-review.googlesource.com/72560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-02 18:51:31 +00:00
danrubel 6c197f7bb1 Address comments
address comments in https://dart-review.googlesource.com/c/sdk/+/72123

Change-Id: I0752369d4e41e72dc772cd63cf62625e2e3988ba
Reviewed-on: https://dart-review.googlesource.com/72500
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-01 16:16:39 +00:00
Paul Berry 17a2b43cfe Compare names of class members, and refactor analyzer visitor.
The analyzer visitor now follows the suggestion of
https://dart-review.googlesource.com/c/sdk/+/72541/1/pkg/analyzer_fe_comparison/lib/src/analyzer.dart#51

Change-Id: I093f994b36d835ae6db0dc6a24ed3357dc53c8b7
Reviewed-on: https://dart-review.googlesource.com/72550
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-09-01 04:26:36 +00:00
Paul Berry 939497a0a3 Stop passing bogus "strong" parameter to SummaryBuilder.
This requires version 0.32.5 or later of the analyzer (which makes the
parameter optional).  In version 0.33.* of the analyzer, the parameter
will be removed.

Change-Id: I9a4eaf5a8ed445051864543d9da5e59a06cd635d
Reviewed-on: https://dart-review.googlesource.com/72552
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-01 03:54:16 +00:00
Jenny Messerly 1a6a334cd7 fix #34273, dartdevk should use the default bound for generic functions
When dynamically calling a generic function or method without passing
any explicit type arguments, the default bounds are used. The default
should be `dynamic` unless an explicit bound was provided for the type
parameter.

Change-Id: I82f7166303f936adbecedd0c633b518f2700def4
Reviewed-on: https://dart-review.googlesource.com/72081
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-09-01 01:48:21 +00:00
Alexander Markov 54dc63a5ec [vm/bytecode] Add eager bounds checks to partial instantiations in bytecode
This is the follow-up to
dbe868de02

Similarly to StreamingFlowGraphBuilder::BuildPartialTearoffInstantiation,
bytecode generator adds _boundsCheckForPartialInstantiation calls
to partial instantiations of tear-offs.

Fixes language_2/partial_instantiation_eager_bounds_check_test in bytecode mode.

Change-Id: I2daf1902aa3df99133b2a25f1413e1bac53b6c30
Reviewed-on: https://dart-review.googlesource.com/72549
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-31 22:55:48 +00:00
Alexander Markov a867e2cc59 [vm/bytecode] Avoid sorting named parameters in kernel AST when generating bytecode
When generating bytecode, kernel AST was modifed to sort optional named
parameters. This has unfortunate side-effect of breaking default
(non-interpreter) mode if it uses platform.dill with bytecode.

Bytecode generator is changed to avoid modifications to kernel AST.
Instead, sorted named parameters are kept on a side.

Fixes https://github.com/dart-lang/sdk/issues/34305

Change-Id: Iba473f09af0af515b2117e39d63363412433d538
Reviewed-on: https://dart-review.googlesource.com/72546
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-31 22:27:20 +00:00
Brian Wilkerson e9504d2857 Add outline support for the new mixin syntax
Change-Id: I75d020f613daf37812ccf805d75e35091a28c198
Reviewed-on: https://dart-review.googlesource.com/72524
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-08-31 21:53:15 +00:00
Konstantin Shcheglov 7cf078c05d Index and search for mixins.
R=brianwilkerson@google.com

Change-Id: I5399507dc5a9688ee5944f6554167a6b1e8692b6
Reviewed-on: https://dart-review.googlesource.com/72525
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-31 21:38:26 +00:00
Konstantin Shcheglov a4a80a0bf1 Start reporting errors for mixin super-class constraints and implements clauses.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I6e6e3edc16737b1d3f665982f7560b46d8b71f01
Reviewed-on: https://dart-review.googlesource.com/72522
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-31 20:25:35 +00:00
Konstantin Shcheglov 0fae13e6bf Support for mixins in search.getElementDeclarations.
R=brianwilkerson@google.com

Change-Id: I88e90159ae28a2585fdbaacca2c4caab15891b83
Reviewed-on: https://dart-review.googlesource.com/72523
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-31 20:19:18 +00:00
Paul Berry b91ea9b7c5 Compare names of typedefs, top level variables, and top level functions.
Change-Id: I5d5b5a4e7609c8f6bcb63ca32ce83e49c42140ca
Reviewed-on: https://dart-review.googlesource.com/72541
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-31 18:38:21 +00:00
Paul Berry 0f7abef23c Begin writing code to compare analyzer and front_end behaviors.
This will help us ensure that the analyzer and the front end interpret
programs in the same way, e.g. they should produce the same type
inference results.

This code is in its own package for now to avoid making the analyzer
package unnecessarily depend on the details of the kernel
representation (which would couple it even more tightly to kernel than
it's already coupled).  We can move it into the analyzer later if we
see fit.

Change-Id: I055e83c7b83b6cd9b1082b4424a2f4144b5abf0e
Reviewed-on: https://dart-review.googlesource.com/72480
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-08-31 17:54:59 +00:00
Brian Wilkerson 4461b7cbcc Add folding support for the new mixin syntax
Change-Id: I8f37a391cc47a2203730c81acd5f1776cb386e2e
Reviewed-on: https://dart-review.googlesource.com/72521
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-31 17:33:36 +00:00
Brian Wilkerson c22f0c6167 Add completion support for the new mixin syntax
Change-Id: I3a8744e03f32092c15f1e340e0ee6bef5245a859
Reviewed-on: https://dart-review.googlesource.com/72520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-31 16:59:18 +00:00
Konstantin Shcheglov e96652352d Resolve mixin declarations.
Errors for onClause are not correct yet, and not tested yet.

R=brianwilkerson@google.com

Change-Id: I9a1f2b4734661baac85a9d1b9311d21104c7c495
Reviewed-on: https://dart-review.googlesource.com/72360
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-31 16:11:21 +00:00
Paul Berry 05ab41c99b Refactor summary tests in preparation for adding a one-phase summary API.
I will soon be adding an API for generating summaries that generates
them in one phase, as opposed to the current two-phase approach of
building unlinked summaries and then linking them together.  This is
will be needed in order to support full type inference of summaries,
since full type inference requires examining the contents of
block-bodied closures, and it's not worth the effort of trying
serialize the contents of block-bodied closures into unlinked
summaries.

To prepare for this, the summary tests need to be generalized so that
during the transition period they will be able to be run with either
API.

This CL introduces several classes in a new `test_strategies.dart` file:

- Interfaces `SummaryBaseTestStrategy`, `SummaryBlackBoxTestStrategy`,
  and `SummaryLinkerTestStrategy`.  These interfaces define the
  methods that can be invoked by tests of the summary mechanism.

- Implementations of those interfaces:
  `SummaryBlackBoxTestStrategyPrelink`,
  `SummaryBlackBoxTestStrategyTwoPhase`, and
  `SummaryLinkerTestStrategyTwoPhase`.  These classes provide the
  ability to drive the summary mechanism in various ways.  When the
  one-phase API is added, more classes will be added to drive it.

- A few private classes occupying intermediate positions in the class
  hierarchy, as well as auxiliary data structures needed by the above
  classes.

The tests themselves have been moved into mixin classes so that they
can be applied to any of the implementations above.

Change-Id: Iac3585944297f78f184d35de544aa4c8d8abe99a
Reviewed-on: https://dart-review.googlesource.com/72320
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-31 13:25:08 +00:00
Peter von der Ahé 3c5fa9fd3f Test various uses of type variables
Change-Id: I579f4ba5dce3a4e1ff8be3afb6ab8b5814108496
Reviewed-on: https://dart-review.googlesource.com/72102
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-08-31 11:16:35 +00:00
Jens Johansen 33704fa75f Fasta: Instance field cannot be const
Fixes #32326.

Change-Id: Idef32a842a68c5c9ee58caff7b6e731204f033b6
Reviewed-on: https://dart-review.googlesource.com/72041
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-08-31 10:28:19 +00:00
Kevin Millikin 9803d5c786 Signal an error when invoking a non-function
When invoking an expression whose static type is not a function type,
signal an error.  However, allow invocations of expressions with
static type `dynamic` or `Function`.  Fixes #32975.

Change-Id: Ia54d8df650076ad5c9c9c3a2c6f79ea31acbbbfe
Reviewed-on: https://dart-review.googlesource.com/72082
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-08-31 02:30:46 +00:00
Konstantin Shcheglov 02b2deefd6 Remove StaticWarningCode.isStrongModeError flag.
It is not used internally outside Analyzer itself.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Iec2b45ebaeb49400e9f61a137a85170657856016
Reviewed-on: https://dart-review.googlesource.com/72300
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-08-31 01:19:24 +00:00
Dan Rubel fa759513ac Add mixin header recovery
Along with the new recovery, there are two new error codes
and their corresponding CFE counterparts:
* ParserErrorCode.IMPLEMENTS_BEFORE_ON
* ParserErrorCode.MULTIPLE_ON_CLAUSES
* ImplementsBeforeOn
* MultipleOnClauses

Change-Id: If9055c9ffa5d56495acf00889236a3a8f6d741ca
Reviewed-on: https://dart-review.googlesource.com/72123
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-31 00:25:16 +00:00
Alan Knight e3a063319d Check for an exception when asking if the Platform is windows
Change-Id: I4c247f5ae38e724d32e9db383817efa57047eea4
Reviewed-on: https://dart-review.googlesource.com/71901
Commit-Queue: Alan Knight <alanknight@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-08-30 22:17:45 +00:00
Brian Wilkerson ce117b0f92 Revert "Add support in analysis options file for new mixin declaration"
Change-Id: If051da5a77ce697525e11c33d33a1e88e7c42832
Reviewed-on: https://dart-review.googlesource.com/72280
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-30 22:11:04 +00:00
Paul Berry 584199eff4 Make the relink() method private.
It's not used by any code except the linker.

Change-Id: Ia2f145279261e42deb9f355898bb429eef0f5413
Reviewed-on: https://dart-review.googlesource.com/72243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-30 22:09:31 +00:00
Konstantin Shcheglov c9d1c4a3b7 Suite of source code based resolution tests.
As opposite to constructing AST nodes and calling partial resolvers.

Also the set of tests that we created for CFE integration is too large,
so I started splitting it into pieces and cleaning up to use findNode,
fincElement, and assertElement/Type().

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ide4f0bee9e89eb2daf2317d1d92303a992847f1b
Reviewed-on: https://dart-review.googlesource.com/72240
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-30 21:49:44 +00:00
Konstantin Shcheglov dbb1b2f4a6 Add 'Wrap with Container' quick assist.
R=brianwilkerson@google.com, devoncarew@google.com

Change-Id: I860a3a92024b349153266fd9e70b56beea426ee2
Bug: https://github.com/flutter/flutter-intellij/issues/2566
Reviewed-on: https://dart-review.googlesource.com/72260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-30 21:47:32 +00:00
Konstantin Shcheglov db8b6bc549 Don't report StaticWarningCode.CONFLICTING_DART_IMPORT.
The warning was removed from the language specification.

Plus some optimization for import scope and conflicts.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I78b6924f9095dce89324f4093e78c948611f8493
Reviewed-on: https://dart-review.googlesource.com/72064
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-30 20:56:41 +00:00
Brian Wilkerson 8c6259fbe8 Add support in analysis options file for new mixin declaration
Change-Id: I0e991ea2c52442ff8a30dc5190d2b37cf14adebf
Reviewed-on: https://dart-review.googlesource.com/72180
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-30 19:12:04 +00:00
Samir Jindel f8575698af Revert "[vm/precomp] Use @pragma("vm:exact-result-type") to specify method behavior."
This reverts commit ade6742ee9.

Reason for revert: Some service tests are broken.

Original change's description:
> [vm/precomp] Use @pragma("vm:exact-result-type") to specify method behavior.
> 
> Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
> Change-Id: I6eeafeea734efb2e876c5e03f12092b5229ad2bc
> Reviewed-on: https://dart-review.googlesource.com/70284
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=vegorov@google.com,alexmarkov@google.com,sjindel@google.com

Change-Id: If95f68704737b1da7553c68eb4e22a4c554d3a4b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/72200
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-08-30 19:02:45 +00:00
Dan Rubel 8c7e83aed2 Remove generic method comment support
Change-Id: I1149ff9c61748fe8d3a51c95e40c02ec5115b0e7
Reviewed-on: https://dart-review.googlesource.com/72122
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-30 17:52:40 +00:00
Dan Rubel a207d36fc2 Remove generic method comment from old parser
Change-Id: I48ae219a238661d042815370960647a0c8b17164
Reviewed-on: https://dart-review.googlesource.com/72121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-30 17:34:52 +00:00
Konstantin Shcheglov bd9645abad Convert FOR_IN_WITH_CONST_VARIABLE to using message.
Analyzer reports it, so it should not be fromFasta().

R=brianwilkerson@google.com

Change-Id: Id0db50e5f770bbae60d1955a05e632f548a104e3
Reviewed-on: https://dart-review.googlesource.com/72140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-30 16:50:40 +00:00
Konstantin Shcheglov 171747a8e5 Resynthesize mixin declarations.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Icb7a122cb39502625ecd253eb53cfb50a82e5da0
Reviewed-on: https://dart-review.googlesource.com/72070
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-30 16:14:09 +00:00
Dan Rubel ba0d814336 Remove obsolete parser tests
Change-Id: I74f0f65e0888a185644f9908e5a25e0c550113ec
Reviewed-on: https://dart-review.googlesource.com/72120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-30 15:37:44 +00:00
Samir Jindel ade6742ee9 [vm/precomp] Use @pragma("vm:exact-result-type") to specify method behavior.
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I6eeafeea734efb2e876c5e03f12092b5229ad2bc
Reviewed-on: https://dart-review.googlesource.com/70284
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-08-30 15:30:40 +00:00
Paul Berry e76d37f307 Remove strong mode booleans related to summary linking.
The analyzer always runs in strong mode now, so these booleans aren't
needed.

Change-Id: Ic16ca9f37f8befead5aee85140fb70395a1d3511
Reviewed-on: https://dart-review.googlesource.com/71622
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-30 13:54:42 +00:00
Daniel Hillerström 2f77de53e2 Revert "Enables arity check for overridden methods inherited from a mixin."
This reverts commit 03c7184cca.

Reason for revert: Flutter doesn't build with after this CL because the following (kind of) program

  abstract class RenderObject {
  String toString({int minLevel}) => "foo";
  }
  abstract class ContainerRenderObjectMixin extends RenderObject {}
  abstract class RenderBoxContainerDefaultsMixin implements 
  ContainerRenderObjectMixin {}

is wrongfully rejected. In patching this, I stumbled upon what seems to be bug in Fasta where some concrete classes arising from mixed in applications are marked as abstract, which causes the patch to produce false-positives. This needs some more investigation.

Original change's description:
> Enables arity check for overridden methods inherited from a mixin.
> 
> The return type and parameter types checks are still disabled for
> mixins as there is an issue with type parameters being uninstantiated
> in mixin applications which causes the two checks to produce
> false-positives. As a result the SDK fails to compile with the two
> checks enabled because the libraries (such as collections) makes
> extensive use of mixin application with generic types. I've opened a
> separate ticket to track this issue [c.f. https://github.com/dart-lang/sdk/issues/34285].
> 
> Furthermore this CL abstracts the arity check, return type check, and
> method parameter type check in checkMethodOverride to make it easier
> to understand the logic of the method.
> 
> Closes https://github.com/dart-lang/sdk/issues/34235 and closes https://github.com/dart-lang/sdk/issues/32014
> 
> Change-Id: Iae224926c2e99e6e89ccc3c19ec4bc7919ee48a5
> Reviewed-on: https://dart-review.googlesource.com/71781
> Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>

TBR=askesc@google.com,hillerstrom@google.com

Change-Id: Idee6f53c2d6a17ea8a4103872b1183c01e4d30ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/72108
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
2018-08-30 13:00:16 +00:00
Paul Berry d04d304909 Stop using/generating spec.sum file.
For some time now, this file has had the same contents as strong.sum.
There's no point in keeping it around.

Change-Id: I793a41ca6cb1c47c68357f549d299fa95b96c4c5
Reviewed-on: https://dart-review.googlesource.com/71701
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-30 12:32:52 +00:00
Peter von der Ahé f5f33776a4 Revert "Store code ranges for formal parameters."
This reverts commit 5b9a42de29.

Change-Id: If6b3edc7194fda050de3b6ffbb0c8124a75509a6
Reviewed-on: https://dart-review.googlesource.com/72100
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-08-30 10:20:18 +00:00
Daniel Hillerström 03c7184cca Enables arity check for overridden methods inherited from a mixin.
The return type and parameter types checks are still disabled for
mixins as there is an issue with type parameters being uninstantiated
in mixin applications which causes the two checks to produce
false-positives. As a result the SDK fails to compile with the two
checks enabled because the libraries (such as collections) makes
extensive use of mixin application with generic types. I've opened a
separate ticket to track this issue [c.f. https://github.com/dart-lang/sdk/issues/34285].

Furthermore this CL abstracts the arity check, return type check, and
method parameter type check in checkMethodOverride to make it easier
to understand the logic of the method.

Closes https://github.com/dart-lang/sdk/issues/34235 and closes https://github.com/dart-lang/sdk/issues/32014

Change-Id: Iae224926c2e99e6e89ccc3c19ec4bc7919ee48a5
Reviewed-on: https://dart-review.googlesource.com/71781
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-30 10:01:19 +00:00
Daniel Hillerström 05271c199c Remove dart2jsCode from messages.yaml.
Change-Id: I5329784c10bcd9696f873189ef59ec18c21f287c
Reviewed-on: https://dart-review.googlesource.com/72043
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2018-08-30 08:49:55 +00:00
Daniel Hillerström 73a35c9937 Checks whether a constant factory has a constant target.
Closes https://github.com/dart-lang/sdk/issues/34161

Change-Id: Ie5eb4d3307e0fd389bcd25b8c548b6dff64633ab
Reviewed-on: https://dart-review.googlesource.com/71300
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-30 08:37:02 +00:00
Peter von der Ahé fa14dbcdfc Format constants and remove dart2jsCode
Change-Id: Ia04066782292f0c49a56689056c69b0481f3aacb
Reviewed-on: https://dart-review.googlesource.com/72021
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-08-30 08:05:31 +00:00
Johnni Winther 263931bd33 Small cleanups to avoid warnings in IntelliJ
Change-Id: I02214d21a910def67184e49765af3020848389d9
Reviewed-on: https://dart-review.googlesource.com/71941
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-30 06:47:38 +00:00
Jens Johansen 4cd26421a8 Set loader.first manually if available in incremental compiler
This should make sure that everything that has to be initialized is in
fact initialized for doing expression compilation.

Change-Id: I89016b2e1b4f679c34c5450bcc56da28177728f2
Reviewed-on: https://dart-review.googlesource.com/71980
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-08-30 06:06:42 +00:00
Jenny Messerly fb67619728 fix #29914, DDC shouldn't create super accessor for an abstract one
When the superclass has a getter/setter pair, and the subclass only
overrides one of the pair, DDC will generate the other one to forward
to the superclass. However these should not be generated for abstract
accessors. This patch fixes the compiler so it skips abstract accessors.

Change-Id: I60fa83b57db2e42ab47b7f4f3c28ef2a56e324ec
Reviewed-on: https://dart-review.googlesource.com/72073
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-08-30 00:39:13 +00:00
Jenny Messerly 14d3249567 fix dartdevc to be robust if JS interop classes are not found
If a JS class is not found (because it's not loaded yet), dartdevc
should handle this gracefully. However the code assumed that the class
would not be nested in a module that itself has not been loaded. That's
fixed in this change.

Change-Id: I2de8f4b85e8063dea31ea257aca9721702c6ea7a
Reviewed-on: https://dart-review.googlesource.com/72065
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-08-30 00:38:08 +00:00
Paul Berry 9a243b35eb Remove summary-related code from pkg/front_end/tool/perf.dart.
This was needed back when we thought the front end would be based on
the analyzer, and so we thought its performance characteristics would
depend on those of the analyzer summary mechanism.  But since the
front end is not based on the analyzer, and the performance of the
analyzer summary mechanism is performance tested elsewhere, we can
remove this code.  Removing it will make it easier to do some re-work
of summaries that is needed for Dart 2.1 support.

Change-Id: I4aa8b5251f26ba7fd59b99d325c66da642d410ed
Reviewed-on: https://dart-review.googlesource.com/71661
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-30 00:09:55 +00:00
Kevin Millikin d8931dafa7 Use the Dart 2 platform in a pair of package tests
Change a pair of package tests that relied on the existence of the
VM's Dart 1 platform Kernel binary.  Use the Dart 2 platform instead,
becuase the VM will stop supporting Dart 1 in the future.

Change-Id: Ic93488974d9ed53cd205dcc24e0455a26b5f71b2
Reviewed-on: https://dart-review.googlesource.com/71246
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-08-29 22:11:58 +00:00
Konstantin Shcheglov d659022f08 Build elements for MixinDeclaration(s).
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ica9912b795bbdfeea2dd46130e30bde3bdc4cef3
Reviewed-on: https://dart-review.googlesource.com/72067
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-29 21:05:35 +00:00
Konstantin Shcheglov 9c642328ac Summarize mixin declarations.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I2aecbe4e3c5548a8034c51191f58eaf3439b9d76
Reviewed-on: https://dart-review.googlesource.com/71928
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-29 19:08:56 +00:00
Devon Carew ecfc82c05d Re-enable two tests.
Change-Id: I9e829ae84556b9b7caa6d5b12bfd710ccab3a443
Reviewed-on: https://dart-review.googlesource.com/71925
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-08-29 18:35:32 +00:00
Konstantin Shcheglov e81c1c57de Remove the workaround for a stale issue.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/25884
Change-Id: I87741664f00200170990e9a13d2f639c41671bda
Reviewed-on: https://dart-review.googlesource.com/71924
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-29 15:33:17 +00:00
Konstantin Shcheglov 1f52372bfa Remove CFE integration from analyzer, analysis_server, and analyzer_cli.
AnalysisDriverResolutionTest is partially updated, about 30 failing
tests added. I will get back to it in a following CL, it is not
directly CFE integration, but updated understanding how we want to
resolve. For example we don't need types for non-expression identifiers.

Change-Id: I3daddbb6c66ffad7a726f3313a1199fd7387aa04
Reviewed-on: https://dart-review.googlesource.com/71883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-29 13:46:45 +00:00
Daniel Hillerström b50c7c4d58 Eliminates some closure allocations in Fasta.
This CL is a result of discussing the Fasta implementation principles
with ahe. Following his advice this CL eliminates some unnecessary
closures that were meant act as plain aliases.

Thanks to ahe for kindly explaining Fasta implementation principles.

Change-Id: I0f0cb3dec211d686b193b3b1feafaa684606994b
Reviewed-on: https://dart-review.googlesource.com/71985
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
2018-08-29 12:49:29 +00:00
Aske Simon Christensen 94dabdaae7 Error when importing a part
Fixes https://github.com/dart-lang/sdk/issues/33650

Change-Id: I2fb5f4bf7c20309c2da9660911b7ce2088e7efea
Reviewed-on: https://dart-review.googlesource.com/71820
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-08-29 12:19:17 +00:00
Johnni Winther 185eec12a6 Avoid crash on falsely enqueued .call methods.
Change-Id: Ib58b02eecfc697f70e74cbb9f5e5816fb936a31b
Reviewed-on: https://dart-review.googlesource.com/71400
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-29 07:29:38 +00:00
Paul Berry 3ea3b21e3c Deprecate summary field PackageBundle.unlinkedUnitHashes.
No code has attempted to read these hashes from summaries for a long
time, so there is no point in writing them out.

Change-Id: I96854d4d5438fb6d5b4ab81b495407e2fc36d82f
Reviewed-on: https://dart-review.googlesource.com/71702
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-29 05:36:26 +00:00
Konstantin Shcheglov 1b8f3026bf Remove most of isStrongModeError: false, update language_2 tests.
https://github.com/dart-lang/sdk/issues/33022
https://github.com/dart-lang/sdk/issues/28823
https://github.com/dart-lang/sdk/issues/11124

Change-Id: I44427cdab25aae356ec89d677fa142d23d7b42c7
Reviewed-on: https://dart-review.googlesource.com/71428
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-08-29 02:06:45 +00:00
Alexander Markov c6d786a3e7 [vm/bytecode] Take environment defines into account when generating bytecode
Fixes corelib_2/from_environment_const_type_test in bytecode mode.

Change-Id: Ie712724a3ef807c446080ee4cc04d4287ac470e9
Reviewed-on: https://dart-review.googlesource.com/71889
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-29 00:21:55 +00:00
danrubel 68e66d4ef5 Parser test cleanup
Change-Id: I93c6a019267d3538e2874acdd06041a330b2cb09
Reviewed-on: https://dart-review.googlesource.com/71900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-28 23:00:16 +00:00
Alexander Markov 1b13583ba8 [vm/bytecode] Keep original declaration order of named parameters in native wrappers
Native methods access their parameters using indices and expect named
parameters to be in the declaration order.

Bytecode generator always sorts named parameters, which is not valid
in native wrappers.

In this CL, the original order of parameters is saved and used
when pushing arguments in native wrappers.

Change-Id: I3fb60c21a484ccae7478b9e59ca16f8b0cde8fd5
Reviewed-on: https://dart-review.googlesource.com/71884
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-28 21:59:36 +00:00
Janice Collins f40ff153a9 Enable --use-fasta-parser with the analyzer by default.
Based on Devon's change at:

https://dart-review.googlesource.com/c/sdk/+/67090

Change-Id: I80b7943826e248bf37d9bbbb769330d24b0dd6ae
Reviewed-on: https://dart-review.googlesource.com/70160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2018-08-28 19:29:17 +00:00
Alexander Aprelev 9e365c811e [vm/frontend] Sort out incremental component before writing it out.
This is what https://github.com/dart-lang/sdk/blob/master/pkg/front_end/test/incremental_load_from_dill_test.dart#L384 `util.postProcess` is doing.

Bug: dartbug.com/34280
Change-Id: I4c7924e29847ef558fe54c48401ee2afc00e8a7a
Reviewed-on: https://dart-review.googlesource.com/71700
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-08-28 17:30:07 +00:00
Danny Tuppeny 19f6c826a4 Ensure we don't walk over closures when looking for argument lists
Bug: https://github.com/dart-lang/sdk/issues/34241
Change-Id: I21e9e8e1389e989aa3ad5ee98f63c497548ffd6b
Reviewed-on: https://dart-review.googlesource.com/71481
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-28 11:40:33 +00:00
Daniel Hillerström 35334b5227 Adds an abstract getter 'isConst' to the abstract class Member.
This CL introduces a new abstract getter 'isConst' for Member class in
the AST. This change ought to be non-breaking since every subclass of
Member implements a boolean getter 'isConst'.

The primary motivation for introducing this change is that it enables
us to simplify some of the code base by eliminating some tedious
branching and/or casts to dynamic when we need to determine whether a
member is constant, e.g.

      bool isConst = false;
      if (member is Procedure) isConst = member.isConst;
      else if (member is Constructor) isConst = member.isConst;
      else if ...

becomes

     bool isConst = member.isConst;

and

      if ( (member as dynamic).isConst ) { ... }

becomes

      if (member.isConst) { ... }

Change-Id: Ifcc3229c7a19dd8f261266f58df5eef562167885
Reviewed-on: https://dart-review.googlesource.com/71403
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-28 10:04:07 +00:00
Konstantin Shcheglov 83324a8db9 Fix for NPE when prefix completion after an expression without type.
R=brianwilkerson@google.com

Change-Id: I3ef1c1e1f981e3a5c9ed6da066a1d204c6b3816d
Reviewed-on: https://dart-review.googlesource.com/71620
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-27 22:14:01 +00:00
Konstantin Shcheglov d332cae86e Refactor PostfixCompletionTest to make invalid tests positive.
A clean up before https://dart-review.googlesource.com/c/sdk/+/71620

R=brianwilkerson@google.com

Change-Id: I475d1eab3bb5a54a2035a7b8940c101f662e53a0
Reviewed-on: https://dart-review.googlesource.com/71660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-27 21:06:23 +00:00
Alexander Markov 52d33f0d5d [vm/kernel/bytecode] Support partially instantiated closures in bytecode
Generic closures should take delayed type arguments into account when
initializing type arguments in prologue.

Fixes language_2/instantiate_tearoff_test in bytecode mode.

Change-Id: I0ab07e759f3372ae9143a48f0b8b0fe4fab8a51a
Reviewed-on: https://dart-review.googlesource.com/71432
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-08-27 18:13:56 +00:00
Alexander Markov 1b89c785e1 [vm/kernel/bytecode] Duplicate receiver variable if it is captured
If receiver is captured, the variable is duplicated so top-level
members can access receiver as a local variable.

This is more efficient and allows uses of receiver in the prologue of
top-level member, before context is allocated and receiver is copied to
the context.

Change-Id: I5b13f692767c3aa445e558bff2bc3f8fbf016561
Reviewed-on: https://dart-review.googlesource.com/71431
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-27 17:41:58 +00:00
Konstantin Shcheglov 8b3a0a8476 Issue 2558. Fixes for 'convert to async function body'.
R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/2558
Change-Id: I6e1931a226732b922c2c1695f378d3b59ae09c09
Reviewed-on: https://dart-review.googlesource.com/71560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-27 16:31:14 +00:00
Daniel Hillerström 8a99ab0c74 Fixes an illegal override in KernelUnresolvedNameGenerator.
The signature of the overridden method buildCompoundAssignment in
KernelUnresolvedNameGenerator (c.f. kernel_expression_generator.dart)
was illegal, because its (named parameter) arity was four, whilst the
same method in one of its supertypes has arity five.

Furthermore, there was a signature conflict for
buildCompoundAssignment amongst the supertypes of
KernelUnresolvedNameGenerator:

   KernelUnresolvedNameGenerator
   extends KernelGenerator
           |
           = Generator with KernelExpressionGenerator
                            |
                            arity(buildCompoundAssignment) = 5
   with    ErroneousExpressionGenerator, UnresolvedNameGenerator.
           |
           arity(buildCompoundAssignment) = 4

In this CL the conflict is resolved by the "greatest common
denominator" approach, that is, now each implementation of
buildCompoundAssignment has arity five.

This CL is a necessary step towards fixing
https://github.com/dart-lang/sdk/issues/34235

Related change: c95ef874aa

Change-Id: If1992b8fb2bb994f83557c48fb0ac276b2d1a8d3
Reviewed-on: https://dart-review.googlesource.com/71520
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
2018-08-27 13:32:30 +00:00
Daniel Hillerström 8b92fe3bbd Checks whether a class extends or implements FutureOr.
According to the specification (§10.9) it is a compile-time error to
extend, implement, or use FutureOr as a mixin.

Expands the "multiple implements" check to include a test for whether
a class attempts to extend or implement the 'FutureOr' class.

The mixin case is indirectly caught by another syntactic check for
mixed in types (c.f. checkSemantics method in source_loader.dart). It
verifies whether a mixin has zero constructors. Since FutureOr has a
constructor the check fails. This is technically enough to meet the
specification, but it leads to a confusing error message for this
particular case. To improve the quality of the error message, we may
want to merge some of the mixed in check into checkSupertypes in
kernel_class_builder.dart.

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

Change-Id: I887ea9431fd50059399937f4236523ed917e3673
Reviewed-on: https://dart-review.googlesource.com/71141
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-27 08:31:15 +00:00
Konstantin Shcheglov 07fb992964 Report CompileTimeErrorCode.FOR_IN_WITH_CONST_VARIABLE
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/25161
Change-Id: I27ebc09fd9fcd6d6d992268f158e80477c41d042
Reviewed-on: https://dart-review.googlesource.com/71424
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-26 20:09:46 +00:00
Konstantin Shcheglov 04e2ada09b Report StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS for dynamic and type parmaeters.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/28813
Change-Id: Iae43c0bb913bfd06fa09ddeacd6fdb8f81eccf9a
Reviewed-on: https://dart-review.googlesource.com/71423
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-26 03:42:31 +00:00
danrubel 5e4e6037a9 Remove old scanner
Change-Id: If3abd39898487f4e790bbd2a4fcf5f2c8704c46d
Reviewed-on: https://dart-review.googlesource.com/70360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-24 23:19:12 +00:00
Stephen Adams ecfc03c3d1 dart2js: fix crash on setter with FutureOr type.
TBR=johnniwinther@google.com

Change-Id: Idc82430ccbee697201401ed7ebcb11c34cb3d8ce
Reviewed-on: https://dart-review.googlesource.com/71429
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-08-24 22:42:21 +00:00
Paul Berry 5424289f95 Analyzer test cleanup: remove unnecessary getter includeInformative
This getter appears to have been introduced in anticipation of
refactoring the summary mechanism to avoid populating summaries with
unnecessary "informative" data (see
da6a26966e), but such a refactoring
never occurred.

Change-Id: I6c486b21864b22a943af546a76bd63f7d55c42a3
Reviewed-on: https://dart-review.googlesource.com/71427
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-24 22:05:21 +00:00
Dan Rubel aa6945d5e9 First cut basic mixin declaration parsing support
... with parser recovery added in subsequent CLs.

Change-Id: I7a73e8e2a4dee961920fe9854bcd108bb1041b20
Reviewed-on: https://dart-review.googlesource.com/70882
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-24 21:58:55 +00:00
Paul Berry e91d30e904 Analyzer test cleanup: remove unnecessary getter skipNonConstInitializers
The getter used to be used to skip certain tests when testing the code
that computed summaries from the element model.  That code was removed
nearly two years ago (d13a887292).

Change-Id: I03fe6a28d9064374e25e4968fb1d2780f75e6826
Reviewed-on: https://dart-review.googlesource.com/71440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-24 21:57:14 +00:00
Alexander Markov 3e3459b0ab [vm/kernel/bytecode] Use default type args (bounds) in generic functions
This CL adds checking of number of passed function type arguments into
prologue of generic functions in bytecode. If type arguments are not
passed, then default type arguments (instantiated bounds) are used.

This mimics IL generated in StreamingFlowGraphBuilder::BuildDefaultTypeHandling.

In order to implement this check, a new bytecode instruction
JumpIfNotZeroTypeArgs is added to bytecode generator and interpreter.

Fixes language_2/function_apply_generic2_test in bytecode mode.

Change-Id: I70901c16b8bfc5f86623d51fccaf50f8969c587e
Reviewed-on: https://dart-review.googlesource.com/71387
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-24 15:55:05 +00:00
Kevin Millikin 6e63df3bfb Revert "Avoid the deprecated input error in source_loader"
Reverted because of failures on the VM reload tests.

Change-Id: I880523a5f3e14cc6d318d4493f037b79515b1dce
Reviewed-on: https://dart-review.googlesource.com/71401
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-08-24 11:03:28 +00:00
Kevin Millikin 0eb0f700b8 Avoid the deprecated input error in source_loader
Avoid using deprecated errors by hadling them on a case-by-case basis.
This is a version of https://dart-review.googlesource.com/c/sdk/+/63144
with merge conflicts resolved.

Fixes #33686

Change-Id: I726740af2db5d32f15c8103c903376bc8ea948e6
Reviewed-on: https://dart-review.googlesource.com/71161
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-08-24 09:14:15 +00:00
Konstantin Shcheglov b255f0fab6 Resolve required arguments after named.
Change-Id: I2947be1fc20b1455e7865c34e35349977d61f70b
Reviewed-on: https://dart-review.googlesource.com/71382
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-23 22:04:12 +00:00
Sam Rawlins ff3908d6df Implement INVALID_SEALED_ANNOTATION analyzer Hint
This follows the pattern of other meta-annotations, when it comes to the AST:

* Element gains a new `hasSealed` getter. Many overrides.
* ElementAnnotation gains a new `isSealed` getter.

Bug: https://github.com/dart-lang/sdk/issues/34232
Change-Id: If8ae8e16b500125cb3b92b3cf83d46de6ca6ee23
Reviewed-on: https://dart-review.googlesource.com/71227
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-23 22:03:22 +00:00
Konstantin Shcheglov 955ca3ef87 Use SUPER_AS_EXPRESSION for SuperAsIdentifier.
Change-Id: I7bcbcc51739f01532f4723cf39c25a620f77f8b0
Reviewed-on: https://dart-review.googlesource.com/71364
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-08-23 21:48:27 +00:00
Brian Wilkerson 7b87c7abeb Fix escape processing in interpolated strings
Change-Id: If4ed614f75a9eb1a0f42cb602fd1236cada31dd3
Reviewed-on: https://dart-review.googlesource.com/71362
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-23 19:25:56 +00:00
Paul Berry 1f82d37124 Refactor duplicate code in ContextAwareGenerator.
Change-Id: I9c63827e41e1a1c043432e5385d381b0e668469d
Reviewed-on: https://dart-review.googlesource.com/71361
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-23 19:21:43 +00:00
Paul Berry 630929edf2 Test analyzer/FE integration of some more obscure invalid assignment cases.
This CL tests proper handling of the following erroneous assignments:
- Compound assignment to prefix increment (e.g. "++x += y;")
- Null aware assignment to prefix increment (e.g. "++x ??= y;")

Change-Id: I090ba2dacd754372674276b9fea3945588f3a731
Reviewed-on: https://dart-review.googlesource.com/71360
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-23 19:11:15 +00:00
Konstantin Shcheglov 19a17e66fd Fix constant evalutation for == and != when left or right is null.
Change-Id: Iefa0890b57a9ba01675ce80c81fd3a73511f8c82
Reviewed-on: https://dart-review.googlesource.com/71340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-23 18:18:51 +00:00
Samir Jindel 2beb05b829 [vm] Re-land use of multiple entrypoints for closure calls.
Original patchset is in revision 1.

Change-Id: I29ab0dbc3711f99895fd4f04a49d4185463a1602
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/71241
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-23 17:54:19 +00:00
Paul Berry a94e43af7c Fix analyzer/CFE integration of some more obscure invalid assignment cases.
This CL fixes handling of the following erroneous assignments:
- Compound assignment to postfix increment (e.g. "x++ += y;")
- Null-aware assignment to postfix increment (e.g. "x++ ??= y;")

There is some code duplication in ContextAwareGenerator now; I will
clean that up in a follow-up CL.

Change-Id: If68bc267b67904562bf8c2e705123d04fdf0b69a
Reviewed-on: https://dart-review.googlesource.com/71321
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-23 17:31:48 +00:00
Brian Wilkerson 4212a46dab Add failing tests for handling of comment refs by fasta parser
Change-Id: I02bfbf2354ccf49bf6c3ea4968bb916f06b34c07
Reviewed-on: https://dart-review.googlesource.com/71320
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-23 17:11:47 +00:00
Konstantin Shcheglov 7e39d07916 Resolve namespace combinators.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/33636
Change-Id: I4f16eec2dcb5805663c0118d221f8ad8710cf3f8
Reviewed-on: https://dart-review.googlesource.com/71220
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-23 16:08:45 +00:00
Kevin Millikin 90a4600c12 Update lower and upper bounds used in type inference
During type inference, use the standard upper bound function SUB and
the standard lower bound function SLB defined in

https://github.com/dart-lang/sdk/blob/master/docs/language/informal/extreme-upper-lower-bounds.md

Change-Id: Ia767ae1e27ec3fac435cfe3f84b59d4bbc1589f7
Reviewed-on: https://dart-review.googlesource.com/70281
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-08-23 14:51:45 +00:00
Brian Wilkerson 3a6663f2d4 Update comparison utility to fix a bug and make it easier to subclass
Change-Id: I34447bb530215938da929320904c26fd7ef39771
Reviewed-on: https://dart-review.googlesource.com/71226
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-23 14:43:31 +00:00
Daniel Hillerström 23e379d0aa Checks whether an interface is implemented multiple times.
It is a compile-time error if an interface appears multiple times
across the extends and implements clauses.

This CL implements a check to detect the aforementioned case. A
previous commit implemented this by expanding and refactoring the
restricted super types check in source_loader.dart
(c.f. checkSemantics method). The restricted super types check decides
whether a type is allowed to appear in an 'extends', 'implements', or
'with' clause. However, it turned out it may have sat too early in the
compilation pipeline as it failed to detect the following case

   class A implements Object {}

I decided that it was somewhat suboptimal to implement a special case
for "Object". Therefore I have moved the check to a later stage in the
pipeline, where classes without a super class have had the Object
class injected as their default super class. The check is now
implemented in kernel_class_builder.dart (c.f. checkSupertypes
method).

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

Change-Id: Ie7153c896337b589118cac4b80e9df8ea5a09daa
Reviewed-on: https://dart-review.googlesource.com/70864
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-23 14:36:40 +00:00
Brian Wilkerson b8ee603eb2 Deprecate the EMPTY_LIST constants in analyzer
Change-Id: I4c85c8c21207c86003cdb47d499ae9a934606889
Reviewed-on: https://dart-review.googlesource.com/71234
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-23 14:32:20 +00:00
Paul Berry f074f3c120 Fix analyzer/FE integration of some obscure invalid assignment cases.
This CL fixes handling of the following erroneous assignments:
- Assignment to postfix increment (e.g. "x++ = y;")
- Assignment to prefix increment (e.g. "++x = y;")
- Prefix increment of postfix increment (e.g. "++x++;")

Change-Id: I651c7cbcc4b3d43f7008f9d583e2057db9bc6e6e
Reviewed-on: https://dart-review.googlesource.com/71260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-23 13:48:43 +00:00
Paul Berry ad6f89f13b Fix analyzer/FE integration of postfix-of-postfix and prefix-of-prefix increments.
These cases don't appear to be exercised by language_2 tests, so no
language_2 tests are fixed by this CL.  I've added test cases to the
analyzer's driver_resolution_test to validate the fix.

Change-Id: I4a364e78f95981e94b51cf94d6f3236b022d42b8
Reviewed-on: https://dart-review.googlesource.com/71229
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-23 12:49:11 +00:00
Paul Berry c95ef874aa Work around #34235 in front_end.
Change-Id: I7e5d2e63bfd018d21ff9587f178440da39a5078d
Reviewed-on: https://dart-review.googlesource.com/71232
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-23 12:47:33 +00:00
Daniel Hillerström 6c812c27be Signal a compile-time error if a const constructor redirects to a
non-const constructor.

This CL also slightly improves the quality of the error message for
when a const constructor redirects to a non-const super constructor.

Note the two redirection checks are implemented in separate parts of
the code base. The former is implemented in finishConstructors in
kernel_target.dart, whilst the latter is implemented in
buildSuperInitializer in body_builder.dart. It might make sense to
localise them.

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

Change-Id: Id9db06aaba9b5a330e22ea328d0ae60f104dfdcf
Reviewed-on: https://dart-review.googlesource.com/71165
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
2018-08-23 12:19:07 +00:00
Kevin Millikin 19e2bb165f Specialize handling of returns and yields
Previously we used the same code to handle returns and yields.  The
code can be inlined and specialized.  This is a change in preparation
for detecting invalid returns in ClosureContext.handleReturn instead
of in TypeInferrer.ensureAssignable.

Change-Id: Ia6adc43ac1b95bb684e5df3757bcfd253434396a
Reviewed-on: https://dart-review.googlesource.com/71248
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-08-23 12:03:39 +00:00
Kevin Millikin 229a7a8eeb Simplify ClosureContext
There are some invariants about this class and some improvements we
can make:

  * needImplicitDowcasts is always true

  * returnContext is never null so neither is declaredReturnType or
    expectedType

  * ensureAssignable calls greatestClosure on the expected type so we
    don't have to

  * we don't need to unwrap the type of the subexpression unless we
    are inferring a return type based on it

Change-Id: I4eaf41f17dd9d5ad44143a04ef02fe11824b2aa7
Reviewed-on: https://dart-review.googlesource.com/71164
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-08-23 09:11:33 +00:00
Sam Rawlins dfce7e26a4 Use uppercase example class names in meta
Change-Id: I21f4ff480648cd0e2e3f732fd56ec6e3564d93fc
Reviewed-on: https://dart-review.googlesource.com/71230
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2018-08-23 00:33:55 +00:00
Brian Wilkerson de3570d8bd Add support for the new mixin feature to the element model
Change-Id: I99344c387c4138438d3d7390bfce15b12e0073ab
Reviewed-on: https://dart-review.googlesource.com/71221
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-08-23 00:19:06 +00:00
Alexander Markov 0554eeb4bb [vm/bytecode] Check number of arguments in closures without optional arguments
This CL adds EntryFixed bytecode instruction in bytecode generator and
interpreter. The new instruction is used instead of Entry in prologues of
closures with fixed arguments in order to check number of arguments.

Fixes language_2/closure_call_wrong_argument_count_test in bytecode mode.

Change-Id: I873166a73c5f33e7faca8739cd6f210370e81b2e
Reviewed-on: https://dart-review.googlesource.com/71231
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-22 23:20:26 +00:00
Stephen Adams e1df47b15e Add closure signature to dependencies
Adds these missing dependencies to the deferred loading partition:

1. Signature of a local function / closure.
2. Bounds of type variables.

TBR=johnniwinther@google.com

Change-Id: I201d08cf874381e58e161d2f910b60d83932968c
Reviewed-on: https://dart-review.googlesource.com/71120
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-08-22 22:04:54 +00:00
Paul Berry e2aceb692e Fix analyzer/FE integration of prefix/postfix increment of non-l-values.
Fixes 2 language tests with [ $compiler == dart2analyzer && $fasta ].

Change-Id: I74f98f328c203fb68d8ebf819230dbe9405cfc7d
Reviewed-on: https://dart-review.googlesource.com/71225
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-22 21:57:21 +00:00
Alexander Aprelev 8908d68d0d [gardening] Mark pkg/plugin_manager_test as flaky.
Bug: https://github.com/dart-lang/sdk/issues/34231

Change-Id: Iee983cebb48b0dfab97282a6f11f07cb2a18617a
Reviewed-on: https://dart-review.googlesource.com/71224
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-08-22 21:41:49 +00:00
Paul Berry 43a8f1d0d6 Fix analyzer/FE integration of assignment with synthetic LHS, inside class method.
Error recovery generates a slightly different kernel representation
for "= x" inside a class method vs. outside a class method.  Inside a
class method, the synthetic LHS is a property access; outside a class
method it is a variable access.  The "outside a class method" case was
addressed in 55aa031404f36d181daf5f5b27424da431ee2e3e; this CL
addresses the "inside a class method" case.

Fixes 1 language test with [ $compiler == dart2analyzer && $fasta ].

Change-Id: Ib9429cac13b775a7d0b40a13468117c442611531
Reviewed-on: https://dart-review.googlesource.com/71223
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-22 20:31:24 +00:00
Devon Carew 8f31a2d96a Mark the test_postfix_completion test as slow.
Change-Id: I38db4fd08cdec35abf159cc2c9807aede266f1b1
Reviewed-on: https://dart-review.googlesource.com/71187
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Steve Messick <messick@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-08-22 19:25:59 +00:00
Alexander Markov cbe9ee5082 [vm/kernel/bytecode] Fix instantiation of function types with parameterized result type
Fixes language_2/type_variable_function_type_test in bytecode mode.

Change-Id: I307083b4469a2eb8cac3c41ccc908f6f3199573a
Reviewed-on: https://dart-review.googlesource.com/71200
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-22 19:12:38 +00:00
Brian Wilkerson aded927ff4 Fix cast exception in ArgListContributor (issue 34227)
Change-Id: Ib6db1fcab1b03059261fc35432794efd92524298
Reviewed-on: https://dart-review.googlesource.com/71188
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-22 19:04:35 +00:00
Konstantin Shcheglov cf1cd3eba0 Resolve metadata for part-of directives.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/33795
Change-Id: Ie2eac3694d2eacbb6619abb47cf9630555a21939
Reviewed-on: https://dart-review.googlesource.com/71186
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-22 19:00:13 +00:00
danrubel cd970b0927 Parser refactoring in preparation for mixin declaration support
This is a bunch of renames and cleanup in preparation for
my next CL with basic mixin declaration support.

Rename listener events:
* handleClassImplements to handleClassOrMixinImplements
* beginClassBody to beginClassOrMixinBody
* endClassBody to endClassOrMixinBody

Rename parser methods:
* parseClassMember to parseClassOrMixinMember
* parseClassBody to parseClassOrMixinBody
* skipClassBody to skipClassOrMixinBody

Also:
* Change test expect from "ClassBody" to "ClassOrMixinBody"
* Rename message ExpectedClassBody to ExpectedClassOrMixinBody
* Update text of MISSING_CLASS_BODY to include mixin
* Rename IdentifierContext.classOrNamedMixinDeclaration to classOrMixinDeclaration
Change-Id: Iaa554cc859e1e665475c0eb544895a311c06395a
Reviewed-on: https://dart-review.googlesource.com/70881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-22 17:57:09 +00:00
Konstantin Shcheglov 5b9a42de29 Store code ranges for formal parameters.
Change-Id: I022e5140869c7007c28109a4dfda3914b34c4725
Reviewed-on: https://dart-review.googlesource.com/71184
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-22 17:40:58 +00:00
Jacob MacDonald 00d9330987 use Uri.base.path not Uri.base.toFilePath
Change-Id: Ib9ace455b22f30e168ae5b37d70a6f5b45d00e0d
Reviewed-on: https://dart-review.googlesource.com/71183
Reviewed-by: Alexander Thomas <athom@google.com>
2018-08-22 16:59:09 +00:00
Devon Carew b63b73d46d Cosmetic tweaks to how we train the analysis server.
Change-Id: I78785450820c3773cb17ce69561806c82d68ddf4
Reviewed-on: https://dart-review.googlesource.com/71182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-22 16:57:37 +00:00
Alexander Markov 5a695abdfa [vm/kernel/bytecode] Do not copy captured top-level parameters in closures
Receiver and factory type arguments are implicit parameters which are
copied from original stack locations to a context if captured (along
with explicit parameters).

However, they were copied not only in top-level members, but also in
closures. So sometimes context was corrupted with unrelated values
taken from the stack (as closures do not receive these parameters
on the stack).

This CL removes incorrect copying of implicit parameters in closures.

Change-Id: I8d7d3992595f761f4ab7a1c8d16e0fc823fae22a
Reviewed-on: https://dart-review.googlesource.com/71101
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-22 15:50:56 +00:00
Sam Rawlins 76ae676a23 Fix meta CHANGELOG and doc comment after feedback
Bug: https://github.com/dart-lang/sdk/issues/27372
Change-Id: If532ad81e833589642b696b5ef0c291ccaac1e3e
Reviewed-on: https://dart-review.googlesource.com/71121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2018-08-22 15:22:58 +00:00
Aske Simon Christensen a4b3009ca5 Require super initializer to be at the end of the initializer list.
Drops code to handle special evaluation order rules for super
initializer before the end.

Initializer check code now also recovers from initializer errors.

Fixes https://github.com/dart-lang/sdk/issues/33101

Change-Id: I1024853bfd3acfef42630bdc2fc47782746b07c0
Reviewed-on: https://dart-review.googlesource.com/68060
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-08-22 10:43:08 +00:00
Johnni Winther 75943282e5 Delete Flags.strongMode and references to it
Change-Id: Ia1af10f04224f172afb7dac1e88338d20467364b
Reviewed-on: https://dart-review.googlesource.com/70646
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-22 07:03:24 +00:00
Johnni Winther d456532124 Disallow non-js interop external members
Change-Id: Ic73a3e2b16bdf77a2cd94fdcfaffe7989a798909
Reviewed-on: https://dart-review.googlesource.com/70513
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-22 06:59:46 +00:00
Daniel Hillerström 5780deb18a Signal a compile-time error when a type variable name conflicts with a setter name.
Specification disallow name conflicts between
  - type variables and class names
  - type variables and getter names
  - type variables and member names

Although not present in current specification, the language team confirms that
it is also supposed to be a compile-time error if there is conflict with a setter.

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

Bug:
Change-Id: Ia25bc91c3287f93ae43faae121a1f9d81b179c6b
Reviewed-on: https://dart-review.googlesource.com/70500
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-22 06:55:22 +00:00
Sam Rawlins 537a6f1411 Introduce @sealed annotation
This annotation will act as an easy way for users to experiment with a language
feature under consideration, called "sealed classes."

Bug: https://github.com/dart-lang/sdk/issues/27372
Change-Id: Ieb8bc70edaf8c11c41f0f47c01951e8311736c1f
Reviewed-on: https://dart-review.googlesource.com/69601
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-08-22 04:03:22 +00:00
Paul Berry 40d72aec8c Re-land "Fix analyzer/FE integration of assignments to ambiguous types."
This reverts commit 9f795883f1.

Change-Id: I485d0722fe8651212660dc961ae9271045ee0c54
Reviewed-on: https://dart-review.googlesource.com/71100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-22 03:13:21 +00:00
Konstantin Shcheglov 9ef53bde19 Store codeOffset/length code fields and top-level variables.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I4590a38245039a4c60144feab039cf8d0db00677
Reviewed-on: https://dart-review.googlesource.com/71040
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-22 01:53:36 +00:00
Konstantin Shcheglov 675b296d49 Store code range for constructors.
Change-Id: I3de1349158e5b6c372c6be246ffdcc599a1baeb9
Reviewed-on: https://dart-review.googlesource.com/71042
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-22 00:09:58 +00:00
Paul Berry 9f795883f1 Revert "Fix analyzer/FE integration of assignments to ambiguous types."
This reverts commit 1b5d273fd7.

Reason for revert: Windows bot breakage

Original change's description:
> Fix analyzer/FE integration of assignments to ambiguous types.
> 
> Fixes 2 language_2 tests with [ $compiler == dart2analyzer && $fasta ].
> 
> Change-Id: I600c7f075d0beb31863a4d17a6764afa2c7187be
> Reviewed-on: https://dart-review.googlesource.com/70982
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>

TBR=paulberry@google.com,scheglov@google.com,brianwilkerson@google.com

Change-Id: Iaefb47e983266d2c81b8beb3c8a5b85eac345be8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/71080
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-21 23:52:28 +00:00
Paul Berry 55aa031404 Fix analyzer/FE integration of assignment with synthetic LHS.
This is a step toward fixing test arg_param_trailing_comma_test/166
with [ $compiler == dart2analyzer && $fasta ], since parser error
recovery handles that case by producing an assignment with a synthetic
LHS.

Change-Id: I5c998d335758d79dc0f13988c259b85e87051a08
Reviewed-on: https://dart-review.googlesource.com/71041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-21 22:36:27 +00:00
asiva ccb16f7282 [VM] fix the arguments of training run of kernel-service to
turn on strong mode and sync-async on by default.

Change-Id: I1e9d656bce7bb99b6a41110458604514a1717d0f
Reviewed-on: https://dart-review.googlesource.com/71020
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-08-21 22:21:20 +00:00
Alexander Aprelev 41e720b486 [vm] Add support for a new source file format kernel file lists.
Given a source file that starts with '#@dill' on a new line, then if the rest of the lines are full paths to the kernel dill files, all kernel dill files will be loaded and executed as single program.

So, for example, given `mytest.dillref` with following content:
```
/projects/mytest/build/bin/main.vm.dill
/projects/mytest/build/packages/mytest/lib.vm.dill
```

invocation of `dart mytest.dillref` will result in loading two dill files and starting combined app.

Bug: dartbug.com/33952
Change-Id: I22a99ec9a018da1bc984bc0d716af94bc10e20d6

Add few tests

Change-Id: I22a99ec9a018da1bc984bc0d716af94bc10e20d6
Reviewed-on: https://dart-review.googlesource.com/67460
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-08-21 22:12:54 +00:00
Konstantin Shcheglov 306141999d Update testing for unresolved invoke types.
R=brianwilkerson@google.com

Change-Id: Ib9a2d0027775c89c84d6bde943406ae0606927fd
Reviewed-on: https://dart-review.googlesource.com/71000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-21 21:42:24 +00:00
Konstantin Shcheglov 34e6aa8ad2 Fix mock SDK and front-end targer in analyzer.
R=brianwilkerson@google.com

Change-Id: I7d4a1948fe21720c237f6e36997d29e63dd7ab28
Reviewed-on: https://dart-review.googlesource.com/70983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-21 21:42:23 +00:00
Alexander Markov 5d86b5e1b0 [vm/kernel/bytecode] Share contexts between scopes in bytecode
This optimization reduces number of context allocations and decreases
number of context levels, making access to captured variables more
efficient.

This change reduces number of context levels in synthetic bodies of
sync* methods to 1. This is important for correctness because
_SyncIterable::iterator clones unerlying sync* closure to create a new
Iterator using _Closure._clone(), and _Closure._clone() clones only
1 level of context.

Fixes language_2/syncstar_yield_test in bytecode mode.

Change-Id: I7a783702b024a7454253f7f4423ec4b2e08ef61f
Reviewed-on: https://dart-review.googlesource.com/70984
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-21 21:18:34 +00:00
Paul Berry 1b5d273fd7 Fix analyzer/FE integration of assignments to ambiguous types.
Fixes 2 language_2 tests with [ $compiler == dart2analyzer && $fasta ].

Change-Id: I600c7f075d0beb31863a4d17a6764afa2c7187be
Reviewed-on: https://dart-review.googlesource.com/70982
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-21 21:13:18 +00:00
Konstantin Shcheglov 4a4132ccab Change code ranges for fields/variables.
We used to set the code range of the whole FieldDeclaration for each
individual VariableDeclaration even when there are multiple of them.

Now the first VariableDeclaration will use code range that starts at
the beginning of the FieldDeclaration, and ends at the end of its
initializer. The subsequent variables (if any) will start of the
start of their names. So, each variable will get unique code range.

R=brianwilkerson@google.com

Change-Id: I0a93bdad2a17454fd5b343b395c72440c86b421d
Reviewed-on: https://dart-review.googlesource.com/70981
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-21 20:57:16 +00:00
asiva d1bd887d03 [VM/SDK] Switch kernel isolate to run in Dart 2 mode
- Switch the kernel isolate to run in Dart2 mode
- Refactor build rules so bootstrapping of the front end happens
  with a prebuilt dart sdk
- Refactor application snapshot build rules so the kernel application
  snapshot rule does not get into a cyclic dependency during the
  bootstrap stage

Change-Id: Iccca3233f6cb8d6b307b4cf1ca3262f293f794a6
Reviewed-on: https://dart-review.googlesource.com/70841
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-08-21 20:28:06 +00:00
Paul Berry e87efdffb4 Fix analyzer/FE integration of assignments to ambiguous types.
Fixes 1 language test with [ $compiler == dart2analyzer && $fasta ].

Change-Id: I807ca277e6e1f6fb81954be5e72b42cdec8c1b68
Reviewed-on: https://dart-review.googlesource.com/70961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-21 19:27:37 +00:00
Jacob MacDonald 4445ad1707 Support custom --multi-root-scheme flag, and --multi-root arguments. Also pass the custom scheme to jsProgramToCode to fix placeSourceMap calls.
Change-Id: I394ce51ba15e68fb98b0ce2c65020c740763cd94
Reviewed-on: https://dart-review.googlesource.com/70680
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2018-08-21 18:58:29 +00:00
Konstantin Shcheglov 8c82098b39 Remove special ignoring MissingImplementationCause.
A more general mechanism was implemented soon after.

R=brianwilkerson@google.com

Change-Id: I20a2b2fbd07720caf78519a3791dff8803f7df41
Reviewed-on: https://dart-review.googlesource.com/70901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-21 18:17:05 +00:00
Dan Rubel d06f4f807f Refactor parsing top level keyword declarations
This revises how top level keywords are parsed in preparation
for parsing the new "mixin" declaration.

Change-Id: Ic3ffff523d081c1ced61285ed2b00d47cad164c3
Reviewed-on: https://dart-review.googlesource.com/70880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-21 17:44:57 +00:00
Samir Jindel 569290dbf5 Revert "[vm] Use multiple entrypoints to remove unnecessary checks on statically-typed closure calls."
This reverts commit 19126e861e.

Reason for revert: Breaks several bots.

Original change's description:
> [vm] Use multiple entrypoints to remove unnecessary checks on statically-typed closure calls.
> 
> Test Plan:
> 
> Behavioral correctness should be ensured by existing tests. Tests in vm/dart/entrypoints
> ensure that the unchecked entrypoint is used in cases where the optimization should trigger.
> 
> Bug: https://github.com/dart-lang/sdk/issues/31798
> 
> Change-Id: Id25ecba86e20c22f0678c12986ad620db312ddaa
> Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
> Reviewed-on: https://dart-review.googlesource.com/69743
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,sjindel@google.com

Change-Id: Ia33e9d141827d3c990c65d839333443c224dc85d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31798
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/70920
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-08-21 17:10:56 +00:00
Stephen Adams ceace12724 dart2js: Work-around for imprecise calledOnce info
Change-Id: Id1118a394a2be5c8a1844ce40ce33512239bf650
Reviewed-on: https://dart-review.googlesource.com/70843
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-08-21 17:02:13 +00:00
Paul Berry d10204f3a0 Fix analyzer/FE integration of assignments to non-l-values.
This required introducing a new generator type to represent a
non-l-value, so that we can re-use the machinery of DelayedAssignment.

Fixes 6 language_2 tests with [ $compiler == dart2analyzer && $fasta ].

Change-Id: Ida2985df6d798d5466948e5de3dce5c17c2de7ac
Reviewed-on: https://dart-review.googlesource.com/70842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-21 16:45:07 +00:00
Brian Wilkerson 8b125b55d0 Add an AST structure for the new mix-in support
Change-Id: I3d8890edf26eeb19eaaab9c27772e2c37c10e629
Reviewed-on: https://dart-review.googlesource.com/70141
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-08-21 16:39:41 +00:00
Samir Jindel 19126e861e [vm] Use multiple entrypoints to remove unnecessary checks on statically-typed closure calls.
Test Plan:

Behavioral correctness should be ensured by existing tests. Tests in vm/dart/entrypoints
ensure that the unchecked entrypoint is used in cases where the optimization should trigger.

Bug: https://github.com/dart-lang/sdk/issues/31798

Change-Id: Id25ecba86e20c22f0678c12986ad620db312ddaa
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/69743
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-21 16:00:57 +00:00
Kevin Millikin 2a36502b02 Squelch some false warnings for disallowed uses of void
The rules for void are changed to allow uses of void where we
previously had a warning, such as the case of assignment to a
variable of type void or passing as a parameter of type void.

Change-Id: I1c1513b0000fa1c8eedbe2645fab503b28024fa3
Reviewed-on: https://dart-review.googlesource.com/70265
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-08-21 09:48:44 +00:00
Johnni Winther 244c9bebec Remove STRONG_MODE flag
Change-Id: I260be375925dde43703f64e83e09ed924e44e669
Reviewed-on: https://dart-review.googlesource.com/70641
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-21 08:21:02 +00:00
Johnni Winther 814738b273 Remove CompilerOptions.strongMode/enableTypeAssertions/trustTypeAnnotations
Change-Id: I4a51b081f42d76f12c70c140286c28375fcbd5ce
Reviewed-on: https://dart-review.googlesource.com/70515
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-21 08:21:02 +00:00
Johnni Winther d7c71862da Check setters in Dart 2
Change-Id: I3a0bb90f34072cb4ef47f2712c43e4779b92fbdd
Reviewed-on: https://dart-review.googlesource.com/70514
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-21 08:21:02 +00:00
Jens Johansen bedc1440d0 Analyzer: replaceComponent: Add small to big instead of the other way around
Instead of adding a big (old) map to a small (new) map and clearing the old
one, add the new entries the old map and let GC take the new map.

--use-cfe analysis-server-cold goes from ~48 to ~43 on my machine.

Change-Id: Ia0ff7bc4cafcea8e11fd9eb4eebd0cfec504b96f
Reviewed-on: https://dart-review.googlesource.com/70643
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-08-21 05:58:47 +00:00
Paul Berry a814614cf4 Fix analyzer/FE integration of invalid assignments to classes.
To ensure that the resolution of the class name is communicated to the
analyzer, we take advantage of SyntheticExpressionJudgment.original,
which allows us to ensure that type inference is performed on a
synthetic read of the class name expression.  This causes the
appropriate information to be communicated to the analyzer, and then
at runtime the value produced by the synthetic read is discarded.

Fixes 15 language_2 tests with [ $compiler == dart2analyzer && $fasta ].

Change-Id: I02ad23acbb64c297129f59ff56171399bf067c33
Reviewed-on: https://dart-review.googlesource.com/70780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-21 00:27:28 +00:00
Alexander Markov 701b13048b [vm/kernel/bytecode] Zap expression stack in try-catch handlers
Also, if return statement is used inside try/finally, its return value
is saved in a variable to avoid clobbering by statements in finally
block.

This CL fixes language_2/stack_overflow_test in bytecode mode.

Change-Id: If6a3981d9dc8673f6b990aa00200e1ab7298c6ac
Reviewed-on: https://dart-review.googlesource.com/70820
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-20 23:39:57 +00:00
Devon Carew 9bf9822bec Increase a timeout for a slow test.
Change-Id: Ica5869cff0a710e778105c84fc8a6f4fbceb5ce9
Reviewed-on: https://dart-review.googlesource.com/70781
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-08-20 21:12:42 +00:00
Alexander Markov 5e0a28a384 [vm/kernel/bytecode] Support unsafeCast() intrinsic method in bytecode
This is the follow-up for 7708989538.

Change-Id: Ib313e823df8625a1dce9ff31749f83d44e2da539
Reviewed-on: https://dart-review.googlesource.com/70760
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-20 20:44:05 +00:00
Johnni Winther 3af2f793ac Remove --no-preview-dart-2 from dart2js
Change-Id: I17a18ebe905fa60ba2a1b41af2f444cfe58a38a2
Reviewed-on: https://dart-review.googlesource.com/70512
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-20 09:18:02 +00:00
Jens Johansen 59833ed175 Analyzer: Clear old metadata
Before:
```
$ out/ReleaseX64/dart pkg/analysis_server/benchmark/benchmarks.dart run
--use-cfe analysis-server-cold
Running analysis-server-cold 3 times...
  {analysis-server-cold-analysis: {micros: 46635813},
analysis-server-cold-memory: {bytes: 1878681920}}
  {analysis-server-cold-analysis: {micros: 46983169},
analysis-server-cold-memory: {bytes: 1880458816}}
  {analysis-server-cold-analysis: {micros: 46840261},
analysis-server-cold-memory: {bytes: 1878427424}}
Finished in 141 seconds.

{"benchmark":"analysis-server-cold","result":{"analysis-server-cold-analysis":{"micros":46635813},"analysis-server-cold-memory":{"bytes":1878427424}}}
```

Now:
```
$ out/ReleaseX64/dart pkg/analysis_server/benchmark/benchmarks.dart run
--use-cfe analysis-server-cold
Running analysis-server-cold 3 times...
  {analysis-server-cold-analysis: {micros: 47372081},
analysis-server-cold-memory: {bytes: 971048688}}
  {analysis-server-cold-analysis: {micros: 46993086},
analysis-server-cold-memory: {bytes: 970874400}}
  {analysis-server-cold-analysis: {micros: 47544922},
analysis-server-cold-memory: {bytes: 989676496}}
Finished in 143 seconds.

{"benchmark":"analysis-server-cold","result":{"analysis-server-cold-analysis":{"micros":46993086},"analysis-server-cold-memory":{"bytes":970874400}}}
```

So it basically uses half the memory...

Change-Id: Ica28572d58800bfa5663bfd1bbe99844eb3fd937
Reviewed-on: https://dart-review.googlesource.com/70506
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-08-20 08:57:20 +00:00
Jens Johansen 4179fbcec7 Only compute canonical names and clean new libraries
analysis-server-cold-analysis reduced from
~70 seconds to ~46 seconds.

Change-Id: I6e793f292beceda32817675625df90cd003bc19c
Reviewed-on: https://dart-review.googlesource.com/70264
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-08-20 08:14:49 +00:00
Jens Johansen fd00c0a4f7 Train analysis server with cfe too
Prior to this change the analysis server was trained in non-cfe mode
only, meaning that the playing field wasn't even.
This CL updates the training so both modes are trained, reducing the
cold server benchmark in cfe mode from ~76 to ~71 seconds on my machine.
This is still *way* more than the non-cfe version, but still.

Before:
```
$ out/ReleaseX64/dart pkg/analysis_server/benchmark/benchmarks.dart run analysis-server-cold
Running analysis-server-cold 3 times...
  {analysis-server-cold-analysis: {micros: 15779864}, analysis-server-cold-memory: {bytes: 254571344}}
  {analysis-server-cold-analysis: {micros: 15181035}, analysis-server-cold-memory: {bytes: 272837552}}
  {analysis-server-cold-analysis: {micros: 15029866}, analysis-server-cold-memory: {bytes: 312474240}}
Finished in 49 seconds.

{"benchmark":"analysis-server-cold","result":{"analysis-server-cold-analysis":{"micros":15029866},"analysis-server-cold-memory":{"bytes":254571344}}}


$ out/ReleaseX64/dart pkg/analysis_server/benchmark/benchmarks.dart run --use-cfe analysis-server-cold
Running analysis-server-cold 3 times...
  {analysis-server-cold-analysis: {micros: 76810701}, analysis-server-cold-memory: {bytes: 1634409696}}
  {analysis-server-cold-analysis: {micros: 74706698}, analysis-server-cold-memory: {bytes: 1565364624}}
  {analysis-server-cold-analysis: {micros: 75798888}, analysis-server-cold-memory: {bytes: 1759452128}}
Finished in 228 seconds.

{"benchmark":"analysis-server-cold","result":{"analysis-server-cold-analysis":{"micros":74706698},"analysis-server-cold-memory":{"bytes":1565364624}}}
```


Now:

```
$ out/ReleaseX64/dart pkg/analysis_server/benchmark/benchmarks.dart run analysis-server-cold
Running analysis-server-cold 3 times...
  {analysis-server-cold-analysis: {micros: 15064119}, analysis-server-cold-memory: {bytes: 302396944}}
  {analysis-server-cold-analysis: {micros: 14909304}, analysis-server-cold-memory: {bytes: 273778864}}
  {analysis-server-cold-analysis: {micros: 14934034}, analysis-server-cold-memory: {bytes: 353252928}}
Finished in 45 seconds.

{"benchmark":"analysis-server-cold","result":{"analysis-server-cold-analysis":{"micros":14909304},"analysis-server-cold-memory":{"bytes":273778864}}}



$ out/ReleaseX64/dart pkg/analysis_server/benchmark/benchmarks.dart run --use-cfe analysis-server-cold
Running analysis-server-cold 3 times...
  {analysis-server-cold-analysis: {micros: 70252048}, analysis-server-cold-memory: {bytes: 1650741520}}
  {analysis-server-cold-analysis: {micros: 70853869}, analysis-server-cold-memory: {bytes: 1579162320}}
  {analysis-server-cold-analysis: {micros: 71155850}, analysis-server-cold-memory: {bytes: 1579512288}}
Finished in 213 seconds.

{"benchmark":"analysis-server-cold","result":{"analysis-server-cold-analysis":{"micros":70252048},"analysis-server-cold-memory":{"bytes":1579162320}}}
```

Change-Id: I8fb75624c86605e7028a2b8483df85ebbd958b0d
Reviewed-on: https://dart-review.googlesource.com/70260
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-08-20 07:15:47 +00:00
Vyacheslav Egorov 032037681e Revert "[VM/SDK] Switch kernel isolate to run in Dart 2 mode"
This reverts commit 499761f0da.

Reason for revert: crashes when building SDK, red bots, broken Flutter 3xHEAD bot

Original change's description:
> [VM/SDK] Switch kernel isolate to run in Dart 2 mode
> 
> - Switch the kernel isolate to run in Dart2 mode
> - Refactor build rules so bootstrapping of the front end happens
>   with a prebuilt dart sdk
> - Refactor application snapshot build rules so the kernel application
>   snapshot rule does not get into a cyclic dependency during the
>   bootstrap stage
> 
> Change-Id: I067c5f1165fb93811dcc8e390a8bf381db721e5b
> Reviewed-on: https://dart-review.googlesource.com/70461
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: Ibf6d526fb5132b766f063fcf873cde661ae895d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/70516
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-08-19 19:58:32 +00:00
asiva 499761f0da [VM/SDK] Switch kernel isolate to run in Dart 2 mode
- Switch the kernel isolate to run in Dart2 mode
- Refactor build rules so bootstrapping of the front end happens
  with a prebuilt dart sdk
- Refactor application snapshot build rules so the kernel application
  snapshot rule does not get into a cyclic dependency during the
  bootstrap stage

Change-Id: I067c5f1165fb93811dcc8e390a8bf381db721e5b
Reviewed-on: https://dart-review.googlesource.com/70461
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-08-18 22:50:09 +00:00
Mike Fairhurst 222ac2498a Revert "Fix #33415 no error for awaiting a void expression."
This reverts commit 9727a4a4ef.

Reason for revert: Internal breakage; needs to be landed behind a flag.

Original change's description:
> Fix #33415 no error for awaiting a void expression.
>
> Bug:  33415
> Change-Id: I4d4e81fef79a5bc5162e37ab07a8fe99e50c8dfc
> Reviewed-on: https://dart-review.googlesource.com/60522
> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

TBR=brianwilkerson@google.com,mfairhurst@google.com


Bug: 33415
Change-Id: I66e1bc58bc0966a2348804dbdef6f5901b6aaf55
Reviewed-on: https://dart-review.googlesource.com/67100
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-17 23:48:46 +00:00
Stephen Adams e02ec040cb @dart2js.tryInline should not inline methods that can't be inlined
Change-Id: I1efc13b64d7740dbe904364e44fa6e6b9be0fd81
Reviewed-on: https://dart-review.googlesource.com/70440
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-08-17 22:14:03 +00:00
Alexander Markov 9b3bda610b [vm/kernel/bytecode] Constant-evaluate default values of optional parameters of closures in bytecode
This constant evaluation is needed as default values of optional parameters
of closures can reference local const variables which are not available in
bytecode, so default value expressions can't be serialized without
enclosing AST.

Fixes test language_2/regress_18435_test in bytecode mode.

Change-Id: I1530c5bae058865de8f40d6f636dd747ba407cc5
Reviewed-on: https://dart-review.googlesource.com/70581
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-17 20:50:02 +00:00
Alexander Markov 4da7360d71 [vm/kernel/bytecode] Fix capturing of factory type arguments in bytecode
Change-Id: I3d1b1d78684b7a5f3c117ec24d7e406a7b4feabd
Reviewed-on: https://dart-review.googlesource.com/70560
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-17 19:10:08 +00:00
Devon Carew 0c2d382a6e add the ability to set the analyzer's state location via an env variable.
Change-Id: I37d1599cb96db7c09f929a6e56f191cc7a969145
Reviewed-on: https://dart-review.googlesource.com/70540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-08-17 17:42:43 +00:00