Files
swift-mirror/validation-test/compiler_crashers_fixed/issue-51690.swift
Hamish Knight 4e811c3a88 [test] Merge crasher directories
There is no longer much of a good reason to keep these separate,
merge them.
2025-10-18 12:51:30 +01:00

59 lines
1.0 KiB
Swift

// RUN: not %target-swift-frontend -emit-ir %s
// https://github.com/apple/swift/issues/51690
// Just make sure we don't crash.
protocol Publicable {
associatedtype PublicModel
func publicized() -> PublicModel
}
protocol WithReturnType {
associatedtype MainType
associatedtype ReturnType
func returnTheThing()
}
extension WithReturnType where MainType: Publicable {
typealias ReturnType = MainType.PublicModel
func returnTheThing() {
print("publicable")
}
}
extension WithReturnType {
func returnTheThing() {
print("not publicable")
}
}
extension String: Publicable {
struct PublicString {
let inner: String
init(str: String) {
self.inner = "Public: \(str)"
}
}
func publicized() -> PublicString {
return PublicString(str: self)
}
}
struct Controller<T> {
}
extension Controller: WithReturnType {
typealias MainType = T
}
let controller = Controller<String>()
controller.returnTheThing()