Uploaded image for project: 'Swift'
  1. Swift
  2. SR-2323

Conflicting scope-private members causes crash

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:

      Description

      struct X {}
      
      extension X {
        private func foo() {}
      }
      extension X {
        private func foo() {}
      }
      

      While this seems like it should be legal, there are two problems:

      1. Our mangling scheme doesn't actually give these different symbol names.
      2. When debugging, we don't have a good way to pick one over the other.

      We could fix these issues, but it seems simpler to just reject this code: within a file, conflicting "overloads" like this should not be allowed despite being declared private. (Note that this isn't limited to extensions and that one of the members might not be private; that's just the simplest way to show the problem.)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jrose Jordan Rose
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: