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

Covariant 'Self' type cannot be referenced from a stored property initializer

    XMLWordPrintable

    Details

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

      Apple Swift version 5.1 (swiftlang-1100.0.257.2 clang-1100.0.31.3)
      Target: x86_64-apple-darwin19.0.0

      Description

      Shouldn't this be possible on a final class?

      final class S {
        // error - Covariant 'Self' type cannot be referenced from a stored property initializer
        var keyPath: KeyPath<Self, Bool> = \Self.bool
        var bool = true
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              slavapestov Slava Pestov
              Reporter:
              DevAndArtist Adrian Meister
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: