Commit Graph

6018 Commits

Author SHA1 Message Date
Peter von der Ahé 06b8ce5d34 More dart2js strong mode cleanup.
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2934333002 .
2017-06-15 09:42:22 +02:00
Paul Berry 44f19d1a60 Lift nearly all top-level type inference restrictions.
This CL lifts all of the restrictions on top level type inference
except for one: the restriction that expressions used for top level
type inference cannot depend on the types of instance getters,
instance setters, or instance fields.  (That restriction will be
lifted in a later CL).

The technique is: to determine the dependencies of an expression,
rather than recurse through the expression applying the rules for what
constitutes an "immediately evident" expression, we simply do a dry
run of the inference algorithm and record what static fields were
accessed.  To avoid recording bogus dependencies on fields whose type
doesn't matter, this dry run skips subexpressions whose type isn't
needed.

To facilitate experimentation, I've left the old code in place, but
disabled it using a const bool `extendedTopLevelInference`.  The old
code can be re-enabled by setting this bool to `false`.  Once we are
sure that we want to proceed with this approach, we can remove the old
code.

Note that this makes the behavior begin to diverge with analyzer
behavior, so I've created a new test directory:
pkg/front_end/testcases/inference_new/, to hold test cases which
aren't expected to match analyzer.  Analyzer is only tested against
the test cases in pkg/front_end/testcases/inference/.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2935323002 .
2017-06-14 20:34:06 -07:00
Sigmund Cherem 5a63b0e339 Add flutter mode to patched_sdk
This is needed to create a platform.dill for flutter.

R=aam@google.com

Review-Url: https://codereview.chromium.org/2931773003 .
2017-06-14 17:29:36 -07:00
Konstantin Shcheglov a3d9f5303c Cache transitive files in FileState.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2937103002 .
2017-06-14 13:53:28 -07:00
Sigmund Cherem 5e5e62f9d8 Remove deps from reloader
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2937983002 .
2017-06-14 10:57:25 -07:00
Paul Berry e03744a740 Fix fasta testcase to avoid a super call to an abstract method.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2941813002 .
2017-06-14 10:55:31 -07:00
Peter von der Ahé 246334011a Ignore recoverable parser errors in outline_builder to avoid double reporting.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2940843003 .
2017-06-14 19:14:53 +02:00
Dan Rubel f8655ca568 update invalid hex digit recovery
* update invalid hex digit recovery for compatibility with analyzer
* address comments from https://codereview.chromium.org/2915093002

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2941583003 .
2017-06-14 11:18:34 -04:00
Konstantin Shcheglov 8925c68a71 Extract computing UnlinkedUnit(s) and cache them in ByteStore.
So, we usually don't have to parse most of the files in order to
compute imports/exports/parts and API signatures.

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

Review-Url: https://codereview.chromium.org/2939823002 .
2017-06-14 08:09:58 -07:00
Paul Berry 92a878f276 Fix argument names for handleIndexedExpression.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2935833002 .
2017-06-14 06:05:53 -07:00
Peter von der Ahé a189be6786 Copy fasta analyze_test to dart2js.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2942573002 .
2017-06-14 15:00:43 +02:00
Peter von der Ahé 6302a5b31b Implement metadata on classes and additional semantic checks.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2938793002 .
2017-06-14 14:59:53 +02:00
Peter von der Ahé 3c17c44d52 Implement metadata on methods and fields.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2935993002 .
2017-06-14 08:25:17 +02:00
Paul Berry 211e578273 Chase imports in analyzer's front_end_inference_test.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2936043002 .
2017-06-13 14:27:54 -07:00
Konstantin Shcheglov ba189d1fd3 Fix for mismatch between existing FileState data and UnlinkedUnit.
I started implementing using of UnlinkedUnit, and found that I like
isShow and names better. Also, parts are always only URIs. And I think
that we are not going to need setters.

R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2936833003 .
2017-06-13 13:33:23 -07:00
Paul Berry e2c2733556 Add expectations to infer_local_function_return_type.
Previously this test didn't really test anything.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2939523003 .
2017-06-13 13:31:12 -07:00
Paul Berry a1ecb46a4c Fix top level type inference for binary operators.
Multiple changes were required:

- The analyzer's mock SDK had an incorrect return type for
  `num.operator/`.

- We weren't considering the RHS of the binary operators `+`, `-`,
  `*`, and `%` to be an inference dependency (we need to, since the
  special overload rules for int depend on the type of the RHS).

- We weren't executing the overload logic when doing top level type
  inference.

- The logic for deciding what operators are overloaded was incorrect.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2940703002 .
2017-06-13 13:07:00 -07:00
Konstantin Shcheglov 0912f3c640 Use API signatures for library cycle signatures when possible.
If there are mixin applications, we still have to use full content hashes.

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

Review-Url: https://codereview.chromium.org/2939743002 .
2017-06-13 11:39:29 -07:00
Konstantin Shcheglov 751c71f034 Store also 'hasMixinApplication' flag with UnlinkedUnit.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2940673002 .
2017-06-13 11:20:04 -07:00
Konstantin Shcheglov fbaa7d45c4 FlatBuffers formats for storing unlinked units.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2939653002 .
2017-06-13 08:50:49 -07:00
Peter von der Ahé 73107ed49e Fix memory leak in test.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2940643002 .
2017-06-13 17:16:53 +02:00
Peter von der Ahé db2e915aac Improve recovery from compile-time errors.
R=danrubel@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2938573002 .
2017-06-13 16:00:15 +02:00
Peter von der Ahé 14e9d0bd89 Prepare for improved error recovery from compile-time errors.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2931423002 .
2017-06-13 15:59:18 +02:00
Peter von der Ahé 11f82b12d2 Update golden files.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2937683002 .
2017-06-13 10:46:04 +02:00
Peter von der Ahé ea30fb6a0d Follow-up to CLs 2933723002 and 2932973003.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2933813002 .
2017-06-13 09:45:41 +02:00
Peter von der Ahé 5095646191 Apply transformations after comparing to golden files.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2939533002 .
2017-06-13 09:40:35 +02:00
Peter von der Ahé b06a3602b4 Update golden files.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2933763002 .
2017-06-13 09:25:22 +02:00
Peter von der Ahé a78250d931 Support metadata on local variables.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2936503002 .
2017-06-13 09:15:54 +02:00
Peter von der Ahé 092ef81f95 Complain about cyclic typedefs.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2931303002 .
2017-06-13 09:13:23 +02:00
Peter von der Ahé 8da7993d63 Attempt to instantiate an enum class is a compile-time error.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2935593002 .
2017-06-13 09:12:51 +02:00
Peter von der Ahé f559a6d1e9 Throw NSM on unresolved factory redirection.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2933733002 .
2017-06-13 09:12:20 +02:00
Paul Berry 24bb748bc7 Implement type inference for "not" expressions.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2935763004 .
2017-06-12 17:44:25 -07:00
Konstantin Shcheglov c4de2886b1 Build reverse dependencies between LibraryCycle(s).
I plan using it for adding libraries that have not been affected by
the changed files, but must be sent to VM because of possible inlining.
We will find affected libraries and then climb up until we reach the
entry point.

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

Review-Url: https://codereview.chromium.org/2934933002 .
2017-06-12 17:30:52 -07:00
Paul Berry 31e2b4ac84 Add offsets to the == null calls inserted by null-aware desugaring.
This makes it possible to close a gap in testing instrumentation:
previously any annotations that were missing a file offset got
silently dropped.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2940453002 .
2017-06-12 14:06:51 -07:00
Paul Berry d4a64e52e7 Add type inference for assignments to this[...]
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2938443003 .
2017-06-12 14:00:59 -07:00
Paul Berry 5d58191948 Add type inference for assignments to super[...]
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2935783003 .
2017-06-12 13:34:38 -07:00
Konstantin Shcheglov 16833bce7c Add FileState.hasMixin/hasMixinLibrary properties.
We will use them to decide which kind of key to use for cache.

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

Review-Url: https://codereview.chromium.org/2928393004 .
2017-06-12 12:43:31 -07:00
Paul Berry cdb1e858d2 Add type inference for assignments to properties.
This covers explicit property accesses (using both `.` and `?.`) as
well as implicit properties of `this`.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2931363003 .
2017-06-12 11:33:06 -07:00
Konstantin Shcheglov e92aadb72f Report unused files to watch.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2933153002 .
2017-06-12 10:01:31 -07:00
Konstantin Shcheglov 5e8ceb60ab Implement GC for FileState(s).
Also fix for invoking watch().

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

Review-Url: https://codereview.chromium.org/2929363002 .
2017-06-12 08:48:03 -07:00
Dmitry Stefantsov 1c544012c3 Re-validate command line options after changing them in fasta
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2934763002 .
2017-06-12 11:30:42 +02:00
Peter von der Ahé 080a25f3a6 Various semantic checks on field initializers.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2929383002 .
2017-06-12 11:15:49 +02:00
Peter von der Ahé 2867303232 Various issues with duplicated names.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2934713002 .
2017-06-12 11:11:45 +02:00
Peter von der Ahé 0c7d657333 Complain about duplicated defer.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2933723002 .
2017-06-12 10:33:40 +02:00
Peter von der Ahé 35d77460e4 Various semantic checks regarding const and final.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2932973003 .
2017-06-12 10:27:22 +02:00
Peter von der Ahé 4e8203f9cd Improve error messages and recovery.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2924363002 .
2017-06-10 10:43:03 +02:00
Peter von der Ahé 202655ebb6 Add option for printing tokens produced by the scanner.
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2933533002 .
2017-06-10 10:14:36 +02:00
Peter von der Ahé 96e494d534 Complain about external methods with a body.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2930093002 .
2017-06-10 10:13:04 +02:00
Peter von der Ahé 043c0096ad Complain about use before declaration.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2924423003 .
2017-06-10 10:12:18 +02:00
Peter von der Ahé dcbac2be00 Complain about incorrect use of null-aware operations.
R=danrubel@google.com, johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2932723003 .
2017-06-10 10:11:36 +02:00