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

`<unknown>` diagnostic location regarding `Codable` derived conformances

    XMLWordPrintable

    Details

      Description

      struct Foo: Codable {
        var x: Int
        var x: Int
      }
      
      $ swift sr-12248.swift
      sr-12248.swift:3:7: error: invalid redeclaration of 'x'
        var x: Int
            ^
      sr-12248.swift:2:7: note: 'x' previously declared here
        var x: Int
            ^
      <unknown>:0: error: invalid redeclaration of 'x'
      <unknown>:0: note: 'x' previously declared here
      sr-12248.swift:1:8: error: type 'Foo' does not conform to protocol 'Encodable'
      struct Foo: Codable {
             ^
      Swift.Encodable:2:10: note: protocol requires function 'encode(to:)' with type 'Encodable'
          func encode(to encoder: Encoder) throws
               ^
      sr-12248.swift:3:7: note: cannot automatically synthesize 'Encodable' because '<<error type>>' does not conform to 'Encodable'
        var x: Int
            ^
      sr-12248.swift:3:7: note: cannot automatically synthesize 'Encodable' because '<<error type>>' does not conform to 'Encodable'
        var x: Int
            ^
      

      I suspect that the "<unknown>" source locations come from declarations synthesized by Codable derived conformances. This issue seems low-priority.

        Attachments

          Activity

            People

            Assignee:
            hassaneldesouky Hassan ElDesouky
            Reporter:
            danzheng Dan Zheng
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: