[dart-lang/sdk] 739826: Update ImportedElementsComputer for primary constr...

0 views
Skip to first unread message

Brian Wilkerson

unread,
May 22, 2026, 3:55:06 PM (2 days ago) May 22
to com...@dartlang.org
Branch: refs/heads/main
Home: https://github.com/dart-lang/sdk
Commit: 739826d041ddc2a72fd4c56a97d862a024eae264
https://github.com/dart-lang/sdk/commit/739826d041ddc2a72fd4c56a97d862a024eae264
Author: Brian Wilkerson <brianwi...@google.com>
Date: 2026-05-22 (Fri, 22 May 2026)

Changed paths:
M pkg/analysis_server/lib/src/computer/imported_elements_computer.dart
M pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart

Log Message:
-----------
Update ImportedElementsComputer for primary constructors

This CL is to resolve a TODO. I couldn't find a way to trigger any bugs
in the code, but I did add a test. I believe that the reason I couldn't
trigger a bug is because any constructor that has a null `typeName`
will not have a simple identifier in a place that would allow
`_isConstructorDeclarationReturnType` to be invoked.

I realized, while looking at the code, that the type check is
unnecessary. If the type name is null, then the test will somply return
`false`, which is what we'd expect it to do. Given that it isn't needed,
I decided to remove it.

Change-Id: Ib36aaf16475db0db5817e65a8b8bfbb8aa834dbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505501
Reviewed-by: Samuel Rawlins <sraw...@google.com>
Commit-Queue: Brian Wilkerson <brianwi...@google.com>



To unsubscribe from these emails, change your notification settings at https://github.com/dart-lang/sdk/settings/notifications

Konstantin Scheglov

unread,
May 22, 2026, 5:16:16 PM (2 days ago) May 22
to com...@dartlang.org
Branch: refs/heads/lkgr
Home: https://github.com/dart-lang/sdk
Commit: 739826d041ddc2a72fd4c56a97d862a024eae264
https://github.com/dart-lang/sdk/commit/739826d041ddc2a72fd4c56a97d862a024eae264
Author: Brian Wilkerson <brianwi...@google.com>
Date: 2026-05-22 (Fri, 22 May 2026)

Changed paths:
M pkg/analysis_server/lib/src/computer/imported_elements_computer.dart
M pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart

Log Message:
-----------
Update ImportedElementsComputer for primary constructors

This CL is to resolve a TODO. I couldn't find a way to trigger any bugs
in the code, but I did add a test. I believe that the reason I couldn't
trigger a bug is because any constructor that has a null `typeName`
will not have a simple identifier in a place that would allow
`_isConstructorDeclarationReturnType` to be invoked.

I realized, while looking at the code, that the type check is
unnecessary. If the type name is null, then the test will somply return
`false`, which is what we'd expect it to do. Given that it isn't needed,
I decided to remove it.

Change-Id: Ib36aaf16475db0db5817e65a8b8bfbb8aa834dbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505501
Reviewed-by: Samuel Rawlins <sraw...@google.com>
Commit-Queue: Brian Wilkerson <brianwi...@google.com>


Commit: fc7c53125356de53e89eb9bb2fee3a3f1d0495f0
https://github.com/dart-lang/sdk/commit/fc7c53125356de53e89eb9bb2fee3a3f1d0495f0
Author: Konstantin Shcheglov <sche...@google.com>
Date: 2026-05-22 (Fri, 22 May 2026)

Changed paths:
M pkg/analyzer/test/generated/invalid_code_test.dart
M pkg/analyzer/test/generated/non_error_resolver_test.dart
M pkg/analyzer/test/generated/non_hint_code_test.dart
M pkg/analyzer/test/generated/simple_resolver_test.dart
M pkg/analyzer/test/generated/static_type_analyzer_test.dart
M pkg/analyzer/test/generated/strong_mode_test.dart
M pkg/analyzer/test/src/dart/analysis/driver_caching_test.dart
M pkg/analyzer/test/src/dart/analysis/driver_test.dart
M pkg/analyzer/test/src/dart/analysis/index_test.dart
M pkg/analyzer/test/src/dart/analysis/results/get_element_declaration_test.dart
M pkg/analyzer/test/src/dart/analysis/search_test.dart
M pkg/analyzer/test/src/dart/ast/ast_test.dart
M pkg/analyzer/test/src/dart/ast/element_locator_test.dart
M pkg/analyzer/test/src/dart/constant/evaluation_test.dart
M pkg/analyzer/test/src/dart/element/display_string_test.dart
M pkg/analyzer/test/src/dart/element/inheritance_manager3_test.dart
M pkg/analyzer/test/src/dart/micro/file_resolution.dart
M pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
M pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
M pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
M pkg/analyzer/test/src/dart/resolution/library_element_test.dart
M pkg/analyzer/test/src/dart/resolution/library_export_test.dart
M pkg/analyzer/test/src/dart/resolution/library_import_test.dart
M pkg/analyzer/test/src/dart/resolution/metadata_test.dart
M pkg/analyzer/test/src/dart/resolution/part_test.dart
M pkg/analyzer/test/src/dart/resolution/resolution.dart
M pkg/analyzer/test/src/dart/resolver/exit_detector_test.dart
M pkg/analyzer/test/src/diagnostics/argument_type_not_assignable_test.dart
M pkg/analyzer/test/src/diagnostics/assignment_of_do_not_store_test.dart
M pkg/analyzer/test/src/diagnostics/duplicate_constructor_default_test.dart
M pkg/analyzer/test/src/diagnostics/duplicate_constructor_name_test.dart
M pkg/analyzer/test/src/diagnostics/final_class_extended_outside_of_library_test.dart
M pkg/analyzer/test/src/diagnostics/final_class_implemented_outside_of_library_test.dart
M pkg/analyzer/test/src/diagnostics/import_internal_library_test.dart
M pkg/analyzer/test/src/diagnostics/invalid_export_of_internal_element_test.dart
M pkg/analyzer/test/src/diagnostics/invalid_factory_name_not_a_class_test.dart
M pkg/analyzer/test/src/diagnostics/invalid_internal_annotation_test.dart
M pkg/analyzer/test/src/diagnostics/invalid_language_override_greater_test.dart
M pkg/analyzer/test/src/diagnostics/invalid_use_of_internal_member_test.dart
M pkg/analyzer/test/src/diagnostics/mixin_application_not_implemented_interface_test.dart
M pkg/analyzer/test/src/diagnostics/mixin_on_sealed_class_test.dart
M pkg/analyzer/test/src/diagnostics/non_const_map_as_expression_statement_test.dart
M pkg/analyzer/test/src/diagnostics/return_of_do_not_store_test.dart
M pkg/analyzer/test/src/diagnostics/subtype_of_base_is_not_base_final_or_sealed_test.dart
M pkg/analyzer/test/src/diagnostics/subtype_of_final_is_not_base_final_or_sealed_test.dart
M pkg/analyzer/test/src/diagnostics/subtype_of_sealed_class_test.dart
M pkg/analyzer/test/src/diagnostics/unused_element_test.dart
M pkg/analyzer/test/src/diagnostics/uri_does_not_exist_test.dart
M pkg/analyzer/test/src/ignore_comments/ignore_info_test.dart
M pkg/analyzer/test/src/services/top_level_declarations_test.dart
M pkg/analyzer/test/src/task/strong/dart2_inference_test.dart
M pkg/analyzer/test/src/task/strong/inferred_type_test.dart
M pkg/analyzer/test/src/wolf/ir/ast_to_ir_test.dart
M pkg/analyzer/test/src/workspace/blaze_test.dart
M pkg/analyzer/test/verify_diagnostics_test.dart

Log Message:
-----------
CQ. Remove result state from ResolutionTest.

Stop storing the most recently resolved unit in ResolutionTest. Make
test helpers operate on explicit result objects instead, so each
assertion uses the diagnostics, type provider, type system, and
inheritance manager from the result it is checking.

This makes the tests less order-dependent and easier to reason about. A
test can now resolve more than one file or unit without later assertions
implicitly depending on whichever result happened to be stored last. It
also makes helper APIs more local: the data needed by an assertion is
passed directly, rather than recovered from mutable test state.

Update tests to keep the returned result when they need access to the
resolved AST or result-derived utilities. Add convenience accessors on
the result wrappers to preserve common lookup patterns without
reintroducing shared mutable state.

Change-Id: Ib45c52f8fd104b668f9fdd1ec6b1442927cd7e61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505920
Reviewed-by: Paul Berry <paul...@google.com>
Commit-Queue: Konstantin Shcheglov <sche...@google.com>


Compare: https://github.com/dart-lang/sdk/compare/c8a74e71efff...fc7c53125356
Reply all
Reply to author
Forward
0 new messages