Skip to content

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

@beniaminidziak

Description

@beniaminidziak

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

  • Swift compiler version info:
    swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51) Target: arm64-apple-macosx12.0
  • Xcode version info
    14.2
  • Deployment target:
    iOS 14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    access controlFeature → modifiers: Access control and access levelsasync & awaitFeature → concurrency: asynchronous function aka the async/await patternbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.classFeature → type declarations: Class declarationscompilerThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresinheritanceFeature → type declarations → class: Subclassing and inheritance of class memberslinker errormultiple modulesFlag: An issue whose reproduction requires multiple modulesoptimized onlyFlag: An issue whose reproduction requires optimized compilationswift 5.7unexpected errorBug: Unexpected error

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions