You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swift-ci opened this issue
Dec 19, 2018
· 4 comments
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfIRGenLLVM IR generation
Tested on Swift 4.2, will try on a nightly shortly.
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug, IRGen
Assignee
fclout (JIRA)
Priority
Medium
md5: a58e6adb86c07765d89d9b61a502e5d3
Issue Description:
Objective-C does not support ivars on classes, and does not support adding ivars in categories. You can then imagine my surprise when I found programs that claim that they have class properties, defined in categories, that are backed by ivars.
The Swift compiler appears to co-opt the ivar field to put the name of the variable that holds the value of a static property, even though that variable is not an ivar.
Build this:
importFoundation@objcpublicextensionFormatter {
@objcstaticvariso8601: Int = 0
}
then inspect it with your favorite disassembler. You can see that the NSFormatter (test) category defines an "iso8601" class property with the type string "Tq,N,Viso8601" (data type signed long long, nonatomic, backed by ivar called iso8601).
The text was updated successfully, but these errors were encountered:
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfIRGenLLVM IR generation
Environment
Tested on Swift 4.2, will try on a nightly shortly.
Additional Detail from JIRA
md5: a58e6adb86c07765d89d9b61a502e5d3
Issue Description:
Objective-C does not support ivars on classes, and does not support adding ivars in categories. You can then imagine my surprise when I found programs that claim that they have class properties, defined in categories, that are backed by ivars.
The Swift compiler appears to co-opt the ivar field to put the name of the variable that holds the value of a static property, even though that variable is not an ivar.
Build this:
then inspect it with your favorite disassembler. You can see that the NSFormatter (test) category defines an "iso8601" class property with the type string "Tq,N,Viso8601" (data type signed long long, nonatomic, backed by ivar called iso8601).
The text was updated successfully, but these errors were encountered: