From 2247b74dcc07e14cc3544a9554b58c72058cae30 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Mon, 1 Apr 2024 18:31:51 -0400 Subject: [PATCH] add test for unimplemented op --- tests/shift_equals_operator.oc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/shift_equals_operator.oc diff --git a/tests/shift_equals_operator.oc b/tests/shift_equals_operator.oc new file mode 100644 index 0000000..6e4684d --- /dev/null +++ b/tests/shift_equals_operator.oc @@ -0,0 +1,21 @@ +/// skip + +// TODO: Implement support for this. Need to properly +// abstract away the operators (and merge with asttype) +// to properly handle all mutable operators (like we do with []=) +// Currently that has just been special cased, which is not great. + +struct Foo { + x: u32 +} + +[operator "<<="] +def Foo::shift(&this, val: u32) { + .x <<= val +} + +def main() { + let f = Foo(4) + f <<= 2 + println(`{f.x}`) +} \ No newline at end of file