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

Final class type and Self should be treated as equivalent in class body

    XMLWordPrintable

    Details

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

      Description

      The following code results in an error, but should probably compile just fine:

      final class C {
          static func foo() -> Self {
              return C() // error: Cannot convert return expression of type 'C' to return type 'Self'
          }
      
          private init() {}
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              jumhyn Frederick Kellison-Linn
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: