swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.3k stars 10.33k forks source link

Subclassing open class with private async/await methods fails #63303

Open beniaminidziak opened 1 year ago

beniaminidziak commented 1 year ago

Description

Having private or internal methods with async modifier inside open class contained inside xcframework or Swift Package and subclassing in other framework or project ends up with Undefined symbol errors looking for this exact method marked as private/internal when building with Release configuration. Current workaround is to put all private and internal methods in separate extension

Steps to reproduce

Sample project here: Example.zip OR - Step 1:

Code inside library:

open class Implementation {
    private func function() async {}
}

Code inside other framework / target

final class Subclass: Implementation {}

- Step 2: Run with Release configuration

- Step 3: Building fails with:

Undefined symbol: _$s7Library14ImplementationC8function33_F5F9723BA4E7E4900FBC54E81B5A0B49LLyyYaFTu

Expected behavior

Project runs with Release configuration - Archiving the project is impossible as well

Environment

quentinfasquel commented 1 year ago

Ah, finally someone found the issue too :D I am so happy. https://twitter.com/quentinfasquel/status/1573234557641441282

Opened feedback at Apple FB11522942 @beniaminidziak