diff --git a/lib/std/core/builtin.c3 b/lib/std/core/builtin.c3 index e09a55c10..2500c2fad 100644 --- a/lib/std/core/builtin.c3 +++ b/lib/std/core/builtin.c3 @@ -112,7 +112,7 @@ macro anycast(any v, $Type) @builtin @return "The value in the pointer" @return? TYPE_MISMATCH *> -macro any.as(self, $Type) +macro any.to(self, $Type) { if (self.type != $Type.typeid) return TYPE_MISMATCH?; return *($Type*)self.ptr; @@ -122,7 +122,7 @@ macro any.as(self, $Type) @require self.type == $Type : "The 'any' contained an unexpected type." @return "The value in the pointer" *> -macro any.to(self, $Type) +macro any.as(self, $Type) { return *($Type*)self.ptr; } diff --git a/test/unit/regression/any.c3 b/test/unit/regression/any.c3 index afa3b39da..50b244bd2 100644 --- a/test/unit/regression/any.c3 +++ b/test/unit/regression/any.c3 @@ -15,8 +15,8 @@ fn void any_to_as() { int x = 3; any a = &x; - test::eq(a.to(int), 3); - test::eq(a.as(int)!!, 3); + test::eq(a.as(int), 3); + test::eq(a.to(int)!!, 3); } fn void test_aliasing()