From c7a70be8240f150c159ab51f76ee776067d9a99b Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 15 Jul 2019 22:38:51 +0100 Subject: [PATCH] Fix __get_map_key --- core/runtime/core.odin | 3 ++- examples/demo/demo.odin | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/runtime/core.odin b/core/runtime/core.odin index 2203e7179..623f3725a 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -816,7 +816,8 @@ __get_map_header :: proc "contextless" (m: ^$T/map[$K]$V) -> Map_Header { return header; } -__get_map_key :: proc "contextless" (key: $K) -> Map_Key { +__get_map_key :: proc "contextless" (k: $K) -> Map_Key { + key := k; map_key: Map_Key; ti := type_info_base_without_enum(type_info_of(K)); switch _ in ti.variant { diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin index 206fa4a2d..298af6e32 100644 --- a/examples/demo/demo.odin +++ b/examples/demo/demo.odin @@ -946,7 +946,12 @@ deferred_procedure_associations :: proc() { } main :: proc() { - when true { + x: map[int]int; + x[123] = 123; + fmt.println(x); + fmt.println(x[123]); + + when false { general_stuff(); union_type(); parametric_polymorphism();