Commit Graph

569 Commits

Author SHA1 Message Date
Sam Rawlins d5cc53a1b8 Prefer for-loop over forEach; other little fixes
These linter fixes help prepare analyzer for lints 2.0.0

Change-Id: Ic942fa367965edac479b917cbbb601b30da8b53c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237766
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-18 03:37:47 +00:00
Jens Johansen fd4e41a7af [parser-ish] Better errors on invalid unicode escapes
https://github.com/dart-lang/sdk/issues/48542

Change-Id: Icbdcc939a93c737914091c00aaefa3c4efb2dde0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237364
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-03-17 13:57:45 +00:00
Konstantin Shcheglov 5ffba0a660 Remove unnecessary code for enum constants from AstBuilder, completion.
With https://github.com/dart-lang/sdk/issues/48380 fixed, we can simplify.

Change-Id: Ic453fe9e86af2f6cb437ff016a9b3786959b05d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236302
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-09 21:07:44 +00:00
Konstantin Shcheglov 44806b2e47 Don't report VALUES_DECLARATION_IN_ENUM for static setter.
See https://github.com/dart-lang/co19/pull/1312

Change-Id: Ie535a826a2997c45344486febbb8cc35a748496c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-09 19:13:34 +00:00
Konstantin Shcheglov 366ad77ee2 Report NON_FINAL_FIELD_IN_ENUM.
Change-Id: I6b481cd5cd02d4dbfdb213fe25aae0423c1b06ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234913
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-02 23:52:30 +00:00
Jens Johansen 514f678199 [parser] Better recovery for extra stuff in enum and using enum as identifier
Fixes https://github.com/dart-lang/sdk/issues/48371

Change-Id: I93331485c884c89c179c2fa332f3f975db9507f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234043
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-02-25 09:35:25 +00:00
Konstantin Shcheglov f21a6d694f Report ENUM_WITH_NAME_VALUES.
Change-Id: Ie8dabdb7874c9e03ed7d48b7b35bdbc7b93d10c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234105
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-23 19:37:02 +00:00
Konstantin Shcheglov 0caead5485 Report ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION/INHERITANCE
Change-Id: I6e0815ddbd3f161fc07c83d6a0c9b7c61b2f9fc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233702
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-22 18:12:31 +00:00
Konstantin Shcheglov 0d9f02bf27 Rename to CONCRETE_CLASS_HAS_ENUM_SUPERINTERFACE, report for concrete classes.
Bug: https://github.com/dart-lang/sdk/issues/48437
Change-Id: Ib5b3ac90c030ea47e33987f7a961432a954807b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-19 23:01:24 +00:00
Konstantin Shcheglov 1acf0dce85 Report ENUM_INSTANTIATED_TO_BOUNDS_IS_NOT_WELL_BOUNDED
Change-Id: I4cef975da984b9bf1da64008292864b716b13e8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232128
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-09 16:13:06 +00:00
Konstantin Shcheglov 29d364dfd4 Report VALUES_DECLARATION_IN_ENUM
Change-Id: I8efc240b5bd2740a457eb373bece31afab3c7525
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232130
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-09 15:53:36 +00:00
Konstantin Shcheglov d8e2cdaeec Report WRONG_NUMBER_OF_TYPE_ARGUMENTS_ENUM and TYPE_ARGUMENT_NOT_MATCHING_BOUNDS for enums.
Change-Id: Icac828fa09d7565974727521c27b5cd4daa7e0f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232089
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-08 19:50:36 +00:00
Konstantin Shcheglov f6ebb50359 Report ENUM_CONSTANT_WITH_NON_CONST_CONSTRUCTOR
Change-Id: I3962553ccaa881db761e87fdd97ce47a65db4b2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232124
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-08 19:15:28 +00:00
Konstantin Shcheglov 63f34ab810 Report UNDEFINED_ENUM_CONSTRUCTOR_NAMED/UNNAMED
Change-Id: I02b8a2d9d3988cc0c281a8d251b9670e378b3561
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232023
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-07 23:27:14 +00:00
Brian Wilkerson 867e155ff6 Merge two error codes
I was thinking about unifying these two codes for documentation purposes,
but then I wondered whether we might not want to unify them for reporting
purposes too. The reason I think it might be better to unify them is
because (a) they really represent a single problem (missing required
arguments) and (b) we were previously reporting the same problem multiple
times.

Change-Id: Iecf2865e67d61b03a1e1f56781e94e283d2a08e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232022
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-02-07 23:10:06 +00:00
Konstantin Shcheglov f15518dffc Report ILLEGAL_ENUM_VALUES_DECLARATION/INHERITANCE
Change-Id: I31a02b7c0fe50362ed6d9cb66159db3386f3b56e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-07 21:47:45 +00:00
Konstantin Shcheglov 2c84f13edb Report ILLEGAL_NON_ABSTRACT_ENUM_INDEX
Change-Id: I028ce008c11a0e4b9e0bebef4e6b62c855a07e82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-07 19:42:20 +00:00
Konstantin Shcheglov d7bb928f64 Report ENUM_WITH_ABSTRACT_MEMBER and NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER.
Change-Id: I3da69337edc299fee847ba7984b16ca7be65c1e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-07 19:26:18 +00:00
Konstantin Shcheglov 2ad4e8258c Report ENUM_CONSTANT_WITH_TYPE_ARGUMENTS_WITHOUT_ARGUMENTS
Change-Id: I41fa9cb8497671363878d2140dfec2ec3fc0f6ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231844
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-07 19:26:15 +00:00
Konstantin Shcheglov 14bead484c Report more enum hierarchy errors for enums.
Change-Id: I9ffc41ce9cbc9a51b059dc8a891e59420232d047
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231536
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-04 18:51:39 +00:00
Konstantin Shcheglov 8f2a27f940 Report ENUM_MIXIN_WITH_INSTANCE_VARIABLE
Change-Id: Idc15ea010fc0b7d7f4b551a2a4b8731bcfc74ad7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231325
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-03 00:03:49 +00:00
Konstantin Shcheglov 33b3c1d6c6 Report ILLEGAL_LANGUAGE_VERSION_OVERRIDE, when 'sourceLanguageConstraint' is set.
Change-Id: Ibbd786090a5a1a61da11f1e9de754202bdc454d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231322
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-02 20:20:39 +00:00
Konstantin Shcheglov 22a8295295 Report INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR instead of INSTANTIATE_ENUM when enhanced-enums.
Change-Id: I634b3e50641b2b696b4d9e164266b43fdc72f137
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231063
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-01 23:58:45 +00:00
Konstantin Shcheglov af598f9d25 Report NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE.
Change-Id: Iec3daeba6b069c80e01baf4bc070059209d1ac4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231045
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-01 23:00:25 +00:00
Konstantin Shcheglov dcc1b8bc18 Report NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR.
Change-Id: I1a087a3b554d5d5439d43b0798d14a46310f1bfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231048
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-01 18:18:55 +00:00
Konstantin Shcheglov 17d2a0b755 Report SUPER_IN_ENUM_CONSTRUCTOR.
Change-Id: I403b51eed9a0f685e56433a2b567b8a38a95e15b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231049
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-01 18:18:35 +00:00
Konstantin Shcheglov edbf6300a1 Remove MIXIN_INFERENCE_NO_POSSIBLE_SUBSTITUTION.
When we cannot infer types, we leave `M<dynamic>` and report
other errors.

Change-Id: Ice6ebabf4bc844ee21aa1cc842e6496fcf8b3c11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-01-06 22:17:45 +00:00
Brian Wilkerson ccc1656eb0 Improve the message when the required keyword needs to replace the required annotation
Fixes https://github.com/dart-lang/sdk/issues/46841

Change-Id: If318064a901f3cf1cbcf117ad392d72a9cf004fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-01-05 16:38:25 +00:00
Konstantin Shcheglov 23d238f02c Report when super-formal parameter type is not a subtype of the associated parameter type.
Change-Id: Id74910d59ae753940ec116ba865305e35eb69465
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226484
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-01-05 01:33:57 +00:00
Konstantin Shcheglov a34925dc19 Report more specific errors for implicitly invoked unnamed super constructor when super-parameters feature is enabled.
Change-Id: Ib2e82f0ab86c606c512d9f5d1787dbbfad753449
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-01-04 20:09:51 +00:00
Brian Wilkerson dc833c2119 Remove the unreported mixin_declares_constructor diagnostic
Change-Id: I3af5b52e3269b155b871004b89a3702530d325d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-01-04 19:03:25 +00:00
Konstantin Shcheglov 8bf64b3b4a Remove CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME
Bug: https://github.com/dart-lang/sdk/issues/48045
Change-Id: I3f408a61e0f789f22a13443fcddeb3964bacc591
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-01-04 17:59:45 +00:00
Konstantin Shcheglov bd3fbd1682 Report a few errors for super-formal parameters in explicit super-constructor invocation.
Change-Id: I75cdc08ab26fba01fb44f387737ee44d6b09eaa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225980
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-31 17:31:43 +00:00
Konstantin Shcheglov 2ad5ab51bd Report an error if super-parameter outside non-redirecting generative constructor.
Change-Id: Ib36f3266aeb0a4fd6992fb61695fd80257a51646
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225900
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-30 17:48:42 +00:00
Sam Rawlins b16b0322b9 Reland "analyzer: Report missing return for nullable return types"
This is a reland of 93bcdf0329

Original change's description:
> analyzer: Report missing return for nullable return types
>
> This is implemented as a new HintCode, but it could be a new Warning, if
> we'd like to stop adding new Hints.
>
> There is also a dartfix available in this change.
>
> Fixes https://github.com/dart-lang/sdk/issues/46656
>
> Change-Id: I8e93e576d2bd09a8ff02d52c12bbb9ec6adff9c2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220803
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>

Change-Id: I369b2dc38db0dc278f50b55aab67da53a5a63a8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-12-22 18:46:14 +00:00
Alexander Thomas 3b5d06e449 Revert "analyzer: Report missing return for nullable return types"
This reverts commit 93bcdf0329.

Reason for revert: Broke google3 rolls.

Original change's description:
> analyzer: Report missing return for nullable return types
>
> This is implemented as a new HintCode, but it could be a new Warning, if
> we'd like to stop adding new Hints.
>
> There is also a dartfix available in this change.
>
> Fixes https://github.com/dart-lang/sdk/issues/46656
>
> Change-Id: I8e93e576d2bd09a8ff02d52c12bbb9ec6adff9c2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220803
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>

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

Change-Id: I122be4cb1d07f7f95334d2d5cbac1de4bd597d15
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224950
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2021-12-22 08:38:52 +00:00
Sam Rawlins 93bcdf0329 analyzer: Report missing return for nullable return types
This is implemented as a new HintCode, but it could be a new Warning, if
we'd like to stop adding new Hints.

There is also a dartfix available in this change.

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

Change-Id: I8e93e576d2bd09a8ff02d52c12bbb9ec6adff9c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220803
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-12-21 18:22:03 +00:00
Daco Harkes acdf82de17 [vm/ffi] ABI-specific integers
This CL adds support for users defining integers which are mapped to
differing sizes and signedness based on the application binary interface
the Dart VM is running on.

Notable implementation design decisions:
- ABIs are open world, so that adding an ABI to the Dart VM does not
  break existing definitions. Thus, we only figure out in the VM that
  we're missing a mapping. We throw compile-time errors.
  - In AOT, these show up in the precompilation step.
  - In JIT, these show up as `_CompileTimeError` at runtime. Note that
    these can be caught. So in subsequent compilation steps we need to
    ensure that we also throw the same compile-time error.
- We match on the call-sites (streaming_flowgraph_builder) rather than
  method bodies (kernel_to_il) of AbiSpecific loads and stores so that
  we can compile for the int-size of the call site.

API design decisions:
https://github.com/dart-lang/sdk/issues/42563#issuecomment-981774001

Closes: https://github.com/dart-lang/sdk/issues/42563

TEST=tests/ffi_2/abi_*_test.dart
TEST=tests/ffi/function_*_generated_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart
Change-Id: I8c8df36fab939b6fb614c5f1ee8e1bf46b6e9521
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,benchmark-linux-try,dart-sdk-linux-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-canary-linux-debug-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-fuchsia-release-x64-try,vm-kernel-checked-linux-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64c-try,vm-kernel-mac-debug-x64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221501
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-12-16 22:07:00 +00:00
Konstantin Shcheglov f317d7c1db Breaking changes for analyzer version 3.0.0
Internal presubmit:
https://fusion2.corp.google.com/presubmit/tap/366560067/OCL:366560067:BASE:415321249:1639080094301:ae113907

Change-Id: Idf9cb7d98f490409bec4eab8833b95328ece9e86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212610
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-09 23:07:19 +00:00
Daco Harkes c3b50826dd [analyzer/ffi] ABI-specific type support in analyzer
TEST=pkg/analyzer/test/src/diagnostics/abi_specific_integer_mapping_test.dart

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

Change-Id: I7ae6e05073e6f28a42b5f8f7d06c9b5b91c510a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221821
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-12-02 12:10:27 +00:00
Sam Rawlins bd57f9a837 analyzer: Explicitly return null in nullable return functions
Related to: https://github.com/dart-lang/sdk/issues/46656

Change-Id: I5c015e9827cc7b7ac26f198371709c124b6c28ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221565
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-11-30 05:20:05 +00:00
pq b403d4bf73 Reland "hints for text_direction_code_points"
This is a reland of 39008c8243

Original change's description:
> hints for text_direction_code_points
>
> Fixes: https://github.com/dart-lang/sdk/issues/47611
>
> Related: https://github.com/flutter/flutter/pull/93034
>
>
> Change-Id: Ia6bac44e1c9a7ef25f01683b8414b9818822cb7f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219123
> Commit-Queue: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Kathy Walrath <kathyw@google.com>

Change-Id: Ib200aa2e6f1a323a6d01cc3c051657fd48f41251
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219750
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
2021-11-10 00:09:33 +00:00
Siva Annamalai 90749574b6 Revert "hints for text_direction_code_points"
This reverts commit 39008c8243.

Reason for revert: breaks G3 builds please see https://ci.chromium.org/p/dart/builders/ci.sandbox/google

Original change's description:
> hints for text_direction_code_points
>
> Fixes: https://github.com/dart-lang/sdk/issues/47611
>
> Related: https://github.com/flutter/flutter/pull/93034
>
>
> Change-Id: Ia6bac44e1c9a7ef25f01683b8414b9818822cb7f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219123
> Commit-Queue: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Kathy Walrath <kathyw@google.com>

TBR=lrn@google.com,brianwilkerson@google.com,pquitslund@google.com,sra@google.com,kathyw@google.com

Change-Id: I82c2b471bc9566222db4616bba501534c35b4f9e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219747
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-11-08 22:48:43 +00:00
Sam Rawlins 8900608365 Report fewer duplicate errors for invalid superinitializers
Fixes https://github.com/dart-lang/sdk/issues/45958

Move check out of old checker.dart, into (less old) error_verifier.dart
and move test case out of old checker_test.dart. Add valid test case.

Rename INVALID_SUPER_INVOCATION to SUPER_INVOCATION_NOT_LAST, and
correct comment on that code (it has a parameter).

Do not duplicate report that code with MULTIPLE_SUPER_INVOCATIONS or
with SUPER_IN_REDIRECTING_CONSTRUCTOR.

Change-Id: I26e28b345fd8cef8ed2c9ec89ab12b56ea1c2f37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218982
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-11-08 18:53:42 +00:00
pq 39008c8243 hints for text_direction_code_points
Fixes: https://github.com/dart-lang/sdk/issues/47611

Related: https://github.com/flutter/flutter/pull/93034


Change-Id: Ia6bac44e1c9a7ef25f01683b8414b9818822cb7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219123
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
2021-11-08 18:38:28 +00:00
Paul Berry 0b94228695 Enforce that all ErrorReporter arguments come from a limited set of types.
This change ensures that the only types ever passed to ErrorReporter
arguments are String, DartType, int, Uri, or Element.  A few call
sites had to be changed so that instead of passing in AST nodes they
passed in the result of calling `toString` on those AST nodes.

In future CLs, I plan to move toward a system where instead of passing
the message arguments to ErrorReporter as a list of `Object`, we call
a `withArguments` method that's specific to each error; that method
will have a specific list of argument types that it supports, so that
if we accidentally pass the wrong things into an error message, the
problem will be detected at compile time (instead of the user just
seeing a confusing error message).

The `withArguments` methods will be code generated from annotations in
the analyzer's `messages.yaml` file.  Keeping the set of types
supported by those `withArguments` messages small should help simplify
the code generation process, and provide flexibility for how errors
are represented in the future.

Change-Id: I4a793db2fe5b1344199b770898634b61be41ad11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216301
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-11-02 14:23:12 +00:00
Sam Rawlins 930697a158 Improve messaging of invalid yield type
Fixes https://github.com/dart-lang/sdk/issues/47379

We use a separate message for yield expressions, so that the yielded
type can be used. In checking against the yielded type, we also stop
reporting in some cases, which removes duplicate errors.

Change-Id: I2ce036086ca06d5ff32531afd4b1812f17b908ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218745
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-11-01 15:28:51 +00:00
Sam Rawlins 383f45ac7e Add DEPRECATED_NEW_IN_COMMENT_REFERENCE diagnostic
This is a new HintCode for code in which comment-references is enabled.

`/// See also [new List].` is marked as deprecated, preferring a direct
reference (or "tear-off") of a constructor, like
`/// See also [List.new].`.

Additionally, a new quick fix supports making the above conversion,
taking into account both unnamed and named constructors.

Bug: https://github.com/dart-lang/sdk/issues/47446
Change-Id: Iec68ef21bd03198ea822979f6f0048cc655023c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217400
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-26 16:52:51 +00:00
Paul Berry ce8ee6cf03 Check the number of arguments when instantiating AnalysisErrors.
Change-Id: I45fa2a560b7368370fae4a7a94d8f52136e92486
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213821
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-23 14:13:33 +00:00
Paul Berry 0a39aa7cf6 Make all analyzer message arguments non-nullable.
Cases where `null` was being passed as an argument to formatting a
message have all been fixed in previous CLs; all that remains to do is
change the type system to reflect that, and insert `!`s in a few
places.

This brings us one step closer to being able to make analyzer message
formatting type safe.

Change-Id: Id9e0d0b32f29cde0fdc5227417b7a2e3fc3b443d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216272
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-20 11:31:51 +00:00