Facing some weird issue where the constant folding is triggering weirdly, as if file naming is affecting whether the program will be compiled or not.
Here’s the dir structure I had:
project/
├── Entry
│ └── Flags.odin
├── Import
│ ├── ... /* more files */
│ ├── EngineBaseTypes.odin <--- I want to rename this file to ImportedBaseTypes.odin
│ └── Format.odin
└── main.odin
There’s some flags declared in Flags.odin
:
package Entry
@(private = "file")
BUILT_VIA_ENGINE :: #config(BUILT_VIA_ENGINE, false)
/* ... */
INTEGRATED_TO_ENGINE :: BUILT_VIA_ENGINE
EngineBaseTypes.odin
(which I want to rename to ImportedBaseTypes.odin
), contains some redeclarations:
package Import
import "../Entry"
INTEGRATED_TO_ENGINE :: Entry.INTEGRATED_TO_ENGINE
Format.odin
uses this redeclared flag.
package Import
when INTEGRATED_TO_ENGINE {
MyStruct :: union {
i32,
f32,
}
} else {
MyStruct :: union {
i32,
b32,
}
}
Here’s the problem: when I perform the rename to ImportedBaseTypes.odin
, my program doesn’t compile anymore.
In Format.odin
, it says INTEGRATED_TO_ENGINE
is not a constant, and in ImportedBaseTypes.odin
, it says Entry
is an unknown identifier, even though there are other usages in the file, which compile just fine.
This is not the first time it has happened to me and I feel it is directly related to the alphabetical sorting, but seems like a bug.