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-11705] -enable-library-evolution breaks cross-module @objc-inference #54113

Closed
swift-ci opened this issue Nov 3, 2019 · 2 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself library evolution Feature: library evolution (umbrella feature for features that facilitate resilient libraries) type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Nov 3, 2019

Previous ID SR-11705
Radar rdar://problem/56923072
Original Reporter moritzhaarmann (JIRA User)
Type Bug
Status Resolved
Resolution Won't Do
Environment

Xcode Version 11.0 (11A420a), reproduced also in Xcode Version 11.2 (11B52)

Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug, LibraryEvolution, TypeChecker
Assignee None
Priority Medium

md5: c130445f1aeb4e4b2ce2c25c157c1dff

Issue Description:

Starting with a disclaimer that I'm absolutely not sure if this is somehow intended behaviour, but I very much think it's not at this point.

The problem is that I'm having a UIView-Subclass in let's call it `UITools`. As it's descending from UIView, no `@objc` is needed and I can use it as the type for an `@IBOutlet` freely in any dependant app or framework target – this works both with and without `-enable-library-evolution`. The problem arises only when I'm subclassing something that has been defined in `UITools` from within a dependant target, example below:

In UITools:

open class CustomButton: UIButton{  
}

In App:

class EvenMoreCustomButton: CustomButton {
   } 
 
class ViewController: UIViewController{     
   @IBOutlet var button: CustomButton? // Compiles with no problems     
   @IBOutlet var button: EvenMoreCustomButton? // IBOutlet property cannot have non-`@objc` class type..  
}

Now, recompiling `UITools` without `-enable-library-evolution` fixes the compilation problem, so it seems to be that compiling frameworks for distribution actually breaks the @objc-inference in dependant projects.

Note: For that specific example, a deployment target below iOS 13 must be used to illustrate the problematic behaviour.

@beccadax
Copy link
Contributor

beccadax commented Nov 5, 2019

@swift-ci create

@slavapestov
Copy link
Member

This is expected behavior. You must use a deployment target of iOS 13 or newer here. Older OS versions do not have the right Objective-C runtime support in order for a class that inherits across a resilience boundary to be made visible to the Objective-C runtime.

@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 library evolution Feature: library evolution (umbrella feature for features that facilitate resilient libraries) type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants