-
-
Notifications
You must be signed in to change notification settings - Fork 218
Open
Labels
needs investigationBug report that needs confirmationBug report that needs confirmation
Description
Describe the bug
When analyzing the code, it is not taken into account that the target may be cross-platform.
Some functions may not be available or used in one of the platforms.
Reproduction
I tried two options
- Active compilation flags
#if os(iOS)
import OtherDeps // ⚠️ import is unused
class OnlyiOSClass {
}
#endifFor some reason, the index-store continues to receive information about imports wrapped under an inactive compilation flag...
@availablekeywords
@availalbe(tvOS, unavailable)
class OnlyiOSClass {
@availalbe(tvOS, unavailable) // ⚠️ init is unused
init() {}
}Periphery still sees init in the tvOS index-store. (with clean build)
Workaround
import OtherDeps // ✅ used by OnlyiOSClass
@availalbe(tvOS, unavailable) // ✅ ignored by platform
class OnlyiOSClass {
#if os(iOS) // ✅ ignored by compliation flag
init() {}
#endif
}But this doesn't work if there are uninitialized properties in the class. (compile error)
Environment
periphery version 3.1.0
swift version 6.0
Xcode 16.2
Build version 16C5032a
kimdv and pylapp
Metadata
Metadata
Assignees
Labels
needs investigationBug report that needs confirmationBug report that needs confirmation