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

Misleading diagnostics

    XMLWordPrintable

    Details

      Description

      The context in which I encountered this issue can be seen in this forums post.

      Here's a reduced example program that demonstrates the same issue:

      struct S {
          func foo() -> UInt { return 0 }
          func foo<T: UnsignedInteger>(bar: T) -> T {
              return bar
          }
      }
      
      let s = S()
      let a = s.foo() // OK
      let b = s.foo(bar: 123) // ERR: Argument passed to call that takes no arguments
      let c: UInt = s.foo(bar: 123) // OK
      let d = s.foo(bar: 123 as UInt) // OK
      

      I see this using Xcode 9.3.1, default toolchain and recent dev snapshot (2018-05-22).

        Attachments

          Activity

            People

            Assignee:
            medismailben Mohamed Ismail Bennani
            Reporter:
            jens Jens Persson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: