This makes closed world computation take the static type of the receiver
into account and removes non-live members from the J-world.
Change-Id: I5547aaae4685c6417a94916df0bc4e621296ce8d
Reviewed-on: https://dart-review.googlesource.com/72643
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This CL just adds the compiler=compareAnalyzerCfe option to the test
framework, and updates the status files so that no language_2 failures
are expected when this "compiler" is used. A placeholder executable
has been added to sdk/bin, but it is not wired up yet--that will be
done in a future CL.
In a future CL I will wire up the placeholder executable to the code
in pkg/analyzer_fe_comparison, and fill in the methods in
CompareAnalyzerCfeCommandOutput to process the output accordingly.
Change-Id: I27439de4ac609cb8b003f157a0ff88d181bfbcae
Reviewed-on: https://dart-review.googlesource.com/73561
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
These types were used long ago when we sometimes generated summaries
from an element model; they haven't been used in a long time.
Change-Id: I73d5e52cc3c35ce1d5ebb68bae59c8a795ce279f
Reviewed-on: https://dart-review.googlesource.com/74013
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Previous implementation didn't include subtypes of the specified type.
For instance `JS('Rectangle', ...)` should have triggered the inclusion
of `_DomRect` but the use of this-type in the subtype test,
`_DomRect <: Rectangle<T>`, prohibited this.
This fix is to use the raw type instead of the this-type. The subtype test
will therefore be `_DomRect <: Rectangle<dynamic>` which correctly
includes `_DomRect`.
The change has the effect that `JS('List', ...)` now actually includes subtypes of
`List`. For this reason uses of `List` have been updated to use `JSArray` or
explicitly use `returns:...` to avoid unintended inclusion of native lists such
as the native typed arrays.
Change-Id: I06ab55d9bf694829596875d9c3a0a6c954d396b7
Reviewed-on: https://dart-review.googlesource.com/73903
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
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>
We need this to support the following requirement in the mixin
specification:
It's a compile-time error to apply a mixin containing super-invocations
to a class that doesn't have a concrete implementation of the
super-invoked members.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: Ib683794fe7101222863b34956619773e2af52d1a
Reviewed-on: https://dart-review.googlesource.com/73780
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
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>
This allows `async` and `async*` functions to be typed without importing `dart:async`.
All other async types still need to be imported, including `FutureOr` and `Zone`,
but pure `async`/`await` based code can be written with no imports.
Fixes#26162.
Bug: http://dartbug.com/26162
Change-Id: Iaf36631ef5b3251a688e495a9d238b2f8787f14c
Reviewed-on: https://dart-review.googlesource.com/71480
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
The only reason to include non-const expressions in an unlinked
summary is for type inference, but for one-phase summarization, we're
going to perform type inference directly based on the source AST. So
skip non-const expressions when doing one-phase summarization.
This requires modifying several summary tests so that they no longer
expect the non-const expressions to be present in the unlinked
summary. It also causes a few tests of one-phase summarization to
start failing, since the AST-based type inference logic hasn't been
implemented yet. This is ok because one-phase summarization isn't
exposed to customers yet; it will be fixed in follow-up CLs.
Change-Id: I7455fd82b64c59362439206a05a9eb3691c8e397
Reviewed-on: https://dart-review.googlesource.com/73688
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
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>
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>
I anticipate heavily modifying this file, and I don't want to have to
mix comment styles when I do so.
Change-Id: Ib93bf5489f080456da81f03f82bd7e850498748c
Reviewed-on: https://dart-review.googlesource.com/73683
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
I'm going to be adding a lot of new functionality to this file, and I
don't want to have to mix comment styles when I do so.
Change-Id: I35fb7b93b2cfc200995364028ea10bab9c8f1245
Reviewed-on: https://dart-review.googlesource.com/73640
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Remove explicit _checkForImplementsDeferredClass(), some other mixin checks.
R=brianwilkerson@google.com
Change-Id: I134200d1e78315c19218cf7a9ff4efba7fc50fb8
Reviewed-on: https://dart-review.googlesource.com/73660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
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>
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>
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>
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>
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>
Currently, analyzer summaries are generated in a two-step process,
translating compilation units into unlinked summaries and then linking
the unlinked summaries together to form linked summaries. In order to
support full unrestricted type inference, we'll need to build
summaries in one step, so that the full AST of initializers is
available for inference during linking.
This CL introduces a new API for one-step summarizing, along with test
cases to exercise it. For now, the one-step summary logic just
invokes the old two-step summary process. In future CLs I'll rework
it to be a true one-step summarizer so that the type inference
restrictions can be lifted.
Change-Id: Ic8d55850972f4697b5c6cc6fabe5d26dc7c1288c
Reviewed-on: https://dart-review.googlesource.com/73300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
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>
This CL makes the following changes:
- Makes `linkerInputs` private to the strategy classes (the only thing
needed by tests is `testDartUri`).
- Changes the return type of addNamedSource to `void` (no caller was
using the return value).
- Generalizes _FilesToLink so that it can be re-used for one-phase
summary generation (where the inputs will be CompilationUnit objects
rather than UnlinkedUnitBuilder objects).
- Moves _parseText to top level so that it can be more easily reused.
Change-Id: I333b278b9a157b5013199d0c21cc4c8d3423dbe7
Reviewed-on: https://dart-review.googlesource.com/73281
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
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>
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>
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>
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>
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>
Note that although this change is inside analyzer/lib/src, in practice
it is a breaking change to the analyzer API, since several clients
invoke the SummaryBuilder constructor. Fortunately we can make
breaking changes now since we have not yet published version 0.33.* of
the analyzer.
To my knowledge, all clients that we care about keeping synchronized
to the bleeding edge version of the analyzer have been modified so
that they no longer pass in the optional parameter. The remaining
clients shouldn't be affected since their pubspecs still point to
analyzer version 0.32.*.
Change-Id: I627bb7b1242e8e36ec82927ed8fe722b5b249fd6
Reviewed-on: https://dart-review.googlesource.com/73000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
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>
I renamed the previous error const to MIXIN_CLASS_DECLARES_CONSTRUCTOR.
R=brianwilkerson@google.com
Change-Id: If06f264e61b7d3e7c254eb457f4b2dc45ef76174
Reviewed-on: https://dart-review.googlesource.com/72860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
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>
Change-Id: I445048f5366a27f2e9e57ef148f511f2aa4bbd3f
Reviewed-on: https://dart-review.googlesource.com/63146
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
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>
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>
This also allows searching for mixin(s), which we test now.
R=brianwilkerson@google.com
Change-Id: I6c1944db0e6ecbc0f7352188968e53ef38603426
Reviewed-on: https://dart-review.googlesource.com/72554
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
CallSpecializer::TryInlineInstanceSetter was using IsReceiver to determine
type check could be skipped. However it is incorrect to use IsReceiver,
because it uses SSA notion of the receiver - rather than a syntactic
notion and all strong mode guarantees apply at syntactic level.
Additionally this CL expands support for exactness tracking to PropertySet
operations and uses it to eliminate checks on setters.
Change-Id: Idce559c4ca4c88f5788d3b6b9955b5af076bd7eb
Reviewed-on: https://dart-review.googlesource.com/72442
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
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>
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>
This requires version 0.32.5 or later of the analyzer (which makes the
parameter optional). In version 0.33.* of the analyzer, the parameter
will be removed.
Change-Id: I9a4eaf5a8ed445051864543d9da5e59a06cd635d
Reviewed-on: https://dart-review.googlesource.com/72552
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
When dynamically calling a generic function or method without passing
any explicit type arguments, the default bounds are used. The default
should be `dynamic` unless an explicit bound was provided for the type
parameter.
Change-Id: I82f7166303f936adbecedd0c633b518f2700def4
Reviewed-on: https://dart-review.googlesource.com/72081
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
This is the follow-up to
dbe868de02
Similarly to StreamingFlowGraphBuilder::BuildPartialTearoffInstantiation,
bytecode generator adds _boundsCheckForPartialInstantiation calls
to partial instantiations of tear-offs.
Fixes language_2/partial_instantiation_eager_bounds_check_test in bytecode mode.
Change-Id: I2daf1902aa3df99133b2a25f1413e1bac53b6c30
Reviewed-on: https://dart-review.googlesource.com/72549
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
When generating bytecode, kernel AST was modifed to sort optional named
parameters. This has unfortunate side-effect of breaking default
(non-interpreter) mode if it uses platform.dill with bytecode.
Bytecode generator is changed to avoid modifications to kernel AST.
Instead, sorted named parameters are kept on a side.
Fixes https://github.com/dart-lang/sdk/issues/34305
Change-Id: Iba473f09af0af515b2117e39d63363412433d538
Reviewed-on: https://dart-review.googlesource.com/72546
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This will help us ensure that the analyzer and the front end interpret
programs in the same way, e.g. they should produce the same type
inference results.
This code is in its own package for now to avoid making the analyzer
package unnecessarily depend on the details of the kernel
representation (which would couple it even more tightly to kernel than
it's already coupled). We can move it into the analyzer later if we
see fit.
Change-Id: I055e83c7b83b6cd9b1082b4424a2f4144b5abf0e
Reviewed-on: https://dart-review.googlesource.com/72480
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Errors for onClause are not correct yet, and not tested yet.
R=brianwilkerson@google.com
Change-Id: I9a1f2b4734661baac85a9d1b9311d21104c7c495
Reviewed-on: https://dart-review.googlesource.com/72360
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
I will soon be adding an API for generating summaries that generates
them in one phase, as opposed to the current two-phase approach of
building unlinked summaries and then linking them together. This is
will be needed in order to support full type inference of summaries,
since full type inference requires examining the contents of
block-bodied closures, and it's not worth the effort of trying
serialize the contents of block-bodied closures into unlinked
summaries.
To prepare for this, the summary tests need to be generalized so that
during the transition period they will be able to be run with either
API.
This CL introduces several classes in a new `test_strategies.dart` file:
- Interfaces `SummaryBaseTestStrategy`, `SummaryBlackBoxTestStrategy`,
and `SummaryLinkerTestStrategy`. These interfaces define the
methods that can be invoked by tests of the summary mechanism.
- Implementations of those interfaces:
`SummaryBlackBoxTestStrategyPrelink`,
`SummaryBlackBoxTestStrategyTwoPhase`, and
`SummaryLinkerTestStrategyTwoPhase`. These classes provide the
ability to drive the summary mechanism in various ways. When the
one-phase API is added, more classes will be added to drive it.
- A few private classes occupying intermediate positions in the class
hierarchy, as well as auxiliary data structures needed by the above
classes.
The tests themselves have been moved into mixin classes so that they
can be applied to any of the implementations above.
Change-Id: Iac3585944297f78f184d35de544aa4c8d8abe99a
Reviewed-on: https://dart-review.googlesource.com/72320
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
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>
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>
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>
It is not used internally outside Analyzer itself.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: Iec2b45ebaeb49400e9f61a137a85170657856016
Reviewed-on: https://dart-review.googlesource.com/72300
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
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>
It's not used by any code except the linker.
Change-Id: Ia2f145279261e42deb9f355898bb429eef0f5413
Reviewed-on: https://dart-review.googlesource.com/72243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
As opposite to constructing AST nodes and calling partial resolvers.
Also the set of tests that we created for CFE integration is too large,
so I started splitting it into pieces and cleaning up to use findNode,
fincElement, and assertElement/Type().
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: Ide4f0bee9e89eb2daf2317d1d92303a992847f1b
Reviewed-on: https://dart-review.googlesource.com/72240
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
The warning was removed from the language specification.
Plus some optimization for import scope and conflicts.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: I78b6924f9095dce89324f4093e78c948611f8493
Reviewed-on: https://dart-review.googlesource.com/72064
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Analyzer reports it, so it should not be fromFasta().
R=brianwilkerson@google.com
Change-Id: Id0db50e5f770bbae60d1955a05e632f548a104e3
Reviewed-on: https://dart-review.googlesource.com/72140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
The analyzer always runs in strong mode now, so these booleans aren't
needed.
Change-Id: Ic16ca9f37f8befead5aee85140fb70395a1d3511
Reviewed-on: https://dart-review.googlesource.com/71622
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
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>
For some time now, this file has had the same contents as strong.sum.
There's no point in keeping it around.
Change-Id: I793a41ca6cb1c47c68357f549d299fa95b96c4c5
Reviewed-on: https://dart-review.googlesource.com/71701
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
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>
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>
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>
This should make sure that everything that has to be initialized is in
fact initialized for doing expression compilation.
Change-Id: I89016b2e1b4f679c34c5450bcc56da28177728f2
Reviewed-on: https://dart-review.googlesource.com/71980
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
When the superclass has a getter/setter pair, and the subclass only
overrides one of the pair, DDC will generate the other one to forward
to the superclass. However these should not be generated for abstract
accessors. This patch fixes the compiler so it skips abstract accessors.
Change-Id: I60fa83b57db2e42ab47b7f4f3c28ef2a56e324ec
Reviewed-on: https://dart-review.googlesource.com/72073
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
If a JS class is not found (because it's not loaded yet), dartdevc
should handle this gracefully. However the code assumed that the class
would not be nested in a module that itself has not been loaded. That's
fixed in this change.
Change-Id: I2de8f4b85e8063dea31ea257aca9721702c6ea7a
Reviewed-on: https://dart-review.googlesource.com/72065
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
This was needed back when we thought the front end would be based on
the analyzer, and so we thought its performance characteristics would
depend on those of the analyzer summary mechanism. But since the
front end is not based on the analyzer, and the performance of the
analyzer summary mechanism is performance tested elsewhere, we can
remove this code. Removing it will make it easier to do some re-work
of summaries that is needed for Dart 2.1 support.
Change-Id: I4aa8b5251f26ba7fd59b99d325c66da642d410ed
Reviewed-on: https://dart-review.googlesource.com/71661
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Change a pair of package tests that relied on the existence of the
VM's Dart 1 platform Kernel binary. Use the Dart 2 platform instead,
becuase the VM will stop supporting Dart 1 in the future.
Change-Id: Ic93488974d9ed53cd205dcc24e0455a26b5f71b2
Reviewed-on: https://dart-review.googlesource.com/71246
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
AnalysisDriverResolutionTest is partially updated, about 30 failing
tests added. I will get back to it in a following CL, it is not
directly CFE integration, but updated understanding how we want to
resolve. For example we don't need types for non-expression identifiers.
Change-Id: I3daddbb6c66ffad7a726f3313a1199fd7387aa04
Reviewed-on: https://dart-review.googlesource.com/71883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This CL is a result of discussing the Fasta implementation principles
with ahe. Following his advice this CL eliminates some unnecessary
closures that were meant act as plain aliases.
Thanks to ahe for kindly explaining Fasta implementation principles.
Change-Id: I0f0cb3dec211d686b193b3b1feafaa684606994b
Reviewed-on: https://dart-review.googlesource.com/71985
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
No code has attempted to read these hashes from summaries for a long
time, so there is no point in writing them out.
Change-Id: I96854d4d5438fb6d5b4ab81b495407e2fc36d82f
Reviewed-on: https://dart-review.googlesource.com/71702
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Native methods access their parameters using indices and expect named
parameters to be in the declaration order.
Bytecode generator always sorts named parameters, which is not valid
in native wrappers.
In this CL, the original order of parameters is saved and used
when pushing arguments in native wrappers.
Change-Id: I3fb60c21a484ccae7478b9e59ca16f8b0cde8fd5
Reviewed-on: https://dart-review.googlesource.com/71884
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This CL introduces a new abstract getter 'isConst' for Member class in
the AST. This change ought to be non-breaking since every subclass of
Member implements a boolean getter 'isConst'.
The primary motivation for introducing this change is that it enables
us to simplify some of the code base by eliminating some tedious
branching and/or casts to dynamic when we need to determine whether a
member is constant, e.g.
bool isConst = false;
if (member is Procedure) isConst = member.isConst;
else if (member is Constructor) isConst = member.isConst;
else if ...
becomes
bool isConst = member.isConst;
and
if ( (member as dynamic).isConst ) { ... }
becomes
if (member.isConst) { ... }
Change-Id: Ifcc3229c7a19dd8f261266f58df5eef562167885
Reviewed-on: https://dart-review.googlesource.com/71403
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
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>
If receiver is captured, the variable is duplicated so top-level
members can access receiver as a local variable.
This is more efficient and allows uses of receiver in the prologue of
top-level member, before context is allocated and receiver is copied to
the context.
Change-Id: I5b13f692767c3aa445e558bff2bc3f8fbf016561
Reviewed-on: https://dart-review.googlesource.com/71431
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
The signature of the overridden method buildCompoundAssignment in
KernelUnresolvedNameGenerator (c.f. kernel_expression_generator.dart)
was illegal, because its (named parameter) arity was four, whilst the
same method in one of its supertypes has arity five.
Furthermore, there was a signature conflict for
buildCompoundAssignment amongst the supertypes of
KernelUnresolvedNameGenerator:
KernelUnresolvedNameGenerator
extends KernelGenerator
|
= Generator with KernelExpressionGenerator
|
arity(buildCompoundAssignment) = 5
with ErroneousExpressionGenerator, UnresolvedNameGenerator.
|
arity(buildCompoundAssignment) = 4
In this CL the conflict is resolved by the "greatest common
denominator" approach, that is, now each implementation of
buildCompoundAssignment has arity five.
This CL is a necessary step towards fixing
https://github.com/dart-lang/sdk/issues/34235
Related change: c95ef874aa
Change-Id: If1992b8fb2bb994f83557c48fb0ac276b2d1a8d3
Reviewed-on: https://dart-review.googlesource.com/71520
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
According to the specification (§10.9) it is a compile-time error to
extend, implement, or use FutureOr as a mixin.
Expands the "multiple implements" check to include a test for whether
a class attempts to extend or implement the 'FutureOr' class.
The mixin case is indirectly caught by another syntactic check for
mixed in types (c.f. checkSemantics method in source_loader.dart). It
verifies whether a mixin has zero constructors. Since FutureOr has a
constructor the check fails. This is technically enough to meet the
specification, but it leads to a confusing error message for this
particular case. To improve the quality of the error message, we may
want to merge some of the mixed in check into checkSupertypes in
kernel_class_builder.dart.
Closes https://github.com/dart-lang/sdk/issues/33744
Change-Id: I887ea9431fd50059399937f4236523ed917e3673
Reviewed-on: https://dart-review.googlesource.com/71141
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This getter appears to have been introduced in anticipation of
refactoring the summary mechanism to avoid populating summaries with
unnecessary "informative" data (see
da6a26966e), but such a refactoring
never occurred.
Change-Id: I6c486b21864b22a943af546a76bd63f7d55c42a3
Reviewed-on: https://dart-review.googlesource.com/71427
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
... with parser recovery added in subsequent CLs.
Change-Id: I7a73e8e2a4dee961920fe9854bcd108bb1041b20
Reviewed-on: https://dart-review.googlesource.com/70882
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
The getter used to be used to skip certain tests when testing the code
that computed summaries from the element model. That code was removed
nearly two years ago (d13a887292).
Change-Id: I03fe6a28d9064374e25e4968fb1d2780f75e6826
Reviewed-on: https://dart-review.googlesource.com/71440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL adds checking of number of passed function type arguments into
prologue of generic functions in bytecode. If type arguments are not
passed, then default type arguments (instantiated bounds) are used.
This mimics IL generated in StreamingFlowGraphBuilder::BuildDefaultTypeHandling.
In order to implement this check, a new bytecode instruction
JumpIfNotZeroTypeArgs is added to bytecode generator and interpreter.
Fixes language_2/function_apply_generic2_test in bytecode mode.
Change-Id: I70901c16b8bfc5f86623d51fccaf50f8969c587e
Reviewed-on: https://dart-review.googlesource.com/71387
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reverted because of failures on the VM reload tests.
Change-Id: I880523a5f3e14cc6d318d4493f037b79515b1dce
Reviewed-on: https://dart-review.googlesource.com/71401
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Avoid using deprecated errors by hadling them on a case-by-case basis.
This is a version of https://dart-review.googlesource.com/c/sdk/+/63144
with merge conflicts resolved.
Fixes#33686
Change-Id: I726740af2db5d32f15c8103c903376bc8ea948e6
Reviewed-on: https://dart-review.googlesource.com/71161
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This follows the pattern of other meta-annotations, when it comes to the AST:
* Element gains a new `hasSealed` getter. Many overrides.
* ElementAnnotation gains a new `isSealed` getter.
Bug: https://github.com/dart-lang/sdk/issues/34232
Change-Id: If8ae8e16b500125cb3b92b3cf83d46de6ca6ee23
Reviewed-on: https://dart-review.googlesource.com/71227
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This CL fixes handling of the following erroneous assignments:
- Compound assignment to postfix increment (e.g. "x++ += y;")
- Null-aware assignment to postfix increment (e.g. "x++ ??= y;")
There is some code duplication in ContextAwareGenerator now; I will
clean that up in a follow-up CL.
Change-Id: If68bc267b67904562bf8c2e705123d04fdf0b69a
Reviewed-on: https://dart-review.googlesource.com/71321
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
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>
These cases don't appear to be exercised by language_2 tests, so no
language_2 tests are fixed by this CL. I've added test cases to the
analyzer's driver_resolution_test to validate the fix.
Change-Id: I4a364e78f95981e94b51cf94d6f3236b022d42b8
Reviewed-on: https://dart-review.googlesource.com/71229
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
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>
Previously we used the same code to handle returns and yields. The
code can be inlined and specialized. This is a change in preparation
for detecting invalid returns in ClosureContext.handleReturn instead
of in TypeInferrer.ensureAssignable.
Change-Id: Ia6adc43ac1b95bb684e5df3757bcfd253434396a
Reviewed-on: https://dart-review.googlesource.com/71248
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
There are some invariants about this class and some improvements we
can make:
* needImplicitDowcasts is always true
* returnContext is never null so neither is declaredReturnType or
expectedType
* ensureAssignable calls greatestClosure on the expected type so we
don't have to
* we don't need to unwrap the type of the subexpression unless we
are inferring a return type based on it
Change-Id: I4eaf41f17dd9d5ad44143a04ef02fe11824b2aa7
Reviewed-on: https://dart-review.googlesource.com/71164
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This CL adds EntryFixed bytecode instruction in bytecode generator and
interpreter. The new instruction is used instead of Entry in prologues of
closures with fixed arguments in order to check number of arguments.
Fixes language_2/closure_call_wrong_argument_count_test in bytecode mode.
Change-Id: I873166a73c5f33e7faca8739cd6f210370e81b2e
Reviewed-on: https://dart-review.googlesource.com/71231
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Adds these missing dependencies to the deferred loading partition:
1. Signature of a local function / closure.
2. Bounds of type variables.
TBR=johnniwinther@google.com
Change-Id: I201d08cf874381e58e161d2f910b60d83932968c
Reviewed-on: https://dart-review.googlesource.com/71120
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Error recovery generates a slightly different kernel representation
for "= x" inside a class method vs. outside a class method. Inside a
class method, the synthetic LHS is a property access; outside a class
method it is a variable access. The "outside a class method" case was
addressed in 55aa031404f36d181daf5f5b27424da431ee2e3e; this CL
addresses the "inside a class method" case.
Fixes 1 language test with [ $compiler == dart2analyzer && $fasta ].
Change-Id: Ib9429cac13b775a7d0b40a13468117c442611531
Reviewed-on: https://dart-review.googlesource.com/71223
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is a bunch of renames and cleanup in preparation for
my next CL with basic mixin declaration support.
Rename listener events:
* handleClassImplements to handleClassOrMixinImplements
* beginClassBody to beginClassOrMixinBody
* endClassBody to endClassOrMixinBody
Rename parser methods:
* parseClassMember to parseClassOrMixinMember
* parseClassBody to parseClassOrMixinBody
* skipClassBody to skipClassOrMixinBody
Also:
* Change test expect from "ClassBody" to "ClassOrMixinBody"
* Rename message ExpectedClassBody to ExpectedClassOrMixinBody
* Update text of MISSING_CLASS_BODY to include mixin
* Rename IdentifierContext.classOrNamedMixinDeclaration to classOrMixinDeclaration
Change-Id: Iaa554cc859e1e665475c0eb544895a311c06395a
Reviewed-on: https://dart-review.googlesource.com/70881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Receiver and factory type arguments are implicit parameters which are
copied from original stack locations to a context if captured (along
with explicit parameters).
However, they were copied not only in top-level members, but also in
closures. So sometimes context was corrupted with unrelated values
taken from the stack (as closures do not receive these parameters
on the stack).
This CL removes incorrect copying of implicit parameters in closures.
Change-Id: I8d7d3992595f761f4ab7a1c8d16e0fc823fae22a
Reviewed-on: https://dart-review.googlesource.com/71101
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
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>
Specification disallow name conflicts between
- type variables and class names
- type variables and getter names
- type variables and member names
Although not present in current specification, the language team confirms that
it is also supposed to be a compile-time error if there is conflict with a setter.
Closes https://github.com/dart-lang/sdk/issues/33827
Bug:
Change-Id: Ia25bc91c3287f93ae43faae121a1f9d81b179c6b
Reviewed-on: https://dart-review.googlesource.com/70500
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This annotation will act as an easy way for users to experiment with a language
feature under consideration, called "sealed classes."
Bug: https://github.com/dart-lang/sdk/issues/27372
Change-Id: Ieb8bc70edaf8c11c41f0f47c01951e8311736c1f
Reviewed-on: https://dart-review.googlesource.com/69601
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
This is a step toward fixing test arg_param_trailing_comma_test/166
with [ $compiler == dart2analyzer && $fasta ], since parser error
recovery handles that case by producing an assignment with a synthetic
LHS.
Change-Id: I5c998d335758d79dc0f13988c259b85e87051a08
Reviewed-on: https://dart-review.googlesource.com/71041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
turn on strong mode and sync-async on by default.
Change-Id: I1e9d656bce7bb99b6a41110458604514a1717d0f
Reviewed-on: https://dart-review.googlesource.com/71020
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Given a source file that starts with '#@dill' on a new line, then if the rest of the lines are full paths to the kernel dill files, all kernel dill files will be loaded and executed as single program.
So, for example, given `mytest.dillref` with following content:
```
/projects/mytest/build/bin/main.vm.dill
/projects/mytest/build/packages/mytest/lib.vm.dill
```
invocation of `dart mytest.dillref` will result in loading two dill files and starting combined app.
Bug: dartbug.com/33952
Change-Id: I22a99ec9a018da1bc984bc0d716af94bc10e20d6
Add few tests
Change-Id: I22a99ec9a018da1bc984bc0d716af94bc10e20d6
Reviewed-on: https://dart-review.googlesource.com/67460
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This optimization reduces number of context allocations and decreases
number of context levels, making access to captured variables more
efficient.
This change reduces number of context levels in synthetic bodies of
sync* methods to 1. This is important for correctness because
_SyncIterable::iterator clones unerlying sync* closure to create a new
Iterator using _Closure._clone(), and _Closure._clone() clones only
1 level of context.
Fixes language_2/syncstar_yield_test in bytecode mode.
Change-Id: I7a783702b024a7454253f7f4423ec4b2e08ef61f
Reviewed-on: https://dart-review.googlesource.com/70984
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
We used to set the code range of the whole FieldDeclaration for each
individual VariableDeclaration even when there are multiple of them.
Now the first VariableDeclaration will use code range that starts at
the beginning of the FieldDeclaration, and ends at the end of its
initializer. The subsequent variables (if any) will start of the
start of their names. So, each variable will get unique code range.
R=brianwilkerson@google.com
Change-Id: I0a93bdad2a17454fd5b343b395c72440c86b421d
Reviewed-on: https://dart-review.googlesource.com/70981
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
- Switch the kernel isolate to run in Dart2 mode
- Refactor build rules so bootstrapping of the front end happens
with a prebuilt dart sdk
- Refactor application snapshot build rules so the kernel application
snapshot rule does not get into a cyclic dependency during the
bootstrap stage
Change-Id: Iccca3233f6cb8d6b307b4cf1ca3262f293f794a6
Reviewed-on: https://dart-review.googlesource.com/70841
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Fixes 1 language test with [ $compiler == dart2analyzer && $fasta ].
Change-Id: I807ca277e6e1f6fb81954be5e72b42cdec8c1b68
Reviewed-on: https://dart-review.googlesource.com/70961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
A more general mechanism was implemented soon after.
R=brianwilkerson@google.com
Change-Id: I20a2b2fbd07720caf78519a3791dff8803f7df41
Reviewed-on: https://dart-review.googlesource.com/70901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This revises how top level keywords are parsed in preparation
for parsing the new "mixin" declaration.
Change-Id: Ic3ffff523d081c1ced61285ed2b00d47cad164c3
Reviewed-on: https://dart-review.googlesource.com/70880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This required introducing a new generator type to represent a
non-l-value, so that we can re-use the machinery of DelayedAssignment.
Fixes 6 language_2 tests with [ $compiler == dart2analyzer && $fasta ].
Change-Id: Ida2985df6d798d5466948e5de3dce5c17c2de7ac
Reviewed-on: https://dart-review.googlesource.com/70842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Test Plan:
Behavioral correctness should be ensured by existing tests. Tests in vm/dart/entrypoints
ensure that the unchecked entrypoint is used in cases where the optimization should trigger.
Bug: https://github.com/dart-lang/sdk/issues/31798
Change-Id: Id25ecba86e20c22f0678c12986ad620db312ddaa
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
Reviewed-on: https://dart-review.googlesource.com/69743
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
The rules for void are changed to allow uses of void where we
previously had a warning, such as the case of assignment to a
variable of type void or passing as a parameter of type void.
Change-Id: I1c1513b0000fa1c8eedbe2645fab503b28024fa3
Reviewed-on: https://dart-review.googlesource.com/70265
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Instead of adding a big (old) map to a small (new) map and clearing the old
one, add the new entries the old map and let GC take the new map.
--use-cfe analysis-server-cold goes from ~48 to ~43 on my machine.
Change-Id: Ia0ff7bc4cafcea8e11fd9eb4eebd0cfec504b96f
Reviewed-on: https://dart-review.googlesource.com/70643
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
To ensure that the resolution of the class name is communicated to the
analyzer, we take advantage of SyntheticExpressionJudgment.original,
which allows us to ensure that type inference is performed on a
synthetic read of the class name expression. This causes the
appropriate information to be communicated to the analyzer, and then
at runtime the value produced by the synthetic read is discarded.
Fixes 15 language_2 tests with [ $compiler == dart2analyzer && $fasta ].
Change-Id: I02ad23acbb64c297129f59ff56171399bf067c33
Reviewed-on: https://dart-review.googlesource.com/70780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Also, if return statement is used inside try/finally, its return value
is saved in a variable to avoid clobbering by statements in finally
block.
This CL fixes language_2/stack_overflow_test in bytecode mode.
Change-Id: If6a3981d9dc8673f6b990aa00200e1ab7298c6ac
Reviewed-on: https://dart-review.googlesource.com/70820
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This is the follow-up for 7708989538.
Change-Id: Ib313e823df8625a1dce9ff31749f83d44e2da539
Reviewed-on: https://dart-review.googlesource.com/70760
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This reverts commit 499761f0da.
Reason for revert: crashes when building SDK, red bots, broken Flutter 3xHEAD bot
Original change's description:
> [VM/SDK] Switch kernel isolate to run in Dart 2 mode
>
> - Switch the kernel isolate to run in Dart2 mode
> - Refactor build rules so bootstrapping of the front end happens
> with a prebuilt dart sdk
> - Refactor application snapshot build rules so the kernel application
> snapshot rule does not get into a cyclic dependency during the
> bootstrap stage
>
> Change-Id: I067c5f1165fb93811dcc8e390a8bf381db721e5b
> Reviewed-on: https://dart-review.googlesource.com/70461
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
TBR=rmacnak@google.com,asiva@google.com
Change-Id: Ibf6d526fb5132b766f063fcf873cde661ae895d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/70516
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
- Switch the kernel isolate to run in Dart2 mode
- Refactor build rules so bootstrapping of the front end happens
with a prebuilt dart sdk
- Refactor application snapshot build rules so the kernel application
snapshot rule does not get into a cyclic dependency during the
bootstrap stage
Change-Id: I067c5f1165fb93811dcc8e390a8bf381db721e5b
Reviewed-on: https://dart-review.googlesource.com/70461
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This reverts commit 9727a4a4ef.
Reason for revert: Internal breakage; needs to be landed behind a flag.
Original change's description:
> Fix#33415 no error for awaiting a void expression.
>
> Bug: 33415
> Change-Id: I4d4e81fef79a5bc5162e37ab07a8fe99e50c8dfc
> Reviewed-on: https://dart-review.googlesource.com/60522
> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
TBR=brianwilkerson@google.com,mfairhurst@google.com
Bug: 33415
Change-Id: I66e1bc58bc0966a2348804dbdef6f5901b6aaf55
Reviewed-on: https://dart-review.googlesource.com/67100
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This constant evaluation is needed as default values of optional parameters
of closures can reference local const variables which are not available in
bytecode, so default value expressions can't be serialized without
enclosing AST.
Fixes test language_2/regress_18435_test in bytecode mode.
Change-Id: I1530c5bae058865de8f40d6f636dd747ba407cc5
Reviewed-on: https://dart-review.googlesource.com/70581
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>