Skip to content

Dev tk - #48

Merged
Tobias-Kohn merged 2 commits into
masterfrom
dev-tk
Aug 6, 2026
Merged

Tobias-Kohn merged 2 commits into
masterfrom
dev-tk

Conversation

@Tobias-Kohn

Copy link
Copy Markdown
Owner

No description provided.

neilccbrown and others added 2 commits August 4, 2026 09:49
pop() was hard-coded to return the list type itself instead of the item
type, so e.g. get_actors().pop().remove() resolved .remove() against
list.remove(x) instead of the actual item class's remove(), leaking the
wrong signature into autocomplete. Also fixed append/extend/insert/remove/
reverse/sort, which had the same hard-coded-to-self bug but should return
None.

Mirrors the BuiltinMethod/getMethodType pattern used for dict.keys() rather
than an AST-walker echo marker: MUTABLE_SEQ registers "pop" as a shared
BuiltinMethod template, and TypeAstWalker.getTypeOfAttr binds it to the
receiver's own PrimitiveType (e.g. list[Actor] rather than plain list) at
each attribute access, since a field shared across every instance of a type
can't otherwise see which concrete instance it was accessed on. ListType
overrides getMethodType to answer "pop" with its item type.
Alternate approach to fix list.pop() return type inference
@Tobias-Kohn
Tobias-Kohn merged commit 463ba04 into master Aug 6, 2026
2 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