Skip to content

corlib: handle comptime in the TypeInstance.GetMethod(int) override - #2496

Merged
bfiete merged 1 commit into
beefytech:masterfrom
jayrulez:fix/comptime-getmethod-index
Sep 7, 2026
Merged

bfiete merged 1 commit into
beefytech:masterfrom
jayrulez:fix/comptime-getmethod-index

Conversation

@jayrulez

@jayrulez jayrulez commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

An extension overrides GetMethod(int) with an implementation that indexes the runtime method table, which replaces the comptime branch on the base declaration rather than adding to it. At comptime mMethodDataCount is 0, so every index is NoResults for a type whose methods are all present.

Restores the comptime path in the override, so an IComptimeTypeApply attribute can walk a type's methods by index.

Test:
Adds Comptime.ComptimeMethodLookup over a class with two named static methods.

Note: The issue was debugged by and the fix created by Claude.

An extension overrides GetMethod(int) with an implementation that indexes the
runtime method table, which replaces the comptime branch on the base
declaration rather than adding to it. At comptime mMethodDataCount is 0, so
every index answers NoResults for a type whose methods are all present:
Comptime_GetMethodCount reports 8 for a class the override finds nothing in,
and the native Comptime_GetMethod returns a valid handle for each of them.

Restores the comptime path in the override, so an IComptimeTypeApply attribute
can walk a type's methods by index.

Adds Comptime.ComptimeMethodLookup over a class with two named static methods.
@jayrulez
jayrulez force-pushed the fix/comptime-getmethod-index branch from 8ccbba6 to 73293e5 Compare September 5, 2026 18:19
@bfiete
bfiete merged commit 2741b3d into beefytech:master Sep 7, 2026
7 checks passed
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.

2 participants