Commit Graph

2004 Commits

Author SHA1 Message Date
Jens Johansen 364ae20a65 [CFE] Only spell/lint check things staged in git
This avoids semi-spurious errors from files not in git.

Change-Id: Ia87a9959ff8a1cdca8da60f315299aabaa0966da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162751
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-09-16 11:40:38 +00:00
Dmitry Stefantsov e119ccad2a [cfe] Infer Object from constraints similar to T? = dynamic
Closes #43163.

Bug: https://github.com/dart-lang/sdk/issues/43163
Change-Id: I55f51eee097a320dcc38cf54a41c9f6684b5dd59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162505
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-09-16 11:36:28 +00:00
Johnni Winther c9576a1dac Reland "[cfe] Make fast path for adding simple member signatures"
Change-Id: If9aa575308a3932988259f36d217f6d402136388
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162749
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-16 10:37:28 +00:00
Johnni Winther 644df9b9fb Revert "Reland: [kernel] Rename Name.name to Name.text"
This reverts commit c430a0ac0b.

Reason for revert: Will break flutter_frontend_server when rolled into google3

Original change's description:
> Reland: [kernel] Rename Name.name to Name.text
> 
> Change-Id: I5240b0ff09faf35184998920202d7600dc97766d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162746
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Johnni Winther <johnniwinther@google.com>

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

Change-Id: Ib6961f49dd416171c5d5935c490d79d6f7be779e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162748
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-16 08:22:55 +00:00
Johnni Winther c430a0ac0b Reland: [kernel] Rename Name.name to Name.text
Change-Id: I5240b0ff09faf35184998920202d7600dc97766d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162746
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-16 07:42:42 +00:00
Jason Simmons fc01707e44 Revert "[cfe] Make fast path for adding simple member signatures"
This reverts commit f7ff99e937.

Reason for revert: This caused a regression in Flutter:
https://api.cirrus-ci.com/v1/task/5181542404194304/logs/test_framework.log

Change-Id: I892690cb2c7dc626939ddbec99b6dffda3f6fc80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163000
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-09-15 23:53:45 +00:00
jonahwilliams 99c3eac6cb [frontend] add support for flutter widget cache
Add an initial draft of the widget cache for fast single widget reloads.

THe intention is to capture the common cases where only a single widget class is modified. This can
provide a signal to the flutter tool that a faster reassemble can be performed, rather than forcing
a complete cold frame.

For more details see the linked issue or go/fast-single-widget-reloads

Bug: https://github.com/flutter/flutter/issues/61407
Change-Id: I1c95fd8fb2d1b297f41874dd69c1c76b0456a4bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161604
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-09-15 17:03:43 +00:00
Daco Harkes 7302e01a79 Revert "[kernel] Rename Name.name to Name.text"
This reverts commit 3ff8dd2f51.

Reason for revert: Fails all CI builders. Possibly something landed
in the mean time.

Original change's description:
> [kernel] Rename Name.name to Name.text
> 
> Change-Id: I93162fb387ba123b949e19a7829bd5614845b15d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162722
> Reviewed-by: Jens Johansen <jensj@google.com>
> Commit-Queue: Johnni Winther <johnniwinther@google.com>

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

Change-Id: I2ffe526dabf37ae09d5e4ab1fbe514925f6e8768
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162744
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-09-15 15:21:35 +00:00
Johnni Winther 3ff8dd2f51 [kernel] Rename Name.name to Name.text
Change-Id: I93162fb387ba123b949e19a7829bd5614845b15d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162722
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-15 14:27:22 +00:00
Johnni Winther f7ff99e937 [cfe] Make fast path for adding simple member signatures
Change-Id: I9eae2bbd048738a9620ed39c2210c5890428e14b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162704
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-15 12:06:31 +00:00
Jens Johansen 809febe06a [CFE] Low-level coverage tool
This/these tools can later be integrated into other tools/tests if we
want to.

For now it is "external" tools where one can for instance see that
running our strong tests leaves quite a bit to be desired in regards
to constant transformation coverage:

package:front_end/src/fasta/kernel/constant_collection_builders.dart
Misses: [950, 956, 960, 970, 1002, 1014, 1015, 1025, 1334, 1340, 1431, 1441, 1782, 1792, 2593, 2599, 2624, 2949, 2977, 2984, 3001, 3036, 3044, 3067, 3080, 3124, 3153, 3157, 3167, 3270, 3280, 3301, 3315, 3354, 3963, 3973, 4050, 4063, 4089, 4099, 4194, 4204, 4275, 4288, 4314, 4324, 4797, 4803, 4828, 5889, 5899, 5979, 6007, 6014, 6031, 6065, 6073, 6096, 6108, 6152, 6180, 6184, 6194, 6296, 6306, 6327, 6341, 6378, 7267, 7273, 7277, 7287, 7318, 7337, 7363, 7368, 7377, 7387, 7401, 7411, 7768, 7774, 7865, 7875, 8232, 8242, 8566, 8572, 8605, 8667, 8677, 8753, 8766, 8787, 8797, 8897, 8907, 8977, 8990, 9011, 9021, 9760, 9788, 9795, 9812, 9854, 9875, 9898, 9910, 9919, 9961, 9989, 9993, 10003, 10105, 10115, 10127, 10149, 10181, 10201]
Not compiled: [[2291 - 2403], [3724 - 3834]]

package:front_end/src/fasta/kernel/constant_evaluator.dart
Misses: [4301, 4340, 4371, 4408, 7793, 7822, 7841, 7848, 7910, 7918, 7958, 8102, 8937, 8983, 9000, 9017, 9030, 9105, 9119, 9165, 9424, 9459, 9492, 9600, 9622, 9670, 9705, 12639, 12657, 19070, 19088, 23629, 23928, 23953, 27554, 27562, 27610, 27623, 28624, 28681, 28698, 29046, 29103, 29120, 29471, 30091, 30138, 30210, 30243, 30284, 30738, 30747, 35250, 37816, 37842, 39028, 39708, 40583, 40660, 40859, 40949, 41212, 41248, 41291, 41340, 41386, 41396, 41658, 41687, 41708, 41736, 41761, 41778, 41803, 41839, 41862, 41872, 41883, 41935, 41948, 41975, 42248, 42274, 42636, 42659, 42761, 42791, 42809, 42825, 43014, 43032, 43048, 43452, 43481, 43563, 43572, 43577, 48621, 48670, 48681, 48704, 48745, 48769, 48773, 49496, 50581, 50623, 50713, 50831, 50843, 50859, 50875, 50879, 51141, 51168, 51199, 51207, 51240, 51259, 51286, 51302, 51310, 51318, 51334, 51424, 51486, 51738, 51771, 51793, 51826, 51842, 51850, 51858, 51874, 51917, 51981, 52047, 52096, 52127, 52159, 52247, 52260, 52269, 52305, 52337, 52389, 52402, 52449, 52465, 52475, 52522, 52530, 52569, 52632, 52660, 52710, 52723, 52764, 52780, 52790, 52833, 52841, 52876, 53178, 53414, 53457, 53474, 53498, 53518, 53550, 53559, 53569, 53857, 53882, 53920, 53958, 53995, 54035, 54072, 54236, 54287, 54313, 54354, 54434, 54447, 54483, 54491, 54512, 54689, 54696, 54741, 54790, 54817, 54859, 54895, 54919, 54925, 54933, 54975, 55063, 55076, 55153, 55169, 55179, 55226, 55234, 55275, 55883, 55971, 55984, 56057, 56073, 56083, 56127, 56135, 56176, 56429, 56509, 56522, 56586, 56602, 56612, 56652, 56660, 56697, 56897, 56977, 56990, 57054, 57070, 57080, 57123, 57131, 57168, 57720, 57800, 57813, 57877, 57893, 57903, 57943, 57951, 57988, 58046, 58085, 58092, 58140, 58163, 58223, 58249, 58285, 58307, 58322, 58348, 58374, 58410, 58432, 58447, 58473, 58499, 58535, 58557, 58563, 58572, 58635, 58667, 58726, 58797, 58810, 58838, 62482, 62498, 62505, 62511, 62531, 62536, 62544, 62569, 62585, 62591, 62631, 62698, 62727, 62767, 62795, 62823, 62849, 62854, 62859, 62887, 62900, 62910, 62935, 62941, 62966, 63002, 63034, 63046, 63070, 63081, 63124, 63156, 63214, 63280, 63293, 63312, 63317, 63333, 63416, 63520, 63548, 64132, 64233, 64246, 64256, 64374, 65680, 65776, 65789, 65797, 65802, 65986, 66082, 66095, 66103, 66108, 66139, 66197, 66227, 68515, 68884, 68958, 69039, 69083, 69113, 69153, 69197, 69253, 69495, 69606, 69645, 69655, 69755, 69765, 69867, 70039, 70054, 70057, 70067, 70165, 70182, 70272, 70378, 70442, 70540, 70615, 71144, 71187, 71227, 71278, 71571, 71576, 71581, 71942, 72011, 72049, 72189, 72240, 72283, 72334, 73668, 73720, 73800, 73834, 73907, 73912, 73933, 73956, 73984, 74017, 74032, 74078, 74093, 74107, 74134, 74175, 74357, 74400, 74413, 74432, 74436, 74456, 74477, 74521, 74540, 74818, 74861, 74874, 74898, 74918, 74936, 74961, 74974, 75117, 75677, 75693, 75711, 75727, 75812, 75828, 75840, 75856, 76609, 76621, 76713, 76729, 76747, 76763, 76852, 76868, 76880, 76896, 77022, 77038, 77050, 77066, 77781, 77839, 77860, 77886, 77938, 77984, 77999, 78834, 78856, 78866, 79352, 79395, 79409, 79447, 79461, 79495, 79892, 79921, 80247, 82403, 82446, 82456, 82459, 82475, 82485, 82573, 82589, 82618, 82632, 82648, 82658, 82700, 82788, 82798, 82905, 82921, 82950, 82964, 82980, 82990, 83029, 85628, 87178, 87195, 87236, 87253, 87294, 87311, 87352, 87369, 87590, 87614, 87631, 87673, 87693, 87712, 87729, 87750, 87769, 87787, 87808, 87827, 87845, 87865, 87884, 87908, 87972, 89297, 90734, 91335, 91363, 91615, 91643, 95325, 95341]
Not compiled: [[2884 - 3935], [4838 - 5709], [5717 - 5764], [5717 - 5764], [6120 - 6260], [6265 - 6330], [6547 - 6616], [6621 - 6690], [6695 - 7565], [8172 - 8766], [9749 - 10256], [10261 - 10332], [10337 - 10565], [10570 - 10649], [12669 - 12775], [15251 - 15850], [22509 - 22639], [22644 - 22832], [22837 - 22965], [23163 - 23291], [32272 - 32540], [32545 - 32690], [32945 - 33199], [33706 - 33737], [33801 - 33832], [34401 - 34563], [36370 - 36615], [36620 - 36744], [37854 - 37926], [40336 - 40462], [43608 - 44490], [44495 - 46198], [46743 - 46814], [47292 - 47433], [58871 - 61188], [61193 - 62190], [66274 - 68208], [70625 - 70783], [78009 - 78569], [79465 - 79493], [80342 - 80520], [80717 - 81197], [85711 - 86339], [89503 - 89864], [91027 - 91185], [91677 - 91731], [91879 - 92361], [92928 - 93577], [93773 - 93882], [94073 - 94130], [94857 - 94883], [94959 - 95053]]

package:front_end/src/fasta/kernel/constant_int_folder.dart
Misses: [801, 1452, 1462, 1516, 1529, 1541, 1551, 2244, 2268, 2280, 2289, 2327, 2337, 2385, 2659, 2673, 2769, 2783, 2824, 2841, 2883, 2897, 2939, 2953, 2994, 3008, 3049, 3063, 3104, 3118, 3217, 3231, 3279, 3294, 3300, 3306, 3313, 3319, 3344, 3396, 3406, 3425, 3463, 3473, 3492, 3531, 3541, 3560, 3663, 3673, 3722]
Not compiled: [[4076 - 4143], [4148 - 4258], [4263 - 4318], [4323 - 4420], [4425 - 4545], [4550 - 4885], [4890 - 5320], [5325 - 7041], [7046 - 7449]]
Change-Id: Ic2334d46ebadfa062f93d7c074d7a1a1ee5f9ffc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162721
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-09-15 06:20:21 +00:00
Jens Johansen f4d3f8e0a2 [parser] Delete unused TokenStreamGhostWriter; test used UndoableTokenStreamRewriter
Change-Id: I7f4f053273f70d282b2ced7338715ca314055065
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162190
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-09-11 06:46:11 +00:00
Jens Johansen b0acaea1e5 [parser] Recover written out binary operators
* Add mechanisms to try out a recovery and only perform it if is
  successful.
* Recover written out binary operators, e.g. "a xor b", "a or b" etc.
  This fixes #26810 and is also how these operators are written in e.g.
  Kotlin. This might be somewhat controversial though.
* Adds a mechanism to _replace_ a token by another token.
  This might be controversial.
  It is done because just inserting the operator causes the same rewrite
  to be attempted on the same token stream several times (at least with
  the way the token stream is parsed via the CFE) in turn causing it to
  be recovered *sometimes*. This is now avoided by actually replacing
  the token.

Change-Id: Icfa806045575d2aa2e5f35126708651b275bcf84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162003
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-09-10 06:23:33 +00:00
Johnni Winther a8f9f08253 [cfe] Don't find unnamed mixin application in least upper bound
InterfaceType's referring to unnamed mixin applications continuously
cause problems for backends since these might not correspond to
types supported at runtime. The LUB specification does not mention
how to handle these so it is valid skip these in the computation of
LUB.

Change-Id: I38f46bf43d5858dec473c26326b741cf36eb57d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145420
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-09-09 13:00:17 +00:00
Johnni Winther 22db21590d [cfe] Report error on nullable spread access
Closes #43256

Change-Id: I15b0f5a9353566af290b78151f7889fa06a44406
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162002
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-09-09 12:44:37 +00:00
Johnni Winther 9d6ee9ec5a [cfe] Don't lower instance fields
Closes #42956

Change-Id: I3d27c8601d835ecafa50dadcebca1493f64588ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161700
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-08 08:11:24 +00:00
jlcontreras 42c4c3c1bd [cfe] Add Jenkins SMI hashcode combiner
Change-Id: I542369fc2d8443bb0094fdedc11596fdc2f20e2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159084
Commit-Queue: Javier López-Contreras <jlcontreras@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-09-07 12:36:13 +00:00
Paul Berry a4b2047d9d Reland "Flow analysis changes to fix mixed-mode unsoundness loophole."
This is a reland of d833f2f65c

Original change's description:
> Flow analysis changes to fix mixed-mode unsoundness loophole.
> 
> This is the flow analysis portion of the fix to
> https://github.com/dart-lang/language/issues/1143.  Follow-up changes
> will be needed in the CFE and/or backends to ensure that exceptions
> are thrown under appropriate circumstances.
> 
> This CL also makes some improvements to flow analysis's reachability
> analysis so that it accounts for nullability of the target when
> analyzing the reachability of `??=` and `?.`.  Hopefully these
> improvements should make the fix to
> https://github.com/dart-lang/language/issues/1143 clearer and more
> consistent.
> 
> Change-Id: I5fa5c070f13fd57ac4c2fb87f2d67588861594b0
> Bug: https://github.com/dart-lang/language/issues/1143
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160440
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>

Bug: https://github.com/dart-lang/language/issues/1143
Change-Id: If9c45649c1e9f4b19f7c282e7a1c4c956a7bc17f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161622
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-03 01:01:43 +00:00
Paul Berry ab16d79af9 Revert "Flow analysis changes to fix mixed-mode unsoundness loophole."
This reverts commit d833f2f65c.

Reason for revert: Broke build, e.g. https://ci.chromium.org/p/dart/builders/ci/dart-sdk-mac/12688

Original change's description:
> Flow analysis changes to fix mixed-mode unsoundness loophole.
> 
> This is the flow analysis portion of the fix to
> https://github.com/dart-lang/language/issues/1143.  Follow-up changes
> will be needed in the CFE and/or backends to ensure that exceptions
> are thrown under appropriate circumstances.
> 
> This CL also makes some improvements to flow analysis's reachability
> analysis so that it accounts for nullability of the target when
> analyzing the reachability of `??=` and `?.`.  Hopefully these
> improvements should make the fix to
> https://github.com/dart-lang/language/issues/1143 clearer and more
> consistent.
> 
> Change-Id: I5fa5c070f13fd57ac4c2fb87f2d67588861594b0
> Bug: https://github.com/dart-lang/language/issues/1143
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160440
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>

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

Change-Id: If1215b19975e0958d612dd69767088095d853879
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/language/issues/1143
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161580
Reviewed-by: Paul Berry <paulberry@google.com>
2020-09-02 15:02:46 +00:00
Paul Berry d833f2f65c Flow analysis changes to fix mixed-mode unsoundness loophole.
This is the flow analysis portion of the fix to
https://github.com/dart-lang/language/issues/1143.  Follow-up changes
will be needed in the CFE and/or backends to ensure that exceptions
are thrown under appropriate circumstances.

This CL also makes some improvements to flow analysis's reachability
analysis so that it accounts for nullability of the target when
analyzing the reachability of `??=` and `?.`.  Hopefully these
improvements should make the fix to
https://github.com/dart-lang/language/issues/1143 clearer and more
consistent.

Change-Id: I5fa5c070f13fd57ac4c2fb87f2d67588861594b0
Bug: https://github.com/dart-lang/language/issues/1143
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-09-02 14:27:52 +00:00
Jens Johansen eb8dfee107 [CFE] Clean up duplicate entries in spell checker lists
If a word is in the common list it shouldn't be in any other list, and
if a word is in code it shouldn't be in test.

Change-Id: Ib697377c5b819150574037fb6021ed52d7c5103a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161174
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-09-02 06:31:01 +00:00
Jens Johansen 4fa2d6497b [CFE] Change ansi escape code visualization
Change-Id: Ib361ad439a8c2822dbe2c9351f020688bac48ca4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161170
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-09-01 13:03:01 +00:00
Jens Johansen 3a1f732c0f [parser] Make begin/end events always come in pairs
This CL:
* Changes the events so beginX and endX events always comes in pairs
  (though technically not right as some specific events can be beginX
  endY --- but in those cases it is at least documented and used in code
  that actually tests it).
  -> This entails adding some events and converting something from
    "beginX" to "handleX" instead.
* Adds a utility that can generate an AST of sorts directly from the
  parser via a listener using the begin/end matching (and knowing of the
  specific ones that doesn't match directly).
* Adds a test that checks that - at least for all tested (50,000+) files
  - the AST actually generate "correctly", i.e. matches up begin/ends
  and ends up with a single top entry "CompilationUnit".
* Adds a different visualization to the parser listener events by
  displaying the "AST directly from the parser" in a UI that can be
  navigated. The visualization may not be the best, but it's certainly
  a stepping stone.

Change-Id: I9b27f7bbf3be442adc92f357c7b3c46da6f84cf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159664
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-01 09:30:43 +00:00
Johnni Winther 082295a61e [cfe] Support lowering of static fields with initializers
This adds support lowering the encoding of top-level/static fields
with initializers as if they were marked as late fields. This ensures
that LateInitialization is thrown if final fields are written to during
initialization.

Closes #42956

Change-Id: I488fdddd87ebd935a0cdaf82a724e9b87d5f91ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160724
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-01 07:20:58 +00:00
pq eb30e43940 specify targets for @doNotStore
Change-Id: I22546585fb189e4536e16a38488ce2e8b3b7fe52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160740
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-08-29 01:11:03 +00:00
Johnni Winther a1baa373ec [cfe] Rename link and test options
Rename test.options files and TestOptions to folder.options and FolderOptions,
respectively. Rename link.options files and LinkDependencyOptions to
test.options and TestOptions.

This is to better reflect the current usage of these options.

Change-Id: Ibd3c49fa5bd1c9ce8a9eb5910417c12cd45845d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160723
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-08-28 11:14:38 +00:00
Jens Johansen 97e981eb85 [CFE] Textual outline refactorings + ability to sort show/hide on import/export
Change-Id: I9d5f0e39f64036d474ec904993c44b1a242b2f4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159660
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-28 09:43:58 +00:00
Johnni Winther 6079377dc1 [cfe] Ensure default type on all declarations
Closes #43202

Change-Id: I3b8f6e24436aac7cdcdd2e1cce1448a1bcc122de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160521
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-08-27 18:21:57 +00:00
Jens Johansen c679be7b8b [parser] Remove 'suppressParseErrors' from Listener
It was never called anyway.

Change-Id: I86cb58d1543476f1865f23eb9a107082a2f7f677
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159663
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-27 11:52:27 +00:00
Jens Johansen 85699cfa6b [parser] Remove 'discardTypeReplacedWithCommentTypeAssign' from Listener
It was never called anyway.

Change-Id: I774dd6fcdaad29fe7b9ff00e70264389a7a4a31c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159662
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-27 11:26:17 +00:00
Johnni Winther 3485a2333c [cfe] Catch and report non file system errors when trying to read a file.
When a crash occurs in Uri it doesn't include the content of the failing
Uri, making it very hard to determine why the error situation occurred.
With the change the offending Uri will be printed as part of the message.

Change-Id: I41bb9762e5fc8deb97e051adaf336ecf3599a901
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160281
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-08-26 10:32:24 +00:00
Johnni Winther 4996d11854 [cfe] Handle experiment release version in CFE.
Closes #43033

Change-Id: I6752d19e56586e4072de1c0f4a7cc31ca3500691
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160062
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-08-25 12:32:50 +00:00
Johnni Winther 44e466c7fb [cfe] Handle dead code in Expression.getStaticTypeAsInstanceOf
Related to https://github.com/flutter/flutter/issues/64155

Change-Id: I71f1310a00a2b0cfbfb263361293bb442826199c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160061
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-08-25 10:19:10 +00:00
Jens Johansen f190a4ae27 [CFE] Change sorting in textual outline
This CL basically change two things about the sorting:
* Entities are not sorted according to metadata. Metadata just follows
  along. Before "@a class B {}" would come before "class A {}" because
  "@" comes before "c". Now "class A {}" comes first because "A" < "B".
* Sorting happens on a token level, i.e. "F<int>" will now come before
  "F2<int>" because "F" < "F2" whereas before it was the other way
  around because "F2" < "F<" (because "2" < "<").

None of it really matters as long as sorting is done the same way when
comparing the outlines.
Doing it this way makes it faster and actually brings the runtime
(in benchmarks) less than the old (now deleted) textual outline.

Change-Id: Ib1d887ab0c14519316c8e9a3da38f0dd49b4104f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159041
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-21 09:55:00 +00:00
Jens Johansen 70914a7164 [CFE] Make textual outline v2 the default and remove the old one
Change-Id: I48d27c92edd445627e6938e2f264fadc11b9262f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159081
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-21 09:42:18 +00:00
Jens Johansen 28db218ed0 [CFE] Create version of textual outline that makes the model more explicit
This version generally produce the same output (with slight variations
for spacing between some elements as well as for unassociated metadata)
but is slightly slower in modelled (i.e. sorting) mode.

The slow-down is remedied (so the whole thing actually becomes slighly
faster) if sorting slightly differently than the old version. That is
for another CL though.

Change-Id: Id19df710dff965250bfb7cf51d8756394cbe2067
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159080
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-21 09:38:37 +00:00
Johnni Winther e7d0947811 [kernel] Delete bin/transform.dart
Change-Id: I92b9f13d4e541c080fa29c9a79df0c925eebcc7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159241
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-08-19 13:07:41 +00:00
Jens Johansen a12b14ed83 [CFE] Add option to mark unknown textual outline chunks
Change-Id: Idcb1596b62e9b6450f08212429b2cc1d5f06d19d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158552
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-17 08:16:18 +00:00
Jens Johansen 04bc03e4ad [CFE] Textual outline knows about (and can thus sort) imports and exports
Before this CL the textual outline didn't know about imports and exports
and thus couldn't sort them.

This CL makes it know about them and allows imports and exports to be
sorted internally, but not mix with other stuff (e.g. imports should be
placed after "foo() {}" just because "f" comes before "i", but putting
"import 'a.dart'" before "import 'b.dart'" is OK.

This CL does not sort the hide and show entries.

Change-Id: Ic640cdaa98ac3562f8b36b21180a26584cb6d205
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158551
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-17 08:16:18 +00:00
Jens Johansen 66f11394f3 [CFE] Textual outline knows about (and can thus sort) named mixin applications
Before this CL the textual outline didn't know about named mixin
applications which caused it to insert "fences", i.e. splaces it
wouldn't sort across.

So for instance
class E {}
class D {}
class C<T> = Object with A<Function(T)>;
class B {}
class A {}

would not be sorted fully because class C is a named mixin application,
something it didn't know about, and it would only allow stuff on either
side to be sorted. So the sorted output would have been

class D {}
class E {}
class C<T> = Object with A<Function(T)>;
class A {}
class B {}

With this change it knows about it and the output would now thus be
class A {}
class B {}
class C<T> = Object with A<Function(T)>;
class D {}
class E {}

Change-Id: I97b28706732582d0c37f1b2c052b9f6eaf862a5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158550
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-17 08:16:18 +00:00
Jens Johansen 42214d2eb0 [CFE] Textual outline doesn't add line-break for empty classes
E.g. before this change an empty class output would have been
class Foo {
}

now instead it becomes
class Foo {}

this matches what the formatter does.

Change-Id: Id08edc5259bae00deff9a66b4ae745f21c192358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158549
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-17 08:16:18 +00:00
Jens Johansen 330c7500d4 [CFE] Textual outline doesn't add space for empty methods
E.g. before this change a procedure output would have been
foo() { }

now instead it becomes
foo() {}

this matches what the formatter does.

Change-Id: Ieb538d61e527cbec26d1d65ed6de349311dd0163
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158548
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-17 08:16:18 +00:00
Jens Johansen 8bca93872a [parser] Better error message for annotations on type arguments
This CL changes the message given in the situation identified in
https://github.com/dart-lang/sdk/issues/22314

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

Change-Id: Ibd47dd419d52673ae0d9e32039e0a635c1e09543
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158388
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-17 07:43:52 +00:00
Paul Berry e403e6ae77 Flow analysis: rework handling of equality tests.
The new logic classifies the LHS and RHS of the equality check as
either null, non-nullable, or potentially nullable, and then either
promotes, treats the expression as equivalent to a boolean, or does
nothing, as appropriate.

This means, for example, that a comparison between a non-nullable
value and `null` is now known to evaluate to `true` for reachability
analysis.

Note: as part of this change, it was tempting to trigger promotion
whenever a varialbe is equality compared to an expression of type
`Null`, but this would be unsound (consider `(int? x) => x == (x =
null) ? true : x.isEven`).  So we still only promote when the variable
is compared to a literal `null`.

Fixes #41985.

There's a corresponding spec change out for review:
https://github.com/dart-lang/language/pull/1134

Change-Id: Id7f1d4eaa3b0fa57124445bb8352eef32c304feb
Bug: https://github.com/dart-lang/sdk/issues/41985
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155926
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-14 12:16:36 +00:00
Jens Johansen 75fe329369 [CFE] Make sure textual outline suite is run on bots
This CL:
* Adds the textual outline suite to the suite runner run by the bots,
  hopefully ensuring that we won't forget about them in the future;
* Adds the missing textual outlines and status entries to make the
  textual_outline suite pass.

Change-Id: I0434b6a8e19019bbae7457ea738a13f2623f0c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158542
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-14 09:39:00 +00:00
Jens Johansen 7e42cbf582 [parser] Change recovery of multiple extends with comma
E.g. class Foo extends Bar, Baz {} would before have parsed weirdly,
but it will parse as you'd (probably) expect with an error saying
you cannot do that. For now at least both CFE and Analyzer will
pretend like you just specified the first one but I suppose Analyzer
could for instance use the extra information to propose converting
other ones to implements clauses or similar.

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

Change-Id: I180cdd8ab07143dd74fd21c9976ec2a46c428d8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158261
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-13 08:49:53 +00:00
Jens Johansen b6423f1f81 [CFE] Make parser_test_listener up-to-date
This also changes lots of expect files.
I don't know how it got out-of-date --- I actually thought that was
tested. It seems it's not...

Change-Id: I6dd524908b8735a5889ed6fdb59be5383e4e8237
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158301
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-12 14:28:54 +00:00
Jens Johansen 1c9ba99278 [CFE] Speed up leak test
On my workstation running the "weekly leak test" (from
https://dart-review.googlesource.com/c/sdk/+/157962) goes from taking
~3.5 hours to taking slightly under 3 hours.

Change-Id: Ifa5a8809e3a0ef6884251d84811d6c8d655f0059
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158300
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-12 12:54:24 +00:00
Jens Johansen 13de7e7560 [CFE] Add first stab at weekly leak test
Change-Id: Ib0307a4d82414e8387f65a9010a6f0f91827c3bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157962
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-11 09:01:29 +00:00
Johnni Winther 3059f64647 [cfe] Use mutual subtyping to check valid mixin applications
Related to flutter/flutter#63029

Change-Id: I492b348c414c76b5fda497614c733730d02bccfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157981
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-08-11 07:24:39 +00:00