Open MaxDesiatov opened 1 year ago
Haven't fully reduced this yet, but something like this is along the liens of what is triggering this:
// RUN: %target-swift-frontend -I ... -module-name reduced -parse-as-library -c %s -S -emit-ir -o -
import ArgumentParser
protocol DestinationCommand: AsyncParsableCommand { }
extension DestinationCommand {
public func run() async throws { }
}
public struct ListDestinations: DestinationCommand {
public init() {}
}
Reduced:
P.swift
// RUN: %target-swift-frontend -parse-as-library -emit-module -module-name P -emit-module-path %t\P.swiftmodule %s
public protocol P {
func f() async throws
}
Q.swift
// RUN: %target-swift-frontend -I%t -parse-as-library -module-name reduced -S -emit-ir -o - %s
import P
protocol Q: P {}
extension Q {
public func f() async throws { }
}
public struct S: Q {
public init() { }
}
(thanks to help from @aschwaighofer)
Resolving this will likely lead to the removal of the workaround at https://github.com/apple/swift/blob/main/include/swift/SIL/SILLinkage.h#L290-L304
~(CC: @jckarter - introduced this in https://github.com/apple/swift/commit/bba87cdc10d411f2f7ee3271aa9e457fc43c9b48)~
CC: @slavapestov - https://github.com/apple/swift/commit/6a83e7303e688566753c22e39f1badac2a6ce906
Removing the workaround causes a SIL verification failure:
SIL verification failed: function_ref inside fragile function cannot reference a private or hidden symbol: (SingleFunction && RefF->isExternalDeclaration()) || RefF->hasValidLinkageForFragileRef()
Originally posted by @compnerd in https://github.com/apple/swift-package-manager/issues/6361#issuecomment-1496129406