Commit Graph

8489 Commits

Author SHA1 Message Date
Paul Berry 9af30dbb06 Null-safe numbers: implement inference rules, hook up for binary operators.
A future CL will hook up the inference rules for method calls (`clamp`
and `remainder`).

Bug: https://github.com/dart-lang/sdk/issues/42629
Change-Id: Iefa36a369ce11726fc316ef46ff7d9bcb0e21da1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159403
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-08-25 03:42:08 +00:00
Paul Berry 8572a26bdf Null-safe numbers: hook up static typing rules for method calls.
Bug: https://github.com/dart-lang/sdk/issues/42629
Change-Id: I0fc4d5b65d3c9494fc280b5af53d0cc065459be8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-08-25 02:54:18 +00:00
Konstantin Shcheglov 8053110035 Report ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR for 'super!'.
Partial implementation to unblock:
https://dart-review.googlesource.com/c/sdk/+/159966, to unlock:
https://dart-review.googlesource.com/c/sdk/+/159960

Bug: https://github.com/dart-lang/sdk/issues/43168
Change-Id: I5e3891f4ddf15c747568b38b794d75fcbd30c03a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159971
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-25 00:43:37 +00:00
Brian Wilkerson 351a1cc489 Add a hint for the new Target annotation
Change-Id: I5d8723eead20bb68407ce2a23e8de6cb9ae8a4de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-08-24 18:04:47 +00:00
Paul Berry 08dd4b1faa Null-safe numbers: implement static typing rules, hook up for binary operators.
Future CLs will hook up the static typing rules for method calls
(`clamp` and `remainder`) and will implement the rules for contexts.

Bug: https://github.com/dart-lang/sdk/issues/42629
Change-Id: Iccfb1fa1ac9aff6c0832d65e4835b5b9bd51a804
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-08-24 15:34:33 +00:00
Konstantin Shcheglov e868d3076c Issue 43151. Fix crash when a field shadows a super-interface method.
Bug: https://github.com/dart-lang/sdk/issues/43151
Change-Id: I27e78815007e12edfefc81b5e49eed30bb633229
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159740
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-24 14:29:24 +00:00
David Morgan a249594de9 Revert "invalid @doNotStore assignment analysis"
This reverts commit 1e2772d106.

Reason for revert: Analyzer crash: b/165866426

Original change's description:
> invalid `@doNotStore` assignment analysis
> 
> TODO: follow-up with an `extensions_test`
> 
> Change-Id: Ie3d18229daf347885128d02e4b751436a8a0643f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159560
> Commit-Queue: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Icfddee0e62fef3691b446ce92531f9281863880a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159841
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-08-24 07:26:06 +00:00
Konstantin Shcheglov 63640ea23d Remove ElementFactory.functionElementXyz()
R=brianwilkerson@google.com

Change-Id: I2dc598481d49d83aa0f7994a455af963fe99b5b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159649
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-21 22:24:31 +00:00
Konstantin Shcheglov 6fb1e57f3a Move _hasSetter and typeInferenceError.
R=brianwilkerson@google.com

Change-Id: I8bf476dd6323f01d987c7cf2c3378f6beb37c267
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159647
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-21 21:17:10 +00:00
Konstantin Shcheglov c2bc119c21 Issue 43144. Convert the bound of type parameter to legacy if necessary.
Bug: https://github.com/dart-lang/sdk/issues/43144
Change-Id: I2bf50c498d7919460133d1bed07ce2de861fce08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159646
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-21 20:18:10 +00:00
Konstantin Shcheglov 085076337b Add LocalVariableElement/PropertyInducingElement.hasInitializer, ParameterElement.hasDefaultValue, deprecate VariableElement.initializer
Change-Id: I02ba37b4f6f1ce79ffddf40613646b99ecbedc9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159582
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-21 18:20:30 +00:00
Konstantin Shcheglov 62bd19cac9 Extract VariableDeclarationResolver.
Change-Id: Ib88682ae56b3e1dd9717957d6f01571de5a685a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-21 02:05:47 +00:00
pq 1e2772d106 invalid @doNotStore assignment analysis
TODO: follow-up with an `extensions_test`

Change-Id: Ie3d18229daf347885128d02e4b751436a8a0643f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159560
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-20 23:58:06 +00:00
Konstantin Shcheglov 514094b74b Resolver annotations for each node directly.
Specifically, don't rely on climbing up from VariableDeclaration(s).

R=brianwilkerson@google.com

Change-Id: I70225ce0b55f9ee2b3405e8a678cc2c854b2af6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-20 21:23:39 +00:00
Konstantin Shcheglov 1c0a64ded5 Comments and renames in FlowAnalysisDataForTesting.
R=brianwilkerson@google.com

Change-Id: I75710e11b88bbed59e57bc1928f9e06bbd279c5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-20 17:14:29 +00:00
Konstantin Shcheglov 25edea3d8d Issue 43100. Verify local variable reads for null safety.
Bug: https://github.com/dart-lang/sdk/issues/43100
Change-Id: Ia8ece4de32f65d7912e534ce61936a45f2c768c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-20 15:50:50 +00:00
Brian Wilkerson d52a577f3b Fix the correction message for late_local_final_already_assigned
Change-Id: I983c6e9a20020f148e16ec068c7edd8d698534ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-08-20 15:30:59 +00:00
Konstantin Shcheglov 39e4dfe571 Update experimental_features.yaml, set experimentalReleaseVersion for non-nullable.
Bug: https://github.com/dart-lang/sdk/issues/43032
Change-Id: I28b27b3416826abd807a185b2d4214782571fb98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159383
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2020-08-20 01:38:48 +00:00
Paul Berry 4280e0a819 Fix crash when a null shorting expression is null checked.
Postfix increments and decrements are null-shorting expressions
(e.g. `x?.y++.isEven` only calls `isEven` if `x` was non-null), but it
is still being decided whether postfix `!` should be null shorting
(i.e. whether `x?.y!` should fail if `x` is null).  See
https://github.com/dart-lang/language/issues/1163.

Previously, the analyzer was inconsistent about whether it considered
`!` to participate in null shorting; as a result, when analyzing an
expression like `x?.y!`, the analyzer would fail to call
`FlowAnalysis.nullAwareAccess_end`, resulting in corrupted flow
analysis state, which could lead to a crash.

This change makes the analyzer treat `!` as *not* participating in
null shorting, which is consistent with what is currently written in
the spec and implemented in the CFE.

Fixes #43093.

Change-Id: Ie69c5c29f226fe1a0282d0e7a1e079778dc700c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159147
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-08-19 19:35:57 +00:00
Konstantin Shcheglov 2b7fc8f134 Update FeatureSet to the new rules.
Bug: https://github.com/dart-lang/sdk/issues/43032
Change-Id: I6c7d7dc56fd0d4edcc3c6f6cc6fb0422316b8f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159187
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-19 18:27:37 +00:00
pq 37c1da672c element model support for @doNotStore
Change-Id: Ic69dcee22de76540d7034a0a9265cb22ea325b4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159184
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-19 04:50:14 +00:00
Devon Carew 690d04e146 [analyzer] update a dignostic message to refernce the new name for NNBD
Change-Id: I6edf67f88005b7745b8c0f875e1ce333134f1a2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159146
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-19 04:42:11 +00:00
Konstantin Shcheglov 1c5a17b212 Don't refresh files when they are not notified as changed.
The refresh was causing "Cycle loading state error", so it is possible
that this CL will fix this long standing issue.

Bug: https://github.com/dart-lang/sdk/issues/43073
Change-Id: Id1eeacd01cf10e918b002d227c8942e38bed543c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-18 21:15:00 +00:00
Konstantin Shcheglov a51f1747e0 Prepare to publish analyzer 0.40.0 and _fe_analyzer_shared 8.0.0.
Change-Id: I126207dcc47885565a3a6d7002ff15ad3cc493c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122483
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-18 15:12:10 +00:00
Paul Berry 5642366611 Null safe numbers: plumb element through to refineBinaryExpressionType.
The new rules for null-safe number promotion apply to both operators
and ordinary method calls, so I'll be implementing them in terms of
MethodElement.name rather than an operator TokenType.  To make this
possible, we need to pass the method element to
TypeSystem.refineBinaryExpressionType.

I'm doing this as a separate CL from the main implementation so that I
can verify that it doesn't introduce backward compatibility issues.

Bug: https://github.com/dart-lang/sdk/issues/42629
Change-Id: I6be9086553ee0ea9994994c903880fe9bb4477fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-08-17 23:17:55 +00:00
Brian Wilkerson 819af72908 Use "receiver" rather than "target" in messages and docs
Change-Id: I08fdc928c72035a04dc2bb731ce8a2e95a81f9df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158803
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-08-17 23:11:35 +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
Konstantin Shcheglov d9ce879bc2 Track if location has access to this.
We will need this also to implement '16.35 Lexical Lookup' from the spec.

Change-Id: I3b77c4a016fd54771b07957d522074aeb8dd1938
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158802
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-17 01:08:52 +00:00
Devon Carew 528238465f Remove the PerformanceTag class and related code.
Change-Id: I55b39e8fa6de7a3a946333bc84cc4ba0a09ecba8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158524
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-08-16 23:59:42 +00:00
Konstantin Shcheglov 332aa7d0c5 Add more data to debug already loaded library cycles.
R=brianwilkerson@google.com, devoncarew@google.com

Change-Id: I60122021faabf776f14034ef42ef08142ba6a5a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158760
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-16 01:25:21 +00:00
Konstantin Shcheglov 87027c97a1 Start rewriting AssignmentExpression resolution, local variables.
Also updates for tests when the left side is a SimpleIdentifier.

Change-Id: I8da1392e2aa8e11a323e09aa380fb49e8cbf38da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-15 01:09:00 +00:00
Konstantin Shcheglov 30b1c95a78 Add readElement, writeElement, referenceElement to SimpleIdentifier.
Just getters for now, not field, and not migrating existing getters
to them.

Change-Id: Id93c5988c606c45d0833aa7b3fbfefa507cbdb2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158525
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-14 19:00:24 +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
Konstantin Shcheglov f3936bca67 Add Resource.provider
R=brianwilkerson@google.com

Change-Id: I1d41d46f927e0ca804031a6fdf8148825695636e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158523
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-14 01:49:45 +00:00
Konstantin Shcheglov 302ad7ab2c Replace isNonNullableByDefaultInternal flag in LibraryElementImpl with FeatureSet.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I4fdb464df5f70ae93ccff5f06d8c99d34d3f8e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158500
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-13 17:27:04 +00:00
Paul Berry bf9ef579ad Null-safe numbers: separate legacy and null-safe number promotion.
The new number promotion rules for null safety
(https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/number-operation-typing.md)
are different enough from the old ones that it makes sense to
implement them separately. As a first step toward that, this CL
separates the existing logic into legacy and null-safe variants.

Bug: https://github.com/dart-lang/sdk/issues/42629
Change-Id: I0d52ce7366e34d5e0d176a0e14f4bc55f5541c04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158460
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-08-13 17:09:34 +00:00
Paul Berry 06aff09656 External/abstract field support: prohibit a field from being both external and abstract.
Change-Id: I8c4dd136dc8c6518fddda68cfcb360cea8386942
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158420
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-08-13 16:11:34 +00:00
Konstantin Shcheglov 5623235652 Report HintCode.MISSING_REQUIRED_PARAM in legacy for null safety required parameters.
Bug: https://github.com/dart-lang/sdk/issues/43026
Change-Id: I1fcd08562bd7259bb09474cad44cf84b342a16fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158343
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-13 16:00:44 +00:00
Konstantin Shcheglov aa867dbc89 Remove LibraryResolutionCapability and hasResolutionCapability().
R=brianwilkerson@google.com

Change-Id: I24503b37a925b9cb5fccb1a97307bc491e0c56f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158370
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-13 15:40:55 +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
Paul Berry a3b15aefca External variable support: do not allow external variables to be late.
Although this error condition is not reported by the parser, the
language grammar does not it, so from a customer perspective it is a
parser error.  Accordingly, it has been assigned a ParserErrorCode and
is reported by the AstBuilder, as we do for other similar errors.

Change-Id: I22aad9b0acd27bf6e60dfb393837d48a49fc336b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158365
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-08-13 03:53:38 +00:00
Paul Berry ff987cc0ad External variable support: do not allow initializing abstract fields/variables.
There are three ways to initialize a field/variable, so we have to
check for three error conditions:
- At the declaration site
- Via a field formal parameter
- Via a constructor initializer

Change-Id: I14caa38aaf2265966a19c68525f1458ff9d116f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158363
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-08-13 02:42:38 +00:00
Konstantin Shcheglov 95d47368ec Add LibraryElement.featureSet
This generalizes `LibraryElement.isNonNullableByDefault`.
I don't have yet plans to remove it though.

R=brianwilkerson@google.com

Change-Id: I6385a568f87e449c9c18e7d93802463567322bfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158369
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-13 01:06:48 +00:00
Paul Berry a52eb87054 External variable/field support: suppress "final not initialized" errors.
External final fields and variables don't need to be initialized (in
fact they can't be initialized), so we shouldn't report "uninitialized
field" errors for them.

This CL also adds some basic tests of the functionality of external
final fields and variables, making sure they don't introduce setters,
and that the getters they introduce are properly resolved and that
their types are properly respected by inheritance checks.

Change-Id: Ic60042b22b0636b7316119b663629c1c6ced6e2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-08-12 23:37:58 +00:00
Paul Berry 967181b480 External variable support: also allow external top level variables.
Change-Id: Id0f8f15bbdc17ef92e7f4e16b6acc0c3f30e69d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158150
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-08-12 17:05:24 +00:00
Konstantin Shcheglov 5e3f13494c Create new context roots for folders with .dart_tool/package_config.json files.
R=brianwilkerson@google.com

Change-Id: If1ad72a1debb7c16737df9ea2507a020fabdfcf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-12 16:38:15 +00:00
Konstantin Shcheglov eb2d8e58f1 Remove unnecessary ErrorCode prefixes from unique names.
R=brianwilkerson@google.com

Change-Id: I58680bcdc79309596bf89a2e193a340456c73b47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-12 16:37:14 +00:00
Paul Berry b7d139a626 External variable support: add a notion of external top level variables to the AST and element model.
In follow-up CLs I will update error reporting logic.

Change-Id: Iee42088beffee3915a2ef6a4c8cb5c1031535d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158149
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-08-12 15:59:24 +00:00
Konstantin Shcheglov 022812983e Enforce uniqueness of ErrorCode.uniqueName
Remove duplicate ParserErrorCode(s).

R=brianwilkerson@google.com

Change-Id: I8c8e4e3433f7147a728888cf5735bbecbc8297c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158204
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-12 00:40:59 +00:00
Konstantin Shcheglov 2f031c7121 Report WRONG_NUMBER_OF_TYPE_ARGUMENTS_EXTENSION.
R=brianwilkerson@google.com

Change-Id: I4c56a4535c4ae26dec9aaae9791774ad3ace365c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-11 21:54:10 +00:00