Skip to content

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

Closed

Description

@swift-ci
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.

Activity

  1. belkadan commented on Mar 15, 2019

    @belkadan
    Contributor
    func ƒ() {
    func nested(_: Bool) { }
    func nested(_: Int) { }
    }
    
    func ƒ2() {
    func nested(bool _: Bool) { }
    
    nested(bool: false)
    
    func nested(int _: Int) { }
    }
    
  2. belkadan commented on Mar 15, 2019

    @belkadan
    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)

  3. swift-ci commented on Mar 15, 2019

    @swift-ci
    ContributorAuthor

    Comment by David Ungar (JIRA)

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

  4. slavapestov commented on Oct 9, 2020

    @slavapestov
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions