Commit Graph

676 Commits

Author SHA1 Message Date
Paul Berry c22b2efb48 Verify that mixin constraints can't be satisfied by the application (or named class) itself.
When I first began working on the feature I mistakenly thought that
these two test cases would be free from compile-time errors, so it
seemed like it would be worth adding a test case to make sure others
don't have the same misunderstanding.

Change-Id: I322991c818f9d136180de443090fa4e15f6f0e27
Reviewed-on: https://dart-review.googlesource.com/76680
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-09-26 13:07:04 +00:00
Alexander Aprelev e17a5965d1 [gardening] Update product dartk test status.
Change-Id: I556695f908fa3edf758e4041f88b6b04f9f18ea2
Reviewed-on: https://dart-review.googlesource.com/76589
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-09-26 06:10:53 +00:00
Jenny Messerly 1c8d65c49b fix #32785, implement typedef equality in dartdevc
This change expands typedefs into their underlying function type in the
compiler. Typedefs no longer exist at runtime in DDC, so they now have
similar equality and identity behavior as other function types.

The compiler used to preserve typedefs so they could have a better
toString. But over time that support has been almost entirely lost;
the caching for function/interface types eliminates typedefs, and
DDC+Kernel does not appear to get any TypedefTypes from the common
front end. So in practice typedef types were almost never present at
runtime. Because of this, we can remove the remaining support with very
little user visible effect. This also brings DDC's canonicalization
roughly in line with dart2js for compile-time typedefs, so frameworks
like Angular will be able to continue their use of `identical` for fast
type comparisons.

This CL also fixes DDC's type caching for generic function types
(typeHashCode was incorrect for them), and has some refactoring to
improve names/comments and make the SDK runtime code more clear.

Change-Id: I4e34c0c8f737a8535ba474a4683967ff41bcd3c8
Reviewed-on: https://dart-review.googlesource.com/74664
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Alan Knight <alanknight@google.com>
2018-09-26 02:01:45 +00:00
Paul Berry b1a54154f8 Check that implicit type arguments satisfy bounds.
This required adding an implementation of super-bounded types to the
analyzer.

We really could use some more tests to verify that we disallow
super-bounded types in all the appropriate locations, but allow it in
other cases (it seems that there are no language_2 tests to verify
this).  To avoid churn, I'll wait until I have confirmation that my
reasoning is correct in #34583 before submitting test cases.

Fixes #34532.
Fixes #34560.

Change-Id: I3c5def60bcac0d31b56bead31cb1aab445f18e96
Reviewed-on: https://dart-review.googlesource.com/76280
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-26 01:12:28 +00:00
Alexander Aprelev e7fc155457 [gardening] Adjust product kernel test status
Change-Id: I2c5126812675e3aef991969276f57b6e51939f1e
Reviewed-on: https://dart-review.googlesource.com/76580
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-09-25 23:23:29 +00:00
Jens Johansen 8477dc2131 Update status after 570fd5a788
Test export_ambiguous_main_test doesn't crash. It gives a compile-time
error.

Change-Id: Ib097099c3f075a18d681b179b0ee6d46cd5d0b7a
Reviewed-on: https://dart-review.googlesource.com/76360
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-09-25 10:55:00 +00:00
Jens Johansen 570fd5a788 Error on re-export, export and import of libraries with same name.
Fixes #12916.

Change-Id: Icef0f04f1575c8dad5f1cd23a9363f06fa2a2b35
Reviewed-on: https://dart-review.googlesource.com/74161
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-25 09:09:21 +00:00
Alexander Markov 62d154f6a3 [vm/bytecode] Record null-initialized fields in bytecode
If a field is initialized with null (either explicitly or implicitly),
field store can be omitted in bytecode. In such case, bytecode should
still convey the information about this initialization to VM for
field guards to work correctly.

Change-Id: I1fd45b858c3c521b97fa5dbffe0e15b1ea75d92f
Reviewed-on: https://dart-review.googlesource.com/76060
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-09-24 17:56:35 +00:00
Daniel Hillerström 7ad1e5da99 Perform substitution on type argument/parameter bounds.
Fixes regression #34528. Introduces a new test to mitigate future
regressions.

Closes #34528.

Change-Id: Iaf0a8f44db2a8b4a8151c391ddb8dff69910fe3a
Reviewed-on: https://dart-review.googlesource.com/75840
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-09-24 14:02:01 +00:00
Régis Crelier 0c60a52bb2 [VM bytecode] Triage failures in interpreted mode.
Change-Id: I7c896386ef38b5ea5aceab5b6090363a34e960e6
Reviewed-on: https://dart-review.googlesource.com/75794
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-21 02:37:44 +00:00
Jenny Messerly 64b6d713e3 [dartdevc] enable super mixin support in Kernel backend
Change-Id: If2a1c4ec8328080a890e7f22b657b19af4fe53ae
Reviewed-on: https://dart-review.googlesource.com/75791
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-09-20 23:59:18 +00:00
Paul Berry 296e4aa7e6 Split mixin_declaration_inference_valid_classes_test.dart into multiple tests.
I will soon start landing fixes to address some (but not necessarily
all) of the test cases in this test, and I want to make sure that my
fixes produce corresponding status file changes, to secure against
possible future regressions.

Change-Id: Iaec11b85a20d670c0702220cadbbdfc51c026d1f
Reviewed-on: https://dart-review.googlesource.com/75624
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-09-20 00:04:42 +00:00
Paul Berry cf67e402bd Add test case reproducing issues #34498 and #34500.
Also modify async_backwards_compatibility_1_test so that fixing these
bugs won't cause it to start failing.

Change-Id: I7bb3b9587a0aeea8662df1923034bcb409a29522
Reviewed-on: https://dart-review.googlesource.com/75280
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-19 16:37:15 +00:00
Daniel Hillerström 0a5d7b866d Update status files after de984e58.
The bleeding edge console revealed that status files for
dartk-checked-linux-release-x64 configuration needed to be updated.

Change-Id: I7015427f55436947aebd019212765c5f3937f846
Reviewed-on: https://dart-review.googlesource.com/75440
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
2018-09-19 07:36:36 +00:00
Daniel Hillerström de984e58cb Type checking for redirecting factories.
Implements static semantics for redirecting factories (c.f. §10.6.2 of
the specification). This CL does not include inference of actual type
arguments on redirectees, that is it does not handle the case where
type arguments have been omitted on the redirectee as in this
following example program:

  class A<T> {
    factory A() = B;
  }
  class B<T> implements A<T> {
    B();
  }

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

Also resolves the second part of
https://github.com/dart-lang/sdk/issues/30579.

Can possibly also close https://github.com/dart-lang/sdk/issues/11578.

Change-Id: I5f1fb60510ba6cdc917321239819c1f817b5b85d
Reviewed-on: https://dart-review.googlesource.com/74580
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-09-19 06:20:20 +00:00
Alexander Markov 37b41bd317 Update status files after d4148159cc
There are several crashes on kernel-precomp bots related to the new
tests. As front-end does not issue a compile-time error,
AOT transformations such as constant evaluation are not skipped and
may crash on incorrect hierarchy.

Stack trace:

Change-Id: Ieaf789535eb4c59a3cc4f2f3437b2b41b9e506f4
Reviewed-on: https://dart-review.googlesource.com/75401
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-09-18 22:19:10 +00:00
Leaf Petersen d4148159cc Initial valid inference checks
Change-Id: I75c3f3a4072aeaa6f27d399196ba3c57e79fecbb
Reviewed-on: https://dart-review.googlesource.com/74017
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-09-18 19:59:26 +00:00
Jenny Messerly 0496569f09 implement super mixins in dartdevc and fix a few issues in Analyzer
Fixes #34167. This implements the Dart 2 mixin proposal
(https://goo.gl/KEKQyv) for DDC. When the mixin is applied, a class
is created for the application that extends the correct superclass
and has all of the instance members, so `super` works correctly.

This also fixes a few minor issues in Analyzer's (mostly complete)
implementation:
- InterfaceType.isObject now returns false for Dart 2 mixins.
- Least upper bound calculation recognizes mixins are not Object.
- Interface of the mixin now implements its superclass constraints.
- Mixin superclass constraints are checked against the superclass and
  all previously applied mixins (if any); this keeps it working with
  the subtype fix above, and also prevents a not-yet-applied mixin
  from satisfying the constraint

The language_2/mixin_declaration tests were updated with a few minor
fixes now that we can run Analyzer/dartdevc to test them.

This change implements super mixins for DDC's Kernel backend (DDK)
too. This will be enabled once Kernel adds a flag to recognize which
Class nodes are mixins (vs normal classes).


Change-Id: Ib3c4fcb12de9988345e52d92931196828d8227c3
Reviewed-on: https://dart-review.googlesource.com/74965
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-09-18 03:21:48 +00:00
Paul Berry 5c54401d74 Add test case reproducing issue #34488.
Change-Id: I0dea1cb682b607b324703303922efdfe098fa28f
Reviewed-on: https://dart-review.googlesource.com/75131
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-17 23:18:08 +00:00
Erik Ernst f5ec9b0554 This CL changes some status comments, but also points out an issue.
The point is that #32782 requests a fix such that
`typedef F1 = void Function(int)` and `typedef void F2(int)`
satisfy that `F1 == F2` evaluates to true. This is marked
'p3-low' for the common front end but 'p1-high' for DDC.

It seems likely to me that this could create the situation where
code is developed using DDC, is working, and then fails upon
deployment using the vm. Also, there is a single case where
`dart2js` fails in the associated `type_alias_equality_test.dart`,
so deployment on the web would also fail upon deployment, though
only in some of the cases.

However, with some input from Aske I concluded that the situation
might have arisen because there _is_ no work to do for this in the
common front end, because it will be handled by the backend (which
also explains why `dart2js` has it almost right).

This CL is just introducing a tiny change: It changes the issue
indicated for all VM related failures in said test to point to
#32783, which is presumably the right issue for backend work.

Apart from that, I've added you, the reviewers, in order to make
sure that the relevant people get this heads up. We may then decide
to land this CL, change the priority on #31359, do nothing, or
whatever turns out to be the right response. ;-)

Change-Id: I92672547d7fe795e877604c0da1e0e4579e4e04a
Reviewed-on: https://dart-review.googlesource.com/74403
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-09-14 08:56:22 +00:00
Kevin Millikin c0a94ded80 Mark two more app_jitk test failures
Mark the runtime failures as well as the compile-time failures.

Change-Id: I6b36dc9cb695238f7c89b62ed198261f9ec5fc32
Reviewed-on: https://dart-review.googlesource.com/74495
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-09-11 23:13:46 +00:00
Kevin Millikin 6bf26ce713 Add status file entries for compiler app_jitk
Mixin declaration tests fail on this configuration (in the same way as
dartk, dartkb, and dartkp).

Change-Id: I06c3aa6f05b147fb2f69d1e2247af3094b1cbf2e
Reviewed-on: https://dart-review.googlesource.com/74483
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-09-11 21:18:56 +00:00
Kevin Millikin 2b296a0671 Enable mixin declaration syntax in Fasta
This enables mixin declarations for the Dart VM by parsing them into
class declarations.

Change-Id: Ic792009bc450d7c887f2e9962040ffad807881eb
Reviewed-on: https://dart-review.googlesource.com/74480
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-09-11 18:05:52 +00:00
Aske Simon Christensen f30543218c GitHub ludo
Change-Id: I03ee56a35dffba9d7d9d4e01872871612b4fbf31
Reviewed-on: https://dart-review.googlesource.com/74420
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2018-09-11 12:26:33 +00:00
Kevin Millikin 3224afe9fe Fix a bug in valid return detection
We had implemented the rule for invalid returns in asynchronous
non-generator functions with return type T and a return expression
with static type S:

  is an error if flatten(T) is void and flatten(S) is not void,
  dynamic, or Null

and the actual rule should be:

  is an error if T is void and flatten(S) is not void, dynamic, or
  Null

which requires T to be exactly void and so signals fewer errors.

Change-Id: I296bb8a607d6e5ad862017674091eafe0f6016da
Reviewed-on: https://dart-review.googlesource.com/73740
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-09-06 21:50:43 +00:00
Leaf Petersen 9883fcca08 Fix valid_returns tests.
The valid return tests were misnamed and hence not run.  Also remove
duplicate tests from one file, and add status to the informal proposal.

Change-Id: I20179e81a0281302056f601ee3b7a51e2aec180e
Reviewed-on: https://dart-review.googlesource.com/73562
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-09-06 20:37:06 +00:00
Alexander Markov cdd18e6811 [vm/bytecode] Support dynamic invocation forwarders and omit checks in bytecode
This CL adds support for _dynamic_ calls (which are routed through
dynamic invocation forwarders) to bytecode pipeline.

This allows to skip argument type checks for non-covariant and
non-generic-convarint-impl parameters in bytecode when calling instance
members through known interface targets. In case of dynamic call, dynamic
invocation forwarders perform type checks which are otherwise skipped.

This CL also corrects argument type checks in forwarding stubs.
Forwarding stubs are synthetic methods, introduced by front-end to ensure
type safety if some of the argument type checks are skipped.
The specifics of forwarding stubs is that they should use parameter types
of a *target* of a stub for the argument type checks.

This change unifies how argument type checks are performed in bytecode
and in the VM in JIT mode. This allows to mix bytecode methods with
methods JIT-compiled from kernel AST in more cases.

Change-Id: I3a2720a488c8bbb91de1b189eb36ee8c51684a78
Reviewed-on: https://dart-review.googlesource.com/72543
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-06 17:23:12 +00:00
Jens Johansen 49ca2fcaf9 Detect cycles in type variable bounds
Fixes #32989.

Change-Id: I809d67a4c0cbbb24446ace6fd56bb3b1a4c1364a
Reviewed-on: https://dart-review.googlesource.com/73120
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-05 13:16:46 +00:00
Daniel Hillerström d1b8e12103 Adds some more tests for mixins.
Change-Id: If7915de3ff86cfdf4629d5fedac22488724b7972
Reviewed-on: https://dart-review.googlesource.com/72441
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-09-05 05:41:24 +00:00
Daniel Hillerström 3d4f28b23a Disallow default values in redirecting factory constructors.
Closes https://github.com/dart-lang/sdk/issues/34160

Change-Id: Idf6ee172b5fe81aa17920d12b68525a37a3c2231
Reviewed-on: https://dart-review.googlesource.com/72660
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-05 05:41:04 +00:00
Kevin Millikin 9bdf2489b5 Signal errors and warnings for invalid returns
Implement the feature spec for checking returns against inferred
function return types:

https://github.com/dart-lang/sdk/blob/master/docs/language/informal/invalid_returns.md

with the change that an invalid return without a subexpression is
a warning, not an error.  This is because it is a warning in the
analyzer and it would be a breaking change to turn it into an
error.

The check for valid returns is moved to exactly where we handle
returns, rather than in ensureAssignable which is used as a
helper in a lot of places. A bug in type inference was fixed: we
would use `void` for the type of return without a subexpression
instead of `null`.  To accommodate that we would use a
non-standard subtyping relation for returns.  This could lead to
us inferring a return type of `void` in cases where we should
not.

Change-Id: Iee9ece9c722f47efa305f49490d3022d0bbb9f44
Reviewed-on: https://dart-review.googlesource.com/72403
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-09-04 16:50:51 +00:00
Aske Simon Christensen 35eacd1afc Type arguments to a constructor is an error.
Fixes https://github.com/dart-lang/sdk/issues/34159

Change-Id: Ib4cca43f4181f2557560fa45ca41dd059c8b5b06
Reviewed-on: https://dart-review.googlesource.com/71521
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-09-04 12:06:14 +00:00
Jens Johansen 40864cc698 Fasta: Signature change with and without noSuchMethod
The below code is not okay, even if we add a noSuchMethod to C.

```
class B {
  foo(int x) => x;
}

class C extends B {
  foo(int x, {int y});
}
```

Issue #32660.

Change-Id: I1ace4443c3732fdd5faefa50e0d2cb68023e97c4
Reviewed-on: https://dart-review.googlesource.com/72106
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-04 10:21:10 +00:00
Jens Johansen 015840d31f Fasta: Wrong number of type parameters is an error
E.g. `new Map<String>` is now reported as an error.

Note that this does not add a check for whether correct types are given,
so e.g.

```
class Foo<X extends num> {}
main() {
  new Foo<String>();
}
```

is not caught by this fix.

Fixes #32972, #32281.

Change-Id: I57513b5c13865a828890775c8e14f7433d00bdbe
Reviewed-on: https://dart-review.googlesource.com/72382
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-04 10:10:32 +00:00
Daniel Hillerström a56203041f Checks whether the type of a switch expression is assignable to the
types of its case expressions.

Resolves the first part of
https://github.com/dart-lang/sdk/issues/34207. According to the
language team the second part may soon become irrelevant.

Change-Id: Ifce38f2a62c293156dafa94f16799d5a126c6b9c
Reviewed-on: https://dart-review.googlesource.com/71981
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-09-03 11:03:56 +00:00
Jens Johansen 33704fa75f Fasta: Instance field cannot be const
Fixes #32326.

Change-Id: Idef32a842a68c5c9ee58caff7b6e731204f033b6
Reviewed-on: https://dart-review.googlesource.com/72041
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-08-31 10:28:19 +00:00
Kevin Millikin 9803d5c786 Signal an error when invoking a non-function
When invoking an expression whose static type is not a function type,
signal an error.  However, allow invocations of expressions with
static type `dynamic` or `Function`.  Fixes #32975.

Change-Id: Ia54d8df650076ad5c9c9c3a2c6f79ea31acbbbfe
Reviewed-on: https://dart-review.googlesource.com/72082
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-08-31 02:30:46 +00:00
Daniel Hillerström 2f77de53e2 Revert "Enables arity check for overridden methods inherited from a mixin."
This reverts commit 03c7184cca.

Reason for revert: Flutter doesn't build with after this CL because the following (kind of) program

  abstract class RenderObject {
  String toString({int minLevel}) => "foo";
  }
  abstract class ContainerRenderObjectMixin extends RenderObject {}
  abstract class RenderBoxContainerDefaultsMixin implements 
  ContainerRenderObjectMixin {}

is wrongfully rejected. In patching this, I stumbled upon what seems to be bug in Fasta where some concrete classes arising from mixed in applications are marked as abstract, which causes the patch to produce false-positives. This needs some more investigation.

Original change's description:
> Enables arity check for overridden methods inherited from a mixin.
> 
> The return type and parameter types checks are still disabled for
> mixins as there is an issue with type parameters being uninstantiated
> in mixin applications which causes the two checks to produce
> false-positives. As a result the SDK fails to compile with the two
> checks enabled because the libraries (such as collections) makes
> extensive use of mixin application with generic types. I've opened a
> separate ticket to track this issue [c.f. https://github.com/dart-lang/sdk/issues/34285].
> 
> Furthermore this CL abstracts the arity check, return type check, and
> method parameter type check in checkMethodOverride to make it easier
> to understand the logic of the method.
> 
> Closes https://github.com/dart-lang/sdk/issues/34235 and closes https://github.com/dart-lang/sdk/issues/32014
> 
> Change-Id: Iae224926c2e99e6e89ccc3c19ec4bc7919ee48a5
> Reviewed-on: https://dart-review.googlesource.com/71781
> Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>

TBR=askesc@google.com,hillerstrom@google.com

Change-Id: Idee6f53c2d6a17ea8a4103872b1183c01e4d30ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/72108
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
2018-08-30 13:00:16 +00:00
Daniel Hillerström 03c7184cca Enables arity check for overridden methods inherited from a mixin.
The return type and parameter types checks are still disabled for
mixins as there is an issue with type parameters being uninstantiated
in mixin applications which causes the two checks to produce
false-positives. As a result the SDK fails to compile with the two
checks enabled because the libraries (such as collections) makes
extensive use of mixin application with generic types. I've opened a
separate ticket to track this issue [c.f. https://github.com/dart-lang/sdk/issues/34285].

Furthermore this CL abstracts the arity check, return type check, and
method parameter type check in checkMethodOverride to make it easier
to understand the logic of the method.

Closes https://github.com/dart-lang/sdk/issues/34235 and closes https://github.com/dart-lang/sdk/issues/32014

Change-Id: Iae224926c2e99e6e89ccc3c19ec4bc7919ee48a5
Reviewed-on: https://dart-review.googlesource.com/71781
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-30 10:01:19 +00:00
Samir Jindel c691a85b92 [vm/kernel] Fix type arguments handling in IL construction.
Thanks to Alex Markov for the test case!

Fixes #34269.

Change-Id: I66371532b40984c58332ee43c99e744d746ecfae
Reviewed-on: https://dart-review.googlesource.com/71540
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-08-27 19:39:27 +00:00
Alexander Markov 52d33f0d5d [vm/kernel/bytecode] Support partially instantiated closures in bytecode
Generic closures should take delayed type arguments into account when
initializing type arguments in prologue.

Fixes language_2/instantiate_tearoff_test in bytecode mode.

Change-Id: I0ab07e759f3372ae9143a48f0b8b0fe4fab8a51a
Reviewed-on: https://dart-review.googlesource.com/71432
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-08-27 18:13:56 +00:00
Alexander Markov ff8a989e55 [vm/bytecode] Update status for a test with missing compile-time error
Negative test cases

  generic_function_type_as_type_argument_test/01
  generic_function_type_as_type_argument_test/02

rely on a compile-time error, which is still missing in CFE.
Unlike default VM, bytecode pipeline does not flag this error.

Change-Id: I3c052b5ca6013ab0728ffc234b5ffbe2fddfec5d
Reviewed-on: https://dart-review.googlesource.com/71600
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-27 17:59:10 +00:00
Samir Jindel 2beb05b829 [vm] Re-land use of multiple entrypoints for closure calls.
Original patchset is in revision 1.

Change-Id: I29ab0dbc3711f99895fd4f04a49d4185463a1602
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/71241
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-23 17:54:19 +00:00
Samir Jindel 723eeccb36 [vm] Update status files after 23e379d0.
Change-Id: Iebb47fc431b44c340ee64e389aabc0e16e48e3d9
Reviewed-on: https://dart-review.googlesource.com/71301
Commit-Queue: Samir Jindel <sjindel@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-23 17:00:28 +00:00
Daniel Hillerström 23e379d0aa Checks whether an interface is implemented multiple times.
It is a compile-time error if an interface appears multiple times
across the extends and implements clauses.

This CL implements a check to detect the aforementioned case. A
previous commit implemented this by expanding and refactoring the
restricted super types check in source_loader.dart
(c.f. checkSemantics method). The restricted super types check decides
whether a type is allowed to appear in an 'extends', 'implements', or
'with' clause. However, it turned out it may have sat too early in the
compilation pipeline as it failed to detect the following case

   class A implements Object {}

I decided that it was somewhat suboptimal to implement a special case
for "Object". Therefore I have moved the check to a later stage in the
pipeline, where classes without a super class have had the Object
class injected as their default super class. The check is now
implemented in kernel_class_builder.dart (c.f. checkSupertypes
method).

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

Change-Id: Ie7153c896337b589118cac4b80e9df8ea5a09daa
Reviewed-on: https://dart-review.googlesource.com/70864
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-23 14:36:40 +00:00
Daniel Hillerström 6c812c27be Signal a compile-time error if a const constructor redirects to a
non-const constructor.

This CL also slightly improves the quality of the error message for
when a const constructor redirects to a non-const super constructor.

Note the two redirection checks are implemented in separate parts of
the code base. The former is implemented in finishConstructors in
kernel_target.dart, whilst the latter is implemented in
buildSuperInitializer in body_builder.dart. It might make sense to
localise them.

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

Change-Id: Id9db06aaba9b5a330e22ea328d0ae60f104dfdcf
Reviewed-on: https://dart-review.googlesource.com/71165
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
2018-08-23 12:19:07 +00:00
Régis Crelier e434142df0 [VM interpreter] Isolate may be NULL in thread.
This fixes a crash in StackFrameIterator when using interpreter.
Prevent timeout in thread test when using interpreter.
Adjust kernel status file for known issue.

Change-Id: I9e28675a3532153df24456e65407a8ce73503928
Reviewed-on: https://dart-review.googlesource.com/71222
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-08-22 22:11:42 +00:00
Aske Simon Christensen a4b3009ca5 Require super initializer to be at the end of the initializer list.
Drops code to handle special evaluation order rules for super
initializer before the end.

Initializer check code now also recovers from initializer errors.

Fixes https://github.com/dart-lang/sdk/issues/33101

Change-Id: I1024853bfd3acfef42630bdc2fc47782746b07c0
Reviewed-on: https://dart-review.googlesource.com/68060
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-08-22 10:43:08 +00:00
Aske Simon Christensen a95db177b8 Fix VM status after language_2 triage
Status file adjustment after ee6ef702ce

Change-Id: I084e14e8983333bb951d16cb88f4f641187d8fcb
Reviewed-on: https://dart-review.googlesource.com/70865
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2018-08-21 13:07:04 +00:00
Aske Simon Christensen ee6ef702ce Update issues for Fasta missing compile-time errors in language_2
Clean out dart2js/ddc status entries that are subsumed by the generic
one for Fasta in language_2_kernel.status.

Change-Id: If70ae797384af488d816082a9d041d48ed6b5876
Reviewed-on: https://dart-review.googlesource.com/70280
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-08-21 11:23:10 +00:00