Commit Graph

29 Commits

Author SHA1 Message Date
Jens Johansen 43937aa9ca Don't let expression compilation bleed into real library
If an expression compilation issues problems of any sort, they are saved
in the target-libraries problemsAsJson field. That's not ideal,
as it means that they can be re-issued later, as well as possibly being
serialized into the dill file.

This CL resets the problemsAsJson field of the real library,
thus fixing the issue.

Change-Id: I765c2cc50059c6bcda6a56bb749869dd4b181876
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96800
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-04-30 11:38:48 +00:00
Jens Johansen 0720888236 Temporarily ignore context of errors in expression_test
To get the same context on errors for expressions compiled against
something we just compiled and something we've loaded from dill we need
the dill to contain offsets on TypeParameters.
We cannot currently change the binary format to include it, so for now
ignore the context in expression_test.

Change-Id: Ifbcc4352650fc56974bf5a78d9eb615ecec34e39
Reviewed-on: https://dart-review.googlesource.com/c/92743
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-19 10:18:29 +00:00
Jens Johansen 6ccdffdb35 Test for expression compilation, type variables and initialize from dill
Prior to f4379435dd,
using a type variable in an expression used for
expression compilation, where the type variable came from a class
that was loaded from dill would fail because type variables wasn't set
up so the type variable didn't exist in scope.

This adds a test for it - the actual fix was landed in
f4379435dd.

Change-Id: Icccf796b96853ece5ea96d4f29d76bb92b59fc83
Reviewed-on: https://dart-review.googlesource.com/c/92564
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-19 10:11:24 +00:00
Jens Johansen 71bee8f05e Fix serializing procdure when realClass is Object from dart:core.
Bug: 34224
Change-Id: I244ed3c15a2e134f1599588a156a7ff45917d4be
Reviewed-on: https://dart-review.googlesource.com/c/91641
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-01-30 08:44:05 +00:00
Aske Simon Christensen c9aaa7a654 Re-formulation of type bound violation error messages
Change-Id: I7f0b99c184b02f6910da054b877b5b5bee86f6bc
Reviewed-on: https://dart-review.googlesource.com/c/85346
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-11-29 13:27:16 +00:00
Aske Simon Christensen c959bd98af Print origins of types in bullet points below error messages.
This gets rid of the useless '#lib1::' prefixes on types in error
messages and instead adds a line to the error message for each
interface type appearing in the message stating where that type
originates.

Name clashes are disambiguated by appending markers like '/*1*/' and
'/*2*/' to the types whenever two interface types with the same name
appear in the same message.

The commonly used core types 'bool', 'num', 'int', 'double', 'String'
and 'Null' are excluded from the origin list unless they take part in a
name clash.

Change-Id: I017ea376d4f6ff2d4f3b36487774463f03bb3301
Reviewed-on: https://dart-review.googlesource.com/c/84604
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-11-29 13:27:16 +00:00
Peter von der Ahé 5aa705776b Remove desugaredError
Change-Id: Ide688cb577457a642d989deb8d4c7c638274a1bc
Reviewed-on: https://dart-review.googlesource.com/c/80448
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-10-19 07:16:47 +00:00
Peter von der Ahé d4fac1684c Remove CompilerOptions.reportMessages
Change-Id: I6b3e2f44ef89ba6a234fab97e08f56a69247d13f
Reviewed-on: https://dart-review.googlesource.com/c/77081
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-10-16 05:50:05 +00:00
Dmitry Stefantsov 8648d782ae Reland "[fasta] Report errors for bounds violations"
The original commit:
https://github.com/dart-lang/sdk/commit/aa6fb2d3a4298e60b5635f26507d5b39f4e531cb

Change-Id: I34287ec856fde16d56e9369ef2620311ba9bb722
Reviewed-on: https://dart-review.googlesource.com/c/79200
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-10-11 10:20:01 +00:00
Dmitry Stefantsov a539d2ef5f Revert "[fasta] Report errors for bounds violations"
The CL is reverted because it didn't account for the case when a check
of a user-specified type argument against the bound depends on another
type that is only known after type inference is done.

Change-Id: I1fd140af95ed37b9191a5b161a281d4639e3453f
Reviewed-on: https://dart-review.googlesource.com/c/79048
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2018-10-10 15:31:27 +00:00
Dmitry Stefantsov aa6fb2d3a4 [fasta] Report errors for bounds violations
Fixes #33308.

Bug: http://dartbug.com/33308
Change-Id: Iae087928468ed6883c438db95644135dc7ef0a6a
Reviewed-on: https://dart-review.googlesource.com/c/57621
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-10-10 12:03:36 +00:00
Peter von der Ahé a1ebe68359 Change how compile-time NSM is handled
Change-Id: I8dc408c1ffec9307e776288a8fb99604c7dedd6b
Reviewed-on: https://dart-review.googlesource.com/76664
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
2018-10-02 16:53:03 +00:00
Peter von der Ahé df32b2ae49 Ignore synthetic tokens when compiling bodies
Change-Id: Id5f6c4158e70f5a444a6baec1374da20f961a4ec
Reviewed-on: https://dart-review.googlesource.com/76603
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
2018-10-02 13:59:20 +00:00
Alexander Aprelev c688d0c0c3 [frontend] When serializing compiled expression proc, clone type params first.
If there are circular references between type parameters and types in the bounds,
currently serialization leaves original type parameters unchanged, which results
in failures to serialize compiled expression procedure.

This CL makes sure to clone all type parameters first, then passes map
with old-to-new type parameters to CloneVisitor.

Bug: https://github.com/dart-lang/sdk/issues/34052
Change-Id: Idf3e6e6e9099f93cdd7e970ab3b21921cdb29178
Reviewed-on: https://dart-review.googlesource.com/75241
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-09-20 14:55:59 +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
Brian Wilkerson 49437e3bae Split TooManyArguments to support quick fixes
Change-Id: I31511f619cafbce01f68d6e182328567a2bc3523
Reviewed-on: https://dart-review.googlesource.com/70021
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-08-15 13:24:22 +00:00
Konstantin Shcheglov d69a354026 Put fileEndOffset into ArgumentsJudgment and use to report argument errors.
Change-Id: Id79bd71e7147be379e93024591134c12aa598a38
Reviewed-on: https://dart-review.googlesource.com/69221
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-10 15:40:37 +00:00
Paul Berry 31af5ce13c Revert CLs reworking generator class handling of non-lvalues.
This arc of work is breaking the Flutter roll--see
https://github.com/dart-lang/sdk/issues/33993.

This reverts the following commits:

- 55c0857037 (Create a common generator class to handle non-lvalues.)

- c9b197017c (Rename "assignment_of" -> "assignment_to".)

- 32fd7b15e4 (Remove special case for assignment to parenthesized
  expressions.)

- 432e59e589 (Fix error reporting if a for-in statement attempts to
  assign to a prefix.)

- 232bed3d11 (Change UnresolvedNameGenerator to use
  NonLvalueGenerator.)

- 0b778d0697 (Change IncompleteErrorGenerator to make use of
  NonLValueGenerator.)

- 1a5f94a0a4 (Fix analyzer-CFE integration of illegal references to
  instance members from static contexts.)

Change-Id: Id637e5ec60150a73031c05d7bb4c6effefd2aa8a
Reviewed-on: https://dart-review.googlesource.com/67091
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-07-27 17:18:28 +00:00
Paul Berry 232bed3d11 Change UnresolvedNameGenerator to use NonLvalueGenerator.
This avoids the need for custom assignment-handling logic in
KernelUnresolvedNameGenerator, and ensures that assignments to
unresloved names work properly with analyzer integration.

Change-Id: I802270987c90043d021f8560b56f47babf72fb1e
Reviewed-on: https://dart-review.googlesource.com/66701
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-07-25 18:22:45 +00:00
Konstantin Shcheglov 312a7d13ec Store resolution for unresolved type instance creation.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I91af78cc5b99924c8dab77662d6bd08786a24fd9
Reviewed-on: https://dart-review.googlesource.com/65026
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-07-15 16:50:49 +00:00
Konstantin Shcheglov 7b68a4516f Wrap Let with ShadowSyntheticExpression in wrapInLocatedCompileTimeError().
So, that ExpressionStatementJudgment is created with an ExpressionJudgment, not with raw Let.

Change-Id: I648b1b6053b90b315064535237122be6289f8e6e
Reviewed-on: https://dart-review.googlesource.com/61105
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-06-20 15:44:44 +00:00
Samir Jindel 1a23ff68a5 Fix incorrect handling of NSM forwarders and pull all logic into CFE. (Take 2)
The behavioral difference is that named and optional arguments are filled in
with their default values in the `Invocation` object passed to `noSuchMethod`.

On the implementation side we make NSM forwarders concrete and fill in their
bodies in the CFE. The custom (and somewhat hacky) VM support is no longer
needed, and Dart2JS can benefit from this implementation as well.

According to discussion on #33031 we will be able to re-land this soon without
breaking Mockito.

Prior failures on precompiler bots are fixed in Patchset 2.

Change-Id: If1b7fe4cf6da5ef38f330e1ad226121bcfc958a1
Reviewed-on: https://dart-review.googlesource.com/54401
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-15 11:23:32 +00:00
Samir Jindel 03abbc73d2 CFE support for expression evaluation, refactored.
Change-Id: I7eac1020b7aa11ea0276f909d7b11ee6388b1aa7
Reviewed-on: https://dart-review.googlesource.com/53209
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-05-08 11:20:35 +00:00
Samir Jindel 054559c5f3 Revert "CFE support for compiling individual expressions in a context."
This reverts commit 9038b8f45f.

Revert "Refactoring to allow compilation inside a library loaded from Dill."

This reverts commit 12d697b2ea.

Change-Id: Ia617e464d0c34a6685d351b73abf20def75021ad
Reviewed-on: https://dart-review.googlesource.com/53420
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-05-08 11:20:35 +00:00
Alexander Aprelev 2765fcf2ae Revert "Revert "Revert "Fix incorrect handling of NSM forwarders and pull all logic into CFE."""
This reverts commit 9a7e1f64a2 as it
breaks mockito tests and commit 0bc6e7217a as being done for
9a7e1f64a2.

Bug: https://github.com/dart-lang/sdk/issues/33031
Change-Id: Id20a83c8a7a62ec73446180ecb37e9200f3a92b6
Reviewed-on: https://dart-review.googlesource.com/53540
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-05-03 06:01:08 +00:00
Samir Jindel 0bc6e7217a Update expression compilation expectations.
Change-Id: Ia335aad6a736723b571d611f849ba7e8ad991865
Reviewed-on: https://dart-review.googlesource.com/53382
Reviewed-by: Jens Johansen <jensj@google.com>
2018-05-02 13:44:21 +00:00
Samir Jindel 9038b8f45f CFE support for compiling individual expressions in a context.
Change-Id: I6469fb16e8846eccaeca3f8585872f4b69dd3f1e
Reviewed-on: https://dart-review.googlesource.com/38123
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-05-02 12:45:03 +00:00
Samir Jindel 69f35c18bc Test code for CFE expression compilation.
Change-Id: I90f953592d66be04bfb26ffb5f604ba5e7f010a5
Reviewed-on: https://dart-review.googlesource.com/51322
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-04-30 15:33:11 +00:00
Samir Jindel f85480b4dd Add tests for CFE implementation of expression compilation.
Change-Id: Ib7af386876d831e84ca97c42bbe3084c96fcc114
Reviewed-on: https://dart-review.googlesource.com/49906
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-04-16 19:29:38 +00:00