Commit Graph

6018 Commits

Author SHA1 Message Date
Konstantin Shcheglov ffadd1ed3d When running analyzer_cli with --preview-dart-2, load SDK from vm_outline.dill.
We need this to be able to access classes that are required by Fasta,
but come from VM patches.

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

Bug:
Change-Id: I4d29e1dca42e016446516a2dab0fae138cb74548
Reviewed-on: https://dart-review.googlesource.com/16863
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-26 23:34:18 +00:00
Sigmund Cherem a8d13565cd Add support for deferred loading in fasta
Change-Id: I2a5489b618210935b4b21c583aba9738a5e3f645
Reviewed-on: https://dart-review.googlesource.com/13441
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-26 23:22:48 +00:00
Konstantin Shcheglov d0f9e9927b Combine class constructors and fields.
Testing is simple, but wordy.
I plan to replace testing of final states with text dumps.

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

Bug:
Change-Id: I82dd3e7c575b68f6889e07f0084b5f9070538d39
Reviewed-on: https://dart-review.googlesource.com/16326
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-26 21:46:50 +00:00
Dan Rubel a02662c47e improve errors and recovery for factory methods
Change-Id: I55711bdb0f98c0747c7055bebda173702c2c138f
Reviewed-on: https://dart-review.googlesource.com/16720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-26 21:21:00 +00:00
Peter von der Ahé d21a98a104 Clean up redirecting factory bodies
Change-Id: Ic780d7ae82db8d3e83ee3b565b7af448721ce5dd
Reviewed-on: https://dart-review.googlesource.com/16741
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-10-26 16:26:22 +00:00
Paul Berry 5c143d4353 Test a corner case of forwarding stubs.
Change-Id: Ifa41ee5caa8b353c34163d76ea799a8402527b2d
Reviewed-on: https://dart-review.googlesource.com/16685
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-10-26 13:58:51 +00:00
Dan Rubel 49eb459c11 test for issue 31155
Change-Id: I0ac565a8ffc27a921c331fc50343e32b907f3100
Reviewed-on: https://dart-review.googlesource.com/16335
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-26 13:58:41 +00:00
Paul Berry cc3f95b41d Check procedure kind when matching up forwarding stubs during mixin resolution.
Otherwise we might match up a getter to a setter and crash.

The test cases indirectly verify that mixin resolution does the right
thing by checking the semantics of the generated code.  These tests do
not pass yet, because covariance checks are not yet implemented in the
VM.

Change-Id: Ibe6d8b7479f86151c515c45c20ed7c880bf2ad43
Reviewed-on: https://dart-review.googlesource.com/16686
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-26 12:54:08 +00:00
Paul Berry 6b5d8b9af0 Fix covariance debugging in the case where Procedure.function is null.
This can happen when the Procedure being considered is a SyntheticAccessor.

Change-Id: I9aaea4eca37ec297ce55c4c9a820486f3a3c0827
Reviewed-on: https://dart-review.googlesource.com/16681
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-25 21:45:46 +00:00
Paul Berry 5a6ae2877a Fix expectations for test "multiple_interface_inheritance".
The behavior was fixed some time ago, but I failed to notice that I
should have re-enabled the test because its expectations were wrong.

Fixes #30547.

Change-Id: I8b740a8b7f478cc9223cd5d91d2bc0e7e5cf2855
Reviewed-on: https://dart-review.googlesource.com/16700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-25 21:40:28 +00:00
Brian Wilkerson 5b6260ce13 Add support for reporting errors that span multiple tokens
Change-Id: I257225465d79e1831392af14d98e0799f0a8b184
Reviewed-on: https://dart-review.googlesource.com/16660
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-25 21:19:58 +00:00
Paul Berry cb51e4b26d Fix forwarding stubs when inherited interface is different from super method.
When the interface inherited for a method is different from the super
method (due to the inherited interface method having a more specific
type than the super method), we determine the set of covariance fixes
that need to be made by looking at the inherited interface method
(since that's the method that the forwarding stub will be created
from).  However, in order to decide whether the forwarding stub needs
to be concrete, we need to compare the checks needed against the
checks that are made by the super method.

A few unit tests of this functionality didn't have the correct
expectations (or contained other errors); they have been fixed.

Change-Id: I70cff371be3bf8f3680c756feb6047794b650a9d
Reviewed-on: https://dart-review.googlesource.com/16680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-25 21:19:16 +00:00
Paul Berry cded10154c Fix type inference of compound assignments when getter/setter have different types.
For compound assignments, we need to look up the "combiner" operation
in the type of the getter (not the setter), since the receiver of the
combiner operation is the value that was read.  This is necessary for
soundness.

Change-Id: I02e0e93310b6b6b94d4a6253d4cf2fc1d3c69cd5
Reviewed-on: https://dart-review.googlesource.com/16607
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-25 18:54:17 +00:00
Brian Wilkerson f6455328b8 Pass length information to listeners when reporting errors
Change-Id: I786cfcaa5631b817c56bb7b68b3bcc440d055344
Reviewed-on: https://dart-review.googlesource.com/16340
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-25 14:15:29 +00:00
Aske Simon Christensen 6e406c78e8 Check if target of redirecting factory is constructor of abstract class
Update status of tests fixed by https://dart-review.googlesource.com/c/sdk/+/13926

Change-Id: I81f3ed273b5a2e17a278ff8b86129c8fdf161749
Reviewed-on: https://dart-review.googlesource.com/14520
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-25 12:23:39 +00:00
Jens Johansen c8aa9d26f7 [kernel] Don't serialize external libraries for vmservice_io.dill
Before this CL vmservice_io.dill included the entire platform
(marked as external), and as thus the dill file was big (4MB+).

With this CL the external libraries are not serialized. While this
doesn't appear to change anything speed-wise it does make the
vmservice_io.dill go from 4MB+ to ~225KB.

Bug:
Change-Id: I6243677b5f4667318c6771132fc0326b7c62ecd0
Reviewed-on: https://dart-review.googlesource.com/8501
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2017-10-25 11:51:41 +00:00
Jens Johansen f94ffbf624 [kernel] Move procedure lazy loading to function node body
Previously lazy loading was done in Procedure by lazy loading functionNode,
now lazy loading is done (only through Procedure) in the functionNode by
lazy loading the body.

Bug:
Change-Id: I25cc86d038123ed4992162b65aa95781ea2c56e8
Reviewed-on: https://dart-review.googlesource.com/15560
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-25 08:45:59 +00:00
Paul Berry f5cb2b52e6 Test a corner case of forwarding stubs.
These tests check that forwarding stubs are properly generated when
the type of the forwarding stub comes from a different class than the
superclass.

Two of the tests currently fail--I will follow up with a CL that fixes
them.

Change-Id: Id3db38bdc869e91d74fc279f39696f108d174a0d
Reviewed-on: https://dart-review.googlesource.com/16334
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-25 01:22:19 +00:00
Paul Berry fa7296a25e Add annotations to testcases for contravariance.
Change-Id: I1ce20f30948af8ff3de304ace036cbcf914861c9
Reviewed-on: https://dart-review.googlesource.com/16380
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-24 22:13:28 +00:00
Konstantin Shcheglov fdb1ce53f1 Implement FlutterByteStore with temporary protected keys.
R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug: https://github.com/dart-lang/sdk/issues/31138
Change-Id: I8aa7344a0a9e232c28a077a7e40211a44685db63
Reviewed-on: https://dart-review.googlesource.com/15861
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-10-24 20:07:00 +00:00
Konstantin Shcheglov ccbed2d33c Parse metadata for part directives and resynthesize in Analyzer.
R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug: https://github.com/dart-lang/sdk/issues/30284
Change-Id: Id869144a6fce170dbc74b0595b545238595be84d
Reviewed-on: https://dart-review.googlesource.com/15983
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2017-10-24 19:40:08 +00:00
Konstantin Shcheglov ebc91d103c Implement combining Class procedures.
R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug:
Change-Id: I4f93637fef4a41acb987d65da75c4ded27c66f6e
Reviewed-on: https://dart-review.googlesource.com/16060
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-24 18:07:18 +00:00
Paul Berry 713712b264 Tighten up return types for resolve/finalize methods.
These methods both are guaranteed to return Procedures, due to the
fact that we only store Procedures in the `candidates` lists.

Change-Id: Ia07f9383baede71960717f8ef905fdd042baf841
Reviewed-on: https://dart-review.googlesource.com/16300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-24 17:12:42 +00:00
Sigmund Cherem 5efdb5f346 Allow to specify the platform-binaries as an environment option in our unit
tests.

Bug: https://github.com/dart-lang/sdk/issues/31178
Change-Id: Ia845287c101020792b382c2ae401eda2a9ad4508
Reviewed-on: https://dart-review.googlesource.com/15766
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2017-10-24 16:32:28 +00:00
danrubel 007be49357 update parser comments
Change-Id: Id2e987d6d2a6c2155dbdad768f3a9e07995a5538
Reviewed-on: https://dart-review.googlesource.com/16120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-24 12:11:42 +00:00
Peter von der Ahé c6d9aac6ee Report positions for unresolved types.
Change-Id: I0d00c0fa61f7df74c428568a1ac8b8da8a50a08a
Reviewed-on: https://dart-review.googlesource.com/16242
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-10-24 12:07:47 +00:00
Peter von der Ahé e63fe4c6a0 Remove unused field
Change-Id: I0f74541a2c59702dfa5570ce95ae0ad2fb9d87b2
Reviewed-on: https://dart-review.googlesource.com/16241
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-10-24 12:02:39 +00:00
Peter von der Ahé 5041e86d6c Make resolveIn and bind non-abstract
Change-Id: If349249b91b7b4a6ff0c36728c1425840a5bb087
Reviewed-on: https://dart-review.googlesource.com/16181
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-10-24 11:59:40 +00:00
Peter von der Ahé 9145326f3b Simplify resolveTypes.
Change-Id: Ib95ae14bc3285ff4b4fd96055fe2ad45fa9f9be8
Reviewed-on: https://dart-review.googlesource.com/15082
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-10-24 11:51:33 +00:00
Peter von der Ahé 99f0637343 Remove MixinApplicationBuilder.subclassName.
Change-Id: I4bad985fc21e6e541b7b57e38b031e37c99cd829
Reviewed-on: https://dart-review.googlesource.com/15181
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2017-10-24 11:43:28 +00:00
Peter von der Ahé ce05bf5a40 Reproduction for lazy loading issue in bulk compiler.
Change-Id: Id2989224c42b414164aae8412d2453d9e79172bd
Reviewed-on: https://dart-review.googlesource.com/15480
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2017-10-24 11:23:39 +00:00
Peter von der Ahé e82d91efc9 Recover from bad setter in abstract method
Closes https://github.com/dart-lang/sdk/issues/31154

Change-Id: I50cac9a5873e191f72fe02314a2bb061270c684d
Reviewed-on: https://dart-review.googlesource.com/15540
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2017-10-24 11:01:18 +00:00
Peter von der Ahé c8dd20ae41 TypeBuilder isn't a Builder.
This removes a number of properties, most notably fileUri and
charOffset from TypeBuilder.

Change-Id: I9508bfb754f725199a8677d10d7d4be9eb351821
Reviewed-on: https://dart-review.googlesource.com/15180
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2017-10-24 10:43:08 +00:00
Kevin Millikin 034501e805 Handle forwarding stubs in mixin application classes
Before: mixin application classes could not have methods of their
own.

After: type inference will sometimes insert forwarding stubs in mixin
application classes.  In the mixin elimination transformation, these
forwarding stubs are replaced with the methods of the mixin class if
they have the same name, but the parameter flags from the forwarding
stub are retained.  The other forwarding stubs are left as methods of
the class.
Change-Id: I5ee89d6b1fc83194df82009c2800b54ce856e8c5
Reviewed-on: https://dart-review.googlesource.com/15887
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2017-10-24 08:04:18 +00:00
Dan Rubel dde9eb69a9 add handleInvalidMember to improve recovery
* add handleInvalidMember event
* update NodeListener to track invalidMemberCount
* update ClassMethodModifierContext to trigger handleInvalidMember
  event, reducing number of superflous errors.

Also, address comment
https://dart-review.googlesource.com/c/sdk/+/16040/1/pkg/analyzer/lib/src/fasta/ast_builder.dart#1580
Change-Id: I4c630faeee7731e2f85bbfaf0a6790bf6f4382b3
Reviewed-on: https://dart-review.googlesource.com/16100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2017-10-24 02:58:28 +00:00
Brian Wilkerson 9575182790 Pass the period in field formal parameters to listeners to enable recovery
Change-Id: I04975f3fb1aeb3b3b6b842e3373a792f13a91685
Reviewed-on: https://dart-review.googlesource.com/16000
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-23 20:57:00 +00:00
Brian Wilkerson 6d11a2e3b4 Explicitly pass the colon following the default case in a switch to allow better recovery
Change-Id: I7e39727e1dd0a005e8e6ed565ec16cc8c503d049
Reviewed-on: https://dart-review.googlesource.com/15960
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-23 20:55:29 +00:00
Konstantin Shcheglov a8fa25afa2 Add more tests for combining top-level getters and setters.
R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug:
Change-Id: I124c6914b08a70dcbd7cb51d30be28ff45f04299
Reviewed-on: https://dart-review.googlesource.com/15982
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-10-23 20:04:29 +00:00
Brian Wilkerson 930d4317cd Enable the assert in AstBuilder.handleIdentifier
Change-Id: I1d33efd5d0ff2f0c0e3625de7787217de4ccba26
Reviewed-on: https://dart-review.googlesource.com/15900
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2017-10-23 18:08:18 +00:00
Brian Wilkerson 6f35dd1f12 Rename parseIdentifier to ensureIdentifier and change it to return the parsed identifier
Change-Id: I8e425646e8853079f2638fdf8dacb6ad11bb061f
Reviewed-on: https://dart-review.googlesource.com/15840
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-23 16:48:38 +00:00
Paul Berry 9aa3a0eec0 Desugar a method invocation into a getter/call when necessary to add an "as" check.
Change-Id: Ic0754a9cfa80a1a91f7c421fb5a1cd55e63e1534
Reviewed-on: https://dart-review.googlesource.com/15762
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-21 11:59:43 +00:00
danrubel d77c683cf0 new verifyErrorTokens scanner utility flag
This adds a verifyErrorTokens environment variable to
pkg/front_end/tool/_fasta/scanner.dart utility.
If specified, then additional validation of the token stream
is performed to help me track down a reproduction case for
https://github.com/dart-lang/sdk/issues/31098
Change-Id: Ib44344b5f0e183df6317772c989e4dc8858605ff
Reviewed-on: https://dart-review.googlesource.com/15780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2017-10-21 01:20:29 +00:00
Sigmund Cherem bc1dd524ba Use custom URIs on most of front_end unit tests
This required a couple small fixes where we had made assumptions in our system
about not having anything other than dart, package, and file URIs.

Change-Id: Ie0943f609ceeaacf3fb284ceba0df5c55c315b0b
Reviewed-on: https://dart-review.googlesource.com/11650
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-21 00:26:58 +00:00
Paul Berry e16478ed2e Fix instrumentation logic to annotate when forwarding stubs are abstract.
Change-Id: I8e59a55ad70988efa8743afd1875a8085f3e8d15
Reviewed-on: https://dart-review.googlesource.com/15652
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-20 21:51:30 +00:00
Konstantin Shcheglov ed69540e4e Issue 31167. Add IncrementalKernelGenerator.setState().
R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug: https://github.com/dart-lang/sdk/issues/31167
Change-Id: I48971fc86c440fec636a775fc68d4292b0309dfa
Reviewed-on: https://dart-review.googlesource.com/15649
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-20 21:27:18 +00:00
Paul Berry 52b93fbd12 When disableTypeInference flag is set, skip {prepare,perform}TopLevelInference.
Change-Id: Iba760999813caf5b585cfb1dbe8b8683b86d6137
Reviewed-on: https://dart-review.googlesource.com/15653
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-20 21:24:58 +00:00
Brian Wilkerson f4477e1437 Split an index operator into two brackets when using it for an empty list literal
Change-Id: Idd4d64e19f21dc7c9fd7f56bb7ea607556f54090
Reviewed-on: https://dart-review.googlesource.com/15700
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-20 21:14:33 +00:00
Brian Wilkerson 7932a17557 Recover from having a missing closing bracket in an index expression
Change-Id: I2fa44b001cf3b72f21a9c3b5859e41d0ecdd7ad3
Reviewed-on: https://dart-review.googlesource.com/15680
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-20 21:06:59 +00:00
Brian Wilkerson bf6f398ef8 Make minus a valid prefix operator
Change-Id: Id741a5b1c753f564b54b4fd3d47cd90162a182c9
Reviewed-on: https://dart-review.googlesource.com/15660
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-20 21:06:29 +00:00
Paul Berry c3dcd3af44 Add "as" checks to assignment combiners when needed due to return type contravariance.
Change-Id: If3a84f02cb45104a673d567472ffac4c55b0be61
Reviewed-on: https://dart-review.googlesource.com/15648
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-20 20:13:00 +00:00