Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closure parameter type cannot be inferred when contextual type is pack expansion #78426

Open
AnthonyLatsis opened this issue Jan 3, 2025 · 7 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. closures Feature: closures compiler The Swift compiler itself expressions Feature: expressions generics Feature: generic declarations and types parameter packs Feature → generics: Parameter packs Swift 6.2-dev type checker Area → compiler: Semantic analysis unexpected error Bug: Unexpected error

Comments

@AnthonyLatsis
Copy link
Collaborator

Description

No response

Reproduction

func foo<each T>(_: repeat each T) {
  let _: (repeat each T) -> Void = { x in }
}

Expected behavior

Successful compilation

Environment

Swift version 6.2-dev (LLVM 1a588e5b044c46f, Swift 9e70208)

Additional information

No response

@AnthonyLatsis AnthonyLatsis added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself type checker Area → compiler: Semantic analysis generics Feature: generic declarations and types closures Feature: closures expressions Feature: expressions unexpected error Bug: Unexpected error parameter packs Feature → generics: Parameter packs swift 6.1-dev labels Jan 3, 2025
@xedin
Copy link
Contributor

xedin commented Jan 3, 2025

I think this might be a dupe, I remember a few similar reports…

@AnthonyLatsis
Copy link
Collaborator Author

I tried searching GitHub. Probably radars?

@xedin
Copy link
Contributor

xedin commented Jan 3, 2025

I will try to find it, I remember replying that closures are just not supported at the moment 😅

@AnthonyLatsis
Copy link
Collaborator Author

Ah, this?

@xedin
Copy link
Contributor

xedin commented Jan 3, 2025

I think the one I remember is related to using closure in a pack expansion pattern, so we might make this a sub-task of the umbrella?…

@AnthonyLatsis
Copy link
Collaborator Author

The umbrella was supposed to be for stuff like repeat <closure>. We could reopen and repurpose it, but I kind of regret creating it because one could have just fetched these issues by a label conjunction.

@xedin
Copy link
Contributor

xedin commented Jan 4, 2025

I see, no worries then, let’s keep it closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. closures Feature: closures compiler The Swift compiler itself expressions Feature: expressions generics Feature: generic declarations and types parameter packs Feature → generics: Parameter packs Swift 6.2-dev type checker Area → compiler: Semantic analysis unexpected error Bug: Unexpected error
Projects
None yet
Development

No branches or pull requests

2 participants