Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-9867] [5.0 Regression] Can't expose unavailable properties marked with unavailable #52273

Closed
0xpablo opened this issue Feb 5, 2019 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 5.0

Comments

@0xpablo
Copy link

0xpablo commented Feb 5, 2019

Previous ID SR-9867
Radar rdar://problem/47852718
Original Reporter @0xpablo
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Version 10.2 beta 2 (10P91b)
MacOS Mojave 10.14.2

(Had the same issue on beta 1)

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, 5.0Regression
Assignee @belkadan
Priority Medium

md5: e2be01b96240922d51580134704e686e

Issue Description:

Sorry for the undescriptive title of the issue

I have an iOS framework that requires extension-safe APIs (i.e. APPLICATION_EXTENSION_API_ONLY = YES)

In that framework I have a class defined as such:

@available(iOSApplicationExtension, unavailable)
public class UnavailableClass {
    init () { }
}

This compiles OK. But now I add another class that exposes this UnavailableClass as a property (the property is marked as unavailable as well)

class Container {
    @available(iOSApplicationExtension, unavailable)
    lazy var unavailable: UnavailableClass = UnavailableClass()
}

This does not compile with the Swift 5 compiler (neither on Swift 4.2.x mode nor on Swift 5 mode)

The error varies a bit depending how you declare that variable, and if the unavailable class comes from Swift or Objc, I've seen:

  • 'Xxxx' is unavailable

  • 'Xxxx' is unavailable: This class cannot be used from extension targets

I attach a sample project that demonstrates the issue, the project compiles fine on Xcode 10.1 (Swift 4.2.x), but fails to compile on Xcode 10.2 (both beta 1 and beta 2)

EDIT: Additional info: if I turn the property into a function, it does work.

@belkadan
Copy link
Contributor

belkadan commented Feb 6, 2019

That last bit's important, thanks!

@belkadan
Copy link
Contributor

belkadan commented Feb 7, 2019

#22460

@belkadan
Copy link
Contributor

5.0: #22516

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

@0xpablo, Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 5.0
Projects
None yet
Development

No branches or pull requests

3 participants