Odin
Odin copied to clipboard
Duplicate declaration error when using same package with a different name casing in different files
Context
- Operating System & Odin Version: Odin: dev-2024-03:04f0fbf23 OS: Windows 11 Professional (version: 22H2), build 23620.1000 CPU: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz RAM: 32689 MiB Backend: LLVM 17.0.1
Expected Behavior
Importing a package in two different files (that share a package) when both imports use different name cases (e.g. "vendor:OpenGL" and "vendor:opengl") should work fine and not cause any compile-time errors.
Current Behavior
The compiler reports a rather unhelpful error when compiling: Duplicate declaration of "..."
, usually the package name is what's in the quotes.
Failure Information (for bugs)
Probably fixable by adding to line 6025 of checker.cpp to convert the pkg name to lowercase before hashing (as stated by avanspector in the discord)
Steps to Reproduce
- Create two source files
- Import a package in both files with a different casing each time (e.g. vendor:OpenGL and vendor:opengl)
- Compile and see error
Failure Logs
Minimal reproducer: file1.odin:
package main
import "vendor:opengl"
main :: proc () {}
file2.odin:
package main
import "vendor:OpenGL"
This problem is fundamentally an issue on platforms which have case insensitive file systems. It's hard to check for because there case sensitive file systems.
Probably fixable by adding to line 6025 of checker.cpp to convert the pkg name to lowercase before hashing (as stated by avanspector in the discord)
This is not a fix to the problem because foo/bar
might be different to fOo/BaR
on a different file system.