[L] Change in dart/sdk[main]: Elements. Issue 62826. Support aliases for DynamicType, NeverType, Vo...

0 views
Skip to first unread message

Paul Berry (Gerrit)

unread,
1:53 PM (7 hours ago) 1:53 PM
to Konstantin Shcheglov, Johnni Winther, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Konstantin Shcheglov

Paul Berry added 3 comments

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Paul Berry . unresolved

CHANGELOG entry and commit message should explain that it is no longer safe to assume that there is a single instance of `DynamicType`, `NeverType`, and `VoidType`.

File pkg/analyzer/lib/src/dart/element/type.dart
Line 35, Patchset 3 (Latest): /// The unique instance of this class.
Paul Berry . unresolved

This doc comment is now incorrect. Same problem with `NeverTypeImpl` and `VoidTypeImpl`.

Should we consider deprecating or removing this field entirely to avoid confusion?

File pkg/analyzer/lib/src/dart/element/type_system.dart
Line 487, Patchset 3 (Latest): if (T is DynamicTypeImpl) {
Paul Berry . unresolved

In some parts of this CL, `identical(t, DynamicTypeImpl.instance)` is changed to `t == DynamicTypeImpl.instance`; in other parts (like here), it is changed to `t is DynamicTypeImpl`. Which is better, and why? The CL should pick one consistent approach, and it should be documented in the commit message (as well as the CHANGELOG, so that authors of analyzer clients know what to do).

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Konstantin Shcheglov
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I2417b05c698b352d7abe09c59995411d7348d388
Gerrit-Change-Number: 491460
Gerrit-PatchSet: 3
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Attention: Johnni Winther <johnni...@google.com>
Gerrit-Comment-Date: Mon, 30 Mar 2026 17:53:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Konstantin Shcheglov (Gerrit)

unread,
3:57 PM (5 hours ago) 3:57 PM
to Paul Berry, Johnni Winther, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Paul Berry

Konstantin Shcheglov voted and added 3 comments

Votes added by Konstantin Shcheglov

Commit-Queue+1

3 comments

Patchset-level comments
File-level comment, Patchset 3:
Paul Berry . resolved

CHANGELOG entry and commit message should explain that it is no longer safe to assume that there is a single instance of `DynamicType`, `NeverType`, and `VoidType`.

Konstantin Shcheglov

Done.

File pkg/analyzer/lib/src/dart/element/type.dart
Line 35, Patchset 3: /// The unique instance of this class.
Paul Berry . resolved

This doc comment is now incorrect. Same problem with `NeverTypeImpl` and `VoidTypeImpl`.

Should we consider deprecating or removing this field entirely to avoid confusion?

Konstantin Shcheglov

I updated the comments.
We still need values for comparison.

File pkg/analyzer/lib/src/dart/element/type_system.dart
Line 487, Patchset 3: if (T is DynamicTypeImpl) {
Paul Berry . resolved

In some parts of this CL, `identical(t, DynamicTypeImpl.instance)` is changed to `t == DynamicTypeImpl.instance`; in other parts (like here), it is changed to `t is DynamicTypeImpl`. Which is better, and why? The CL should pick one consistent approach, and it should be documented in the commit message (as well as the CHANGELOG, so that authors of analyzer clients know what to do).

Konstantin Shcheglov

Authors of the analyzer clients don't get access to `DynamicTypeImpl.instance`.

`t is DynamicTypeImpl` is better, just one type check, no virtual method invocation.

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Paul Berry
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I2417b05c698b352d7abe09c59995411d7348d388
Gerrit-Change-Number: 491460
Gerrit-PatchSet: 5
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Paul Berry <paul...@google.com>
Gerrit-Attention: Johnni Winther <johnni...@google.com>
Gerrit-Comment-Date: Mon, 30 Mar 2026 19:57:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Paul Berry <paul...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Paul Berry (Gerrit)

unread,
4:06 PM (5 hours ago) 4:06 PM
to Konstantin Shcheglov, Johnni Winther, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Konstantin Shcheglov

Paul Berry voted and added 2 comments

Votes added by Paul Berry

Code-Review+1

2 comments

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Paul Berry . resolved

lgtm assuming commit message and CHANGELOG are updated.

File pkg/analyzer/CHANGELOG.md
Line 5, Patchset 5 (Latest): or equality operators (`==`) instead of `identical()`.
Paul Berry . unresolved

Since you have decided that using `is` checks is better (and I agree with your reasoning), the commit message and the CHANGELOG should reflect this decision. Don't suggest using equality operators.

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Konstantin Shcheglov
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I2417b05c698b352d7abe09c59995411d7348d388
Gerrit-Change-Number: 491460
Gerrit-PatchSet: 5
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Attention: Johnni Winther <johnni...@google.com>
Gerrit-Comment-Date: Mon, 30 Mar 2026 20:06:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Konstantin Shcheglov (Gerrit)

unread,
5:32 PM (3 hours ago) 5:32 PM
to Paul Berry, Johnni Winther, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther

Konstantin Shcheglov voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I2417b05c698b352d7abe09c59995411d7348d388
Gerrit-Change-Number: 491460
Gerrit-PatchSet: 7
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Johnni Winther <johnni...@google.com>
Gerrit-Comment-Date: Mon, 30 Mar 2026 21:32:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Commit Queue (Gerrit)

unread,
6:06 PM (3 hours ago) 6:06 PM
to Konstantin Shcheglov, Paul Berry, Johnni Winther, dart-analys...@google.com, rev...@dartlang.org

Commit Queue submitted the change with unreviewed changes

Unreviewed changes

5 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: pkg/analyzer/CHANGELOG.md
Insertions: 1, Deletions: 3.

@@ -1,9 +1,7 @@
## 12.1.0-dev

* Support type aliases for `dynamic`, `Never`, and `void`. As a result, it is no longer safe to assume that
- there is a single instance of `DynamicType`, `NeverType`, or `VoidType`. Use type checks (`is DynamicType`)
- or equality operators (`==`) instead of `identical()`.
-
+ there is a single instance of `DynamicType`, `NeverType`, or `VoidType`. Use type checks (`is DynamicType`) instead of `identical()`.

## 12.0.0

```

Change information

Commit message:
Elements. Issue 62826. Support aliases for DynamicType, NeverType, VoidType.

As a result, it is no longer safe to assume that
there is a single instance of `DynamicType`, `NeverType`, or `VoidType`. Use type checks (`is DynamicType`) instead of `identical()`.
Change-Id: I2417b05c698b352d7abe09c59995411d7348d388
Reviewed-by: Paul Berry <paul...@google.com>
Commit-Queue: Konstantin Shcheglov <sche...@google.com>
Files:
  • M pkg/analyzer/CHANGELOG.md
  • M pkg/analyzer/lib/src/dart/element/element.dart
  • M pkg/analyzer/lib/src/dart/element/normalize.dart
  • M pkg/analyzer/lib/src/dart/element/subtype.dart
  • M pkg/analyzer/lib/src/dart/element/top_merge.dart
  • M pkg/analyzer/lib/src/dart/element/type.dart
  • M pkg/analyzer/lib/src/dart/element/type_system.dart
  • M pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
  • M pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
  • M pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
  • M pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
  • M pkg/analyzer/lib/src/error/bool_expression_verifier.dart
  • M pkg/analyzer/lib/src/generated/error_detection_helpers.dart
  • M pkg/analyzer/lib/src/summary2/bundle_reader.dart
  • M pkg/analyzer/test/src/dart/resolution/named_type_test.dart
  • M pkg/analyzer/test/src/dart/resolution/object_pattern_test.dart
  • M pkg/analyzer/test/src/summary/elements/type_alias_test.dart
Change size: L
Delta: 17 files changed, 293 insertions(+), 88 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Paul Berry
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I2417b05c698b352d7abe09c59995411d7348d388
Gerrit-Change-Number: 491460
Gerrit-PatchSet: 8
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages