Improve lvalue handling in the compiler. #1357

This commit is contained in:
Christoffer Lerno
2024-09-07 03:19:17 +02:00
parent 78c60ae695
commit 7649738618
3 changed files with 21 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
module lvalue_handling;
import std;
struct Foo
{
int a;
}
def IntList = List(<Foo>);
fn void subscript_overload() @test
{
IntList x;
x.push({ 3 });
int* a = &x[0].a;
assert(*a == 3);
assert(x[0].a == 3);
*a = 4;
assert(x[0].a == 4);
x[0].a = 5;
assert(x[0].a == 5);
}