thelilylang / lily

The Lily programming language ⚜
MIT License
9 stars 2 forks source link

Typecheck dot and arrow access #548

Closed ArthurPV closed 1 month ago

ArthurPV commented 1 month ago

The following code now works:

struct Node.[@T] {
    @T value;
    struct Node.[@T] *next;
};

struct Node.[@T]
new__Node.[@T](@T value)
{
    return (struct Node.[@T]){ .value = value, .next = NULL };
}

struct LinkedList.[@T] {
    struct Node.[@T] *first;
    struct Node.[@T] *last;
    size_t length;
};

struct LinkedList.[@T]
new__LinkedList.[@T]()
{
    return (struct LinkedList.[@T]){ .first = NULL, .last = NULL, .length = 0 };
}

int main() {
        struct Node.[int] first = new__Node.[int](2);
        struct LinkedList.[int] l = new__LinkedList.[int]();
        l.first = &first;
}