Commit Graph

42 Commits

Author SHA1 Message Date
David Morgan d46cc75617 Revert "Issue 45672. Report constant errors when null value where non-nullable type is expected."
This reverts commit 9abc59e74c.

Reason for revert: Breaks google3: b/185915025

Original change's description:
> Issue 45672. Report constant errors when null value where non-nullable type is expected.
>
> Bug: https://github.com/dart-lang/sdk/issues/45672
> Change-Id: I9d006955523bf470c762fde57444e3596e4dccae
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196042
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

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

Change-Id: I0b16cf82414623a2fbda17813aeb0c24f080e568
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/45672
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196281
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2021-04-21 06:44:41 +00:00
Konstantin Shcheglov 9abc59e74c Issue 45672. Report constant errors when null value where non-nullable type is expected.
Bug: https://github.com/dart-lang/sdk/issues/45672
Change-Id: I9d006955523bf470c762fde57444e3596e4dccae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196042
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-04-20 17:54:10 +00:00
Konstantin Shcheglov 60a53afc5e Revert "Make AnalysisResult.path non-nullable, more non-nullable for ParsedLibraryResult and ResolvedLibraryResult."
This reverts commit 83ca0e87a0.

Reason for revert: breaks google3

Original change's description:
> Make AnalysisResult.path non-nullable, more non-nullable for ParsedLibraryResult and ResolvedLibraryResult.
>
> Change-Id: Iab3a8c6c81ace30049a93d0a453e2473634ba07a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195058
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

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

Change-Id: Iecaa81064450f536a45235d4d79d3b212a93918b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195188
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-04-14 00:41:59 +00:00
Konstantin Shcheglov 83ca0e87a0 Make AnalysisResult.path non-nullable, more non-nullable for ParsedLibraryResult and ResolvedLibraryResult.
Change-Id: Iab3a8c6c81ace30049a93d0a453e2473634ba07a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195058
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-04-13 18:05:28 +00:00
Sam Rawlins 89f563c4d3 analyzer: add triple-shift experiment to all tests
Change-Id: I560f82b239d78b748f6e2298a291d71cd2c831a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184840
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-12 21:17:54 +00:00
Sam Rawlins 337bba0ee9 Analyzer: add triple-shift constant test
Bug: https://github.com/dart-lang/sdk/issues/44908
Change-Id: If510a9aa36fa028e8f91d3cc9dd161282d2db383
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-12 17:45:36 +00:00
Konstantin Shcheglov 9f986d2501 Migrate package:analyzer to null safety.
Change-Id: Iffe4370431587e46a141ddc72a86ceec29c163b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176486
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-02-01 18:56:04 +00:00
Konstantin Shcheglov 5051d75bc6 Issue 43462. Compute constant values in libraries with contain them.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/43462
Change-Id: I82200c06b1a77f634b7c7f30fd3ad7e10eb01ad4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-17 21:26:13 +00:00
Konstantin Shcheglov c2379a800a Move more tests to PubPackageResolutionTest.
R=brianwilkerson@google.com

Change-Id: Ic6c37d069323cc06c6ab630757625a7e0b072200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-06 22:30:39 +00:00
Konstantin Shcheglov a8397d8bac Replace assertElementTypeString with assertType.
TBR, somehow I missed these invocation sites initially.

R=brianwilkerson@google.com

Change-Id: Iaf372750c5cb3b9d1912037a03092e1d487316ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130721
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-01-08 17:51:03 +00:00
Konstantin Shcheglov 5bfabfb4f0 Merge some resolution assertions.
Change-Id: I4a5d79d13d890acd641f302c85c7b0f463a11200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-01-08 17:30:35 +00:00
Konstantin Shcheglov e85e203e73 Deprecate DartType.name
Change-Id: If3a967bba976aa78493764513edbb3d406b08d27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130625
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-08 07:00:59 +00:00
Konstantin Shcheglov c913b01ec0 Report error during constant evaluation for ForElement.
R=brianwilkerson@google.com, pquitslund@google.com

Change-Id: Ic87094ed1dcfb4e630e3e62b9ed7e7ec8feab2c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130133
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-01-03 21:18:59 +00:00
Konstantin Shcheglov eee20b4e60 Fix prefer_equal_for_default_values in analyzer.
Change-Id: Ia72a2ac31d6cf6329c78baad6954ac9595a6c45a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127448
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-12-06 00:00:30 +00:00
Konstantin Shcheglov 4a07d80178 Deprecate ParameterizedType.typeParameters, update typeArguments doc.
Change-Id: I76c02e026c6c566def4f33478ef18f7df9d1d96e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123323
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-29 17:39:59 +00:00
Konstantin Shcheglov bf361ebe19 Replace addTestFile()/resolveTestFile() pair with resolveTestCode().
R=brianwilkerson@google.com

Change-Id: Ie3289e355421b0339b012319ce39d2b8eb9569d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-25 16:03:16 +00:00
Brian Wilkerson 5f0de26d48 Clean up the remaining copyright notices
Change-Id: If099be4f71ba551df0dc3d69815ae6a9f55d1eba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97781
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-03-24 20:11:28 +00:00
Konstantin Shcheglov 661e91e30e Extract and migrate tests for ConstantEvaluator.
R=brianwilkerson@google.com

Change-Id: Ia637dbe78a710678153cfc74726bf4825e36f755
Reviewed-on: https://dart-review.googlesource.com/c/92080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-06 16:54:35 +00:00
Paul Berry c9b1877cbf Disable task model for clients by making WorkItem inconstructible.
The task model is still allowed in analyzer tests since we still have
some unit tests of non-task-model functionality that rely on the task
model to do their testing (see #35734).

Unit tests whose sole purpose was to test the task model have been
removed.  Test files that now empty have been removed.  Non-empty test
files that now contain no tests of their own have had their `main`
functions removed, and have been renamed so that the testing
infrastructure will no longer attempt to run them.

Change-Id: I8b4d0b2dde9337c4e1fe91e443a2c9da6eee8f4f
Reviewed-on: https://dart-review.googlesource.com/c/90720
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-01-24 16:29:17 +00:00
Konstantin Shcheglov 162d0d12b0 Remove EngineTestCase.assertInstanceOf and extract ast/element TypeMatcher(s).
R=brianwilkerson@google.com

Change-Id: I9c47b4a7426dccafb8d3ffc1b0652da0106f2184
Reviewed-on: https://dart-review.googlesource.com/c/87302
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-12-14 17:51:27 +00:00
Alexandre Ardhuin b343d0a80d trigger error for const A(B()) if B non-const
To unblock dart-lang/linter#995

Closes #33515
https://github.com/dart-lang/sdk/pull/33515

GitOrigin-RevId: 9a6d3ca6775aceeb56836cc4e0c948be9b1c78c3
Change-Id: Ie8d627c031489bbaa606063b0a43c6696e45c2f1
Reviewed-on: https://dart-review.googlesource.com/61220
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-06-20 20:58:37 +00:00
Brian Wilkerson d0f105de1a Reland "Produce an error if there would be an exception thrown by an assert in an initializer list"
Change-Id: Id79a8cf949a08d56a59268b687f299f3482a1b88
Reviewed-on: https://dart-review.googlesource.com/37540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-30 14:40:19 +00:00
Brian Wilkerson 7a36d39962 Revert "Produce an error if there would be an exception thrown by an assert in an initializer list" (TBR)
Change-Id: Iece7d75e9245cdb9d0a72ac30f6b1031a76c0755
Reviewed-on: https://dart-review.googlesource.com/37080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-26 21:54:30 +00:00
Brian Wilkerson fb739fffe6 Produce an error if there would be an exception thrown by an assert in an initializer list (2)
Change-Id: I2f268a23c3d84dfbe4bba67730e226f5b5603570
Reviewed-on: https://dart-review.googlesource.com/32740
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-26 20:15:01 +00:00
Brian Wilkerson 439dfe0c29 Revert "Produce an error if there would be an exception thrown by an assert in an initializer list"
Change-Id: I21553a5a3bf12b7636d9ef507092d0e19f9c0d57
Reviewed-on: https://dart-review.googlesource.com/30041
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-12-16 01:44:13 +00:00
Brian Wilkerson 71dd8acda1 Produce an error if there would be an exception thrown by an assert in an initializer list
Change-Id: Ia95b2e09c64846d319d940e29c422355ab972da6
Reviewed-on: https://dart-review.googlesource.com/29700
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-12-15 23:03:15 +00:00
Konstantin Shcheglov 5455fd0118 Remove 'initializeTestEnvironment' from 'analyzer'.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2399913002 .
2016-10-06 10:18:54 -07:00
Konstantin Shcheglov 175dad4f15 Switch 'analyzer' to 'package:test' and test_reflective_loader ^0.1.0.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2391423003 .
2016-10-06 08:46:35 -07:00
Konstantin Shcheglov cc6beaf56d Pull in test_reflective_loader 0.0.4 and switch analyzer to it.
There are following changes:

1. DEPS to pull in test_reflective_loader 0.0.4
2. Rename runReflectiveTests() to defineReflectiveTests().
3. Remove analyzer's pkg/analyzer/test/reflective_tests.dart
4. Replace reflective_tests.dart imports with package:test_reflective_loader/test_reflective_loader.dart imports.
5. Sort/format and organize imports in the files with imports changes.
6. Fix for a couple of bugs in analysis_server exposed by the new loader.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2298913003 .
2016-08-31 13:46:39 -07:00
Brian Wilkerson 2797cf5367 Code clean-up
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2265793002 .
2016-08-21 15:48:44 -07:00
Brian Wilkerson 5a310a1684 Move constant implementation out of generated
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1816923002 .
2016-03-20 15:07:49 -07:00
Bob Nystrom 8defa5f77c Split resolver_test.dart into smaller files.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1782463002 .
2016-03-09 10:42:09 -08:00
Brian Wilkerson 71e7ed86c0 Move scanner out of generated and clean up imports
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1693083004 .
2016-02-14 07:48:44 -08:00
Bob Nystrom b0719aa402 Remove unused or unneeded stuff from java_core.dart.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1688113004 .
2016-02-12 11:10:48 -08:00
Konstantin Shcheglov c4602b0c8b Don't use Set when collecting constant targets in a unit.
This forces location / hashCode computation and caching, and the unit
is not linked to its library, so the cached values are not valid.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1691943002 .
2016-02-11 12:35:33 -08:00
Paul Berry c43622e897 Use ElementAnnotation as the ConstantEvaluationTarget for annotations.
Previously, we had a special class,
ConstantEvaluationTarget_Annotation, for this purpose.  It held on to
a the AST node for the annotation.  This was bad because it meant that
the presence of any ConstantEvaluationTarget_Annotation referring to a
given compilation unit would keep the entire compilation unit's AST in
memory.

Now we copy just the portions of the AST we need into
ElementAnnotation, just as we do for all other constant evaluation
targets.  In addition to saving memory, this paves the way for
supporting annotations in summaries, by making it possible to compute
the constant value of an annotation without having to consult the full
AST.

Fixes #25285.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1665353002 .
2016-02-04 15:22:40 -08:00
Konstantin Shcheglov 2546e179a9 Make constant map literal ordered.
Plus couple fixes for spelling problems.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1643253002 .
2016-01-29 09:31:03 -08:00
Konstantin Shcheglov df5d6bd6e1 Move more constant tests to constant_test.dart file.
I found out that we use HashMap for constant map literals.
But then I realized that I we could move more tests into the right
place.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1647183002 .
2016-01-29 08:58:41 -08:00
Brian Slesinsky ccf3870ffc final fields shouldn't be dependencies of const variables
(They are only dependencies of const constructors.)

This was causing bogus error messages to appear
when a const expression mistakenly references
a final field.

BUG=https://github.com/dart-lang/sdk/issues/25526
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1620963003 .
2016-01-25 15:53:41 -08:00
Brian Slesinsky 28ecd1bbef Oops, move ReferenceTest to constant_test.dart as well
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1623673003 .
2016-01-25 13:28:05 -08:00
Brian Slesinsky 001f64b564 print nicer errors for a const dependency graph failure
BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/1618103002 .
2016-01-22 14:47:18 -08:00
Brian Slesinsky 771fea4502 move constant tests to constant_test.dart
BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/1616743006 .
2016-01-22 12:44:15 -08:00