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

Ambiguous type name error in Module Interface

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Environment:

      Test on xcode 11.4 and Swift toolchain snapshot 2020-04-19

       

      Description

      Problem

      The generated module interface file below will got an error when parsed by xcode. 

      // swift-interface-format-version: 1.0
      // swift-compiler-version: Apple Swift version 5.3-dev (LLVM 5e4413896d, Swift f0df46771f)
      // swift-module-flags: -target x86_64-apple-ios8.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -Onone -module-name A
      @_exported import A
      import Foundation
      import Swift
      public protocol Pt {
        typealias AnotherName = Swift.String
      }
      @_hasMissingDesignatedInitializers public class Name<T> : A.Pt {
        public typealias AnotherName = Swift.Int
        public func hi() -> A.Name<T>.AnotherName
        @objc deinit
      }
      

      ("A" is the name of the framework)

      Source code 

      public protocol Pt {
          typealias AnotherName = String
      }
      
      public class Name<T>: Pt {
          public typealias AnotherName = Int
          public func hi() -> AnotherName {
              return 0
          }
      }
      

      Steps to Reproduce

      1. build a framework with the source above, with "Build Libraries for Distribution" enabled
      2. delete the .swiftinterface files in the framework
      3. add the generated framework to another project, import and build

      Why Important

      The module interface cannot be used , which means module stability never achieve its goal.

        Attachments

          Activity

            People

            Assignee:
            slavapestov Slava Pestov
            Reporter:
            leavez leavez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: