gavr123456789 / Niva

Smalltalk like programming language
https://gavr123456789.github.io/niva-site
32 stars 2 forks source link

Methods for types with instantiated generics #280

Open gavr123456789 opened 3 weeks ago

gavr123456789 commented 3 weeks ago

Pair(List::T, List::T) forEach = []

this should work only for Pairs with the same generics

now u dont store types with instantiated generics as separated types so this is not possible

1) if receiver type of method decl after resolving still contains unresolved generics(T, G) then store it somehow inside TypeDB

For example create a list of instantiated types inside type and store this type like Pair(List::T, List::T) not Pair(T, G) inside and search there

2) store receivers of methods separatelly from types itself, and typecheck it this receiver the same as receeiver of this type
such typecheck would be needed only for types with generics since they can be instanciated with different types