Commit Graph

1972 Commits

Author SHA1 Message Date
Sigmund Cherem e5d20a7749 Add type to loadLibrary tearoff
Fixes https://github.com/dart-lang/sdk/issues/32604

Change-Id: If068cdf66b87f9665586c9ad7a39cb8392db9ae6
Reviewed-on: https://dart-review.googlesource.com/49042
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-04-03 21:53:29 +00:00
Dan Rubel 701e02b2fa Update AstBuilder to handle named function declaration
Change-Id: I34e699e49b7138b6d0ecf7087afef9739888c716
Reviewed-on: https://dart-review.googlesource.com/49240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-03 20:45:19 +00:00
Dan Rubel 57d6ec265d Improve AstBuilder for-in recovery
Fix AstBuilder recovery when for-in expression is not a simple identifier

Change-Id: Id32ec4f8054de7870d8424c489dc5f5819ec7632
Reviewed-on: https://dart-review.googlesource.com/49181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-03 18:08:29 +00:00
Jens Johansen 38fae026b4 Allow to output full component via computeDelta
This is the second attempt at this change.
The original try was committed as f9c7a4a22d.
The revert of that was committed as 2f68e82526.

This CL allows users of the incremental compiler to ask for a computeDelta
call to include the full Component in the output,
basically turning the incremental compiler into a batch compiler.

This CL furthermore changes the frontend_server (in pkg/vm) to use this
functionality.

This change - used in flutter - takes the time it takes to run
`flutter test` in `packages/flutter` from ~8 minutes 30 seconds to
~2 minutes 30 seconds (on my machine).

Fixes #32663.

Change-Id: I073e77b3596b33a24cabcfbcedf97bb0be7aa450
Reviewed-on: https://dart-review.googlesource.com/49125
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-04-03 12:59:48 +00:00
Lasse Reichstein Holst Nielsen 155e55cbb1 Remove defaultValue parameter from Stream.first/lastWhere.
Change-Id: Id1f642a2f29086a5a7478c771ce16987b340861f
Reviewed-on: https://dart-review.googlesource.com/43420
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-03 10:58:15 +00:00
Dmitry Stefantsov 59d859645e [fasta] Do new/const insertion in simple cases
Bug: http://dartbug.com/32553
Change-Id: I58e201ffd5019a5a65c0ac188aaab363225b5296
Reviewed-on: https://dart-review.googlesource.com/48481
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-30 18:35:05 +00:00
Régis Crelier 7d90df42f1 [Kernel, VM runtime] Hook up bool checks in strong mode (fixes #32336).
Update kernel status file.

Change-Id: I08b153d431c15870e0251e7dd760213c795579c9
Reviewed-on: https://dart-review.googlesource.com/48707
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-29 16:10:52 +00:00
Dan Rubel e260a01272 Replace skipTypeReferenceOpt with computeType part 1
This CL modifies class member parsing to replace one use of skipTypeReferenceOpt
and parseType with a more efficient call to computeType. In addition, it updates
computeType to detect when a builtIn is used as a type and improves recovery
of invalid operator declarations.

Change-Id: Idbe96584ef3c2e72faf91037668421bb0f1055d0
Reviewed-on: https://dart-review.googlesource.com/48221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-25 20:03:34 +00:00
Siva Annamalai 2f68e82526 Revert "Allow to output full component via computeDelta"
This reverts commit f9c7a4a22d.

Reason for revert: This CL breaks the restart functionality in Flutter, when we restart we end up with an empty app.dill file (60 bytes).

Original change's description:
> Allow to output full component via computeDelta
> 
> This CL allows users of the incremental compiler to ask for a computeDelta
> call to include the full Component in the output,
> basically turning the incremental compiler into a batch compiler.
> 
> This CL furthermore changes the frontend_server (in pkg/vm) to use this
> functionality.
> 
> This change - used in flutter - takes the time it takes to run
> `flutter test` in `packages/flutter` from ~8 minutes 30 seconds to
> ~2 minutes 30 seconds (on my machine).
> 
> Change-Id: Ia185d28da1f97b0be5dad8814cd01a8f13482724
> Reviewed-on: https://dart-review.googlesource.com/47020
> Commit-Queue: Jens Johansen <jensj@google.com>
> Reviewed-by: Peter von der Ahé <ahe@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=ahe@google.com,vegorov@google.com,jensj@google.com

Change-Id: I5ff39f9d78319413f4bbb7800e24bf27ab4ada9c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/48240
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-03-23 21:20:30 +00:00
Jens Johansen f9c7a4a22d Allow to output full component via computeDelta
This CL allows users of the incremental compiler to ask for a computeDelta
call to include the full Component in the output,
basically turning the incremental compiler into a batch compiler.

This CL furthermore changes the frontend_server (in pkg/vm) to use this
functionality.

This change - used in flutter - takes the time it takes to run
`flutter test` in `packages/flutter` from ~8 minutes 30 seconds to
~2 minutes 30 seconds (on my machine).

Change-Id: Ia185d28da1f97b0be5dad8814cd01a8f13482724
Reviewed-on: https://dart-review.googlesource.com/47020
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-23 12:07:56 +00:00
Paul Berry 1ac627a026 Set the file offset for Let node in implicit tearoff of call
Fixes #32629.

Change-Id: I96e12aa2c575853868846ce438b786172ec8faa5
Reviewed-on: https://dart-review.googlesource.com/48080
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-03-23 11:50:56 +00:00
Dmitry Stefantsov dacf9d4e18 Add tests for noSuchMethod forwarders
Change-Id: I22cf843faf886ae877b351017a7a8e5ab25f7f0a
Reviewed-on: https://dart-review.googlesource.com/47881
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-03-23 11:26:36 +00:00
Peter von der Ahé e21b54159f Tests incremental compilation of parts in packages.
Change-Id: Ic432bc255df1fe356f281779132a92391e3a0c6c
Reviewed-on: https://dart-review.googlesource.com/48100
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-03-23 09:30:25 +00:00
Jens Johansen 83bfbcdd96 Incremental compilation: computing class hierarchy for reachable things only
When incrementally compiling, we can have builders for things that aren't
included anymore. Such builders should not introduce errors.

Change-Id: Ia0487d84819028913d54f6b55a2882e620009bd9
Reviewed-on: https://dart-review.googlesource.com/47223
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-22 09:08:46 +00:00
Jens Johansen 0dd2a8dbdb Incremental compiler: Only include libraries loaded from dill if used
Prior to this CL, if loading a library from the dill file what ends
up being unused in the new program it would still be included in the
output. This CL introduces a test and fixes the problem.

Change-Id: I60dd9c3b6bdb959e103f0d2a5653d036b6653140
Reviewed-on: https://dart-review.googlesource.com/46983
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-22 09:08:46 +00:00
Jens Johansen bb2bf609be Incremental compiler: Deal with disappearing package
Prior to this CL, if incrementally compiling something and the .packages
file changed we could get a crash when trying to translate a package url.
This CL introduces a test and fixes the problem.

Change-Id: Ie1874780df7ade394eecef05835b0d9203f4c2b5
Reviewed-on: https://dart-review.googlesource.com/46982
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-22 08:57:36 +00:00
Jens Johansen 2e366e8c9a [fasta] Refactor incremental_load_from_dill_test
Split into 2:
- One with a "smoke-test" of dart2js.
- One with several small examples that has caused problems in the past.

The latter of the two is now based on package:testing and the test-cases
are saved as yaml files.

Change-Id: I8b588e9b42edc73f58a07292a1226e37cc458d89
Reviewed-on: https://dart-review.googlesource.com/45505
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-22 08:57:36 +00:00
Samir Jindel 34cfabff5d Add expectation.
Change-Id: I1b07ece35aece7cd2de57065529209635721144b
Reviewed-on: https://dart-review.googlesource.com/46760
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-15 13:50:57 +00:00
Samir Jindel 4289a9967b Check expected outputs of transforms.
Change-Id: I56ff4d4391b7a22d709dc60b696646895928e34c
Reviewed-on: https://dart-review.googlesource.com/46100
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-03-15 12:11:13 +00:00
Dan Rubel 71e16622cd Improve for statement errors and recovery
This CL updates fasta parsing of `for` statements
to detect additional errors and improve recovery.

The parser originally called parseType when parsing `for` statements
which committed the parser down a particular path
and limited the ability of the caller to gracefully recovery.
Now the parser calls computeType, which parses and caches
the type information, so that the caller has more opportunity
to recover gracefully.

Change-Id: I6296ffb1f75e77a87a7533bfca77dae18cfcf60d
Reviewed-on: https://dart-review.googlesource.com/46383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-15 11:43:13 +00:00
Dmitry Stefantsov 8c82c3b5fe Fix instantiate-to-bound algorithm implementation
Change-Id: Ia13867b0ffab9fab527d8dba6d4f10cc90c002c2
Reviewed-on: https://dart-review.googlesource.com/43061
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-03-13 19:18:34 +00:00
Dmitry Stefantsov f8995da6aa Report a compile-time error on magic const
When inferring const or new for expressions that aren't required to be const,
Fasta always choses new. That's not correct, and this is a short-term work
around to avoid introducing a breaking change in the future. The plan is to
implement this feature correctly, but that will require more time than we have
right now.

Originally submitted by ahe@google.com.  Added: status file fixes.

Change-Id: I2d70bd2488de6b69fcd5546c1f4654dfbbb30b7f
Reviewed-on: https://dart-review.googlesource.com/46340
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-03-13 19:07:12 +00:00
Lasse R.H. Nielsen 6f13072739 Add toString to MapEntry.
Fixes #32464

BUG: http://dartbug.com/32464

Change-Id: I1462452c3f6a7838aeaaa84e3fb0e092a3f85338
Reviewed-on: https://dart-review.googlesource.com/45704
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2018-03-13 13:57:59 +00:00
Paul Berry 424ae0f5e4 Check contravariance of property gets that resolve to fields.
Fixes #32501

Change-Id: Ic3c5aca1d12b73e40e63c6cdd8304b95f54e5497
Reviewed-on: https://dart-review.googlesource.com/46002
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-03-13 10:37:09 +00:00
Samir Jindel 290c576264 Remove inherited setters for mixed-in fields and copy their covariance-bits.
Currently the transformed expectations are not checked.
This will be implemented shortly.

Mixin code from kmillikin@ (https://dart-review.googlesource.com/c/sdk/+/46060).
Test from jensjoha@.

Change-Id: If8abe4950b80bbec993833700bfeeb8be15f9585
Reviewed-on: https://dart-review.googlesource.com/46061
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-03-12 14:25:01 +00:00
Dmitry Stefantsov f820555d19 Add test of type checks on redirecting initializer arguments
Bug: http://dartbug.com/32343
Change-Id: I863e370a3148f7a7da7a4c4599e005b381ceffa7
Reviewed-on: https://dart-review.googlesource.com/44465
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-03-12 08:49:37 +00:00
Lasse Reichstein Holst Nielsen b3c12d4e3a Dart 2 Libraries Wave 3
Add `typeArguments` to Invocation.
Add constructors to Invocation, making it less necessary for users to create their own implementations.
Add tests.
Add Symbol.unaryMinus and Symbol.empty constants.

Change-Id: I70cb3265f9413617cf57fce1297e393a29eeb26a
Reviewed-on: https://dart-review.googlesource.com/40741
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-03-08 16:36:07 +00:00
Paul Berry db08061424 Handle implicit tear-off of .call when an implicit downcast is required
Previously, we were setting `expression` incorrectly after generating
the implicit tear-off of .call, so if an implicit downcast was needed
as well, it was not attached to the proper kernel node, and the
resulting kernel representation was invalid.

Addresses the front end manifestation of #32426.

Change-Id: Ibd86b75c54a53db1fc4606b7583910c57e1c4aae
Reviewed-on: https://dart-review.googlesource.com/45522
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-03-07 13:59:39 +00:00
Paul Berry d17db1d5f3 Pass type inference context down to field initializer when type inferred via override
Fixes #32412.

Change-Id: I52660ffd5a6eadd10c6d62a17c64872946aa2a4a
Reviewed-on: https://dart-review.googlesource.com/45520
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-07 11:45:34 +00:00
Peter von der Ahé 9f56e28372 Mixin Applications with a Vengeance
Change-Id: I213f99234f29abd7e2ec03dc8451ed6dd16f3d03
Reviewed-on: https://dart-review.googlesource.com/45021
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-06 15:15:57 +00:00
Paul Berry 90098c6c49 In front_end, treat ? and _ type contexts as equivalent.
We do this by requiring that the context argument to inferExpression
is non-null (since `_` is represented by `null`).  Instead of passing
`null` as a type context, we pass `const UnknownType()`, which
represents `?`.

See #32291.

Change-Id: I9a0d0f3bcd74e6226004c85f63cf8be49934388a
Reviewed-on: https://dart-review.googlesource.com/43761
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-03-01 13:20:28 +00:00
Paul Berry 0d42430ed8 Change the implicit tear-off of call methods to be null-aware.
We want the implicit tear-off of a `call` method to succeed even if
the value is `null`, so we need the implicit tear-off to be equivalent
to `?.call`.

Change-Id: I5134858b84e501081a52d59b78b101597bdfcc4a
Reviewed-on: https://dart-review.googlesource.com/43480
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-27 09:44:27 +00:00
Aske Simon Christensen 69775fbf8c Allow constructors called 'get' or 'set'.
Closes https://github.com/dart-lang/sdk/issues/32196

Change-Id: I61ea62b5c3d96634b1830383217ba6ef2aef8b7b
Reviewed-on: https://dart-review.googlesource.com/43741
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-02-26 17:30:17 +00:00
Dan Rubel a8be36f42a Report error on dynamic with type arguments
Change-Id: Ie95e1c1b0b23cb3a3b6d4b7b7561edc2765fdebb
Reviewed-on: https://dart-review.googlesource.com/43560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-02-23 21:49:07 +00:00
Dmitry Stefantsov 22447b9516 Fix bug in assignability check for return expressions of async bodies
Change-Id: Iaab2466ac1c9766861e72e9224a3206da6c42d45
Reviewed-on: https://dart-review.googlesource.com/42743
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-02-22 13:15:14 +00:00
Dmitry Stefantsov b94da9dbe7 Run instantiate-to-bound tests in legacy mode
Change-Id: I6cc90caea40b210f6a988a3c019f3ebc900a7a42
Reviewed-on: https://dart-review.googlesource.com/42640
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-02-22 12:37:53 +00:00
Peter von der Ahé 7deea026b3 Include length in problems
Change-Id: Ieaf7e1445da2b4974f7a325d74186b4b4f2eb72b
Reviewed-on: https://dart-review.googlesource.com/42840
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-02-22 11:44:38 +00:00
Peter von der Ahé d359ce8650 Replace \n in expectation files with newline
Change-Id: Ia8444f7b817ac8e298c4f212f7aaa4fc6ba026b7
Reviewed-on: https://dart-review.googlesource.com/42682
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-02-21 17:02:07 +00:00
Kevin Millikin be30b62e3d Remove the Kernel type inference listener
We have decided to move to a different API for Fasta/Analyzer
integration, one that doesn't involve compiling to Kernel or observing
type inference.  The listener API will become broken, so let's just
remove it before that happens.

We lose the ability to trace type inference so let's restore that
ability next.  The analyzer's resolution storer is not used, but that
code has been left.  The resolution applier will no longer work
without the resolution storer, so those tests have been disabled.

Change-Id: If9ac5aba2d5de7788d8a65f7fa8410599e636d21
Reviewed-on: https://dart-review.googlesource.com/42400
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-02-21 16:28:07 +00:00
Paul Berry b119f7a4cd Only allow implicit use of .call if it refers to a method.
Change-Id: I4c332b64eb7338ceaf63544c3dd0317f8c7d4538
Reviewed-on: https://dart-review.googlesource.com/42020
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-02-21 14:12:14 +00:00
Aske Simon Christensen 355cc5d508 Regression test for getter with same name as class
Closes https://github.com/dart-lang/sdk/issues/30981

Change-Id: If6c359fbc95a92f46f4f5923cd45a94645424b36
Reviewed-on: https://dart-review.googlesource.com/40281
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2018-02-21 11:10:44 +00:00
Aske Simon Christensen 7772b66381 Regression test for #31846
Closes https://github.com/dart-lang/sdk/issues/31846

Change-Id: Ib4ca2b336675772290a5f2074ca6a6e9e794736d
Reviewed-on: https://dart-review.googlesource.com/42241
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2018-02-21 11:01:44 +00:00
Peter von der Ahé 26437741ec Fix crash in handleType
Closes https://github.com/dart-lang/sdk/issues/32200

Change-Id: I3f35d3c5cbc7ab3e0e098bf8e2d3ed695f068b97
Reviewed-on: https://dart-review.googlesource.com/41984
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-02-20 17:10:17 +00:00
Aske Simon Christensen 2183869465 Treat invocations on dynamic as unknown, except for return type of ==
Closes https://github.com/dart-lang/sdk/issues/32173

Change-Id: I77bd06f292a701f1b51d4077f31439598a7b4683
Reviewed-on: https://dart-review.googlesource.com/41762
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-02-20 16:42:25 +00:00
Aske Simon Christensen 194dcf6a9b Report detailed errors when the number or names of arguments do not
match parameters of callee.

Closes https://github.com/dart-lang/sdk/issues/31795

Change-Id: Ic53cc55174a540f387289d4d9cc24ff5c65c547e
Reviewed-on: https://dart-review.googlesource.com/40822
Reviewed-by: Paul Berry <paulberry@google.com>
2018-02-20 16:42:25 +00:00
Paul Berry 6e3b91507b Use getCalleeType to look up the type of an implicitly invoked .call method.
This ensures that if the class containing the `.call` method is
generic, the appropriate substitutions will be made.

Fixes #32238.

Change-Id: Ie72ebffc8f3a8233a7e4d7f9cec1d5fd7b2eec97
Reviewed-on: https://dart-review.googlesource.com/42380
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-20 12:14:14 +00:00
Peter von der Ahé 2191139a1a Fix crash in mixin canonicalization
Change-Id: Ifcb15672816aae04833c18fa6954336e680ddda7
Reviewed-on: https://dart-review.googlesource.com/41820
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-02-16 09:00:16 +00:00
kmillikin b019045393 Front-end implementation of mixin type inference.
Infer missing type arguments to generic mixin classes in mixin
applications based on mixin supertype constraints.  The implementation
directly follows the draft feature specification at
https://dart-review.googlesource.com/c/sdk/+/38940.

Bug: https://github.com/dart-lang/sdk/issues/31984
Change-Id: I7caba037b1b0e73c44f71aaa958f3ff3e8f3c1f0
Reviewed-on: https://dart-review.googlesource.com/40661
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-14 22:43:24 +00:00
Dmitry Stefantsov ec9c927b18 Resolve type arguments of redirecting factories invocations
Fixes #32068

Change-Id: Ifc2c832d5a761ae51b7f93084543aa04902a9529
Reviewed-on: https://dart-review.googlesource.com/40280
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-02-14 22:03:23 +00:00
Paul Berry c4de71ede2 Re-land "Change front_end handling of callable classes."
Original description:
Change front_end handling of callable classes.

This CL is the first in a series of CLs to change the handling of
callable classes in Dart 2.0.

For purposes of this description, a "callable class" is a class whose
interface contains a `.call` method.

In Dart 1.0, a callable class was considered to be a subtype of the
`.call` method's function type.  This allowed the user to create
custom objects with similar behavior to closures, but with additional
fields and methods.

In Dart 2.0, a callable class is just an ordinary class, with no
subtype relation to any particular function type.  (Note however that
it is still permissible for a class to declare that it "implements
Function").

To reduce the amount of code broken by this change, a piece of
syntactic sugar is being added: if an expression whose static type is
a callable class appears where a function type is expected, an
implicit tear-off of the `.call` method is inserted.

Note that it is still possible at compile time to invoke an expression
whose static type is a callable class, and it is still possible at
runtime to invoke an expression whose runtime type is a callable
class; in both cases, this is considered an implicit invocation of the
class's `.call` method.  This is unchanged from Dart 1.0 behavior.

This CL introduces test cases for the new behavior, and implements the
implicit tear-off of `.call` in the front end.

Still to be implemented in future CLs:

- Spec text needs to be written.

- DDC/analyzer code needs to be written to perform implicit tear-offs
  of `.call`.

- The subtyping algorithm in DDC, analyzer, VM, and dart2js needs to
  be changed so that callable classes are no longer considered
  subtypes of any particular function type.

- A small corner case involving type parameters still needs to be
  addressed (see TODO in
  pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart).

Fixes #32064.

Change-Id: I0d397c608321e25ba42cc02aa8a516aa77aa7c9d
Reviewed-on: https://dart-review.googlesource.com/41280
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-02-14 15:22:25 +00:00