Commit Graph

10 Commits

Author SHA1 Message Date
Konstantin Shcheglov 4756d077ed Update NamedType to use ImportPrefixReference and name token.
Using Identifier expression inside NamedType does not make sense.

Change-Id: I4a61d2b472fd66fb7c5e6e92a80cccb391b06d49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-28 17:31:46 +00:00
Konstantin Shcheglov ac9de46499 Share FeatureSets for analyzer tests.
Change-Id: Ibe2655ed43af3cab632d6e4506f2366c1bfbbc27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234803
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-01 21:13:38 +00:00
Konstantin Shcheglov 60b428e2b1 Deprecate superclass2, mixinTypes2, etc.
Change-Id: Ieaaeab57930cb93f5b6b1323efe63c3395b79993
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232742
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-17 02:20:42 +00:00
Konstantin Shcheglov e1b5db7478 Deprecate getters that return TypeName, replace with returning NamedType.
Change-Id: I13764db3da27d5eabe972aab32cdf587a7de53e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-09-22 21:01:58 +00:00
Konstantin Shcheglov b41ae230a2 Replace many casts to TypeName with NamedType.
Change-Id: I485b7a3e268c59c435f02e3357dc5dcf256e627e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214067
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-21 20:32:38 +00:00
Paul Berry 1b4f067e0b Parser: Reduce the set of disambiguation tokens for resolving < ambiguities.
When the parser encounters a `<` after an expression, it must choose
whether to interpret it as a relational operator or a <typeArguments>
selector.  The disambiguation rule is: if the `<` and the tokens
following it *can* be parsed as <typeArguments>, and the token that
follows is a member of a privileged set of tokens, then it is treated
as a <typeArguments> selector; otherwise it is treated as a relational
operator.

This change reduces the privileged set of tokens to the following:

- the "continuation tokens" `(`, `.`, `==`, and `!=`
- the "stop tokens" `)`, `]`, `}`, `;`, `:`, and `,`

The names "continuation tokens" and "stop tokens" reflect the
rationale for choosing these tokens:

- Continuation tokens are tokens that we can reasonably imagine a
  programmer wanting to place after a type argument selector to
  *continue* the expression.  For example, `if (List<int> == T) ...`
  is allowed.

- Stop tokens are tokens that can't possibly follow a `>` that is a
  relational operator, because they *stop* the expression that's in
  progress.  For example, `var x = List<int>;` is allowed.

If a user wants to follow a <typeArguments> selector with a token
other than the ones above, they'll have to parenthesize the
expression.  So for example, if they want to do `List<int> + 1` (which
could be meaningful if an extension method defined `operator +` for
the type `Type`), they will have to use parentheses, and instead write
`(List<int>) + 1`.

Bug: https://github.com/dart-lang/language/issues/1806
Change-Id: I2816cdac24e55eac3cb3e9920e276404c1228d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210941
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-27 14:56:16 +00:00
Paul Berry 8dc6c5ecb0 Allow is or as to follow type arguments in constructor tearoff disambiguation.
Fixes #46888.

Bug: https://github.com/dart-lang/sdk/issues/46888
Change-Id: I780a53a2d5a45a8630935c9be5c886d96ef1a2ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209881
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-08-13 15:41:31 +00:00
Paul Berry ee38656c0b Fix corner cases of type argument parsing.
Fixes #46635.

Bug: https://github.com/dart-lang/sdk/issues/46635
Change-Id: I4f74f5ad39bfc775f69e4a47892725e1f166f962
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207201
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-07-19 11:28:29 +00:00
Paul Berry b7c6ad117f Remove hack that builds FunctionExpressionInvocation with synthetic arguments.
Now that we have an AST and visitor support for the FunctionReference
structure (which represents `Expression<TypeArguments>` for various
kinds of expressions), we no longer need to error recover this as a
FunctionExpressionInvocation with synthetic arguments.  The resolver
still doesn't resolve the syntax properly, but that's ok because it's
not permitted in valid code (for now we just treat it as having type
`dynamic`).

Fixes #46150.

Change-Id: I357175cc16bcf2f9027be2e1da66bb6ca70a9400
Bug: https://github.com/dart-lang/sdk/issues/46020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199682
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-06-01 22:44:45 +00:00
Paul Berry 126c5fa680 Initial parser support for constructor tear-offs.
This CL adds parser support for use of `<typeArguments>` as a
selector.  This allows expressions like `List<int>` (type literal with
type arguments), `f<int>` (function tear-off with type arguments),
`C.m<int>` (static method tear-off with type arguments), `EXPR.m<int>`
(instance method tear-off with type arguments), and `EXPR<int>`
(tear-off of `.call` method with type arguments).

I will add parser support for `.new` as a constructor name in a
follow-up CL.

Change-Id: I157e732276421e8c3fd20c38c67ae9643993bd85
Bug: https://github.com/dart-lang/sdk/issues/46020, https://github.com/dart-lang/sdk/issues/46044.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197102
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-05-25 13:58:10 +00:00