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

Deprecation warning about use of `dynamicType` when it's a real property

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Labels:

      Description

      struct X {
        let dynamicType = 0
      }func f(a: X) -> Bool {
        a.dynamicType == a.dynamicType
      }
      

      Yields the warning

      x.swift:6:4: error: '.dynamicType' is deprecated. Use 'type(of: ...)' instead
        a.dynamicType == a.dynamicType
         ^~~~~~~~~~~~
      

      which I claim should only come up when no user-defined member name dynamicType exists.

        Attachments

          Activity

            People

            Assignee:
            ehuda Ehud Adler
            Reporter:
            dabrahams Dave Abrahams
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: