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

Poor diagnostic for type mismatch in pointer conversion to double optional

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Environment:

      Swift version 5.3-dev (LLVM 0704986941, Swift cd7bc73a0a)
      Target: x86_64-apple-darwin18.5.0

      Description

      The following produces an unhelpful diagnostic:

      func takesMutableDoubleOptionalTypedPtr(_ x: UnsafeMutablePointer<Double>??) {}
      
      var i = 0
      takesMutableDoubleOptionalTypedPtr(&i) // error: type of expression is ambiguous without more context
      

      We should instead point out that there's a type mismatch between Int and Double.

        Attachments

          Activity

            People

            Assignee:
            originaluser2 Hamish Knight
            Reporter:
            originaluser2 Hamish Knight
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: