[M] Change in dart/sdk[main]: Modify property promotion: only `this`

0 views
Skip to first unread message

Erik Ernst (Gerrit)

unread,
May 12, 2026, 3:34:04 AM (yesterday) May 12
to Paul Berry, Johnni Winther, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, dart-fe-te...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Paul Berry

Erik Ernst added 1 comment

Patchset-level comments
File-level comment, Patchset 9 (Latest):
Erik Ernst . resolved

Hello Paul and Johnni,
I reduced the set of situations where promotions of some private final instance variables (aka property promotions) can be "inherited" via an anonymous method. This means that only the parameterless kind are covered (as in `x.=> _y.isEven` is allowed if the type of `x._y` has been promoted to `int`, but `x.(p) => _y.isEven` is an error). This improves on the consistency: This kind of property promotion inheritance is new, and it is only supported with a new concept (namely the new kind of `this` that goes with anonymous methods), and the explicitly declared parameter is treated the same as local variables in general. This would make Leaf more happy, and perhaps others. ;-)

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Paul Berry
Submit Requirements:
  • requirement is not 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: Ibe70713d3d9c89a6d95f9c3dd28df8f147cb518d
Gerrit-Change-Number: 502660
Gerrit-PatchSet: 9
Gerrit-Owner: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@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: Tue, 12 May 2026 07:33:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Erik Ernst (Gerrit)

unread,
May 12, 2026, 3:37:33 AM (yesterday) May 12
to Paul Berry, Johnni Winther, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, dart-fe-te...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Paul Berry

Erik Ernst added 2 comments

Patchset-level comments
Erik Ernst . resolved

Added a question to some new code in the CFE.

File pkg/front_end/lib/src/type_inference/inference_visitor.dart
Line 11970, Patchset 9 (Latest): }
Erik Ernst . unresolved

Johnni, is this an appropriate way to maintain that the lessons learned during the execution of an anonymous method are available to the context?

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Paul Berry
Submit Requirements:
  • requirement is not 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: Ibe70713d3d9c89a6d95f9c3dd28df8f147cb518d
Gerrit-Change-Number: 502660
Gerrit-PatchSet: 9
Gerrit-Owner: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@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: Tue, 12 May 2026 07:37:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Johnni Winther (Gerrit)

unread,
May 12, 2026, 4:08:11 AM (yesterday) May 12
to Erik Ernst, Paul Berry, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, dart-fe-te...@google.com, rev...@dartlang.org
Attention needed from Erik Ernst and Paul Berry

Johnni Winther voted and added 2 comments

Votes added by Johnni Winther

Code-Review+1

2 comments

File pkg/front_end/lib/src/type_inference/inference_visitor.dart
Line 11890, Patchset 9 (Latest): bool isParameterless = node.variable.isSynthesized;
Johnni Winther . unresolved

Move this above line 11873 and use it in line 11880.

(Also, we should an `isParameterless` property to `AnonymousMethodExpression` and use it instead of `node.variable.isSynthesized`.)

Erik Ernst . resolved

Johnni, is this an appropriate way to maintain that the lessons learned during the execution of an anonymous method are available to the context?

Johnni Winther

Yes.

Open in Gerrit

Related details

Attention is currently required from:
  • Erik Ernst
  • Paul Berry
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: Ibe70713d3d9c89a6d95f9c3dd28df8f147cb518d
Gerrit-Change-Number: 502660
Gerrit-PatchSet: 9
Gerrit-Owner: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Erik Ernst <eer...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Paul Berry <paul...@google.com>
Gerrit-Attention: Erik Ernst <eer...@google.com>
Gerrit-Comment-Date: Tue, 12 May 2026 08:08:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Erik Ernst <eer...@google.com>
satisfied_requirement
open
diffy

Erik Ernst (Gerrit)

unread,
May 12, 2026, 5:42:59 AM (yesterday) May 12
to Johnni Winther, Paul Berry, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, dart-fe-te...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Paul Berry

Erik Ernst added 2 comments

Patchset-level comments
File-level comment, Patchset 9:
Erik Ernst . resolved

Small changes, to have a nicer `isParameterless`.

File pkg/front_end/lib/src/type_inference/inference_visitor.dart
Line 11890, Patchset 9: bool isParameterless = node.variable.isSynthesized;
Johnni Winther . resolved

Move this above line 11873 and use it in line 11880.

(Also, we should an `isParameterless` property to `AnonymousMethodExpression` and use it instead of `node.variable.isSynthesized`.)

Erik Ernst

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Paul Berry
Submit Requirements:
    • requirement is not 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: Ibe70713d3d9c89a6d95f9c3dd28df8f147cb518d
    Gerrit-Change-Number: 502660
    Gerrit-PatchSet: 9
    Gerrit-Owner: Erik Ernst <eer...@google.com>
    Gerrit-Reviewer: Erik Ernst <eer...@google.com>
    Gerrit-Reviewer: Johnni Winther <johnni...@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: Tue, 12 May 2026 09:42:54 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Johnni Winther <johnni...@google.com>
    unsatisfied_requirement
    open
    diffy

    Paul Berry (Gerrit)

    unread,
    May 12, 2026, 11:42:01 AM (21 hours ago) May 12
    to Erik Ernst, Johnni Winther, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, dart-fe-te...@google.com, rev...@dartlang.org
    Attention needed from Erik Ernst and Johnni Winther

    Paul Berry voted and added 1 comment

    Votes added by Paul Berry

    Code-Review+1

    1 comment

    Patchset-level comments
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Erik Ernst
    • 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: Ibe70713d3d9c89a6d95f9c3dd28df8f147cb518d
      Gerrit-Change-Number: 502660
      Gerrit-PatchSet: 13
      Gerrit-Owner: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
      Gerrit-Reviewer: Paul Berry <paul...@google.com>
      Gerrit-Attention: Erik Ernst <eer...@google.com>
      Gerrit-Attention: Johnni Winther <johnni...@google.com>
      Gerrit-Comment-Date: Tue, 12 May 2026 15:41:57 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Erik Ernst (Gerrit)

      unread,
      3:08 AM (6 hours ago) 3:08 AM
      to Paul Berry, Johnni Winther, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, dart-fe-te...@google.com, rev...@dartlang.org
      Attention needed from Johnni Winther

      Erik Ernst 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: Ibe70713d3d9c89a6d95f9c3dd28df8f147cb518d
      Gerrit-Change-Number: 502660
      Gerrit-PatchSet: 13
      Gerrit-Owner: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
      Gerrit-Reviewer: Paul Berry <paul...@google.com>
      Gerrit-Attention: Johnni Winther <johnni...@google.com>
      Gerrit-Comment-Date: Wed, 13 May 2026 07:08:12 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      dart-scoped@luci-project-accounts.iam.gserviceaccount.com (Gerrit)

      unread,
      3:08 AM (6 hours ago) 3:08 AM
      to Erik Ernst, Paul Berry, Johnni Winther, dart-analys...@google.com, dart-fe-te...@google.com, rev...@dartlang.org

      dart-...@luci-project-accounts.iam.gserviceaccount.com submitted the change

      Change information

      Commit message:
      Modify property promotion: only `this`

      https://dart-review.googlesource.com/c/sdk/+/498840 added support for
      promotion of properties (private, final instance variables with a name
      which isn't used much for other purposes) in the context of anonymous
      methods.

      This CL reduces the set of situations where this feature is enabled such
      that only `this` will allow property promotions to be carried in (such
      that `this._x` is promoted in `v.=> this._x` when `v` is such that
      `v._x` has been promoted before the anonymous method occurs). It also
      generalizes the mechanism such that property promotions are carried out
      (so we can do `if (v.=> _x is int) v._x.isEven;`).

      Tests has been adjusted accordingly.
      Change-Id: Ibe70713d3d9c89a6d95f9c3dd28df8f147cb518d
      Reviewed-by: Paul Berry <paul...@google.com>
      Commit-Queue: Erik Ernst <eer...@google.com>
      Files:
      • M pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_test.dart
      • M pkg/_fe_analyzer_shared/test/mini_ast.dart
      • M pkg/analyzer/lib/src/generated/resolver.dart
      • M pkg/front_end/lib/src/kernel/internal_ast.dart
      • M pkg/front_end/lib/src/type_inference/inference_visitor.dart
      • M tests/language/anonymous_methods/block/private_field_promotion_test.dart
      • M tests/language/anonymous_methods/expression/condition_variable_test.dart
      • M tests/language/anonymous_methods/expression/private_field_promotion_test.dart
      Change size: M
      Delta: 8 files changed, 54 insertions(+), 29 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: Ibe70713d3d9c89a6d95f9c3dd28df8f147cb518d
      Gerrit-Change-Number: 502660
      Gerrit-PatchSet: 14
      Gerrit-Owner: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Erik Ernst <eer...@google.com>
      Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
      Gerrit-Reviewer: Paul Berry <paul...@google.com>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages