#if !SOMETHING

Sorry for the flurry of posts, I’m on fire (no pun intended) today.

Silver code, using some #if / #endif directives to reuse my existing Swift source code. I can’t get the compiler to accept #if !ELEMENTS however (it spits out a “Type mismatch, expected “Boolean”” error). The documentation at https://docs.elementscompiler.com/Concepts/ConditionalCompilation/ seems to imply that the ! operator should work, though.

Furthermore, I’m getting this related, puzzling behavior now:

I’ve done a rebuild and tried restarting Fire, to no avail.

This code is part of a shared project that gets compiled into a Silver/Toffee iOS dylib and into an Android class library (hence the duplicate constructor workaround - although I’m wondering why I’m getting the ‘previous declaration’ messages).

Hm, yeah curious. its not ! that fails, it’s “ELEMENTS”. Also, not everywhere (I can repro it if I change an ifdef in SwiftBaseLibrary, but NOT in a new project. Odd. I’ve logged for Carlo to sort out what’s going on here…

Thanks, logged as bugs://81801

bugs://81801 got closed with status fixed.

Seems to be resolved in 2365. Thanks!

1 Like