Commit Graph

25510 Commits

Author SHA1 Message Date
Dmitry Stefantsov 9f3e9f37a0 [cfe] Make checks on individual leaves of collection element sub-trees
Closes #36456.

Bug: http://dartbug.com/36456
Change-Id: Ic604fecbabe78eede44cedb2251a68b71f608c41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98567
Auto-Submit: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-04-03 13:54:03 +00:00
Kevin Millikin 54783db99c [cfe] Ensure that await for elements are marked async
When converting an await for map entry to an element, ensure that the
element is properly marked async.  This fixes failures on dart2js and
DDK.

Change-Id: I7566bc57728f1d734bb8932f15ea7a9e9487d39e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98565
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-04-03 12:54:33 +00:00
Kevin Millikin dbb6bf0237 [cfe] Ensure that async for map entries are marked
When disambiguating between maps and sets, ensure that `await for`
loops are marked as asynchronous.  Otherwise, there will be a spurious
type error because we have a Stream and would expect an Iterable.

Change-Id: Ie97eaf74ff7a9e4dfb262ab0447f4322d04701aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98467
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-04-03 10:27:22 +00:00
Johnni Winther 78fca5b2fa Include liveness of type argument in supertypes in RTI needed checks computation
Change-Id: Ifdde3e8694f8d39ccf10cac0d5dc2cb3cb9225bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98560
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-04-03 10:23:53 +00:00
Dmitry Stefantsov e1e5bb59c9 [cfe] Check that the condition in if-elements is a bool
Change-Id: If089fa603d586169ca2a368ba7fbf7fffc7ec8d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98484
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-03 09:17:24 +00:00
Dmitry Stefantsov c5f1614bcc [fasta] Don't use invalidCollectionElement when ui-as-code is enabled
Closes #36413.

Bug: http://dartbug.com/36413
Change-Id: Ie9f0b82bab63c802fddb4c5642d374d7cc43455e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98466
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-03 09:17:24 +00:00
Konstantin Shcheglov cc0997f1bc Compute 'isSimplyBounded' for generic classes and typedefs.
I also copied corresponding tests from summary to resynthesize tests,
so that AST linking can run them too.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I01d019cc57373f0dd05ab2f1467bd5528d1e2432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98431
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-04-03 05:44:24 +00:00
Mike Fairhurst 5f03a9a07e Fix lints in summary generator: setter types, star-slash docs
Change-Id: I808be84579c775c58b9a4b6d8f4ea10fc6fb29dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98458
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-04-02 23:48:31 +00:00
Mayank Patke 335a854696 Implement JavaScript semantics for frontend constant folding.
Change-Id: I8232d0f5875d8471d8110582c44fc9d9b8a735f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98240
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-04-02 22:37:46 +00:00
Brian Wilkerson 9f59f46650 Fix an exception in the changeArgumentName quick fix (issue 36440)
Change-Id: Ide70f8535798829e208b482c79c6f97cd414a829
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98438
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-04-02 22:26:24 +00:00
Konstantin Shcheglov 0d0f5916f7 Issue 36439. Fix for incomplete generic type alias, without function type.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/36439
Change-Id: I6a3c5be2f412ce7fb4e5b9ce3ad463158c878106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98436
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-04-02 21:15:35 +00:00
Alexander Markov 8fb77ec84d [vm/bytecode] Preliminary support for new language features in bytecode
Issue: https://github.com/dart-lang/sdk/issues/36214
Issue: https://github.com/dart-lang/sdk/issues/36218

Change-Id: I39149b82cb93c1cb87c64cf9c41c56b753bba13a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98400
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2019-04-02 19:11:09 +00:00
Sam Rawlins 8aabbf39e5 Move last meta-based hint code tests to diagnostics:
* INVALID_FACTORY_ANNOTATION
* INVALID_FACTORY_METHOD_IMPL
* INVALID_USE_OF_PROTECTED_MEMBER
* INVALID_USE_OF_VISIBLE_FOR_TEMPLATE
* INVALID_USE_OF_VISIBLE_FOR_TESTING
* MISSING_REQUIRED_PARAM

Change-Id: I3bb556f140dd61d8c707ae8db7ec2ce36d01ed97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98451
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-04-02 18:18:49 +00:00
Brian Wilkerson f6768b6fb3 Update the data version to prevent the use of outdated cached data
Change-Id: Ie590959d2812b7e33854e8ad798cd43366f7bfa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98450
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-04-02 16:55:41 +00:00
Nate Bosch 8fee2596e5 Remove some unused front_end dependencies
There are no imports to these packages.

Change-Id: I51c194cd48b7fb594070616524f817267ae11d56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2019-04-02 16:55:29 +00:00
danrubel 725c070632 report error on type reference before factory keyword
This updates the parser to report an error if there is a type reference
preceding the factory keyword.

Fix https://github.com/dart-lang/sdk/issues/36400

Change-Id: Iba04f68bba8d260444d55168322d67a600feba53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98449
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-02 15:39:29 +00:00
danrubel ff99692175 dartfix update analysis options to enable NNBD
This updates the analysis server edit.dartfix functionality
to enable NNBD by modifying the analysis options file,
creating that file if necessary.

Change-Id: I831182e49e585ef0d851d4eb715885e90954bcad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98429
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-02 15:29:59 +00:00
Johnni Winther 14fd3b7d6a Report errors on invalid constants in == and !=
Invocation of == and != is only constant on receivers of types bool, int, double, and String or null operands. This is now handled correctly in constant evaluation. The case for method invocation of `a != b` is removed since it is parsed as `!(a == b)`.

Change-Id: I65d8ddf2716f319f61fc0609803a5237f4aba644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98349
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-04-02 13:54:28 +00:00
Dmitry Stefantsov 4a1b153fe1 [cfe] Enable type promotion in if-elements of literal collections
Closes #36396.

Bug: http://dartbug.com/36396
Change-Id: I223267cdee1aca38d69354e4f97df7dcc76e9553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98461
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-02 13:33:19 +00:00
Dmitry Stefantsov 45bd79c119 [cfe] Fix inference on variable declarations in for-elements
Closes #36395, closes #36393.

Bug: http://dartbug.com/36395
Change-Id: Ifd35ce2e1a646b484b7fcc83d9fb1a0f9d3ae978
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98333
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-02 13:33:19 +00:00
Dmitry Stefantsov 71a3649a5a [cfe] Assume invocations are dead if they aren't reached by type inference
Closes #36356

Bug: http://dartbug.com/36356
Change-Id: I8fdc50877ada3eaa608bd8b02d53dc975af4efd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98355
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-02 13:08:09 +00:00
Aske Simon Christensen d320f42542 [CFE] Remove redundant null checks in constant evaluator.
The evaluate method now never returns null, so checks for null of
return values are redundant, and the "try" in the name of the
evaluation functions is not appropriate.

Change-Id: I32960164ba73fb706eef5a5a617df7d47e24a074
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98357
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-04-02 12:11:58 +00:00
Jens Johansen 8ce2d7a4e1 [CFE] Better error messages on errors with user definable operators
Fixes #36383

Change-Id: I24fd51bdb3ead75973009fe515819f9c8354e1b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98332
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-02 10:46:18 +00:00
Kevin Millikin c71888d537 [cfe] Async translation of block expressions
Translate block expressions in the VM's async translation.  Closes
https://github.com/dart-lang/sdk/issues/36277

Change-Id: I606b155bfe1364e948d18043c167a272007411e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98339
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-04-02 10:00:53 +00:00
Mark Zhou 28e658814f [dartdevc] Implementing collection concatenation
Required for collection constants.

Change-Id: I7397cd9b84e4fc7dea4a968272269d4d1d540f23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98300
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-04-02 02:47:44 +00:00
Mark Zhou bfb99d146d [dartdevc] Adding superclass constraints to mixin init
Change-Id: Ib21279326c46d1e675b5646e4df759fa176942dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98366
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2019-04-02 00:23:53 +00:00
Sigmund Cherem c26f1c6bf7 Do not assume stack trace is not null
Change-Id: Ib795cfdbcf9599f7e4bc2688b9a965f50c0b7c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98421
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-04-02 00:02:53 +00:00
Brian Wilkerson dd7a6320e3 Rework the way Dartdoc template information is gathered
Change-Id: Ia6ecde9cc317ae40e8876cdf39b49bd39a47b543
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98365
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-04-01 21:46:52 +00:00
Sam Rawlins 75b2f9f919 Move more HintCode tests to individual files:
* DUPLICATE_IMPORT
* IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION
* NULL_AWARE_*
* OVERRIDE_*

This puts non_hint_code_test alllllmost at empty.

Change-Id: Iade3a2fd29b484d711556ff688a6386789a50d0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98289
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-04-01 16:54:55 +00:00
Brian Wilkerson acb62b97fe Add a default URL for lints
Change-Id: I4dc735cb4982329c6b275f64f2969865e9235c26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97844
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-04-01 16:54:53 +00:00
Konstantin Shcheglov e979448597 Patch expectations for tests where AST linking does better / differently.
R=brianwilkerson@google.com

Change-Id: I86dbcffe4d278c33a7916399367bbc4bb20607a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98288
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-04-01 16:05:10 +00:00
Aske Simon Christensen 87de68341f [CFE] Disallow property access on instance constants.
Change-Id: I06b87332774790ae0c650810541bb6828101c3ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98335
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-04-01 15:51:34 +00:00
Johnni Winther 1a3e8dda3b Handle nested unevaluated constants in constant evaluator
The constant evaluator assumed that any ConstantExpression met during evaluation of a sub expression was not an unevaluated constant. This do occur, for instance when a field is initialized to an unevaluated constant. With the change, unevaluated constants met during evaluation are themselves evaluated.

This change also fixed handling of assert initializers in unevaluated constants.

Change-Id: Id9e676f40bc829c4d234f34a74ef0ca5c4c6ec48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98348
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-04-01 14:29:32 +00:00
Aske Simon Christensen 277f65ec93 [CFE] Permit evaluating a const variable more than once.
This happens for instance in language_2/const_qq_test.

Change-Id: Ibad3f578f765cf2dccbf1e6c50ef0ff7187f5f8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98334
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-04-01 13:44:13 +00:00
Aske Simon Christensen a88b653e03 [CFE] Bubble out InvalidExpression from unevaluated constants.
This allows backends that do not understand unevaluated constants,
such as the VM, to properly throw when encountering static errors
inside constant expressions.

Change-Id: Ida0f213cacbc66aea9bb1db2ddbd3fb4b8405eae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98352
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-04-01 13:11:47 +00:00
Johnni Winther 05dd851566 Test late CFE constant evaluation.
Tests that dart2js can handle evaluation of unevaluated constants from CFE, including handling of potential compile-time errors found during evaluation.

The CL fixes a bug in the constant evaluator where it created map literals that were not marked as constant as needed.

Change-Id: I7df77a3c68e52392a143478b3567d19e09ebe6bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98347
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-04-01 13:05:52 +00:00
Samir Jindel 154c324786 [vm/ffi] Lock out structs on 32-bit platforms.
Addresses https://github.com/dart-lang/sdk/issues/36334

Change-Id: I880812941748207ea93a789db2f2d4d2938d3f37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97961
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
2019-04-01 10:30:58 +00:00
Konstantin Shcheglov 66f16d3d5e Resynthesize import/export combinators.
R=brianwilkerson@google.com

Change-Id: Ib37f1d3fe431e792fe63c92abd0be45d84af11b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98283
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-31 17:04:01 +00:00
Konstantin Shcheglov 4e3d1400d5 Resynthesize ImportElement.isDeferred from AST.
R=brianwilkerson@google.com

Change-Id: I332fb8cfd6260ead322a1242b2340f4a9ccee269
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98285
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-31 16:46:23 +00:00
Konstantin Shcheglov 8a5901a7af Support for isCovariant in fields.
R=brianwilkerson@google.com

Change-Id: Ie134ee454cef7b5cff69b52986ecd3f46ca1e485
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98284
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-31 16:45:10 +00:00
Konstantin Shcheglov 9113bb5855 Issue 36380. Increment DATA_VERSION.
I suspect that the referenced issue was caused by producing and consuming
incompatible summaries from the cache.

R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/36380
Change-Id: I41bd6b3ae8a07853bb702ce34724ed854f33e753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98286
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-31 16:35:08 +00:00
Brian Wilkerson e6b0676f58 Change comment style in a few more files
Change-Id: I2c7a3e2a01e9db61ea9ca5f6a1156d6d8ce34f5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98282
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-03-31 15:28:53 +00:00
Konstantin Shcheglov c7dd9c1c23 Perform top-level inference using elements.
This is still not a valid implementation, because for example it does
no inheritance inference, or ordering. But we need elements for
inheritance, so this change is required.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ia290a9034cbda753af60e74f6d9120d9c38bf203
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-29 23:59:33 +00:00
Brian Wilkerson 3642eddca1 Create an experiment flag for triple-shift and move existing support for the operator behind the new flag
Change-Id: Ibff112644921618f8d21b0b1b8eb6332a590bfab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98305
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-03-29 21:51:40 +00:00
Konstantin Shcheglov dfbdf0a187 Support for function typed formal parameters.
R=brianwilkerson@google.com

Change-Id: I3843c970ae94f6637aa8b4ba50e840a6ca979c83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98304
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-29 19:01:02 +00:00
Dmitry Stefantsov e0a2651ce0 [cfe] Fix downcasts added during set/map disambiguation
Change-Id: I79d559c756994424eb395ecc8f12f84c1bf1e257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98327
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-03-29 17:18:55 +00:00
Dmitry Stefantsov f21d521d0e [cfe] Fix pre-inference set/map disambiguation
Closes #36377

Bug: http://dartbug.com/36377
Change-Id: I0a486f467bdc999e6188fb3206f4eed1d8ffb67a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98341
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-03-29 17:18:55 +00:00
Dmitry Stefantsov 6b19aa821b [cfe] Do type checks on spreads during inference
Change-Id: I9eb72681a5a019ff7f7e030cf5f500144293bd4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98180
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-03-29 17:18:55 +00:00
Dmitry Stefantsov 1a5ed8247f [fasta] Fix typos and copy-paste errors in a test case
Change-Id: I5d65f4ec44cb358767b1a8902d862dba1be1bb6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98019
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-03-29 17:18:55 +00:00
Dmitry Stefantsov 584affcffa [cfe] Add initial support for 'for' and for-in elements in maps
Change-Id: I9fade4b8ac193f4d9a4df33c71447c0cb5fc3590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98015
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-03-29 17:18:55 +00:00