Skip to content

[SR-15825] Miscompilation leads to reference of unavailable type at runtime #58099

Description

@NachoSoto
Previous ID SR-15825
Radar rdar://problem/88513988
Original Reporter @NachoSoto
Type Bug

Attachment: Download

Environment

Xcode 13.2.1 (13C100)
swift-driver version: 1.26.21 Apple Swift version 5.5.2

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 0364d04118c34e43f2a2f813254337a7

Issue Description:

This code:

import StoreKit

@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 7.0, *)
class Mock {
    var mockTransaction: StoreKit.Transaction?
}

Compiles, but when run in a unit test host app on iOS 14.x it crashes at runtime:

dyld: lazy symbol binding failed: Symbol not found: _$s8StoreKit11TransactionVMa
  Referenced from: /Users/nachosoto/Library/Developer/CoreSimulator/Devices/47674D70-24C0-455B-BAB3-D0A5C218C75A/data/Containers/Bundle/Application/DD93C493-D46E-4CB5-BA2B-D83B4B7C77BB/StoreKitTest.app/PlugIns/StoreKitTestTests.xctest/StoreKitTestTests
  Expected in: /System/Library/Frameworks/StoreKit.framework/StoreKit

`StoreKit.Transaction` isn't available until iOS 15.0, and neither is `Mock`.

Repro steps:

  • Download attached project

  • Select `StoreKitTest` scheme

  • Test (on iOS 14.x)

Metadata

Metadata

Assignees

No one assigned

    Labels

    availabilityThe "available" attribute and availability checking in generalbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselflinker error

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions