The goal here is to create Analyzer FunctionType that remembers the
Element a function or a method it is associated with. We could just
translate Kernel FunctionType into a "detached" Analyzer FunctionType,
but that would be a breaking change.
Alternatively, we could accept that staticInvokeType in
InvocationExpression might be detached, and it the client needs the
exact element, it can be accessed using for example
MethodInvocation.methodName.staticElement. Practically, move closer
to the front-end way of dealing with types.
R=brianwilkerson@google.com, paulberry@google.com
Bug:
Change-Id: I1de0b76c53f003dca837e714df4a9eee64c4ac9b
Reviewed-on: https://dart-review.googlesource.com/25280
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This reverts commit 8e4b0bda23.
Reason for revert: Failures on most kernel bots
Original change's description:
> Route all messages through Loader.
>
> This ensures that all messages are passed to instrumentation.
>
> Issues addressed in this CL:
>
> * When I added addCompileTimeError, I forgot to remove addError.
>
> * All messages now all arrive in a single location (Loader). SourceLoader adds instrumentation by overriding recordMessage.
>
> * As I changed the type inferrer to use addCompileTimeError, I broke DDC. This is because the front_end API (generateKernelInternal in kernel_generator_impl.dart) returns null if there are any errors reported via addCompileTimeError (and this didn't happen with addError, that shouldn't have been there anyways).
>
> * Due to the previous problem, I changed generateKernelInternal to ignore errors, but then I started getting missing compile-time errors. This turned out to be due to the the silent parameter used during outline- and diet-parsing.
>
> * I've removed all the "silent" parameters. This didn't work reliably and have been confusing Brian, Dan, and me several times when making parser changes. Instead we detect duplicated messages and avoid reporting them more than once.
>
> * Types in error messages got names that where using a global object (globalDebuggingNames in pkg/kernel/lib/text/ast_to_text.dart). This meant that the #lib prefix would vary depending on how many tests were run which affected the serialized error message in pkg/front_end/testcases/invalid_assignment.dart.strong.expect.
>
> Change-Id: I3d89372d6593a6e7e50cce733f61eedb881e15ed
> Reviewed-on: https://dart-review.googlesource.com/24481
> Commit-Queue: Peter von der Ahé <ahe@google.com>
> Reviewed-by: Paul Berry <paulberry@google.com>
> Reviewed-by: Kevin Millikin <kmillikin@google.com>
TBR=paulberry@google.com,ahe@google.com,kmillikin@google.com
Change-Id: I9f7b345a8ff040fc7aa73c5cb605190e47fd284b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/25660
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reverting due to several test failures.
This reverts commit 67adfe741b.
Bug:
Change-Id: Idd1aa15d47df68f2938285468dfa3d5043d8dae2
Reviewed-on: https://dart-review.googlesource.com/25520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This allows us update enclosing ExecutableElement as we enter/exit
local functions, and successfully translate references to type
parameters.
R=brianwilkerson@google.com, paulberry@google.com
Bug:
Change-Id: I184123212b816740a586beee98796c28beadf6b2
Reviewed-on: https://dart-review.googlesource.com/25220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Fixes#31440.
There is a minor change outside of type inference: the body builder
now stores the synthetic assignment (used for for-in loops that don't
declare their own variable) in ShadowForInStatement so that type
inference doesn't have to dig through the desugared kernel objects in
order to find it.
Change-Id: I6520695336560883e2aa07bb110378b7846c2e11
Reviewed-on: https://dart-review.googlesource.com/25040
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
`void` will be a reserved word in Dart 2.0 (it always was in Dart 1.x).
Remove it as an exported name from dart:core because it could be
accidentally hidden.
Bug: https://github.com/dart-lang/sdk/issues/31480
Change-Id: Id804cccbc144f3c8ba2fc9898a3b5c79e238ab36
Reviewed-on: https://dart-review.googlesource.com/24940
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Change-Id: Ie324e0bc91fa9c311be19b6c95690ed85a3aab75
Reviewed-on: https://dart-review.googlesource.com/25100
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Assert initializers in Dart may be compiled directly to this form of initializer,
rather than through local initializers as is done now.
Bug:
Change-Id: Ia149ea3d1df5d1dc18be5636801604ffaf7ca7d8
Reviewed-on: https://dart-review.googlesource.com/14760
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Change-Id: I38e969e494c671982ec2cba96d2657a836dd0d49
Reviewed-on: https://dart-review.googlesource.com/24122
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This ensures that all messages are passed to instrumentation.
Issues addressed in this CL:
* When I added addCompileTimeError, I forgot to remove addError.
* All messages now all arrive in a single location (Loader). SourceLoader adds instrumentation by overriding recordMessage.
* As I changed the type inferrer to use addCompileTimeError, I broke DDC. This is because the front_end API (generateKernelInternal in kernel_generator_impl.dart) returns null if there are any errors reported via addCompileTimeError (and this didn't happen with addError, that shouldn't have been there anyways).
* Due to the previous problem, I changed generateKernelInternal to ignore errors, but then I started getting missing compile-time errors. This turned out to be due to the the silent parameter used during outline- and diet-parsing.
* I've removed all the "silent" parameters. This didn't work reliably and have been confusing Brian, Dan, and me several times when making parser changes. Instead we detect duplicated messages and avoid reporting them more than once.
* Types in error messages got names that where using a global object (globalDebuggingNames in pkg/kernel/lib/text/ast_to_text.dart). This meant that the #lib prefix would vary depending on how many tests were run which affected the serialized error message in pkg/front_end/testcases/invalid_assignment.dart.strong.expect.
Change-Id: I3d89372d6593a6e7e50cce733f61eedb881e15ed
Reviewed-on: https://dart-review.googlesource.com/24481
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
This CL deprecates the front-end API and moves it into src/api_prototype.
For now all usages have been updated to point to the new location,
but they should be updated to use custom-client invocations instead (e.g.
one specific way for DDC, another for dart2js etc.)
Bug:
Change-Id: I9b4f41f6ebf55d42510fd35240d942d1dc7292d6
Reviewed-on: https://dart-review.googlesource.com/24822
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Change-Id: I1645317fc0707bb1e61550031eae680fb602089d
Reviewed-on: https://dart-review.googlesource.com/24280
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Kernel transformations are categorized as 'modular' or 'global'.
Modular transformations are run at a granularity finer than a whole program
(e.g., a library, a class, or even a method). They cannot make closed-world
assumptions. One can think of them as running at 'compile time'.
Global transformations are run on a whole (closed) program. They should be
optimizations only, not required for the implementation correctness of the
back end, because they are not guaranteed to be performed. A simple linker
might just concatenate .dill files. One can think of them as running at
'link time'.
The front end was applying global transformations to (open) bundles of
libraries, which violates the closed-world assumptions that these
transformations are allowed to make. We no longer do that.
Bug:
Change-Id: If50faa78c3cfbcd8a3bc2f45b922c90d11761117
Reviewed-on: https://dart-review.googlesource.com/24740
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This makes it possible to tighten up the types for the methods that
don't deal with Function.call.
Fixes#31435.
Change-Id: Iadde3e57bdb5e836a3561953531f111ca7f661ab
Reviewed-on: https://dart-review.googlesource.com/24640
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Note that there are currently some inconsistencies between how
function expressions are inferred depending whether they are defined
using `{}` or `=>` (see issue #31436). This CL preserves the existing
inconsistencies. Once we decide how we want to resolve issue #31436,
I'll revisit this code to ensure that it is still correct.
Change-Id: I3926a4b3dc51155d8f03adaae380b50aab39ca60
Reviewed-on: https://dart-review.googlesource.com/24622
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Note that this CL makes a minor change outside of type inference: it
changes the BodyBuilder so that when it desugars a for-in loop that
assigns to a variable declared elsewhere, the desugared assignment is
expressed using shadow objects; this is necessary to ensure that the
type inference engine can walk the desugared assignment and insert an
implicit downcast if necessary.
Change-Id: I4d87f83b8a4b3b72e7ba8042ccd711f0d012fac0
Reviewed-on: https://dart-review.googlesource.com/24340
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This is not related to the failing VM test as far I see.
R=brianwilkerson@google.com
Bug:
Change-Id: Id5799b4b55e75da021c64a949d4084c44689a175
Reviewed-on: https://dart-review.googlesource.com/24502
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Change-Id: I0e3d637a43ba3d71a71fa1b7a3e2162c247abf49
Reviewed-on: https://dart-review.googlesource.com/24111
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
Change-Id: I20613a98e25d32aede47ca14a879387af30d0fd4
Reviewed-on: https://dart-review.googlesource.com/24108
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
This also changes the order of information for invocations:
1. Target / receiver.
2. Reference to the procedure.
3. The actual type of the procedure.
4. The type of the returned result.
5. Arguments.
This makes reading and assigning by index consistent.
Unfortunately we need to provide the offset associate with the
defered returned result in methodInvocationBeforeArgs(), where we
don't have access to Arguments yet. So, I have to implement replacing
offsets with _replaceType().
R=brianwilkerson@google.com, paulberry@google.com
Bug:
Change-Id: Ib86c57efce8fa194b11a6979633243054c8ab7c9
Reviewed-on: https://dart-review.googlesource.com/24221
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
No language_2 tests are added to validate this behavior yet, because
we are still deciding what we want the semantics to be. I will follow
up with language_2 tests once the semantics have been decided upon.
Tests that have begun failing due to this change are marked with a
reference to issue #31402.
Change-Id: Ia24c9789220d09682b4b3ade9374d279ff2a4b6e
Reviewed-on: https://dart-review.googlesource.com/24320
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Change-Id: Ifea9db1f41e232136afe0c0eacdcc7c1a430e69d
Reviewed-on: https://dart-review.googlesource.com/24200
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>