Commit Graph

3345 Commits

Author SHA1 Message Date
Peter von der Ahé 00ceb8e359 Share type handling between BodyBuilder and OutlineBuilder.
The BodyBuilder now operates on TypeBuilders instead of DartType.

This

* enables better error messages, and

* paves the way for removing the dependency on OutlineBuilder from BodyBuilder.

Change-Id: I2fb5e61a4d30c11f01d04cc0150d5352b4fb6999
Reviewed-on: https://dart-review.googlesource.com/74064
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-11 12:44:46 +00:00
danrubel c7960df357 Generate analyzer error codes from messages.yaml
With this change, analyzer error codes can be generated from messages.yaml
and those error codes easily translated from the corresponding fasta error.

Each fasta error code in messages.yaml that has an "index:" field
(see prior CL https://dart-review.googlesource.com/c/sdk/+/74040)
now has an Analyzer error code automatically generated
with the information in messages.yaml. In addition
a list of all indexed errors is generated so that a fasta error
code can be quickly translated into an Analyzer error code.

Change-Id: I2d534b7349590ddd54996f564db786c6ffe259b3
Reviewed-on: https://dart-review.googlesource.com/74240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-10 23:07:19 +00:00
Jenny Messerly 24493c2f54 Add support for dartdevk to read Analyzer summaries into Kernel format
This allows dartdevk to be used in the context of an existing build
system based on Analyzer summary files. This will ease migration of
existing dartdevc users over to dartdevk.

Change-Id: I8413f906e384f3f33c98e450adc0860f6fa7bc53
Reviewed-on: https://dart-review.googlesource.com/65641
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-09-10 22:51:04 +00:00
danrubel d32c8e4793 Generate error code index from "index:" field in messages.yaml
Change-Id: I4bebce34d136cf7a89c8b15696c907d1f69bede0
Reviewed-on: https://dart-review.googlesource.com/74040
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-09-10 22:29:41 +00:00
Kevin Millikin cbfc78f5b2 Parse mixin declarations as if they were classes
In Fasta's outline builder, parse mixin declarations as if they were
the corresponding class declaration:

mixin M<T0,...,Ti> on S0,S1,...,Sj implement I0,...,Ik {...}

is parsed as if it were:

class M<T0,...,Ti> extends S0 with S1,...,Sj implements I0,...,Ik {
  ...
}

This supports the syntax and should automatically provide an
implementation of the runtime semantics on the VM.  Not all of the
required static checks are implemented in the front end.

Change-Id: Ice65e93446222484272f8f7db0de2d18c352f56b
Reviewed-on: https://dart-review.googlesource.com/73760
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-09-10 20:40:45 +00:00
Konstantin Shcheglov 63fbfcc69a Translate InvalidInlineFunctionType to ParserErrorCode.INVALID_INLINE_FUNCTION_TYPE.
R=brianwilkerson@google.com, danrubel@google.com

Change-Id: I2b1c7938c081b771e554149846c8157f8332e061
Bug: https://github.com/dart-lang/sdk/issues/33398
Reviewed-on: https://dart-review.googlesource.com/74043
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-09-10 16:08:41 +00:00
Peter von der Ahé e1fe4d48a5 Remove type inferrer from generators
The type inferrer is no longer used (and wasn't necessary to begin
with, it should have been exposed via the helper object instead).

Also some other tweaks that should help me avoid merge conflicts.

Change-Id: I1f2aade93f9c836cc02dac6c002f48156caf2c76
Reviewed-on: https://dart-review.googlesource.com/74063
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-10 09:05:59 +00:00
Peter von der Ahé c42bde5eac Remove type-inference listener
Change-Id: I00db170300a55ff9adc51c36f851ce3454d1e34a
Reviewed-on: https://dart-review.googlesource.com/73882
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-10 08:43:24 +00:00
danrubel a9cc6f0f19 Revise with clause event handling
This replaces the begin/endMixinApplication events which were used in both
```
  class A = B with M;
```
and
```
  class A extends B with M { }
``
with different events for each of the above situations.
This change facilitates properly handling class declarations of the form
```
  class A with M { }
```

Removed event:
* beginMixinApplication
* endMixinApplication

Added events:
* handleNamedMixinApplicationWithClause
* handleClassWithClause
* handleClassNoWithClause

Change-Id: Ifa0ecfd7ff8c408087ad78036ad35ba4a00728c6
Reviewed-on: https://dart-review.googlesource.com/73940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-07 19:33:51 +00:00
Alexander Markov 9c8e9f02a3 [vm/kernel] Support CheckLibraryIsLoaded node in kernel constant evaluator
Change-Id: I5530c54ce86a61e1545c727215ca561c77b86e99
Reviewed-on: https://dart-review.googlesource.com/73840
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-09-07 19:32:11 +00:00
Peter von der Ahé e0b6a2edb7 Don't create growable lists for non-Kernel objects
Change-Id: Iaf44a0073f6641e0f8f47e252818fcbfa010140b
Reviewed-on: https://dart-review.googlesource.com/73481
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-07 07:12:17 +00:00
Peter von der Ahé 196687f0ef Refactor handling of formals
Change-Id: I5e4279d5f0668d5d770be93cc14fc866862761cd
Reviewed-on: https://dart-review.googlesource.com/73460
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-07 07:12:17 +00:00
Peter von der Ahé 51dc3aa370 Improve handling of catch parameters
Change-Id: I216b352e6c140a364930d4005f8d9f9d3809d257
Reviewed-on: https://dart-review.googlesource.com/73420
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-07 07:12:17 +00:00
danrubel d761e97178 Remove WithWithoutExtends error code
Change-Id: I1bfe3721200493945580fa1e687ff565a7a79cf0
Reviewed-on: https://dart-review.googlesource.com/73820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-07 04:15:28 +00:00
Dan Rubel 7905136e64 Allow with clause without extends clause
This removes the code the generates an error when a `with` clause
is used without an `extends` clause as in
```
   class C with M { }
```
This is the first of several CLs to update the parser
as this CL only prevents the error from being generated.

Change-Id: I1d5c8577902e253a4c83cda2f6a1d4ab98319903
Reviewed-on: https://dart-review.googlesource.com/73687
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-07 00:25:58 +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
Paul Berry 66863ea6e2 Avoid a "missing_return" warning in flattenName.
The analyzer can't tell that `unhandled` is guaranteed not to return,
so it thinks that `flattenName` might exit without returning a value.
An easy workaround is to return the result of calling `unhandled`.

This is needed to roll kernel into the internal Google codebase, in
which the "missing_return" warning causes build failures.

Change-Id: I38133db0c2058d687c2f408cc8c8dbf224551408
Reviewed-on: https://dart-review.googlesource.com/73560
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-06 17:52:20 +00:00
Peter von der Ahé d6cd15b80b Restore types to aid refactoring
Change-Id: Ib58e4cad0727f3b0556f21395bd0dddff3fc66de
Reviewed-on: https://dart-review.googlesource.com/73380
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-06 10:25:15 +00:00
Peter von der Ahé b62eef3d8b Use LocatedMessage for invalid types
Change-Id: Ib233b40211d1893b1de6bea36e84c91c81a49fa9
Reviewed-on: https://dart-review.googlesource.com/73343
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-06 10:25:15 +00:00
Peter von der Ahé 2782266d5c Unify QualifiedName and Identifier
Change-Id: Ie7e7131c58186efd5ed4e81e2f010cc240ce8d03
Reviewed-on: https://dart-review.googlesource.com/73341
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-06 08:57:07 +00:00
Peter von der Ahé 04d3e448dd Clean up KernelFormalParameterBuilder
Change-Id: Id0fce5cc75996fd5f88e22a5182b2dc1061d2beb
Reviewed-on: https://dart-review.googlesource.com/73320
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-06 07:27:50 +00:00
Peter von der Ahé d1e2ee28f3 Remove addCompileTimeError in favor of addProblem
Replace most methods with names containing CompileTimeError with corresponding
Problem methods.

Also make Severity.error the default severity.

Change-Id: I4f47bf71dec02347407f2ce4ccfdb04730daf51b
Reviewed-on: https://dart-review.googlesource.com/73221
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-06 06:56:42 +00:00
danrubel dc0aae5c44 Improve super initializer recovery
This CL addresses one of the issues in https://github.com/dart-lang/sdk/issues/34041
by fixing an AstBuilder crash and improving recovery of super constructor calls
in a constructor initializer list.

In addition, this adds a TestDescriptor adjustValidUnitBeforeComparison field
to support the new recovery tests.

Change-Id: I9e687aed34ea293700bd45d7c13ce36e83a00a05
Reviewed-on: https://dart-review.googlesource.com/73286
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-06 01:16:55 +00:00
Alexander Aprelev e07af58238 When compiled delta is rejected, reset incremental compiler back to last known good state(last accepted state).
This is needed so that compileExpression requests are serviced from that accepted state.

Bug: https://github.com/dart-lang/sdk/issues/34025
Change-Id: I592d2af50e59a721e1feb1699c6d56bcd568465f
Reviewed-on: https://dart-review.googlesource.com/72540
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-05 18:58:29 +00:00
Konstantin Shcheglov b443c9f72f Parse static get/set with name of the enclosing class as getters/setters.
R=brianwilkerson@google.com, danrubel@google.com

Change-Id: I97015fbc3bc49c70a022a2edabf4fcdcc34405ad
Reviewed-on: https://dart-review.googlesource.com/73020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-05 15:43:48 +00:00
Martin Kustermann dcf1f0a145 Revert "Remove addCompileTimeError in favor of addProblem"
This reverts commit f872c17a85.

Reason for revert: After the CQ was green someone else made changes which this CL is not compatible with. The CQ lands if the tests passed
and doesn't rebase before doing so. 


Original change's description:
> Remove addCompileTimeError in favor of addProblem
> 
> Replace most methods with names containing CompileTimeError with corresponding
> Problem methods.
> 
> Also make Severity.error the default severity.
> 
> Change-Id: I85a340168848cd3b4375b3f53cb0361251ed6e5d
> Reviewed-on: https://dart-review.googlesource.com/73100
> Commit-Queue: Peter von der Ahé <ahe@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>

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

Change-Id: I3ea736a9752805adb3bacc8b67e8eb1435c1bf69
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/73181
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-09-05 14:13:48 +00:00
Jens Johansen 4cbe28035d Better context message on SyntheticForwarder in MissingImplementation
Previously we could get something like this:
```
regress_32660_test_06.dart:9:7: Context: 'foo' is defined here.
class I extends G implements H {
      ^^^
```

because a SyntheticForwarder was added with a file location of the
class.

It now instead goes to the forwarding stub target and says
```
regress_32660_test_06.dart:6:3: Context: 'foo' is defined here.
  foo(int x, {int y}) => y;
  ^^^
```

Change-Id: I6fb1b958f58635c9afffa8e58cd49eb69df28afd
Reviewed-on: https://dart-review.googlesource.com/72680
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-09-05 14:05:33 +00:00
Peter von der Ahé f872c17a85 Remove addCompileTimeError in favor of addProblem
Replace most methods with names containing CompileTimeError with corresponding
Problem methods.

Also make Severity.error the default severity.

Change-Id: I85a340168848cd3b4375b3f53cb0361251ed6e5d
Reviewed-on: https://dart-review.googlesource.com/73100
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-09-05 13:47:23 +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
Jens Johansen 416ef3fc4e Setter with name of class is error
Fixes #34225.

Change-Id: I1efd39ad1739f49a60d724ca13d916623b9fff09
Reviewed-on: https://dart-review.googlesource.com/72841
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-09-05 13:00:20 +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
Paul Berry e0b1576288 Avoid a "missing_return" warning in isValidImplementation.
The analyzer can't tell that `unhandled` is guaranteed not to return,
so it thinks that `isValidImplementation` might exit without returning
a value.  An easy workaround is to turn the call to `unhandled` into a
`throw`.

This is needed to roll kernel into the internal Google codebase, in
which the "missing_return" warning causes build failures.

Change-Id: Ia88b6cdef3693ab4646470616c7f868c5bad0502
Reviewed-on: https://dart-review.googlesource.com/72900
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-09-04 20:19:53 +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
Peter von der Ahé 23dd0cccb2 Remove OutlineListener.
Revert "Store named types resolution during outline building."

This reverts commit 82947cccc9.

Revert "Store reference/type for invalid types."

This reverts commit 9fb6c09015.

Revert "Clear ShadowX references that are not required after compilation."

This reverts commit 6c39bc38f3.

Revert "Store constructor field initializera when the target is not a field."

This reverts commit 12326c10e1.

Revert "Don't rewrite error Severity for special cases of front-end testing."

This reverts commit 4bb3fb6cae.

Revert "Translate ConstructorElement(s) of parameterized InterfaceType(s) to ConstructorMember(s)."

This reverts commit 62a2752b96.

Revert "Store resolution for out of range integer literals."

This reverts commit 8df84c0a00.

Revert "Infer original expression in SyntheticExpressionJudgment."

This reverts commit cec29e4aa8.

Revert "Resolve invalid 'as' constant expression."

This reverts commit 77202bf2b0.

Revert "Resolve invalid return from constructor."

This reverts commit 737e546939.

Revert "Store import prefix offset into metadata and resynthesize."

This reverts commit c30af508a4.

Revert "Get documentation comments before metadata as well."

This reverts commit 29401573d5.

Revert "Put fileEndOffset into ArgumentsJudgment and use to report argument errors."

This reverts commit d69a354026.

Revert "Return SourceSpan with actual length from _CompilationMessage."

This reverts commit ac973e5ba7.

Revert "Store codeOffset / codeLength for classes."

This reverts commit 28583df3ee.

Revert "Store and resynthesize codeOffset/codeLength for functions and methods."

This reverts commit 5a2a13c8bf.

Revert "Fix analyzer/FE integration of invalid assignments to classes."

This reverts commit a814614cf4.

Revert "Fix analyzer/FE integration of assignments to non-l-values."

This reverts commit d10204f3a0.

Revert "Fix analyzer/FE integration of assignments to ambiguous types."

This reverts commit e87efdffb4.

Revert "Fix analyzer/FE integration of assignments to ambiguous types."

This reverts commit 1b5d273fd7.

Revert "Fix analyzer/FE integration of assignment with synthetic LHS."

This reverts commit 55aa031404.

Revert "Revert "Fix analyzer/FE integration of assignments to ambiguous types.""

This reverts commit 9f795883f1.

Revert "Store code range for constructors."

This reverts commit 675b296d49.

Revert "Store codeOffset/length code fields and top-level variables."

This reverts commit 9ef53bde19.

Revert "Re-land "Fix analyzer/FE integration of assignments to ambiguous types.""

This reverts commit 40d72aec8c.

Revert "Resolve metadata for part-of directives."

This reverts commit cf1cd3eba0.

Revert "Fix analyzer/FE integration of assignment with synthetic LHS, inside class method."

This reverts commit 43a8f1d0d6.

Revert "Fix analyzer/FE integration of prefix/postfix increment of non-l-values."

This reverts commit e2aceb692e.

Revert "Fix analyzer/FE integration of postfix-of-postfix and prefix-of-prefix increments."

This reverts commit ad6f89f13b.

Revert "Fix analyzer/FE integration of some obscure invalid assignment cases."

This reverts commit f074f3c120.

Revert "Resolve namespace combinators."

This reverts commit 7e39d07916.

Revert "Fix analyzer/CFE integration of some more obscure invalid assignment cases."

This reverts commit a94e43af7c.

Revert "Refactor duplicate code in ContextAwareGenerator."

This reverts commit 1f82d37124.

Revert "Resolve required arguments after named."

This reverts commit b255f0fab6.

Change-Id: I44616db9b8ef037a2580a1ab35050da7e72ff7d8
Reviewed-on: https://dart-review.googlesource.com/72642
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-03 11:45:33 +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
danrubel 4cd69887e3 Fix parsing postfix expressions with type parameters
Fix https://github.com/dart-lang/sdk/issues/34315

Change-Id: Id6b1749070473ed5a04a3f024276f9985f82da6e
Reviewed-on: https://dart-review.googlesource.com/72560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-02 18:51:31 +00:00
Peter von der Ahé 3c5fa9fd3f Test various uses of type variables
Change-Id: I579f4ba5dce3a4e1ff8be3afb6ab8b5814108496
Reviewed-on: https://dart-review.googlesource.com/72102
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-08-31 11:16:35 +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
Dan Rubel fa759513ac Add mixin header recovery
Along with the new recovery, there are two new error codes
and their corresponding CFE counterparts:
* ParserErrorCode.IMPLEMENTS_BEFORE_ON
* ParserErrorCode.MULTIPLE_ON_CLAUSES
* ImplementsBeforeOn
* MultipleOnClauses

Change-Id: If9055c9ffa5d56495acf00889236a3a8f6d741ca
Reviewed-on: https://dart-review.googlesource.com/72123
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-31 00:25:16 +00:00
Dan Rubel 8c7e83aed2 Remove generic method comment support
Change-Id: I1149ff9c61748fe8d3a51c95e40c02ec5115b0e7
Reviewed-on: https://dart-review.googlesource.com/72122
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-30 17:52:40 +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
Peter von der Ahé f5f33776a4 Revert "Store code ranges for formal parameters."
This reverts commit 5b9a42de29.

Change-Id: If6b3edc7194fda050de3b6ffbb0c8124a75509a6
Reviewed-on: https://dart-review.googlesource.com/72100
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-08-30 10:20:18 +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
Daniel Hillerström 05271c199c Remove dart2jsCode from messages.yaml.
Change-Id: I5329784c10bcd9696f873189ef59ec18c21f287c
Reviewed-on: https://dart-review.googlesource.com/72043
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2018-08-30 08:49:55 +00:00
Daniel Hillerström 73a35c9937 Checks whether a constant factory has a constant target.
Closes https://github.com/dart-lang/sdk/issues/34161

Change-Id: Ie5eb4d3307e0fd389bcd25b8c548b6dff64633ab
Reviewed-on: https://dart-review.googlesource.com/71300
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-30 08:37:02 +00:00
Peter von der Ahé fa14dbcdfc Format constants and remove dart2jsCode
Change-Id: Ia04066782292f0c49a56689056c69b0481f3aacb
Reviewed-on: https://dart-review.googlesource.com/72021
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-08-30 08:05:31 +00:00