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-5268] Swift type encoding of properties should include class names #47843

Open
swift-ci opened this issue Jun 20, 2017 · 2 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself IRGen LLVM IR generation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-5268
Radar None
Original Reporter flovilmart (JIRA User)
Type Bug
Environment

Swift 3.1, Swift 3.2, Swift 4

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

md5: 0a210a9676dd780ea82e37b9d324abfb

Issue Description:

While migrating from Swift 2 to Swift 3.1, for the Parse iOS SDK, we encountered the following issue:

PFRelation< ObjectType: PFObject*> is defined in Objective-C as a lightweight generic.

When reading the `property_getAttributes` in a PFObject subclass in objective-c, the type encoding is property set to: `@"PFRelation\` therefore our codepath is correct as per the test suite here

when defining it in a swift subclass however, the type encoding looses the PFRelation specialization and is rendered as an `@` which is inconsistent with the behaviour with the objective-c runtime.

ex:

class MyObject: PFObject, PFSubclassing {
  @NSManaged var relation: PFRelation<PFObject>
}

We expect the behaviour to be consistent and the swift compiler to produce the right type encoding, in conformance with the objective-c compiler.

Note: observed as well on Swift 4

@belkadan
Copy link
Contributor

This doesn't have anything to do with generics, and isn't a regression. You're just saying Swift should try to emit property attributes with class names.

@swift-ci
Copy link
Collaborator Author

Comment by Florent Vilmart (JIRA)

yes, but in other cases, it looks ok (NSObject subclasses defined in obj-c)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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 IRGen LLVM IR generation
Projects
None yet
Development

No branches or pull requests

2 participants