Commit Graph

6018 Commits

Author SHA1 Message Date
Paul Berry 6e842b3c11 Start implementing logic for determining when formal parameters need type checks.
We haven't quite figured out how we want to store the need for these
type checks in the kernel representation, and I'm hoping that my
coding work can help inform that decision.  So for the moment the
annotation is simply stored in the front_end wrapper
(KernelVariableDeclaration).  This is enough to get simple tests to
pass.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/3000353002 .
2017-08-23 10:17:54 -07:00
Paul Berry 53553e8f61 Beef up the covariant generic parameter tear off test case
This reflects some discussion that happened during the review of how
tear offs should be handled; it should help us remember to test a few
additional corner cases.

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2995383002 .
2017-08-22 16:01:14 -07:00
Dan Rubel 69e9106ead improve fasta export directive recovery
R=ahe@google.com

Review-Url: https://codereview.chromium.org/3001993002 .
2017-08-22 16:52:23 -04:00
Dan Rubel d1385f099f support class native clause
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2996163002 .
2017-08-22 07:42:56 -04:00
Jacob MacDonald 649345392a add bazel worker for summary generation
BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2999263002 .
2017-08-21 14:22:55 -07:00
Paul Berry 247f20b581 Begin writing tests of the runtime checks needed for Dart 2.0 soundness.
The tests in this CL illustrate the major use cases where runtime
checks are required.  They are not exhaustive.  In a later CL I will
copy over some of analyzer's internal unit tests, which are much more
thorough.

So far these tests only pass when tested via analyzer, since analyzer
currently is the only platform that does the necessary analysis to
figure out which checks are needed.  In follow up CLs I will begin
introducing code into front_end to determine which checks are needed,
and to record this information in the kernel representation.

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

Review-Url: https://codereview.chromium.org/3002893002 .
2017-08-20 22:28:36 -07:00
Siva Annamalai cfac48179b 1. Figure out the modified libraries from the specifeid kernel file during
reload instead of computing it based on the source modification information.

2. Fix for failure in Unit test case https://github.com/dart-lang/sdk/issues/30322

3. Fix crash in test that was being skipped in https://github.com/dart-lang/sdk/issues/30109 and turn that test on.

This CL is work towards completing issue https://github.com/dart-lang/sdk/issues/28051

R=aam@google.com

Review-Url: https://codereview.chromium.org/2998983002 .
2017-08-18 13:42:19 -07:00
Samir Jindel 1f2844c992 [kernel] Allow arrow_function test to pass.
BUG=
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/3000073002 .
2017-08-16 18:08:14 +02:00
Dan Rubel 6a958b3edb refactor AstBuilder
Refactor the AstBuilder to use scriptTag, directives, and declarations
fields rather than pushing top level nodes on a generic stack
and later popping and sorting objects from the that generic stack.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2995963002 .
2017-08-16 09:47:27 -04:00
Dan Rubel aefd73b8d3 new handleInvalidTopLevelDeclaration event in fasta parser
This adds a new event for better fasta parser recovery
when the parser detects an invalid character at the top level.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2985703002 .
2017-08-16 09:36:24 -04:00
Paul Berry 19e1f44be3 Fix logic for locating dartfmt
When dartfmt is run as part of tests to verify that code generation is
up to date, the directory containing the resolved executable is
sometimes .../out/Release.../, but dartfmt is located in
.../out/Release.../dart-sdk/bin/dartfmt.  So we need to look in both
the resolved executable directory and in dart-sdk/bin for dartfmt.

R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/3002713002 .
2017-08-15 13:32:30 -07:00
Dan Rubel edc043a83b move endMetadataStar
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2998933002 .
2017-08-15 13:48:59 -04:00
Peter von der Ahé 07cf2557ed Implement type variables on local function declarations and expressions.
Closes https://github.com/dart-lang/sdk/issues/29798

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2994973002 .
2017-08-15 11:21:01 +02:00
Alexander Aprelev 69d9c26416 Update incremental load example so you can point it at different(flutter) sdk.
This allows to run flutter gallery example through incremental compiler(it assumes you built android_debug flutter/engine and have fetched flutter/flutter):

$HOME/p/d/dart-sdk/sdk/out/DebugX64/dart --packages=$HOME/p/d/dart-sdk/sdk/.packages $HOME/p/d/dart-sdk/sdk/pkg/front_end/example/incremental_reload/run.dart  --sdk-root=$HOME/p/f/t11/flutter/engine/src/out/android_debug/flutter_patched_sdk --input $HOME/p/f/t11/flutter/flutter/examples/flutter_gallery/lib/main.dart

which crashes with

R=sigmund@google.com

  error: compilation error: dart:_builtin: Internal problem: Unhandled null in builder.library., #0      internalProblem (package:front_end/src/fasta/problems.dart:29:3)
#1      unhandled (package:front_end/src/fasta/problems.dart:41:10)
#2      DillLoader.buildOutline (package:front_end/src/fasta/dill/dill_loader.dart:47:7)
<asynchronous suspension>
...
Review-Url: https://codereview.chromium.org/2995913002 .
2017-08-14 21:04:29 -07:00
Alexander Markov f40ce90eaa [fasta] Issue error for large integer literals
This CL adds error reporting for large integer literals into the
new kernel front-end. It is a part of preparation for limiting
integers to 64 bits in Dart. The new error is reported only
if int.parse() fails to parse integer literal, which could happen
in the --limit-ints-to-64-bits mode.

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

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2989073002 .
2017-08-14 11:08:40 -07:00
Dan Rubel 63991ba171 generate synthetic and error tokens when missing digit
Fix #30321

R=ahe@google.com

Review-Url: https://codereview.chromium.org/3002493002 .
2017-08-14 09:09:40 -04:00
Dan Rubel 02ce510601 translate missing ">" fasta error code to analyzer error
Fix #30320

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2996673002 .
2017-08-11 15:29:49 -04:00
Konstantin Shcheglov eb3c3d8f77 Extract BytesMemoryCache from MemoryCachingByteStore.
BytesMemoryCache will be used in Bazel workers to cache values of
inputs by their digest, so avoid reading the same files multiple times.

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

Review-Url: https://codereview.chromium.org/3000723002 .
2017-08-11 12:25:29 -07:00
Konstantin Shcheglov ada4db3fb6 When using SDK outline, transplant its names into the name root.
It's a bit messy that we have to break immutability of CanonicalName(s)
here. The alternative is not re-load SDK outline from bytes every time.
It is relatively expensive for small tests, although probably relatively
less expensive for large apps when we load hundreds of other libraries.

Thoughts?

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG= https://github.com/dart-lang/sdk/issues/30409

Review-Url: https://codereview.chromium.org/2995773002 .
2017-08-11 12:00:37 -07:00
Konstantin Shcheglov b01c225ade Enforce single computeDelta() invocation.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2993393002 .
2017-08-10 21:51:06 -07:00
Konstantin Shcheglov 222ce73a49 Add IncrementalKernelGenerator.acceptLastDelta()/rejectLastDelta().
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG= https://github.com/dart-lang/sdk/issues/30377

Review-Url: https://codereview.chromium.org/2996843002 .
2017-08-10 12:28:14 -07:00
Sigmund Cherem 046302f119 Add error_recovery.yaml: a place to add scenarios we explicitly want to model in
the front-end.

I added a couple examples from recent conversations as a starting point.

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

Review-Url: https://codereview.chromium.org/2998743002 .
2017-08-10 11:52:48 -07:00
Jens Johansen f6d6898bce [kernel] Offsets on loops
BUG=
R=ahe@google.com, johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2999633002 .
2017-08-09 08:39:26 +02:00
Konstantin Shcheglov 461ef144ab Use LibraryBuilder.target for imports/exports.
As recommended in https://codereview.chromium.org/2991753002/diff/20001/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart#newcode742

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

Review-Url: https://codereview.chromium.org/2993283002 .
2017-08-08 10:57:07 -07:00
Paul Berry 2e90786091 Implement type inference for named function expressions.
Named function expressions are not legal in Dart, but they are
accepted by the Fasta parser and BodyBuilder for error recovery
purposes, so the type inference engine needs to support them.

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

Review-Url: https://codereview.chromium.org/2993883002 .
2017-08-08 10:02:19 -07:00
Konstantin Shcheglov 06e94bc360 Add support for SDK outline in IKG.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2999563002 .
2017-08-07 17:09:04 -07:00
Paul Berry 6855bd28f8 Remove hack from KernelTypeInferrer.inferInitializer.
Now that all constructor initializers created by BodyBuilder implement
KernelInitializer, we no longer need a hack to skip initializers that
don't.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2992423002 .
2017-08-07 14:03:44 -07:00
Paul Berry 41170b0a15 When reordering constructor initializers, use correct types for temp vars.
In strong mode, when a call to a super-initializer is reordered, we
can use the static type of the super-initializer arguments to set the
types of the temporary variables that we use to do the reordering.
This is desirable because it might help avoid unnecessary casts.

In non-strong mode, we use `dynamic` for the temporary variables, to
replicate Dart 1.0 behavior.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2993193002 .
2017-08-07 13:55:40 -07:00
Paul Berry 107335c1d0 Add type inference for invalid constructor initializers.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2998573002 .
2017-08-07 13:37:27 -07:00
Konstantin Shcheglov 5011b024df Replace fake directories with actual createDirectory().
R=paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2994683002 .
2017-08-07 13:25:16 -07:00
Paul Berry 89c910b9c1 Move byte_store.dart and file_byte_store.dart to their own subdirectory.
This allows us to use the subpackage relationships test to verify that
they don't import any other parts of front_end, which paves the way
for the possibility of moving them to their own package in the future.

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

Review-Url: https://codereview.chromium.org/2990323002 .
2017-08-07 11:04:48 -07:00
Konstantin Shcheglov c28419bce0 Add support for SDK outline in KernelDriver.
I had to weaken file system createDirectory() to avoid conflicts when
we re-create SDK, and attempt to re-recreate its directory.

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

Review-Url: https://codereview.chromium.org/2993093003 .
2017-08-07 10:46:44 -07:00
Paul Berry ae4cbb50af Use "bool" as the downward inference context for assert conditions.
This addresses the type inference part of #30326.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2997513002 .
2017-08-07 10:36:51 -07:00
Sigmund Cherem b48584d3d0 Switch FE to use the libraries.json format.
This CL:
  * introduces the Dart API to operate over libraries specifications and describes
    the format we intend to use (see libraries_spec.dart)

  * implements serialization/deserialization for this API

  * switches over the front_end to use these APIs
    * public options accept a URI to the JSON file and no longer
       accept a `dartLibraries` map
    * internal code uses the LibrariesSpecification API

  * switches other dependencies on these APIs (resynthesizer_test and patch_sdk.dart)

This is the first step in migrating over to use the libraries.json format and
eventually remove the patched_sdk step. In particular, some of the next steps
include:
  * add a build step to generate .json files from .yaml files
  * add a libraries.yaml file for the sdk
  * split the patched_sdk step in two:
     * patching files
     * generating .dill files
  * add any missing support for patch-files in fasta
  * finally remove the patching files step, and only have a build step for generating
   .dill files

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

Committed: https://github.com/dart-lang/sdk/commit/abf2d23af2315fae6dc688741147ef677ec34835
Review-Url: https://codereview.chromium.org/2986303003 .
2017-08-07 08:41:28 -07:00
Peter von der Ahé dbe482caac Share code for parsing local functions.
R=danrubel@google.com, johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2999523002 .
2017-08-07 16:06:04 +02:00
Peter von der Ahé 98422979ac Parse type variables of local functions before return type.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2985673002 .
2017-08-07 13:46:47 +02:00
Sigmund Cherem b6d08264a3 Revert "Switch FE to use the libraries.json format."
This reverts commit abf2d23af2.

Reason for revert:
 - win build failed in patched_sdk (likely storing paths and not uris)
 - dart2js bots failed (missing flag)

Will fix the issues and reland shortly.

Review-Url: https://codereview.chromium.org/2993113003 .
2017-08-04 19:46:17 -07:00
Paul Berry 1b9ba53fb6 Implement type inference for asserts in constructor initializers.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2995553002 .
2017-08-04 17:55:11 -07:00
Sigmund Cherem abf2d23af2 Switch FE to use the libraries.json format.
This CL:
  * introduces the Dart API to operate over libraries specifications and describes
    the format we intend to use (see libraries_spec.dart)

  * implements serialization/deserialization for this API

  * switches over the front_end to use these APIs
    * public options accept a URI to the JSON file and no longer
       accept a `dartLibraries` map
    * internal code uses the LibrariesSpecification API

  * switches other dependencies on these APIs (resynthesizer_test and patch_sdk.dart)

This is the first step in migrating over to use the libraries.json format and
eventually remove the patched_sdk step. In particular, some of the next steps
include:
  * add a build step to generate .json files from .yaml files
  * add a libraries.yaml file for the sdk
  * split the patched_sdk step in two:
     * patching files
     * generating .dill files
  * add any missing support for patch-files in fasta
  * finally remove the patching files step, and only have a build step for generating
   .dill files

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

Review-Url: https://codereview.chromium.org/2986303003 .
2017-08-04 17:41:27 -07:00
Konstantin Shcheglov f5d2688206 Add documentation comments for enum and enum values. Resynthesize in analyzer.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2997473002 .
2017-08-04 16:53:52 -07:00
Stephen Adams bb1e91b597 Redo "Work-around for missing mixin-application charOffset"
TBR=sigmund@google.com

BUG=

Review-Url: https://codereview.chromium.org/2991403002 .
2017-08-04 15:35:38 -07:00
Konstantin Shcheglov 4ef7fd14c1 Record Typedef reference into Kernel FunctionType and resynthesyze typedefs in Analyzer.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2986393002 .
2017-08-04 12:02:26 -07:00
Konstantin Shcheglov 41bcfaa4a4 Add createDirectory() to MemoryFileSystemEntity.
We need this API to create a mock SDK in a way that makes
ProcessedOptions.validateOptions() to accept it - the SDK root
must exist.

Alternatively (or in addition to) we could make writeXYZ create parent
directories implicitly. So, to "create" a directory, you would need
to create a file in this directory.

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

Review-Url: https://codereview.chromium.org/2994643002 .
2017-08-04 11:46:02 -07:00
Paul Berry 1b03375d62 Implement type inference for super initializers.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2992263002 .
2017-08-03 19:39:13 -07:00
Stephen Adams 9442c1cf44 Revert "Work-around for missing mixin-application charOffset"
This reverts commit 2007487cf0.

Needs status file changes.

TBR=sigmund@google.com

BUG=

Review-Url: https://codereview.chromium.org/2992993002 .
2017-08-03 16:43:35 -07:00
Stephen Adams 2007487cf0 Work-around for missing mixin-application charOffset
BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2994553002 .
2017-08-03 14:47:31 -07:00
Paul Berry 867d682ff5 Test type inference for field initializers using "this." syntax.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2986403002 .
2017-08-03 14:32:06 -07:00
Paul Berry 57d71479e1 Perform type inference on constructor field initializer expressions.
Fixes #30251

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2994533002 .
2017-08-03 13:54:36 -07:00
Konstantin Shcheglov 60a576108c Store parts in Kernel Library, resynthesize parts in Analyzer.
R=ahe@google.com, brianwilkerson@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2988373002 .
2017-08-03 10:36:29 -07:00
Konstantin Shcheglov 58df70b83b Get logger / fileSystem / byteStore from ProcessedOptions.
R=ahe@google.com, brianwilkerson@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2992173002 .
2017-08-01 16:19:59 -07:00