Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Odin: dev-2026-02:c63e31035
OS: macOS Sonoma 14.4.0 (build 23E214, kernel 23.4.0)
CPU: Apple M3
RAM: 16384 MiB
Backend: LLVM 20.1.5
Expected Behavior
This code should compile:
package odin_mapkey_bug
Foo :: struct { f: proc(^Bar) }
Bar :: struct { m: map[Foo]int }
main :: proc() {}
Current Behavior
Instead, we get this error:
Error: Invalid type of a key for a map, got 'Foo'
Bar :: struct { m: map[Foo]int }
Failure Information (for bugs)
Only triggered when they key type is declared before the map. Swapping the declaration order avoids the error (though programs should not need to care about global declaration order).
Also triggered through indirect chains, e.g.
Foo :: struct { f: proc(^Baz) }
Baz :: struct { g: proc(^Bar) }
Bar :: struct { m: map[Foo]int }
A proc type alias avoids the error — only inline types in struct fields are affected afaik.
I'll open a PR with a fix for this.