[dart-lang/sdk] 03a05b: Fix a primary-constructors bug in ElementMatcher

0 views
Skip to first unread message

Brian Wilkerson

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

Changed paths:
M pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
M pkg/analysis_server/test/src/services/correction/fix/data_driven/element_matcher_test.dart

Log Message:
-----------
Fix a primary-constructors bug in ElementMatcher

The element matcher threw a null check exception when getting a matcher
in the argument list of a constructor redirect in a secondary
constructor declaration with no explicit type name. This fixes it so
that no exception will be thrown.

That said, it isn't clear to me that this code could ever be reached
outside of the tests. There might be a lot of unreachable code in
ElementMatcher. I just can't prove that this particular bug would never
have occurred.

Change-Id: I5adf9ab5d4f79686110099054902a28535483f4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505921
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:49:03 PM (2 days ago) May 22
to com...@dartlang.org
Branch: refs/heads/lkgr
Home: https://github.com/dart-lang/sdk
Commit: 03a05b52d8d60c391ec01ee3405079e6f53c79d8
https://github.com/dart-lang/sdk/commit/03a05b52d8d60c391ec01ee3405079e6f53c79d8
Author: Brian Wilkerson <brianwi...@google.com>
Date: 2026-05-22 (Fri, 22 May 2026)

Changed paths:
M pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
M pkg/analysis_server/test/src/services/correction/fix/data_driven/element_matcher_test.dart

Log Message:
-----------
Fix a primary-constructors bug in ElementMatcher

The element matcher threw a null check exception when getting a matcher
in the argument list of a constructor redirect in a secondary
constructor declaration with no explicit type name. This fixes it so
that no exception will be thrown.

That said, it isn't clear to me that this code could ever be reached
outside of the tests. There might be a lot of unreachable code in
ElementMatcher. I just can't prove that this particular bug would never
have occurred.

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


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

Changed paths:
M pkg/analyzer/test/generated/simple_resolver_test.dart
M pkg/analyzer/test/generated/strong_mode_test.dart
M pkg/analyzer/test/src/dart/resolution/assignment_test.dart
M pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
M pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
M pkg/analyzer/test/src/dart/resolution/comment_test.dart
M pkg/analyzer/test/src/dart/resolution/conditional_expression_test.dart
M pkg/analyzer/test/src/dart/resolution/dot_shorthand_constructor_invocation_test.dart
M pkg/analyzer/test/src/dart/resolution/dot_shorthand_invocation_test.dart
M pkg/analyzer/test/src/dart/resolution/dot_shorthand_property_access_test.dart
M pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
M pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
M pkg/analyzer/test/src/dart/resolution/field_promotion_test.dart
M pkg/analyzer/test/src/dart/resolution/for_element_test.dart
M pkg/analyzer/test/src/dart/resolution/function_declaration_test.dart
M pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
M pkg/analyzer/test/src/dart/resolution/generic_function_type_test.dart
M pkg/analyzer/test/src/dart/resolution/if_statement_test.dart
M pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
M pkg/analyzer/test/src/dart/resolution/local_variable_test.dart
M pkg/analyzer/test/src/dart/resolution/metadata_test.dart
M pkg/analyzer/test/src/dart/resolution/method_declaration_test.dart
M pkg/analyzer/test/src/dart/resolution/mixin_test.dart
M pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
M pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart
M pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
M pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
M pkg/analyzer/test/src/dart/resolution/property_access_test.dart
M pkg/analyzer/test/src/dart/resolution/simple_identifier_test.dart
M pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
M pkg/analyzer/test/src/dart/resolution/type_literal_test.dart
M pkg/analyzer/test/src/diagnostics/abstract_super_member_reference_test.dart
M pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
M pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
M pkg/analyzer/test/src/diagnostics/private_setter_test.dart
M pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
M pkg/analyzer/test/src/diagnostics/undefined_setter_test.dart
M pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart

Log Message:
-----------
CQ. Consistently use 'var node =' before assertResolvedNodeText().

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


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