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

Type check operator (is) fails for Any! variable holding an Error (struct) value

    XMLWordPrintable

    Details

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

      Xcode 10.0 (10A255), Swift 4.2

      Description

      In the following code the "b is Error" incorrectly returns false though the b variable holds an Error value.

      struct MyError: Error { }
      
      let a: Any! = MyError()
      let b: Any = a
      b is Error // false 

      The result of the type check should be true. This issue might be related to SR-4552.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tbkka Tim Kientzle
              Reporter:
              wojciechczerski Wojciech Czerski
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: