Commit Graph

4770 Commits

Author SHA1 Message Date
Paul Berry c519414702 Add subtype matching rules for function types.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2883133002 .
2017-05-15 14:04:32 -07:00
Konstantin Shcheglov b3837a5e28 Enhance DirectiveListener to collect import/exports with combinators.
We need combinators to build export scopes for DILL libraries.

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2884783002 .
2017-05-15 13:59:14 -07:00
Paul Berry 358c3da935 Make type inference handle overloaded arithmetic operations.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2883083002 .
2017-05-15 11:43:50 -07:00
Alexander Aprelev b0c6a59731 Fix analyzer tests in checked mode.
BUG=
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2884023002 .
2017-05-15 10:25:59 -07:00
Alexander Aprelev 089a355766 Build up and pass MemoryFileSystem to fasta frontend.
Allow kernel service request to provide source files(filename, content), which will be used to build up MemoryFileSystem instance. MemoryFileSystem instance will be used instead of PhysicalFileSystem instance.

Immediate need for this is to support VM unit testing, where small Dart scripts that have to be parsed are hardcoded in the unit tests.

BUG=https://github.com/dart-lang/sdk/issues/28264
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2880453005 .
2017-05-15 08:44:34 -07:00
Dan Rubel d644be82ab Revert "cleanup unused incremental resolution"
This reverts commit 77b383e6b8.

Review-Url: https://codereview.chromium.org/2887443002 .
2017-05-15 11:01:57 -04:00
Paul Berry bd15c223de Implement function-typed formal parameters in OutlineBuilder.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2884483002 .
2017-05-15 06:28:51 -07:00
Dan Rubel 77b383e6b8 cleanup unused incremental resolution
* remove unused analyzer incremental resolution
* remove unused Token.applyDelta method

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2876993005 .
2017-05-15 09:09:25 -04:00
Peter von der Ahé d256128d7c Reduce use of relativize and unsort methods.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2880213002 .
2017-05-15 13:56:20 +02:00
Dmitry Stefantsov 1de8e38121 Fix command line args validation for platform compilation with fasta
This commit is to adjust command line arguments validation for platform
compilation with fasta according to the interface changes made in
db331244d0.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2878383003 .
2017-05-15 13:08:24 +02:00
Konstantin Shcheglov dd62ad5d77 Store Typedef(s) in kernel when parsing with Fasta, deserilize in DillLibraryBuilder.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2882893002 .
2017-05-14 17:51:55 -07:00
Paul Berry 66a8d2ec9c Implement full closure inference logic.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2882863002 .
2017-05-14 15:21:32 -07:00
Konstantin Shcheglov 8bf0b9092a Skip native clauses when parsing directives.
Otherwise we cannot parse SDK libraries to build full graph.

R=ahe@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2879063002 .
2017-05-14 11:21:13 -07:00
Paul Berry 28e742a31c Infer return types of closures (basic support).
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2878173002 .
2017-05-13 06:13:31 -07:00
Konstantin Shcheglov 396d72be4c Start actually adding incrementality into incremental kernel generator.
We now store and reuse resolved kernel libraries.
Existing tests are not yet check this, I will add this in future CLs.

Also returned ProgramDelta(s) are still not deltas, but full bundles.

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2877193003 .
2017-05-12 19:58:36 -07:00
Paul Berry 6dc30771b3 Don't type promote local functions.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2877253003 .
2017-05-12 18:58:52 -07:00
Konstantin Shcheglov a4fd5d814f Extract PerformanceLogger from AnalysisDriver.
I also added the runAsync().

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

Review-Url: https://codereview.chromium.org/2883633002 .
2017-05-12 14:27:50 -07:00
Paul Berry b5bc14c0b4 Begin writing a TypeInferenceListener interface.
In the long term, this is intended to be used to communicate the
results of type inference from the front_end to analyzer.  In the
short term, it can be used to debug type inference (by uncommenting
the print statements in type_inference_listener.dart).

R=scheglov@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2878733006 .
2017-05-12 13:31:26 -07:00
Konstantin Shcheglov 02cb71685e Move flat_buffer and api_signature into front_end.
I will need to use these in front_end to store precomputed information
and computing combined signatures.

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

Review-Url: https://codereview.chromium.org/2875373002 .
2017-05-12 10:48:28 -07:00
Konstantin Shcheglov bdedd6768b Add a way to use shared CanonicalName root to deserialize Program.
This allows for example to add SDK into a Program, then load the
"incomplete" Program A that has only the library A, and name sequences
that references SDK classes. Because we look into the nameRoot which
aleady has SDK CanonicalName(s), we can find these names while filling
the link table and use references which point to the existing SDK
AST nodes.  Then we can load another set of library cycles, etc.

At the end we have a set of self-consistent libraries that we can
feed into DillTarget/DillLoader and resolve anothersource target
against it.

This CL is based on https://codereview.chromium.org/2872903005/
which has not been reviewed yet.

R=kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2874723002 .
2017-05-12 10:42:08 -07:00
Sigmund Cherem dae30fe286 Remove one more use of DillTarget.read that broke compiler/tool/generate_kernel.
Also adds a test for that script.

BUG=
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2880443005 .
2017-05-12 10:37:17 -07:00
Konstantin Shcheglov 25e8941cc7 Compute topologically sorted library cycles.
In following CLs we will compile (or load already compiled) kernels
for each cycle and compile following cycles against them.

R=paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2879783002 .
2017-05-12 08:41:48 -07:00
Sigmund Cherem db331244d0 Generate outline without transformations in patched_sdk, use it for unit tests
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2881603003 .
2017-05-11 15:10:33 -07:00
Paul Berry 99d9a77be8 Get rid of promotedType=none annotations
These turned out to be really unweildy.  Besides, they aren't
necessary since the test framework will flag a failure if a type gets
promoted when it is not expected to be.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2865403007 .
2017-05-11 11:14:23 -07:00
Konstantin Shcheglov 8751b91062 Rework DillLoader to allow adding multiple dills.
This allows us to compose a consistent bundle with SDK and the transitive
closure of required libraries for a libarary, and then compile it
separately (or as a part of its own library cycle).

There is still more data public than I'd like, but I will leave this
clean up fo later.

R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2872903005 .
2017-05-11 08:56:36 -07:00
Paul Berry 06bba1e551 Add FunctionType.getNamedParameter.
This functionality was duplicated both in
TypeCheckingVisitor.handleFunctionCall and in the front end's
TypeInferrerImpl._getCalleeFunctionType.  I kept the implementation
from TypeInferrerImpl._getCalleeFunctionType since it does a binary
search, so it should theoretically be faster.

R=kmillikin@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2876533004 .
2017-05-11 06:03:37 -07:00
Paul Berry 17c23be470 Set MethodInvocation.interfaceTarget during type inference.
We need to compute the interface target in order to do the inference
anyway, so this is a reasonable time to store it.

Also annotate the inference tests with interface targets so that we
can verify that the interface targets computed by analyzer match those
computed by Fasta.  Note that this causes a few strong mode tests to
fail that were previously passing, due to the fact that type inference
in Fasta is incomplete.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2874033003 .
2017-05-10 14:31:05 -07:00
Konstantin Shcheglov 114f49dcab Add the test for updating a part.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2876643002 .
2017-05-10 14:20:35 -07:00
Konstantin Shcheglov 176c7d7303 Replace factory constructor with a static method for creating IncrementalKernelGenerator.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2869273006 .
2017-05-10 13:10:11 -07:00
Paul Berry 6208c8f05c Propagate type inference through variable gets.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2872323003 .
2017-05-10 12:21:32 -07:00
Sigmund Cherem bd85c499b0 Allow overriding core types in dart:_interceptors.
This gets rid of the warning you get today when building the SDK (you can see
this on the `build.py -m release patched_dart2js_sdk` target).

R=ahe@google.com, paulberry@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2869393003 .
2017-05-10 11:33:23 -07:00
Paul Berry e68668f88d Fix method call type inference with explicit type parameters.
This was broken for three reasons:

- We weren't recording the fact that the type parameters were
  explicitly provided, so the inference code path to handle this case
  wasn't being exercised.

- The inference code path to handle this case was accidentally
  referring to the `inferredTypes` variable, which is `null` in this
  case.

- We were not checking for the case where the user provided the wrong
  number of type parameters.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2874053002 .
2017-05-10 11:00:29 -07:00
Paul Berry 6e499b16cf Implement type inference of method invocations in Fasta.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2873813002 .
2017-05-09 16:51:05 -07:00
Konstantin Shcheglov f0b6ded604 FileState needs only bytes of the file.
R=paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2867303002 .
2017-05-09 09:20:55 -07:00
Konstantin Shcheglov bd1ee32543 Move [file_]byte_store.dart into pkg/front_end/test/src/incremental/.
We are going to reuse ByteStore in front_end, also for incremental
compilation.

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

Review-Url: https://codereview.chromium.org/2869803004 .
2017-05-09 09:12:15 -07:00
Konstantin Shcheglov 6e7d280a83 (Reland) Start using FileState/FileSystemState to provide consistent view.
R=paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2871783002 .
Review-Url: https://codereview.chromium.org/2865253003 .
2017-05-09 09:04:40 -07:00
Paul Berry 6b9b2146ed Clean up type inference methods.
Several minor changes that shouldn't affect functionality:

- inferGenericFunctionOrType no longer returns the inferred type;
  instead, it fills an "inferredTypes" array with the inferred type
  arguments.

- Downwards inference is signaled to inferGenericFunctionOrType by
  passing `null` for `formalTypes` and `actualTypes`.

- inferTypeFromConstraints no longer falls back on
  instantiateToBounds.  This never could have had any effect anyway
  because it was only invoked for upwards inference, and in that case,
  all type arguments are already known.

- Inferred type arguments are now passed back to
  KernelConstructorInvocation as a list rather than forcing it to
  extract them from the inferred class type.  If the inferred class
  type doesn't need to be computed, it isn't.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2869003002 .
2017-05-09 05:52:40 -07:00
Peter von der Ahé 4880a2876e Rewrite mixin application handling in Fasta.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2862223002 .
2017-05-09 09:22:57 +02:00
Erik Corry de0f220b7d Revert "Start using FileState/FileSystemState to provide consistent view."
This reverts commit 6173ac476b.
Failure on analyzer test: python tools/test.py -mrelease --checked -t60
--use-sdk pkg/front_end/test/subpackage_relationships_test

BUG=
TBR=scheglov@google.com

Review-Url: https://codereview.chromium.org/2864243004 .
2017-05-09 09:21:24 +02:00
Dan Rubel 81d25f4c71 more work aligning fasta.Token with analyzer.Token
* move isPseudo getter out of Token into TokenType
* move special case charCount logic out of fasta.Token into fasta.ErrorToken
* move more accessors from fasta.Token into analyzer.Token
* add @overrides to denote which methods have been declared in analyzer.Token
* make fasta LazySubstring and its subclasses private
* rename fasta.previousToken to previous to match analyzer.Token
* flatten fasta.Token.preceedingCommentTokens into preceedingComments
* normalize fasta.Token.next and analyzer.Token.next

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2872433005 .
2017-05-09 00:09:56 -04:00
Konstantin Shcheglov 6173ac476b Start using FileState/FileSystemState to provide consistent view.
R=paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2871783002 .
2017-05-08 17:17:19 -07:00
Paul Berry 4eee6cb5ea Fix constructor invocation type inference.
Three problems are fixed:

- I forgot to pass the `downwards` flag when doing downwards inference.

- I forgot to initialize the `formalTypes` and `actualTypes` arrays.

- I wasn't tracking whether constructor type arguments were implicit
  or explicit, so constructor type inference wasn't actually
  happening.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2864853002 .
2017-05-08 14:41:56 -07:00
Paul Berry d34d4e545c Change front end type inference algebra to match analyzer.
This CL swaps the behavior of greatest and least closure in
solveTypeConstraint.  It also changes greatestClosure(?) to `dynamic`
rather than `Object`.

These changes bring front end type inference more closely into line
with analyzer type inference.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2872763002 .
2017-05-08 14:19:11 -07:00
Konstantin Shcheglov 9167ad0f55 Update DeltaProgram API and documentation.
R=paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2871573003 .
2017-05-08 14:13:13 -07:00
Dan Rubel a14bda01a9 align fasta.Token and analyzer.Token
* move kind to analyzer.Token
* move charOffset, charLength, charEnd to analyzer.Token
* move isEOF from fasta.Token into analyzer.Token
* move stringValue into TokenType

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

Review-Url: https://codereview.chromium.org/2866973005 .
2017-05-08 15:44:35 -04:00
Dan Rubel 3347169016 cleanup TokenType var names
* rename TokenType info --> type
* rename fasta Token.info --> Token.type

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

Review-Url: https://codereview.chromium.org/2872453004 .
2017-05-08 12:43:08 -04:00
Konstantin Shcheglov 9acca5f464 Initial version of Fasta based IncrementalKernelGenerator.
No incrementality yet.
In a separate experiment I can load SDK kernel and resolve against it.
So, I will add it in a following CL, or maybe even generalize to any library.

R=paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2869563002 .
2017-05-08 09:19:26 -07:00
Konstantin Shcheglov 48b22b0e52 Throw FileSystemException from FileSystemEntity methods.
We need to be able to handle exceptions regardless of the implementation.

R=paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2864183002 .
2017-05-08 08:27:54 -07:00
Dan Rubel e0e892008a remove TokenType.KEYWORD
Breaking change to be landed after all existing callsites
have been converted to use the new API.

This is part 2 of https://codereview.chromium.org/2842643004/

* make Keyword extend TokenType
* make TokenType.AS be the same object as Keyword.AS
* make TokenType.IS be the same object as Keyword.IS
* remove TokenType.KEYWORD
* remove unnecessary Keyword.info method

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2848493003 .
2017-05-08 11:20:21 -04:00
Peter von der Ahé 0dba8c9516 Update handling of multiline strings to specification.
R=johnniwinther@google.com, lrn@google.com

Review-Url: https://codereview.chromium.org/2847793002 .
2017-05-08 12:20:02 +02:00