Commit Graph

3345 Commits

Author SHA1 Message Date
Jens Johansen 4cd26421a8 Set loader.first manually if available in incremental compiler
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>
2018-08-30 06:06:42 +00:00
Kevin Millikin d8931dafa7 Use the Dart 2 platform in a pair of package tests
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>
2018-08-29 22:11:58 +00:00
Daniel Hillerström b50c7c4d58 Eliminates some closure allocations in Fasta.
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>
2018-08-29 12:49:29 +00:00
Aske Simon Christensen 94dabdaae7 Error when importing a part
Fixes https://github.com/dart-lang/sdk/issues/33650

Change-Id: I2fb5f4bf7c20309c2da9660911b7ce2088e7efea
Reviewed-on: https://dart-review.googlesource.com/71820
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-08-29 12:19:17 +00:00
Daniel Hillerström 8a99ab0c74 Fixes an illegal override in KernelUnresolvedNameGenerator.
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: https://github.com/dart-lang/sdk/commit/c95ef874aa5f3231bcd0560e86ccc03bc5a49839

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>
2018-08-27 13:32:30 +00:00
Daniel Hillerström 8b92fe3bbd Checks whether a class extends or implements FutureOr.
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>
2018-08-27 08:31:15 +00:00
danrubel 5e4e6037a9 Remove old scanner
Change-Id: If3abd39898487f4e790bbd2a4fcf5f2c8704c46d
Reviewed-on: https://dart-review.googlesource.com/70360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-24 23:19:12 +00:00
Dan Rubel aa6945d5e9 First cut basic mixin declaration parsing support
... 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>
2018-08-24 21:58:55 +00:00
Kevin Millikin 6e63df3bfb Revert "Avoid the deprecated input error in source_loader"
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>
2018-08-24 11:03:28 +00:00
Kevin Millikin 0eb0f700b8 Avoid the deprecated input error in source_loader
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>
2018-08-24 09:14:15 +00:00
Konstantin Shcheglov b255f0fab6 Resolve required arguments after named.
Change-Id: I2947be1fc20b1455e7865c34e35349977d61f70b
Reviewed-on: https://dart-review.googlesource.com/71382
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-23 22:04:12 +00:00
Konstantin Shcheglov 955ca3ef87 Use SUPER_AS_EXPRESSION for SuperAsIdentifier.
Change-Id: I7bcbcc51739f01532f4723cf39c25a620f77f8b0
Reviewed-on: https://dart-review.googlesource.com/71364
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-08-23 21:48:27 +00:00
Paul Berry 1f82d37124 Refactor duplicate code in ContextAwareGenerator.
Change-Id: I9c63827e41e1a1c043432e5385d381b0e668469d
Reviewed-on: https://dart-review.googlesource.com/71361
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-23 19:21:43 +00:00
Paul Berry a94e43af7c Fix analyzer/CFE integration of some more obscure invalid assignment cases.
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>
2018-08-23 17:31:48 +00:00
Konstantin Shcheglov 7e39d07916 Resolve namespace combinators.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/33636
Change-Id: I4f16eec2dcb5805663c0118d221f8ad8710cf3f8
Reviewed-on: https://dart-review.googlesource.com/71220
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-23 16:08:45 +00:00
Kevin Millikin 90a4600c12 Update lower and upper bounds used in type inference
During type inference, use the standard upper bound function SUB and
the standard lower bound function SLB defined in

https://github.com/dart-lang/sdk/blob/master/docs/language/informal/extreme-upper-lower-bounds.md

Change-Id: Ia767ae1e27ec3fac435cfe3f84b59d4bbc1589f7
Reviewed-on: https://dart-review.googlesource.com/70281
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-08-23 14:51:45 +00:00
Daniel Hillerström 23e379d0aa Checks whether an interface is implemented multiple times.
It is a compile-time error if an interface appears multiple times
across the extends and implements clauses.

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

   class A implements Object {}

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

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

Change-Id: Ie7153c896337b589118cac4b80e9df8ea5a09daa
Reviewed-on: https://dart-review.googlesource.com/70864
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-23 14:36:40 +00:00
Paul Berry f074f3c120 Fix analyzer/FE integration of some obscure invalid assignment cases.
This CL fixes handling of the following erroneous assignments:
- Assignment to postfix increment (e.g. "x++ = y;")
- Assignment to prefix increment (e.g. "++x = y;")
- Prefix increment of postfix increment (e.g. "++x++;")

Change-Id: I651c7cbcc4b3d43f7008f9d583e2057db9bc6e6e
Reviewed-on: https://dart-review.googlesource.com/71260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-23 13:48:43 +00:00
Paul Berry ad6f89f13b Fix analyzer/FE integration of postfix-of-postfix and prefix-of-prefix increments.
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>
2018-08-23 12:49:11 +00:00
Paul Berry c95ef874aa Work around #34235 in front_end.
Change-Id: I7e5d2e63bfd018d21ff9587f178440da39a5078d
Reviewed-on: https://dart-review.googlesource.com/71232
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-23 12:47:33 +00:00
Daniel Hillerström 6c812c27be Signal a compile-time error if a const constructor redirects to a
non-const constructor.

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

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

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

Change-Id: Id9db06aaba9b5a330e22ea328d0ae60f104dfdcf
Reviewed-on: https://dart-review.googlesource.com/71165
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
2018-08-23 12:19:07 +00:00
Kevin Millikin 19e2bb165f Specialize handling of returns and yields
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>
2018-08-23 12:03:39 +00:00
Kevin Millikin 229a7a8eeb Simplify ClosureContext
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>
2018-08-23 09:11:33 +00:00
Paul Berry e2aceb692e Fix analyzer/FE integration of prefix/postfix increment of non-l-values.
Fixes 2 language tests with [ $compiler == dart2analyzer && $fasta ].

Change-Id: I74f98f328c203fb68d8ebf819230dbe9405cfc7d
Reviewed-on: https://dart-review.googlesource.com/71225
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-22 21:57:21 +00:00
Paul Berry 43a8f1d0d6 Fix analyzer/FE integration of assignment with synthetic LHS, inside class method.
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>
2018-08-22 20:31:24 +00:00
Konstantin Shcheglov cf1cd3eba0 Resolve metadata for part-of directives.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/33795
Change-Id: Ie2eac3694d2eacbb6619abb47cf9630555a21939
Reviewed-on: https://dart-review.googlesource.com/71186
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-22 19:00:13 +00:00
danrubel cd970b0927 Parser refactoring in preparation for mixin declaration support
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>
2018-08-22 17:57:09 +00:00
Konstantin Shcheglov 5b9a42de29 Store code ranges for formal parameters.
Change-Id: I022e5140869c7007c28109a4dfda3914b34c4725
Reviewed-on: https://dart-review.googlesource.com/71184
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-22 17:40:58 +00:00
Aske Simon Christensen a4b3009ca5 Require super initializer to be at the end of the initializer list.
Drops code to handle special evaluation order rules for super
initializer before the end.

Initializer check code now also recovers from initializer errors.

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

Change-Id: I1024853bfd3acfef42630bdc2fc47782746b07c0
Reviewed-on: https://dart-review.googlesource.com/68060
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-08-22 10:43:08 +00:00
Daniel Hillerström 5780deb18a Signal a compile-time error when a type variable name conflicts with a setter name.
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>
2018-08-22 06:55:22 +00:00
Paul Berry 40d72aec8c Re-land "Fix analyzer/FE integration of assignments to ambiguous types."
This reverts commit 9f795883f1.

Change-Id: I485d0722fe8651212660dc961ae9271045ee0c54
Reviewed-on: https://dart-review.googlesource.com/71100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-22 03:13:21 +00:00
Konstantin Shcheglov 9ef53bde19 Store codeOffset/length code fields and top-level variables.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I4590a38245039a4c60144feab039cf8d0db00677
Reviewed-on: https://dart-review.googlesource.com/71040
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-22 01:53:36 +00:00
Konstantin Shcheglov 675b296d49 Store code range for constructors.
Change-Id: I3de1349158e5b6c372c6be246ffdcc599a1baeb9
Reviewed-on: https://dart-review.googlesource.com/71042
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-22 00:09:58 +00:00
Paul Berry 9f795883f1 Revert "Fix analyzer/FE integration of assignments to ambiguous types."
This reverts commit 1b5d273fd7.

Reason for revert: Windows bot breakage

Original change's description:
> Fix analyzer/FE integration of assignments to ambiguous types.
> 
> Fixes 2 language_2 tests with [ $compiler == dart2analyzer && $fasta ].
> 
> Change-Id: I600c7f075d0beb31863a4d17a6764afa2c7187be
> Reviewed-on: https://dart-review.googlesource.com/70982
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>

TBR=paulberry@google.com,scheglov@google.com,brianwilkerson@google.com

Change-Id: Iaefb47e983266d2c81b8beb3c8a5b85eac345be8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/71080
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-21 23:52:28 +00:00
Paul Berry 55aa031404 Fix analyzer/FE integration of assignment with synthetic LHS.
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>
2018-08-21 22:36:27 +00:00
Paul Berry 1b5d273fd7 Fix analyzer/FE integration of assignments to ambiguous types.
Fixes 2 language_2 tests with [ $compiler == dart2analyzer && $fasta ].

Change-Id: I600c7f075d0beb31863a4d17a6764afa2c7187be
Reviewed-on: https://dart-review.googlesource.com/70982
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-08-21 21:13:18 +00:00
Paul Berry e87efdffb4 Fix analyzer/FE integration of assignments to ambiguous types.
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>
2018-08-21 19:27:37 +00:00
Dan Rubel d06f4f807f Refactor parsing top level keyword declarations
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>
2018-08-21 17:44:57 +00:00
Paul Berry d10204f3a0 Fix analyzer/FE integration of assignments to non-l-values.
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>
2018-08-21 16:45:07 +00:00
Kevin Millikin 2a36502b02 Squelch some false warnings for disallowed uses of void
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>
2018-08-21 09:48:44 +00:00
Paul Berry a814614cf4 Fix analyzer/FE integration of invalid assignments to classes.
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>
2018-08-21 00:27:28 +00:00
Aske Simon Christensen eb37da8344 It is an error if a final field is initialized by some, but not all, constructors
closes https://github.com/dart-lang/sdk/issues/33022

Change-Id: I96549fcb2650a6efd685de41c972fd30a345fcf3
Reviewed-on: https://dart-review.googlesource.com/66563
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-08-17 12:37:52 +00:00
Aske Simon Christensen 5dec524cb0 Omit default constructor when a constructor is injected by a patch
Change-Id: I6d8182a8bcbdd2abd9d0566c9c6d6bb96bca4144
Reviewed-on: https://dart-review.googlesource.com/66561
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-08-17 12:37:52 +00:00
Aske Simon Christensen f8a96b88e9 It is an error if a final field is not initialized.
Bug: https://github.com/dart-lang/sdk/issues/33022

This commit adds an error when a final field is not initialized at all
(and there is at least one generative constructor). A later commit
will add an error for the case where a field is initialized by some,
but not all, generative constructors.

A number of classes in the Dart2js and DDC support libraries use
uninitialized final fields to indicate getters in the corresponding
native classes. This commit adds a temporary whitelist for the
affected files, which can be removed when the fields have been
replaced by external getters.

This is tracked by https://github.com/dart-lang/sdk/issues/33762

Change-Id: I6b5cee230c7cd5554da2b61da7ebddb6b0b9396e
Reviewed-on: https://dart-review.googlesource.com/63781
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-08-17 12:37:52 +00:00
Jens Johansen ff46f9f8c7 Cleanup unused things in incremental compiler
Change-Id: I886ad3517c7d00f78b27b8c605a817c31d2c1744
Reviewed-on: https://dart-review.googlesource.com/69303
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-17 06:40:27 +00:00
Alexander Markov 4e959af53d [vm/kernel/bytecode] Generate bytecode for platform when building SDK in --bytecode mode
Change-Id: Ib82765fa80a83d1434124e3fba9181a789a83932
Reviewed-on: https://dart-review.googlesource.com/69380
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-08-16 18:01:17 +00:00
Jens Johansen 57d48dcc9f Fix bug in incremental compiler, only later using initialized type
Before this CL, if initializing from a dill file containing a class,
say A, but it wasn't used, and then later using it as a type, say
'A a = new A()', the class hierarchy would complain about not knowing A.

This was caused by the class hierarchy initially being constructed using
the full component of the first compile (i.e. in the example above
without any usage of A and thus without including A), and subsequent
compiles telling the class hierarchy about new classes created in that
compile. The problem was, that if the class was loaded from a dill file
(in the example above 'A' was such a class) it would never be included
if not a part of the first full component.

This CL fixes it by changing the interface to the class hierarchys
`applyTreeChanges` function and letting the class hierarchy know about
libraries too: It will now basically just be given the full component
when asked to update, and just update with the libraries it doesn't
already know about. In the example above that would - once using 'A' -
include 'A'.

Change-Id: I895100b51659938636da0bca6c80516d87b57a24
Reviewed-on: https://dart-review.googlesource.com/69302
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-08-16 13:26:08 +00:00
Vyacheslav Egorov aa8145a03d [vm/kernel] Add a transformation that annotates invocations with receiver type.
Currently we only annotate those call-sites that would result
in generic covariant checks performed on the callee side.

Bug: https://github.com/dart-lang/sdk/issues/31798
Change-Id: Ifcf60032036575f615015d716276484a7c1236b3
Reviewed-on: https://dart-review.googlesource.com/69580
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-08-16 12:30:56 +00:00
Daniel Hillerström 0db6545b51 Illegal return type check for functions marked async* or sync*.
Extends the illegal return type check for async functions to cover
illegal return types for functions marked async* or sync* as well.

Adds new error messages for illegal return types of functions marked
async, async*, and sync*. These error messages conform with those
produced by the analyzer.

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

Bug: www.dartbug.com/33068
Change-Id: I6d8690537139d3d094a4e295fcac9de4f4a7f0af
Reviewed-on: https://dart-review.googlesource.com/69581
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-08-16 07:07:40 +00:00
Dan Rubel ad6029c608 Update fasta parser to split ">>=" when parsing type var
Change-Id: Id60da00165ef1c7d9128985ccadef06f62637a24
Reviewed-on: https://dart-review.googlesource.com/70181
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-16 01:04:46 +00:00