Commit Graph

7349 Commits

Author SHA1 Message Date
Sam Rawlins 26bfbd4cf1 analyzer tests: Remove the WithNullSafety mixin
Two remaining test files are modified to use the TestCases structure.
In each case, the tests are unchanged, but the classes are renamed.

Additionally, each file had a *WtihNonFunctionTypes variant. Each of
these classes just specified more test cases that include some form of
"typeAlias" in the name, and can be safely merged with the null safety
test cases.

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

Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: Id7db1038e64f8bbc12764cb558670b23427a5a86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209763
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-11 06:41:51 +00:00
Konstantin Shcheglov 3a2e4d92a2 Remove ExperimentStatus.latestWithNullSafety
Change-Id: I0a813ce1a64f1d6201005280cf7a116deaf8da1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209581
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-11 02:37:44 +00:00
Sam Rawlins 3393591b3f Rewrite AST w/ Constructor reference w/ explicit type args
This should handle all cases of constructor reference w/ explicit type
args; there aren't too many cases:

* named and unnamed constructors
* referencing class and referencing type alias
* prefixed class names and not-prefixed
* null-aware access (weird)
* bound on type parameter of class, and on type parameter of alias

error cases:

* cascade
* wrong number of type arguments

Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: If257eb561a9ad854709b6e9a7d81faa9d084d6ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209622
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-10 23:54:49 +00:00
Sam Rawlins 19fa4519bd Analyzer: Refactor and rename test classes in 18 files to use TestCases model
The diffs may look large, but only due to sorting. No tests were added,
removed, or altered.

Change-Id: Id126e9a08056f6d3f99bad32d7060d65b07e4e90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-10 18:48:50 +00:00
Sam Rawlins 2c32ff9331 Report error on function tearoff w/ type args on dynamic
From the spec:

> We do not allow dynamic explicit instantiation. If an
expression _e_ has type `dynamic` (or `Never`), then
`e.foo<int>` is a compile-time error for any name `foo`.

Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: I041c3fcac77fe8edf64633a8d23dbaa89cf42f77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209623
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-10 18:36:11 +00:00
Konstantin Shcheglov 7ad9feb2d6 Issue 46472. Don't resolve to static Object members via dynamic.
For instance members we do this because this is the best that we
know about the result, and any successful override will be more
specific. But static members never can be invoked this way. So, we
don't do recovery for recovery.

Bug: https://github.com/dart-lang/sdk/issues/46472
Change-Id: Ifbd274011e159c3c8ae35d343603c02bb7599d8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209420
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-08-10 12:53:23 +00:00
Konstantin Shcheglov 766113bc54 Update latestSdkLanguageVersion to 2.13
Bug: https://buganizer.corp.google.com/issues/195648511
Change-Id: I7f882edaec42c6224a0863be96a41e1abd5b3329
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209580
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-10 11:56:43 +00:00
Sam Rawlins d9dc244eed Analyzer: Refactor and rename test classes in 11 files to use TestCases model
The diffs may look large, but only due to sorting. No tests were added,
removed, or altered.

Change-Id: I55b591c45691319a02f272c7c6b424f0ff755d5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-09 23:30:39 +00:00
Paul Berry 8f853bc32f Unit test some corner cases of annotation resolution.
Currently, if a type parameter of a class, mixin, or extension
declaration has an annotation, that annotation is resolved in the type
parameter scope of the class, mixin, or extension declaration (meaning
that static methods are not in scope), however if scope lookup fails,
then static methods are accessible via implicit `this`.

AFAICT, this odd behavior is not spec compliant, so I've filed
https://github.com/dart-lang/language/issues/1790 to discuss the
possibilty of changing it.  However, for now I want to unit test the
behavior in order to ensure that if we make any changes to the
analyzer that affect it, the change won't go unnoticed.

Bug: https://github.com/dart-lang/language/issues/1790
Change-Id: I02df7e6e8939ecc6222085f28a6d6b7d072179c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209662
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-08-09 22:43:19 +00:00
Sam Rawlins 9b586a3da6 analyzer: add constructor references from PrefixedIdentifier
Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: Ifafea6edb6c9ce7fdf1c1f092ff278738c273bb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-09 15:03:48 +00:00
Konstantin Shcheglov 04c44e8e67 Inline FeatureSetProvider.isNullSafetySdk, rename isNullSafetySdkAndLegacyLibrary.
Change-Id: I12397d77a1f77bc872f335550789322e4344d456
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209520
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-09 13:31:38 +00:00
Sam Rawlins b38ccf33e0 Combine test classes in ast_rewrite_test.dart
These two classes have the same FeatureSet, so should be combined.

Change-Id: If03e74d54ca35ed81fe532a7dc1974ecc52b6b25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-06 20:47:58 +00:00
Sam Rawlins e61ef3889e Analyzer: Refactor and rename 8 test classes in 4 files to use TestCase model
The diffs may look large, but only due to sorting. No tests were added,
removed, or altered.

Change-Id: I55246391205a8a234c05b9e1aa3ec681a178f973
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209361
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-08-06 20:47:49 +00:00
Konstantin Shcheglov c951b72ed5 Issue 46753. Enhance LinterContext.resolveNameInScope() to suport type parameters.
Bug: https://github.com/dart-lang/sdk/issues/46753
Change-Id: Ide53294599496cb8011e86bced0b075e389e1040
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-05 21:54:21 +00:00
Konstantin Shcheglov 39178e6b13 Issue 46206. Record redirectedConstructor even for non-const constructors.
Bug: https://github.com/dart-lang/sdk/issues/46206
Change-Id: I9a121454e382988228d62130ef2f9cad7164135a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-05 19:53:21 +00:00
Brian Wilkerson 878cd3a3f8 Improve the messaging around conflicting constructors
Fixes: https://github.com/dart-lang/sdk/issues/46803
Change-Id: I0435ea15cfb4c57dfb865f66d251afbe1d9459a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-04 17:29:47 +00:00
pq 9fced4c389 check for undefined parameter references in UseResult.unless targets
Change-Id: Iaba4696c3f04efe0c104695ac51896bb81d06bb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208862
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-04 00:35:30 +00:00
pq b820538026 @UseResult verifier: check for passed "using" param
Change-Id: I5d0ececce8702c8dace87a4fbf3922fa05ba74ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208822
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-03 19:31:39 +00:00
Sam Rawlins e64597aa1b analyzer: Report duplicate unnamed and "new"-named constructors
Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: I5a737b8b227fa205e66650dd40d697e4e3ef0125
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208821
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-03 19:27:02 +00:00
Sam Rawlins 9ec112a509 analyzer: Support declaring and invoking unnamed constructor via 'new'
This adds support for both declaring an unnamed constructor with the
explicit name, "new", and support for invoking an unnamed constructor
as a named constructor named "new".

The parser will report EXPERIMENT_NOT_ENABLED if the experiment is not
enabled, as the parser takes care around the keyword, "new".

Tearoff support will be separate.

Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: Iaf3af333dd22337b560aa7f4e5811a4cb38b2a7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208760
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-03 03:06:41 +00:00
Paul Berry b13dc22338 Add an analysis option allowing linter exceptions to be propagated.
This will be used in internal builds to ensure that an exception
occuring during linting fails the build; this should help us be more
confident in the robustness of the linter code.

Change-Id: I4eaa47044b32b45433a67cc919ad047663dc771c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-07-30 20:05:37 +00:00
Paul Berry b7f8227c42 Remove dead code related to visitor-based lints.
In the two LibraryAnalyzer classes, the list of visitors is always
empty, so there are never any "visitor based lints" to run.  (I
suspect that all the visitor based lints were long ago converted to
use the node registry, leaving this code dead).

Removing the last remnants of the visitor based lint logic allows us
to remove the ExceptionHandlingDelegatingAstVisitor class, which in
turn allows us to move its logException method into a simpler class.
In a follow-up CL, I will expand on this class to allow its behavior
to be customized.

Change-Id: I1261a94572ea65eb220a58fb45f6d887e6497fe9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208140
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-07-30 14:48:04 +00:00
Sam Rawlins f4d3f801b3 Re-arrange 11 test cases to use TestCases mixin
The diffs look large but that is only the result of sorting; I did not add,
remove, or edit any test cases.

Change-Id: I2728d9c66d79561f4291c007d202eca4af01e28e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-07-27 15:54:57 +00:00
Konstantin Shcheglov e50b483976 Rename to HasMacroGenerationData.
R=brianwilkerson@google.com

Change-Id: I10c5f2900366ce2614e51c83be5f9e0138f279a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208144
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-26 23:19:46 +00:00
Konstantin Shcheglov ca97ef0f20 Add a few data-class macros.
Mostly to excercise adding methods and constructors.

Change-Id: I378085acf047ef8b0afb6dcc75708bf1b503ee44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208025
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-07-26 17:23:28 +00:00
Sam Rawlins ef8add038f Analyzer function refs: report more disallowed instantiations
Only the following short list of elements are allowed to be type-
instantiated: top-level function, local function, instance method,
constructor, type.

Bug: https://github.com/dart-lang/sdk/issues/46233 and
Change-Id: I37e2a793b7fb25ef670152490e73b227b7c0cdac
https://github.com/dart-lang/sdk/issues/46590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207643
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-07-26 06:49:34 +00:00
Konstantin Shcheglov 53cb22619a Store informative data for macro-produced elements.
This includes offsets, which are relative to the macro produced code.
So, when we compose the effective unit code, we will know the actual
offset of macro-produced elements in this unit code.

Change-Id: I308d78313cee51c4b1d1890e36eeef1c8dc45e3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208000
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-23 22:04:09 +00:00
Konstantin Shcheglov c9a570c22e Store macro generated code into corresponding elements.
Macros (at least first phases) run during linking, and so new code that
they produce (new elements, methods, etc) are element model artifacts.
So, we store them into the element model.

Change-Id: Ifa19c240b9fc0cf194e016e986651fe788a46005
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207983
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2021-07-23 19:04:01 +00:00
Konstantin Shcheglov 639665cc4e [Macro] Resolve types in new class members in the scope of the class.
Change-Id: Iaf35bb0a7e941dba2bd80e1fe30e449623a16de9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207862
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-07-23 16:47:15 +00:00
Konstantin Shcheglov b89c35472f Initial support for macro(s) as built into analyzer.
Change-Id: Ib22317b1257b0a4d56d6ed35d5b6a13e39226c59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-22 15:55:39 +00:00
Konstantin Shcheglov 1250fa4911 Rename FileResolverTestView.resolvedLibraries
Change-Id: I30431ce52368737c5e0fb3666d30117fb0e77f50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207600
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-21 23:00:08 +00:00
Brian Wilkerson ca071d6219 Improve the highlight range for must_be_native_function_type
Change-Id: I5d547b4a87be6f5f4d153b17ffdded26f4005a40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207706
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-21 20:30:18 +00:00
Brian Wilkerson 16ddc5c166 Improve the highlight range for empty_struct
Change-Id: I758fd52f04e0e68251aa27b2f30639f063e16395
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207705
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-21 18:45:38 +00:00
Konstantin Shcheglov 64eaebc9c6 Revert "Basic support for linking with macro-generated code."
This reverts commit 55c5e3b680.

After discussions with various people I decided that this approach
is not what we want.

Change-Id: Id49f491c4bcd0ffb0cb8dfec0bdbb2d09c413c08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207703
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-21 18:04:30 +00:00
Sam Rawlins ea5333a23f Do not report const ctor with a mixed in abstract final field
Additionally, reduce duplicated errors regarding invalid const constructors.

Fixes https://github.com/dart-lang/sdk/issues/46641
Change-Id: Ica397ad6e28a05bc5340d5ceca236fbedf1e95f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207621
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-07-21 17:56:08 +00:00
Sam Rawlins 6a8e74e656 Tidy up function reference resolution; support extension methods
This change is mostly just extracting out some code into helpers; the
`resolve` method was getting extremely long. The block of code
extracted into each helper is largely unchanged.

Bug: https://github.com/dart-lang/sdk/issues/46233
Change-Id: I057dc31339e6a4d9deee18c881123e488f593ac9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207440
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-07-20 18:02:31 +00:00
Clement Skau 93d5c4eeef [VM] Adds error for leaf FfiNative w. Handle
This adds an analyzer compile-time error for using Handles
with leaf call FfiNatives.
This same error already exists in the transforms.
(See `_ensureLeafCallDoesNotUseHandles(..)`)

Bug: https://github.com/dart-lang/sdk/issues/46625
Change-Id: Iec52d5df6dd346a25ef2976e552cf1cb58c17ff6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207460
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-07-20 13:01:40 +00:00
Clement Skau 2f0b352e98 [VM] Adds compile-time error for non-static FfiNative
This makes it a compile-time error to add @FfiNative annotation
to any non-static function, such as an instance method.

TEST=tests/ffi/ffi_native_test.dart,pkg/analyzer/test/src/diagnostics/ffi_native_test.dart

Bug: https://github.com/dart-lang/sdk/issues/43889
Change-Id: Ib9ec61345bb47e735ed635c5ceea15ab643f65a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207306
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-07-20 11:54:30 +00:00
Konstantin Shcheglov ae8a2aac09 Don't cache ResolvedLibraryResult(s) for partial / completion results.
Change-Id: I2212b8032d90f7959639f51f92eded3a3bd44003
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-19 23:44:44 +00:00
Konstantin Shcheglov 62f73a5bd9 Add DartType.alias, deprecate aliasElement/aliasArguments.
Change-Id: I80e0c47c8f431eb504044f4110b55add64c943d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207280
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-07-19 21:56:34 +00:00
Konstantin Shcheglov 8cfb874b91 Declare 'dynamic' and 'Never' in 'dart:core' when build or read.
There are exceptions like this in Cider:
[handleCodeActionRequest] Bad state: Expected existing element: root::dart:core::dynamic :
#0      LinkedElementFactory.elementOfReference (package:analyzer/src/summary2/linked_element_factory.dart:148)
#1      LinkedElementFactory.buildExportNamespace (package:analyzer/src/summary2/linked_element_factory.dart:54)
#2      LibraryElementImpl.exportNamespace (package:analyzer/src/dart/element/element.dart:3738)
#3      NamespaceBuilder._getExportMapping (package:analyzer/src/dart/resolver/scope.dart:271)
#4      NamespaceBuilder.getImportedElements (package:analyzer/src/dart/resolver/scope.dart:211)
#5      new PrefixScope (package:analyzer/src/dart/element/scope.dart:181)
#6      new _LibraryImportScope (package:analyzer/src/dart/element/scope.dart:295)
#7      new LibraryScope (package:analyzer/src/dart/element/scope.dart:106)
#8      LibraryElementImpl.scope (package:analyzer/src/dart/element/element.dart:3944)
#9      LibraryBuilder.buildScope (package:analyzer/src/summary2/library_builder.dart:134)
#10     Linker._computeLibraryScopes (package:analyzer/src/summary2/link.dart:165)


Change-Id: Ib2198e32c0467aa20f279047008778d1deda5b97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-19 21:49:39 +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
Sam Rawlins 9ef9fce004 Report more errors on invalid explicit type instantiation function tearoffs.
When an expression which is not a type, not a constructor, and not an
identifier for a function, is torn off with type arguments, report
DISALLOWED_TYPE_INSTANTIATION_EXPRESSION.

When a function expression (without a name) is explicitly torn off with
the wrong number of type arguments, report
WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION. This separate error
code has text which does not have a slot for a function's name.

Add resolution for implicit receiver super-type instance method tearoff.

Bug: https://github.com/dart-lang/sdk/issues/46233
Change-Id: I3243e1824e191b6b703b1c995af5e1bd8a242915
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207140
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-07-18 02:04:04 +00:00
Konstantin Shcheglov 55c5e3b680 Basic support for linking with macro-generated code.
Only classes and methods for now.

Change-Id: Iacca78a25b34ef8ebd7f74eca0876996009025be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207260
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-07-17 01:09:33 +00:00
Konstantin Shcheglov 5383b536c4 Add ClassElementImpl.isEnumLike
Change-Id: If89e9936f0c93f414bfdb3c6642712c2086a1b66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-16 19:18:47 +00:00
Devon Carew b468669c9b [analyzer] increase the timeout for the verify_diagnostics_test
Change-Id: I109200bdf9ecf1d1c208c61b0cfed3088eef9ae9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207223
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-07-16 18:31:37 +00:00
Konstantin Shcheglov 5c902ff32b Fix ContextBuilderImplTest on Windows.
TBR

R=brianwilkerson@google.com

Change-Id: Id21b8756e6cb097d042bfc492b1f67822165c4c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207222
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-07-16 17:41:22 +00:00
Konstantin Shcheglov 320616c42e Revert "Switch Workspace to Packages."
This reverts commit c7421d3406.

Reason for revert: breaks Cider in google3

Original change's description:
> Switch Workspace to Packages.
>
> PackageMapUriResolver is still based on Map.
>
> Change-Id: If6ed2d3181129a6605f60dddd8de5783fafa09d1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206700
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

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

Change-Id: Icdd360f226ab70df5b19711e49345c4d66f8d8b6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207221
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-16 17:23:08 +00:00
Konstantin Shcheglov c7421d3406 Switch Workspace to Packages.
PackageMapUriResolver is still based on Map.

Change-Id: If6ed2d3181129a6605f60dddd8de5783fafa09d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-16 16:27:37 +00:00
Konstantin Shcheglov 79327c9f05 Make ResolvedUnitResult.content/unit non-nullable.
Change-Id: Ia79567d248f2c91290bfdf8204ea7e9f3dc85fa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206668
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-14 02:33:10 +00:00