Commit Graph

8489 Commits

Author SHA1 Message Date
Konstantin Shcheglov 0fb52e9f78 Fix some null checks.
Change-Id: Idd3d88d1f7dd6e2250088498734396b98f8c5375
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 17:44:49 +00:00
Konstantin Shcheglov 90e54dee18 InstrumentationLogger in InstrumentationLogAdapter is not null.
Change-Id: Ie4ab159002c74796429e5176cd09abdcd1a90ad7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184382
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 17:44:05 +00:00
Konstantin Shcheglov 1d5555e67a Remove support for variants in summary format.
We don't use it anymore.

Change-Id: I3c1eaa7bb19629275a2839fd53607d5388178a94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 17:36:46 +00:00
Konstantin Shcheglov 0ffaacc8a6 Fix null checks in dependency tracking.
Mostly replacing fields that we implicitly expect to be filled by the
time when the consumer method is invoked, with explicit parameters.
So, we let the type system to prove that they are not null.

Change-Id: I13e2d943f124886bdb37971ec20cbc0893b0ea78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184384
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 17:36:01 +00:00
Konstantin Shcheglov c323f218a7 Fix a few null checks in CodeChecker.
Change-Id: I585ce017319e2b47f76a29180a669806853dbbf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184385
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 17:28:41 +00:00
Konstantin Shcheglov be1c75dcae Fix null checks in DeadCodeVerifier.
Change-Id: I23afbb131d8cbe16ed49ed7ce90dd0a2ca5fbae7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184400
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 17:27:57 +00:00
Konstantin Shcheglov d208be069e Fix most null checks in AstBinaryWriter.
Change-Id: Ie0de6623503bd2474a44f0d98535f6af9273952e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-10 21:00:55 +00:00
Konstantin Shcheglov 4015a920ed Remove a few null checks.
Change-Id: I271f010aadb41aca81c76ec854e8b30a39bc971b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184283
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-10 20:39:05 +00:00
Konstantin Shcheglov 8120c43d85 Replace 'Expression.staticType!' with 'typeOrThrow'.
It is not a huge improvement, because it does not add static safety,
for this we would need to distinguish between unresolved and resolved
expressions, as separate types.

But it is still an improvement.

1. We get to know the node that was not resolved.
   Maybe not enough, in case if it was because of the enclosing
   now that this node was not resolved. But still something.

2. We group this use case into one place.

Change-Id: I2e8f029e8a5fcd8ccecdd1b6bc9d78ee9eaf12a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184103
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-10 17:19:27 +00:00
Konstantin Shcheglov b4409ea3b4 Deprecate FunctionType.element/typeArguments
Bug: https://github.com/dart-lang/sdk/issues/44629
Change-Id: I5009a1abd456f33738d3b5e2ecae24b269b20000
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182700
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-10 17:17:58 +00:00
Devon Carew 3f8c508a94 [analyzer] don't analyze html files
Change-Id: I45fa266be055a7d6ca1c0ecb90dc8245fa8b4616
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184102
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-02-10 15:52:24 +00:00
Devon Carew 4ca94b044c [analyzer] remove a comma from one of the analyzer's hint messages
Change-Id: Idd72c1a6b058a4de8b8e4a079723cb29e521aa48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-02-10 01:56:17 +00:00
Konstantin Shcheglov a0b275911a Stop visiting typedefs of return types.
Change-Id: I1e3936f7a819add5f93fcf2974ba5d928cd68aef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184043
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-09 23:14:39 +00:00
Konstantin Shcheglov bcbebc8fd5 Fix for resolving package: URIs with space in BazelPackageUriResolver.
Change-Id: I0de91dcb2438205b476dea99fa2231dd189ef094
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184042
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-09 22:26:59 +00:00
Konstantin Shcheglov 4765ef5037 Remove 'actualUri' from UriResolver.resolveAbsolute()
Change-Id: I87edfa780e891a5e1ecdd1a9a548509e4cfa641a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-09 22:17:08 +00:00
Konstantin Shcheglov 257fae8937 Throw StateError with debug data when a URI cannot be resolved back to path in getFileForPath()
Change-Id: I361826b0f878b74e848f38ae11422007c06e341f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-09 22:16:49 +00:00
Konstantin Shcheglov b7b88d53f7 Tweak FfiVerifier._validateSizeOfAnnotation()
Change-Id: I43fc092294e29f10c8b7266e4ef575131a04c6e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-09 21:55:51 +00:00
Konstantin Shcheglov 36c63c1269 Issue 44865. Report USE_OF_VOID_RESULT for ConstructorFieldInitializer.
Bug: https://github.com/dart-lang/sdk/issues/44865
Change-Id: I4af50cc92a155df08895eb3699cf86a3a6c45858
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183763
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-09 17:13:49 +00:00
Daco Harkes 5c4a916dc8 [analyzer/ffi] Support inline arrays in Structs
This CL does not add inline arrays to `dart:ffi` yet, only to the mock
SDK in the analyzer for testing the analyzer. This means we can review
and land it separately.

Closes: https://github.com/dart-lang/sdk/issues/44747
Bug: https://github.com/dart-lang/sdk/issues/35763

Change-Id: I7df6a61ea4cfa522afd12194dd2f3573eb79b3ef
Cq-Include-Trybots: luci.dart.try:analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183684
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-09 11:38:06 +00:00
Paul Berry 680f5e6da5 Clean up error message nomenclature around metadata vs annotations.
Change-Id: I866900d2c4baca6ee000885f2126de2a97e643ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182800
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-08 22:00:04 +00:00
Konstantin Shcheglov 86636aff07 Use empty placeholders for List(s) in elements.
Change-Id: I1d63fe018a0a78cfdf2e9e7ec91aefdc9cd91bb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183500
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-08 18:09:33 +00:00
Konstantin Shcheglov 9624709abf Remove ForMixin and IfMixin.
Change-Id: I1487d5487b43c910f8ac313dd3ea54430da48009
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183420
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-07 02:13:46 +00:00
Konstantin Shcheglov 8a88268f20 Eliminate 'lazy' from AST.
Change-Id: Ied5452b85824f169d92957f852864589d94d32da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-06 18:11:16 +00:00
Konstantin Shcheglov 2e3ac0cf15 Don't assert that T2 and T3 are num subtypes.
Bug: https://buganizer.corp.google.com/issues/179461891
Change-Id: I87be38a09aade855413382b1d86476c295c4e317
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-06 02:57:06 +00:00
pq 7844db28a0 add test dir checking to LinterContext
Change-Id: I53730f982a265d063c29cf8e485f1d4d84a6b65d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-02-06 02:05:19 +00:00
Loren Van Spronsen c426bc5eff Correct the inline grammar in the SimpleStringLiteral dartdoc.
Change-Id: I03956ea2e7f2dfba45bab265b0ab7a7b86559224
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-06 01:46:48 +00:00
Konstantin Shcheglov 6b793358ca Update NodeListImp constructors, owner, initialize.
Both Brian and Paul noted that in general we should express the
semantics correctly, if something is expected to be not null before
it is used, it would be nice to type it as such. This change makes
`_owner` late final, so that it is always not null, and set only once.
It should not affect performance negatively because almost always
we use `owner` inside `_initialize`, where it is a local variable.

Change-Id: I2abe45f2f98e9ac0ce69d4a65d641334244876ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183044
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-05 22:29:18 +00:00
Paul Berry c14fd57acc Update AstBuilder to handle generic annotations.
Bug: https://github.com/dart-lang/sdk/issues/44838
Change-Id: If69cbbc13a087f0f6280da0bc7f9dbca1d3ec0ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-05 20:57:18 +00:00
Paul Berry 93cd0cdd3b Parser support for generic annotations.
This CL updates the parser so that it allows annotations of the form:

    `@` <constructorDesignation> <argumentPart>

Where <argumentPart> can contain type arguments.  Previously this was
prohibited at parse time.

Generic annotations are still prohibited in the current language
version, but the error is now generated by the parser listener
(BodyBuilder in the case of CFE, AstBuilder in the case of analyzer);
this should open the door for future CLs to add support for generic
annotations when the `generic-metadata` experimental flag is supplied.

Bug: https://github.com/dart-lang/sdk/issues/44838
Change-Id: I90604f38bcb378fc798c5737e486fb26589d4d1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182668
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-05 20:57:18 +00:00
Konstantin Shcheglov a7f84dc626 Make NodeList fields in AST final not lazy.
Change-Id: Ia145ea52a7a13ce8d97708a135099ef064ec3397
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-05 00:25:02 +00:00
Konstantin Shcheglov 9cbe1cafe0 Element.session can be nullable
This is not convenient, and not nice, but it can be.
We have to accept that it can for now, and plan to make it better.

Bug: https://github.com/dart-lang/sdk/issues/44837
Change-Id: Icbd2d55b6690ed817b38a7768198c41ce36cf002
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182960
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-04 22:02:29 +00:00
Alexander Thomas c88171c8af [sdk] Bump version to 2.13
TEST=Presubmit tests and local builds
Change-Id: I1b15d60eced0cf3f422548eda75706609f6640cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182624
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-04 12:10:17 +00:00
Paul Berry ba5064fa31 Analyzer AST changes for generic metadata
Bug: https://github.com/dart-lang/sdk/issues/44838
Change-Id: I55b8dacc571570568c1b3f101a1a4e1f517f7f6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182581
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-04 09:45:47 +00:00
Sam Rawlins 43e4536ebb analyzer: Fix documentation for TypeProvider
Text like "Future<Null>" turns into an HTML tag. Referencing the elements with
[] escapes the HTML and creates links for the user.

Change-Id: Ib20020f879ec1eef4a5d98e896f72b00242deac7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-03 21:53:59 +00:00
Konstantin Shcheglov 2038d4fed1 Remove a few usages of FunctionTypeAliasElement in analyzer.
Change-Id: I64a09b9de5ded6cf9116c3abe0f3fbcc8105387c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182660
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-03 20:29:39 +00:00
Konstantin Shcheglov 7313f905e3 Remove 'functionTypeAliasElement' from 'TypeSystem.instantiateToBounds2'.
Change-Id: I402d55b1ccdc0178680406c5f6135b497115a1c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182603
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-03 19:54:29 +00:00
Paul Berry 0427342228 Add flag for generic metadata
See implementation plan PR:
https://github.com/dart-lang/language/pull/1417

Change-Id: Ib75026d7008d313f3dad94d9ccf47e341f945dc9
Bug: https://github.com/dart-lang/language/issues/1297
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182301
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-03 13:54:48 +00:00
Daco Harkes fb624c4209 Reland "[vm/ffi] Change Pointer<T extends Struct>.ref to use static type"
This CL changes the semantics of `Pointer<T extends Struct>.ref` to use
the compile-time `T` rather than the runtime `T`.

This enables tree shaking of subtypes of Struct and optimizing `.ref`.

Bug: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/vmspecific_static_checks_test.dart
TEST=tests/ffi/*struct*test_.dart

Change-Id: Ie19bc3259d1cb721d0ce56d68e82d09dc3a4ad0e
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180190
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-02-03 10:55:49 +00:00
Konstantin Shcheglov 125bec8d78 Rewrite ElementAnnotation.isXyz with helpers, avoid null checks.
Change-Id: I48dc83fe0002a45833d3059e87afa7a090a18180
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182420
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-03 05:35:28 +00:00
Konstantin Shcheglov 7834aef945 Fix for NPE when an ambiguous getter is used as an annotation.
Change-Id: If0e2d597099c8eb64479a9dce4ed83dde08e8a65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182371
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-03 01:27:10 +00:00
Konstantin Shcheglov cadf512b67 Issue 44841. Add debug information into LinkedElementFactory.
Bug: https://github.com/dart-lang/sdk/issues/44841
Change-Id: Ie82506ff80b39029d4c9caecab42580f4b473a89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182400
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-03 00:19:50 +00:00
Konstantin Shcheglov 0b68104b98 Issue 44840. Add debug information.
Bug: https://github.com/dart-lang/sdk/issues/44840
Change-Id: I7a536db1de0da3144a9b5184373637335da494d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182367
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 23:54:25 +00:00
Konstantin Shcheglov d1d8730472 Don't use part-of library that does not have the part file.
Bug: https://github.com/dart-lang/sdk/issues/44840
Change-Id: I7e7353472e5deaa3f63c6f461f547149b04d1fb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182366
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 23:54:16 +00:00
Konstantin Shcheglov e1273e96e8 Support URI in PartOfDirective in ToSourceVisitor.
Change-Id: I8e0eb8d55de3c78ad7723946296010136634f000
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182364
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 22:16:44 +00:00
Konstantin Shcheglov b971bbd199 Issue 41023. Remove debug information added for tracking the issue.
Bug: https://github.com/dart-lang/sdk/issues/41023
Change-Id: Icfe10ac290e88c099115b587532dbcdae19d3641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182363
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 22:06:44 +00:00
Konstantin Shcheglov 977f1717e1 Fix for null in ElementImpl.session when synthetic getter/setter.
Change-Id: Id32003c3644275210778667f07bb49baddbfbdc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182362
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 21:36:34 +00:00
Konstantin Shcheglov 4c6f5f7658 Remove NullSafetyUnderstandingFlag.
Bug: https://github.com/dart-lang/sdk/issues/40531

Change-Id: I197cfdf64c697a09bb9e0e3896f3ee5ac1967757
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168160
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 18:03:24 +00:00
Konstantin Shcheglov 74583b31ed Make looking for BUILD file substitutes in BazelWorkspace optional.
Disable it for DAS, we always have BUILD files when interactive analysis.

Change-Id: I095f74ad25698e7ec07ea94252ee287d29e6a52f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182122
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 17:03:14 +00:00
Konstantin Shcheglov 8cbef3bec1 Cache files analyzed in AnalysisDriver.
This is necessary to fix a (recent) performance regression in search.

Change-Id: Iefe06021e4ba1536827cba88f91bfba9df7734a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182161
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 17:02:24 +00:00
Paul Berry a42244f73b Flow analysis: begin tracking non-promotion reasons.
This CL implements the core flow analysis infrastructure for tracking
reasons why an expression was not promoted.  It supports the following
reasons:

- Expression was a property access
- Expression has been written to since it was promoted

I expect to add support for other non-promotion reasons in the future,
for example:

- `this` cannot be promoted
- Expression has been write captured
- Expression was a reference to a static field or top level variable

These non-promotion reasons are plumbed through to the CFE and
analyzer for the purpose of making errors easier for the user to
understand.  For example, given the following code:

  class C {
    int? i;
    f() {
      if (i == null) return;
      print(i.isEven);
    }
  }

The front end now prints:

  ../../tmp/test.dart:5:13: Error: Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
  Try accessing using ?. instead.
      print(i.isEven);
              ^^^^^^
  Context: 'i' refers to a property so it could not be promoted.

Much work still needs to be done to round out this feature, for example:

- Currently the analyzer only shows the new "why not promoted"
  messages when the "--verbose" flag is specified; this means the
  feature is unlikely to be noticed by users.

- Currently the analyzer doesn't show a "why not promoted" message
  when the non-promotion reason is that the expression is a property
  access.

- We need one or more web pages explaining non-promotion reasons in
  more detail so that the error messages can contain pointers to them.

- The analyzer and front end currently only show non-promotion reasons
  for expressions of the form `x.y` where `x` fails to be promoted to
  non-nullable.  There are many other scenarios that should be
  handled.

Change-Id: I0a12df74d0fc6274dfb3cb555abea81a75884231
Bug: https://github.com/dart-lang/sdk/issues/38773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181741
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 16:15:34 +00:00