Skip to content

Compiler: comptime keeps no method list of a type still declaring them - #2587

Merged
bfiete merged 1 commit into
beefytech:masterfrom
jayrulez:fix/comptime-methods-of-a-type-mid-declaration
Oct 27, 2026
Merged

bfiete merged 1 commit into
beefytech:masterfrom
jayrulez:fix/comptime-methods-of-a-type-mid-declaration

Conversation

@jayrulez

Copy link
Copy Markdown
Contributor

CeMachine::GetTypeInfo caches a type's method instances by its revision. A comptime call can reach a type through a cycle while that type is still declaring its methods (a generator on a derived type reading its base's methods, when declaring one of the base's methods populated the derived type), and the partial list was cached under the type's final revision, so every later GetMethods in the compile saw it. Which types came out short depended on compile order.

Such a type is now answered with what it has but not cached, so a read after its methods are declared sees them all.

CeMachine::GetTypeInfo caches a type's method instances by its revision.
A comptime call can reach a type through a cycle while that type is still
declaring its methods (a generator on a derived type reading its base's
methods, when declaring one of the base's methods populated the derived
type), and the partial list was cached under the type's final revision,
so every later GetMethods in the compile saw it. Which types came out
short depended on compile order.

Such a type is now answered with what it has but not cached, so a read
after its methods are declared sees them all.
@bfiete
bfiete merged commit b06ab00 into beefytech:master Oct 27, 2026
5 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