[M] Change in dart/sdk[main]: Add signature to target kind

0 views
Skip to first unread message

Moritz Sümmermann (Gerrit)

unread,
Jul 29, 2025, 12:20:28 PM7/29/25
to Brian Wilkerson, Samuel Rawlins, dart-analys...@google.com, rev...@dartlang.org

Moritz Sümmermann added 1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Moritz Sümmermann . unresolved

@brianwi...@google.com @sraw...@google.com This is a rough draft of adding a function signature to the `TargetKind`. This could be of use for cases like https://github.com/GoogleCloudPlatform/functions-framework-dart/blob/8083517599d7f2fb58123776a88f029f094cb5e0/functions_framework/lib/src/cloud_function.dart#L22, where we know the target must have a certain signature (in that case accepting an `HttpRequest`), but have no good way of expressing that so far in our type system or through language features.

What do you think?

Open in Gerrit

Related details

Attention set is empty
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: If27864b664dd04beb22a16e9bf7109f1c82e3586
Gerrit-Change-Number: 442740
Gerrit-PatchSet: 2
Gerrit-Owner: Moritz Sümmermann <mo...@google.com>
Gerrit-CC: Brian Wilkerson <brianwi...@google.com>
Gerrit-CC: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Tue, 29 Jul 2025 16:20:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Samuel Rawlins (Gerrit)

unread,
Aug 7, 2025, 1:04:39 PM8/7/25
to Moritz Sümmermann, Brian Wilkerson, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Moritz Sümmermann

Samuel Rawlins added 2 comments

Patchset-level comments
Moritz Sümmermann . unresolved

@brianwi...@google.com @sraw...@google.com This is a rough draft of adding a function signature to the `TargetKind`. This could be of use for cases like https://github.com/GoogleCloudPlatform/functions-framework-dart/blob/8083517599d7f2fb58123776a88f029f094cb5e0/functions_framework/lib/src/cloud_function.dart#L22, where we know the target must have a certain signature (in that case accepting an `HttpRequest`), but have no good way of expressing that so far in our type system or through language features.

What do you think?

Samuel Rawlins

Hey Moritz, sorry for the delay!

Brian and I generally like this idea. But we need to know the specific motivation here, to judge the implementation a little better. Would you mind filing an issue?

File pkg/analyzer/lib/src/dart/element/extensions.dart
Line 161, Patchset 4 (Latest):class FunctionTargetKindInternal {
Samuel Rawlins . unresolved

Can you explain this a bit more? The fact that `get targetKinds` returns `Set<Object>` makes me squirmy. I see how we need to fill this with `signature: signature.toTypeValue() as FunctionType` which is not available directly on the constant object. But maybe we can still subclass `TargetKind`?

Open in Gerrit

Related details

Attention is currently required from:
  • Moritz Sümmermann
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: If27864b664dd04beb22a16e9bf7109f1c82e3586
Gerrit-Change-Number: 442740
Gerrit-PatchSet: 4
Gerrit-Owner: Moritz Sümmermann <mo...@google.com>
Gerrit-CC: Brian Wilkerson <brianwi...@google.com>
Gerrit-CC: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Moritz Sümmermann <mo...@google.com>
Gerrit-Comment-Date: Thu, 07 Aug 2025 17:04:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Moritz Sümmermann <mo...@google.com>
unsatisfied_requirement
open
diffy

Moritz Sümmermann (Gerrit)

unread,
Aug 8, 2025, 9:10:59 AM8/8/25
to Brian Wilkerson, Samuel Rawlins, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Samuel Rawlins

Moritz Sümmermann added 2 comments

Patchset-level comments
File-level comment, Patchset 2:
Moritz Sümmermann . resolved

@brianwi...@google.com @sraw...@google.com This is a rough draft of adding a function signature to the `TargetKind`. This could be of use for cases like https://github.com/GoogleCloudPlatform/functions-framework-dart/blob/8083517599d7f2fb58123776a88f029f094cb5e0/functions_framework/lib/src/cloud_function.dart#L22, where we know the target must have a certain signature (in that case accepting an `HttpRequest`), but have no good way of expressing that so far in our type system or through language features.

What do you think?

Samuel Rawlins

Hey Moritz, sorry for the delay!

Brian and I generally like this idea. But we need to know the specific motivation here, to judge the implementation a little better. Would you mind filing an issue?

Moritz Sümmermann

I filed https://github.com/dart-lang/sdk/issues/61275 with the comment above a bit elaborated.

File pkg/analyzer/lib/src/dart/element/extensions.dart
Line 161, Patchset 4 (Latest):class FunctionTargetKindInternal {
Samuel Rawlins . unresolved

Can you explain this a bit more? The fact that `get targetKinds` returns `Set<Object>` makes me squirmy. I see how we need to fill this with `signature: signature.toTypeValue() as FunctionType` which is not available directly on the constant object. But maybe we can still subclass `TargetKind`?

Moritz Sümmermann

Yes, this CL is not at all ready yet, this is just an idea.

Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Rawlins
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: If27864b664dd04beb22a16e9bf7109f1c82e3586
Gerrit-Change-Number: 442740
Gerrit-PatchSet: 4
Gerrit-Owner: Moritz Sümmermann <mo...@google.com>
Gerrit-CC: Brian Wilkerson <brianwi...@google.com>
Gerrit-CC: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Fri, 08 Aug 2025 13:10:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Samuel Rawlins <sraw...@google.com>
Comment-In-Reply-To: Moritz Sümmermann <mo...@google.com>
unsatisfied_requirement
open
diffy

Lasse Nielsen (Gerrit)

unread,
Aug 8, 2025, 10:06:47 AM8/8/25
to Moritz Sümmermann, Brian Wilkerson, Samuel Rawlins, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Moritz Sümmermann and Samuel Rawlins

Lasse Nielsen added 1 comment

File pkg/analyzer_testing/lib/mock_packages/package_content/meta/lib/meta_meta.dart
Line 192, Patchset 4 (Latest):class FunctionTargetKind extends TargetKind {
Lasse Nielsen . unresolved

Could make it
```dart
class FunctionTargetKind<F extends Function> extends TargetKind {...}
```
instead to ensure that the type is actually a *function* type.

Open in Gerrit

Related details

Attention is currently required from:
  • Moritz Sümmermann
  • Samuel Rawlins
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: If27864b664dd04beb22a16e9bf7109f1c82e3586
Gerrit-Change-Number: 442740
Gerrit-PatchSet: 4
Gerrit-Owner: Moritz Sümmermann <mo...@google.com>
Gerrit-CC: Brian Wilkerson <brianwi...@google.com>
Gerrit-CC: Lasse Nielsen <l...@google.com>
Gerrit-CC: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Moritz Sümmermann <mo...@google.com>
Gerrit-Comment-Date: Fri, 08 Aug 2025 14:06:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages