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

Generic trouble

    XMLWordPrintable

    Details

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

      Swift 4.0 Snapshot 2017-06-02 (a)

      Description

      Hello!

      Generics:

      protocol P1 {
         associatedtype Type1
         associatedtype Type2
         var value1: Type1? { get set }
         var value2: Type2? { get set }
      }
      
      protocol P2: P1 { }
      
      class BaseC1<T1, T2>: P1 {
         typealias Type1 = T1
         typealias Type2 = T2
         var value1: T1?
         var value2: T2?
      }
      
      class BaseC2<T1, T2>: BaseC1<T1, T2>, P2 {}
      
      class C1: BaseC1<C1, C2> { }
      class C2: BaseC2<C1, C2> { }
      

      Using:

      print("begin") 
      let c1 = C1()
      let c2 = C2()
      c1.value2 = c2
      print("end")
      

      No compile errors. No runtime errors. But "end" never printed.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              rtnm Dmitriy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: