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

Decodable/Encodable synthesis for unavailable property produces location-less diagnostic

    XMLWordPrintable

    Details

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

      Swift version 5.0-dev (LLVM 8d1b92b83c, Swift e3bea40079)
      Target: x86_64-apple-darwin18.2.0

      Description

      For the following code:

      struct S : Decodable {
        @available(*, unavailable)
        var i: Int
      }
      

      we currently produce the location-less diagnostic:

      <unknown>:0: error: 'i' is unavailable
      /Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:160:7: note: 'i' has been explicitly marked unavailable here
        var i: Int
            ^
      

      The same also applies to Encodable.

      Either we should refuse to synthesise a conformance or we should ignore the availability of i within the synthesised body (like we do for the memberwise initialiser, as we emit its body in SILGen).

        Attachments

          Activity

            People

            • Assignee:
              brentdax Brent Royal-Gordon
              Reporter:
              originaluser2 Hamish Knight
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: