[L] Change in dart/sdk[main]: [record_use] Constructor invocations via typedefs

0 views
Skip to first unread message

Daco Harkes (Gerrit)

unread,
Mar 4, 2026, 9:37:11 AM (6 days ago) Mar 4
to Johnni Winther, Nate Biggs, Commit Queue, Alexander Markov, dart-fe-te...@google.com, dart2js-te...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Nate Biggs

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Nate Biggs
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • 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: If87b16d314474256ce225d71af771393ebb7d1c7
Gerrit-Change-Number: 485420
Gerrit-PatchSet: 5
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-CC: Alexander Markov <alexm...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Johnni Winther <johnni...@google.com>
Gerrit-Comment-Date: Wed, 04 Mar 2026 14:37:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Johnni Winther (Gerrit)

unread,
Mar 5, 2026, 3:41:53 AM (5 days ago) Mar 5
to Daco Harkes, Nate Biggs, Commit Queue, Alexander Markov, dart-fe-te...@google.com, dart2js-te...@google.com, rev...@dartlang.org
Attention needed from Daco Harkes and Nate Biggs

Johnni Winther voted and added 2 comments

Votes added by Johnni Winther

Code-Review+1

2 comments

File pkg/front_end/lib/src/api_prototype/lowering_predicates.dart
Line 1159, Patchset 6 (Latest): final List<Object>? typedefNameFromTearOff = extractTypedefNameFromTearOff(
Johnni Winther . unresolved

Could you change `extractTypedefNameFromTearOff` to return a record `({String typedefName, Name constructorName})` instead? This call site could definitely benefit from it.

Line 1164, Patchset 6 (Latest): constructorNameFromTearOff ?? (typedefNameFromTearOff![1] as Name).text;
Johnni Winther . unresolved

The code will never find a `target` from the `typedefNameFromTearOff`; if `node` is a typedef tear-off it has no enclosing class and it will not have an extensionTypeDeclaration.

Open in Gerrit

Related details

Attention is currently required from:
  • Daco Harkes
  • Nate Biggs
Submit Requirements:
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedCommit-Message-Has-TEST
    • 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: If87b16d314474256ce225d71af771393ebb7d1c7
    Gerrit-Change-Number: 485420
    Gerrit-PatchSet: 6
    Gerrit-Owner: Daco Harkes <dacoh...@google.com>
    Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
    Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
    Gerrit-Reviewer: Nate Biggs <nate...@google.com>
    Gerrit-CC: Alexander Markov <alexm...@google.com>
    Gerrit-Attention: Daco Harkes <dacoh...@google.com>
    Gerrit-Attention: Nate Biggs <nate...@google.com>
    Gerrit-Comment-Date: Thu, 05 Mar 2026 08:41:49 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Nate Biggs (Gerrit)

    unread,
    Mar 5, 2026, 10:31:13 PM (4 days ago) Mar 5
    to Daco Harkes, Johnni Winther, Commit Queue, Alexander Markov, dart-fe-te...@google.com, dart2js-te...@google.com, rev...@dartlang.org
    Attention needed from Daco Harkes

    Nate Biggs voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daco Harkes
    Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedCommit-Message-Has-TEST
    • 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: If87b16d314474256ce225d71af771393ebb7d1c7
    Gerrit-Change-Number: 485420
    Gerrit-PatchSet: 6
    Gerrit-Owner: Daco Harkes <dacoh...@google.com>
    Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
    Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
    Gerrit-Reviewer: Nate Biggs <nate...@google.com>
    Gerrit-CC: Alexander Markov <alexm...@google.com>
    Gerrit-Attention: Daco Harkes <dacoh...@google.com>
    Gerrit-Comment-Date: Fri, 06 Mar 2026 03:31:11 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Daco Harkes (Gerrit)

    unread,
    Mar 6, 2026, 6:04:49 AM (4 days ago) Mar 6
    to Nate Biggs, Johnni Winther, Commit Queue, Alexander Markov, dart-fe-te...@google.com, dart2js-te...@google.com, rev...@dartlang.org
    Attention needed from Johnni Winther and Nate Biggs

    Daco Harkes voted and added 2 comments

    Votes added by Daco Harkes

    Commit-Queue+1

    2 comments

    File pkg/front_end/lib/src/api_prototype/lowering_predicates.dart
    Line 1159, Patchset 6: final List<Object>? typedefNameFromTearOff = extractTypedefNameFromTearOff(
    Johnni Winther . resolved

    Could you change `extractTypedefNameFromTearOff` to return a record `({String typedefName, Name constructorName})` instead? This call site could definitely benefit from it.

    Daco Harkes

    Done

    Line 1164, Patchset 6: constructorNameFromTearOff ?? (typedefNameFromTearOff![1] as Name).text;
    Johnni Winther . unresolved

    The code will never find a `target` from the `typedefNameFromTearOff`; if `node` is a typedef tear-off it has no enclosing class and it will not have an extensionTypeDeclaration.

    Daco Harkes

    Right, the test cases are likely passing due to `target==null` fallback below it.

    Do we have a way of finding the typedef and then the type it is resolving to? Or are we better off using the fallback below?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Johnni Winther
    • Nate Biggs
    Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement satisfiedCommit-Message-Has-TEST
      • 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: If87b16d314474256ce225d71af771393ebb7d1c7
      Gerrit-Change-Number: 485420
      Gerrit-PatchSet: 7
      Gerrit-Owner: Daco Harkes <dacoh...@google.com>
      Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
      Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
      Gerrit-Reviewer: Nate Biggs <nate...@google.com>
      Gerrit-CC: Alexander Markov <alexm...@google.com>
      Gerrit-Attention: Nate Biggs <nate...@google.com>
      Gerrit-Attention: Johnni Winther <johnni...@google.com>
      Gerrit-Comment-Date: Fri, 06 Mar 2026 11:04:44 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Johnni Winther <johnni...@google.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Johnni Winther (Gerrit)

      unread,
      Mar 6, 2026, 6:27:30 AM (4 days ago) Mar 6
      to Daco Harkes, Nate Biggs, Commit Queue, Alexander Markov, dart-fe-te...@google.com, dart2js-te...@google.com, rev...@dartlang.org
      Attention needed from Daco Harkes and Nate Biggs

      Johnni Winther added 1 comment

      File pkg/front_end/lib/src/api_prototype/lowering_predicates.dart
      Line 1164, Patchset 6: constructorNameFromTearOff ?? (typedefNameFromTearOff![1] as Name).text;
      Johnni Winther . unresolved

      The code will never find a `target` from the `typedefNameFromTearOff`; if `node` is a typedef tear-off it has no enclosing class and it will not have an extensionTypeDeclaration.

      Daco Harkes

      Right, the test cases are likely passing due to `target==null` fallback below it.

      Do we have a way of finding the typedef and then the type it is resolving to? Or are we better off using the fallback below?

      Johnni Winther

      You can use the `typedefName` returned from `extractTypedefNameFromTearOff` to search through typedefs in the same library. A `Typedef` node has a `type` property that holds its definition, so you can get the target type from `typedef.type.unalias`.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Daco Harkes
      • Nate Biggs
      Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement satisfiedCommit-Message-Has-TEST
      • 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: If87b16d314474256ce225d71af771393ebb7d1c7
      Gerrit-Change-Number: 485420
      Gerrit-PatchSet: 7
      Gerrit-Owner: Daco Harkes <dacoh...@google.com>
      Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
      Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
      Gerrit-Reviewer: Nate Biggs <nate...@google.com>
      Gerrit-CC: Alexander Markov <alexm...@google.com>
      Gerrit-Attention: Daco Harkes <dacoh...@google.com>
      Gerrit-Attention: Nate Biggs <nate...@google.com>
      Gerrit-Comment-Date: Fri, 06 Mar 2026 11:27:26 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Daco Harkes <dacoh...@google.com>
      Comment-In-Reply-To: Johnni Winther <johnni...@google.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Daco Harkes (Gerrit)

      unread,
      Mar 6, 2026, 7:18:40 AM (4 days ago) Mar 6
      to Nate Biggs, Johnni Winther, Commit Queue, Alexander Markov, dart-fe-te...@google.com, dart2js-te...@google.com, rev...@dartlang.org
      Attention needed from Johnni Winther and Nate Biggs

      Daco Harkes voted and added 1 comment

      Votes added by Daco Harkes

      Commit-Queue+1

      1 comment

      File pkg/front_end/lib/src/api_prototype/lowering_predicates.dart
      Line 1164, Patchset 6: constructorNameFromTearOff ?? (typedefNameFromTearOff![1] as Name).text;
      Johnni Winther . resolved

      The code will never find a `target` from the `typedefNameFromTearOff`; if `node` is a typedef tear-off it has no enclosing class and it will not have an extensionTypeDeclaration.

      Daco Harkes

      Right, the test cases are likely passing due to `target==null` fallback below it.

      Do we have a way of finding the typedef and then the type it is resolving to? Or are we better off using the fallback below?

      Johnni Winther

      You can use the `typedefName` returned from `extractTypedefNameFromTearOff` to search through typedefs in the same library. A `Typedef` node has a `type` property that holds its definition, so you can get the target type from `typedef.type.unalias`.

      Daco Harkes

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Johnni Winther
      • Nate Biggs
      Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement satisfiedCommit-Message-Has-TEST
      • 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: If87b16d314474256ce225d71af771393ebb7d1c7
      Gerrit-Change-Number: 485420
      Gerrit-PatchSet: 8
      Gerrit-Owner: Daco Harkes <dacoh...@google.com>
      Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
      Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
      Gerrit-Reviewer: Nate Biggs <nate...@google.com>
      Gerrit-CC: Alexander Markov <alexm...@google.com>
      Gerrit-Attention: Nate Biggs <nate...@google.com>
      Gerrit-Attention: Johnni Winther <johnni...@google.com>
      Gerrit-Comment-Date: Fri, 06 Mar 2026 12:18:35 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Sigmund Cherem (Gerrit)

      unread,
      Mar 6, 2026, 12:28:28 PM (4 days ago) Mar 6
      to Daco Harkes, Sigmund Cherem, Johnni Winther, Commit Queue, Alexander Markov, dart-fe-te...@google.com, dart2js-te...@google.com, rev...@dartlang.org
      Attention needed from Daco Harkes and Johnni Winther

      Sigmund Cherem voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Daco Harkes
      • Johnni Winther
      Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedCommit-Message-Has-TEST
      • 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: If87b16d314474256ce225d71af771393ebb7d1c7
      Gerrit-Change-Number: 485420
      Gerrit-PatchSet: 9
      Gerrit-Owner: Daco Harkes <dacoh...@google.com>
      Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
      Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
      Gerrit-Reviewer: Sigmund Cherem <sig...@google.com>
      Gerrit-CC: Alexander Markov <alexm...@google.com>
      Gerrit-Attention: Daco Harkes <dacoh...@google.com>
      Gerrit-Attention: Johnni Winther <johnni...@google.com>
      Gerrit-Comment-Date: Fri, 06 Mar 2026 17:28:25 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Commit Queue (Gerrit)

      unread,
      Mar 9, 2026, 1:04:50 PM (14 hours ago) Mar 9
      to Daco Harkes, Sigmund Cherem, Johnni Winther, Alexander Markov, dart-fe-te...@google.com, dart2js-te...@google.com, rev...@dartlang.org

      Commit Queue submitted the change

      Unreviewed changes

      9 is the latest approved patch-set.
      No files were changed between the latest approved patch-set and the submitted one.

      Change information

      Commit message:
      [record_use] Constructor invocations via typedefs

      Closes: https://github.com/dart-lang/native/issues/2907

      TEST=pkg/compiler/test/record_use/record_use_test.dart
      TEST=pkg/dart2wasm/test/record_use_test.dart
      TEST=pkg/vm/test/transformations/record_use_test.dart
      Change-Id: If87b16d314474256ce225d71af771393ebb7d1c7
      Cq-Include-Trybots: luci.dart.try:dart2wasm-asserts-linux-chrome-try,dart2wasm-asserts-minified-linux-d8-try,dart2wasm-linux-chrome-try,dart2wasm-linux-d8-try,dart2wasm-linux-firefox-try,dart2wasm-linux-jscm-chrome-try,dart2wasm-linux-optimized-jsc-try,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try,dart2js-canary-linux-try,dart2js-hostasserts-linux-d8-try,dart2js-linux-chrome-try,dart2js-linux-firefox-try,dart2js-mac-chrome-try,dart2js-mac-safari-try,dart2js-minified-csp-linux-chrome-try,dart2js-minified-linux-d8-try,dart2js-unit-linux-x64-release-try,dart2js-win-chrome-try
      Reviewed-by: Sigmund Cherem <sig...@google.com>
      Files:
      • M pkg/compiler/lib/src/js_emitter/record_use_emitter.dart
      • M pkg/compiler/lib/src/ssa/codegen.dart
      • M pkg/compiler/lib/src/universe/recorded_use.dart
      • M pkg/front_end/lib/src/api_prototype/lowering_predicates.dart
      • M pkg/front_end/lib/src/dill/dill_library_builder.dart
      • M pkg/front_end/lib/src/kernel/record_use.dart
      • M pkg/kernel/lib/constructor_tearoff_lowering.dart
      • M pkg/vm/lib/transformations/record_use/constant_collector.dart
      • M pkg/vm/lib/transformations/record_use/record_call.dart
      • M pkg/vm/lib/transformations/record_use/record_instance.dart
      • M pkg/vm/lib/transformations/record_use/record_use.dart
      • A pkg/vm/testcases/transformations/record_use/lib/factory_direct.dart
      • A pkg/vm/testcases/transformations/record_use/lib/factory_direct.dart.aot.expect
      • A pkg/vm/testcases/transformations/record_use/lib/factory_direct.dart.json.expect
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_factory_partial.dart
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_factory_partial.dart.aot.expect
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_factory_partial.dart.json.expect
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_non_generic.dart
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_non_generic.dart.aot.expect
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_non_generic.dart.json.expect
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_partial.dart
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_partial.dart.aot.expect
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_partial.dart.json.expect
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_tearoff.dart
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_tearoff.dart.aot.expect
      • A pkg/vm/testcases/transformations/record_use/lib/typedef_tearoff.dart.json.expect
      Change size: L
      Delta: 26 files changed, 709 insertions(+), 48 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Sigmund Cherem
      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: If87b16d314474256ce225d71af771393ebb7d1c7
      Gerrit-Change-Number: 485420
      Gerrit-PatchSet: 11
      Gerrit-Owner: Daco Harkes <dacoh...@google.com>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages