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

[SR-10069] Local functions cannot be overloaded #52471

Closed
swift-ci opened this issue Mar 9, 2019 · 4 comments
Closed

[SR-10069] Local functions cannot be overloaded #52471

swift-ci opened this issue Mar 9, 2019 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Mar 9, 2019

Previous ID SR-10069
Radar rdar://problem/29312676
Original Reporter Jessy (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 10.2 beta 2

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: a3e401e1593c9e4c9bddb38188f91607

is duplicated by:

  • SR-13306 Incorrect shadowing behavior for local functions and outer function parameters

Issue Description:

These don't compile:

  1. Nested overloads with different parameter types.

  2. Calling a nested function before an overload is defined later in the function.

@belkadan
Copy link
Contributor

func ƒ() {
func nested(_: Bool) { }
func nested(_: Int) { }
}

func ƒ2() {
func nested(bool _: Bool) { }

nested(bool: false)

func nested(int _: Int) { }
}

@belkadan
Copy link
Contributor

I'm not sure if there was an explicit discussion against allowing nested overloads by type. The second example certainly seems like a bug to me, though.

cc @DougGregor, @xedin, davidungar (JIRA User)

@swift-ci
Copy link
Collaborator Author

Comment by David Ungar (JIRA)

Thanks, @belkadan for the heads-up. Thanks Jessy (JIRA User).

@slavapestov
Copy link
Member

#34246

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was 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. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants