mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ModuleInterface: Avoid printing generic arguments of a ParameterizedProtocolType in inheritance clause
When emitting module interfaces, parameterized protocols in inheritance clauses were being printed with generic arguments (public struct T: Fancy<Float64>), causing errors with protocol conformance verification. The fix strip ParameterizedProtocolType to its base protocol type when printing inherited types, producing the correct inheritance clause. Resolves: rdar://161925627
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
// RUN: %target-swift-emit-module-interface(%t/Fancy.swiftinterface) %s -module-name Library
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t/Fancy.swiftinterface) -module-name Library
|
||||
// RUN: %FileCheck %s < %t/Fancy.swiftinterface
|
||||
|
||||
public protocol Fancy<Stuff> {
|
||||
associatedtype Stuff
|
||||
}
|
||||
|
||||
// CHECK: public struct T : Library.Fancy {
|
||||
// CHECK: public typealias Stuff = Swift.Float64
|
||||
public struct T: Fancy<Float64> {
|
||||
}
|
||||
|
||||
public protocol Q {
|
||||
}
|
||||
|
||||
// CHECK: public struct S : Library.Fancy & Library.Q {
|
||||
// CHECK: public typealias Stuff = Swift.Int
|
||||
public struct S: Fancy<Int> & Q {
|
||||
}
|
||||
|
||||
public protocol P {
|
||||
}
|
||||
|
||||
// CHECK: public struct V : Library.Fancy & Library.P & Library.Q {
|
||||
// CHECK: public typealias Stuff = Swift.CChar32
|
||||
public struct V: ((Fancy<CChar32> & P) & Q) {
|
||||
}
|
||||
|
||||
public protocol Bar<T> {
|
||||
associatedtype T
|
||||
}
|
||||
|
||||
// CHECK: public struct X : Library.Bar & Library.Fancy
|
||||
// CHECK: public typealias Stuff = Swift.CChar32
|
||||
// CHECK: public typealias T = Swift.Int
|
||||
public struct X: Fancy<CChar32> & Bar<Int> {
|
||||
}
|
||||
|
||||
public class Base {
|
||||
}
|
||||
|
||||
public protocol B<A>: ~Copyable {
|
||||
associatedtype A
|
||||
}
|
||||
|
||||
// CHECK: public class Derived : Library.Base & Library.B {
|
||||
// CHECK: public typealias A = Swift.Int
|
||||
public class Derived: Base & B<Int> {
|
||||
}
|
||||
|
||||
public protocol R<E>: ~Copyable & ~Escapable {
|
||||
associatedtype E
|
||||
}
|
||||
|
||||
// CHECK: public struct N : Library.B & Library.R & ~Copyable {
|
||||
// CHECK: public typealias A = Swift.Float64
|
||||
// CHECK: public typealias E = Swift.Int
|
||||
public struct N: R<Int> & B<Float64> & ~Copyable {
|
||||
}
|
||||
Reference in New Issue
Block a user