Skip to content

Conversation

@volsa
Copy link
Member

@volsa volsa commented Oct 2, 2025

Previously, when visiting the virtual-table pointer of a class or function block, the resolver added a dependency on the intrinsic VOID type but not on the concrete __vtable_* struct and its members. Codegen then failed with “unknown type” when expanding opaque types that reference vtable members.

This commit fixes that, such that the members of the virtual table are fetched and added as dependencies in the resolver module.

A minimal reproducible example would be

// file: main.st
FUNCTION main
    VAR
        baseInstance: base;
        baseRef: POINTER TO base;
    END_VAR

    baseRef := ADR(baseInstance);
    baseRef^.foo();
END_FUNCTION

// file: base.st
FUNCTION_BLOCK base
    METHOD foo
        printf('base::foo$N');
    END_METHOD
END_FUNCTION_BLOCK

Previously, when visiting the virtual-table pointer of a class or function block,
the resolver added a dependency on the intrinsic `VOID` type but not on the
concrete `__vtable_*` struct and its members. Codegen then failed with
“unknown type” when expanding opaque types that reference vtable members.

This commit fixes that, such that the members of the virtual table are fetched and
added as dependencies in the resolver module.

A minimal reproducible example would be
```
// file: main.st
FUNCTION main
    VAR
        baseInstance: base;
        baseRef: POINTER TO base;
    END_VAR

    baseRef := ADR(baseInstance);
    baseRef^.foo();
END_FUNCTION

// file: base.st
FUNCTION_BLOCK base
    METHOD foo
        printf('base::foo$N');
    END_METHOD
END_FUNCTION_BLOCK
```
@volsa volsa requested review from abroooo, ghaith and mhasel October 2, 2025 08:33
@volsa volsa merged commit 88e240b into master Oct 2, 2025
23 checks passed
@volsa volsa deleted the vosa/vtable-dependencies branch October 2, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants