Commit Graph

2004 Commits

Author SHA1 Message Date
Paul Berry 8f5bcddc31 Implement type inference for assignments to a static variable.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2933643002 .
2017-06-09 17:36:20 -07:00
Paul Berry ef94f715a9 Add type inference for assignment to local variables.
Also fix some upwards inference cases for assignment to index
expressions.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2928033005 .
2017-06-09 15:13:14 -07:00
Konstantin Shcheglov c2f18fc930 Implement promised watch behaviour.
1. There are no reasons to use different watch function between
   computeDelta() invocations, so I moved it to the constructor.

2. We need to call it, and await, before reading files, not after.

3. Added tests.

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

Review-Url: https://codereview.chromium.org/2931183003 .
2017-06-09 15:04:30 -07:00
Konstantin Shcheglov 6f4bba5f03 Compute API signatures of files.
Note, that in non-incemental case this change has negative performance
implications - compilation is 10% slower. Computing MD5 hashes is very
expensive.

In real life scenarios we will cache API signatures and URIs as
part of unlinked information for each file.

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

Review-Url: https://codereview.chromium.org/2926883003 .
2017-06-09 11:41:29 -07:00
Konstantin Shcheglov cf59b1a0f9 Remove ClassHierarchy factory constructor.
KernelTarget already uses IncrementalClassHierarchy, and other clients
either need ClosedWorldClassHierarchy, so should explicitly create it,
or don't care, and can be switched to IncrementalClassHierarchy.

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

Review-Url: https://codereview.chromium.org/2930973002 .
2017-06-08 18:42:22 -07:00
Paul Berry 029771d746 Add type inference for complex assignments whose LHS is an index expression.
In later CLs I will expand on this code to handle other kinds of
complex assignments.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2926763003 .
2017-06-08 09:25:24 -07:00
Sigmund Cherem e551bef8ba add check of preconditions in run step.
BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2914773003 .
2017-06-07 15:45:55 -07:00
Sigmund Cherem aecfab68aa Add an incremental reloader example and a utility tool to trigger a reload by
hand.

The example includes:
 - an interactive UI that lets you trigger reloads without typing commands
 - a wrapper of the incremental kernel generator that invalidates files based on
 modification time stamps

BUG=
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2928483005 .
2017-06-07 13:44:56 -07:00
Sigmund Cherem ebdb0af64f Add integration test: hot reload + incremental compiler
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2925953002 .
2017-06-07 12:47:27 -07:00
Konstantin Shcheglov 400c7a0cb5 Set main procedure for Program.
Why is it called main _method_ when it is actually Procedure?

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

Review-Url: https://codereview.chromium.org/2931603003 .
2017-06-07 10:59:32 -07:00
Peter von der Ahé c4a8b146e0 Semantic checks on switch cases and fall-through errors.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2926533004 .
2017-06-07 11:26:34 +02:00
Peter von der Ahé d6a766bb14 Improve NSM handling.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2927613002 .
2017-06-07 09:28:13 +02:00
Paul Berry b18c325f68 Add int.toString() to analyzer mock SDK.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2922383003 .
2017-06-06 13:35:36 -07:00
Paul Berry 49110ba0d6 Fix implementation of fold() in analyzer's mock SDK.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2924853003 .
2017-06-06 13:23:45 -07:00
Paul Berry 7ab22d7ad2 Properly flatten FutureOr types when inferring the type of an async method.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2923733004 .
2017-06-06 13:13:08 -07:00
Paul Berry f7f9d1766f Fix corner cases of type inference with implicit references to .call.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2928613003 .
2017-06-06 13:00:26 -07:00
Paul Berry 32e78868bd Record method invocation targets that are not procedures.
We don't yet store the targets in the kernel representation, since
kernel currently requires method invocation targets to be procedures
(see https://codereview.chromium.org/2923653003/).  But we record the
target that we *would* store in the kernel to instrumentation so that
we can pass tests.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2920223008 .
2017-06-06 12:27:34 -07:00
Paul Berry 47d50e51a3 Add type inference for this expressions.
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2925603002 .
2017-06-06 09:54:19 -07:00
Dmitry Stefantsov 09e755196a Pass a Target instance to DillTarget instead of its name
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2924833002 .
2017-06-06 16:03:49 +02:00
Dan Rubel c36936f37f translate remaining fasta scanner error codes
This updates the fasta scanner to translate the remaining
previously untranslated error codes so that they will be seen
by the analyzer when the fasta scanner is used by analyzer.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2923113002 .
2017-06-06 09:08:13 -04:00
Paul Berry b5883633f7 Do not annotate type parameters of instantiated function types.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2925693002 .
2017-06-05 13:26:12 -07:00
Paul Berry 2513c2b93f Adjust expectations for parameterized closures to match front_end behavior.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2925583003 .
2017-06-05 12:51:37 -07:00
Paul Berry 2162b2da9b Improve annotation of type variables in type inference tests.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2918373003 .
2017-06-05 11:47:07 -07:00
Paul Berry 416a860de5 Mark some more type inference tests as passing.
These tests were already working--they just needed expectations files
(and in one case, a `main` method).

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2926433002 .
2017-06-05 10:07:27 -07:00
Dan Rubel c4449efa33 improve handling of missing interpolation identifier
When the fasta scanner finds a STRING_INTERPOLATION_IDENTIFIER token '$'
without an identifier, it now inserts a synthetic identifier

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

Review-Url: https://codereview.chromium.org/2922563002 .
2017-06-02 15:16:44 -04:00
Dan Rubel 5b6d7653fe fix unterminated interpolation expression handling
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2914213003 .
2017-06-02 13:47:08 -04:00
Dan Rubel b61f9f2343 improve fasta unterminated string recovery
This updates the fasta scanner
to append synthetic closing quotes to unterminated strings.

Rework of https://codereview.chromium.org/2912693002/

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

Review-Url: https://codereview.chromium.org/2915093002 .
2017-06-02 11:51:11 -04:00
Dmitry Stefantsov 1e2f06f8da Reapply "Use backend targets to run Kernel transformations in Fasta"
This reverts commit 0b424ca5d2

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2919003003 .
2017-06-02 16:10:28 +02:00
Peter von der Ahé 0db20bf56a Add testing configuration for Fasta.
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2919043002 .
2017-06-02 14:29:43 +02:00
Dmitry Stefantsov 0b424ca5d2 Revert "Use backend targets to run Kernel transformations in Fasta"
This reverts commit 8ff762067a.

TBR=ahe@google.com

Review-Url: https://codereview.chromium.org/2918923003 .
2017-06-02 12:45:34 +02:00
Dmitry Stefantsov 8ff762067a Use backend targets to run Kernel transformations in Fasta
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2918623004 .
2017-06-02 10:40:13 +02:00
Paul Berry eefdf15aa1 Perform type inference on default values of optional/named parameters.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2915763008 .
2017-06-01 21:18:37 -07:00
Paul Berry 3babf830e7 Remove remaining references to defunct parameter --failure-summary.
As of db06324975, this parameter is no
longer supported by the test framework.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2915933005 .
2017-06-01 21:13:14 -07:00
Paul Berry da869cff4e Fix inference test annotation of named/optional parameters in function types.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2915913004 .
2017-06-01 20:51:29 -07:00
Paul Berry 349f95f687 Fix a corner case of block closure inference.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2914983003 .
2017-06-01 16:07:59 -07:00
Peter von der Ahé 984b13052d Compute correct return type for factory methods.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2917853002 .
2017-06-01 14:02:05 +02:00
Peter von der Ahé 679cd68453 Update expectations files.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2921623002 .
2017-06-01 14:01:12 +02:00
Paul Berry 7cdf85da06 Fix a corner case of function type inference.
When an expression function's expression has type `dynamic` (or
`Null`, since `Null` is coerced to `dynamic`), the inferred return
type is taken from the context.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2921583002 .
2017-05-31 21:26:14 -07:00
Paul Berry a122a6409e Add some top level type inference rules for property gets.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2914113002 .
2017-05-31 15:17:16 -07:00
Paul Berry cd5bacbc54 Implement type inference for PropertySet.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2919623002 .
2017-05-31 15:09:28 -07:00
Paul Berry f9c1cab33b Remove some bogus type promotion code.
This code was part of an attempt to prototype some possible extensions
to type promotion to handle `if (x is! Foo)`.  I thought I had
rendered it harmless, but it was having some buggy effects.

Also added a test case demonstrating the problem.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2914093002 .
2017-05-31 13:40:33 -07:00
Paul Berry 26c61e4d22 Implement type inference for PropertyGet.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2921443002 .
2017-05-31 12:26:10 -07:00
Paul Berry 54c57f0015 Remove TODOs from KernelConditionalExpression._inferExpression.
The code is correct as is (at least insofar as it matches analyzer's
behavior).  I've added a new test to verify this, and I've made a
comment on the spec asking for it to be updated to match analyzer's
behavior.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2916633002 .
2017-05-31 10:04:20 -07:00
Peter von der Ahé cdfd07b9d3 Don't read platform files during testing, and avoid trimming broken programs.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2912353002 .
2017-05-31 15:03:30 +02:00
Peter von der Ahé 8ea78cbc3f Avoid using Invalid{Statement,Expression,Initializer}.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2906253004 .
2017-05-31 14:53:44 +02:00
Paul Berry b89e8cd1a1 Fix inferInvocation for top level inference.
When inferring the type of an invocation for top level inference, if
type parameters are not specified, then it is an error.  So we should
not recurse into subexpressions (even if inferenceNeeded is `true`).
This avoids confusion by making it clear to the user that we don't
take subexpressions into account when doing top level type inference,
even when recovering from type inference errors.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2911323002 .
2017-05-30 14:43:06 -07:00
danrubel 427c06c2fe fix fasta scanner adapter lineStarts
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2913043002 .
2017-05-30 16:54:05 -04:00
Konstantin Shcheglov 8460f770b1 Serialize also canonical names of 'interfaceTargetReference'.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2906693002 .
2017-05-30 10:54:14 -07:00
Paul Berry 6a809aa432 Add type inference logic for "for-in" loops.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2908973002 .
2017-05-29 07:35:46 -07:00
Dan Rubel 767d5ecbfd Revert "improve fasta unterminated string recovery"
This reverts commit 6907345fb9.

Review-Url: https://codereview.chromium.org/2907093002 .
2017-05-28 23:40:08 -04:00