mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Moving generic constraint from extension to its member or vice versa may change the mangled name of the member without changing the generic signature, thus introducing ABI breakages. This change teaches the ABI checker to diagnose USR (mangled name) changes to cover such cases. rdar://78276290
22 lines
1.3 KiB
Swift
22 lines
1.3 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: echo "public func foo() {}" > %t/Foo.swift
|
|
|
|
// RUN: echo "public protocol P { associatedtype A }" > %t/Foo-1.swift
|
|
// RUN: echo "public extension P { public func f() where A == Int {} }" >> %t/Foo-1.swift
|
|
|
|
// RUN: echo "public protocol P { associatedtype A }" > %t/Foo-2.swift
|
|
// RUN: echo "public extension P where A == Int { public func f() {} }" >> %t/Foo-2.swift
|
|
|
|
// RUN: %target-swift-frontend -emit-module %t/Foo-1.swift -module-name Foo -emit-module-interface-path %t/Foo1.swiftinterface
|
|
// RUN: %target-swift-frontend -emit-module %t/Foo-2.swift -module-name Foo -emit-module-interface-path %t/Foo2.swiftinterface
|
|
|
|
// RUN: %target-swift-frontend -compile-module-from-interface %t/Foo1.swiftinterface -o %t/Foo1.swiftmodule -module-name Foo -emit-abi-descriptor-path %t/Foo1.json
|
|
|
|
// RUN: %target-swift-frontend -compile-module-from-interface %t/Foo2.swiftinterface -o %t/Foo2.swiftmodule -module-name Foo -emit-abi-descriptor-path %t/Foo2.json
|
|
|
|
// RUN: %api-digester -diagnose-sdk -print-module --input-paths %t/Foo1.json -input-paths %t/Foo2.json -abi -o %t/result.txt
|
|
|
|
// RUN: %FileCheck %s < %t/result.txt
|
|
|
|
// CHECK: Foo: Func P.f() has mangled name changing from '(extension in Foo):Foo.P.f< where A.A == Swift.Int>() -> ()' to '(extension in Foo):Foo.P< where A.A == Swift.Int>.f() -> ()'
|