Refactor, generics, methods, overloads and more #9

Merged
HEL merged 64 commits from feat/generics into main 2026-06-14 22:13:14 +00:00
Owner

This PR is a bit messy. It groups many features and fixes including, but not limited to:

  • a refactor to split the checker into a proper Midas typer and a Python typer
  • generic types, with type variables
  • grouping of properties and methods as "members", stored separately in the registry (previously operations)
  • function overloads with resolution
  • builtin type methods and properties defined in a Midas file (including lists)
  • add option to compile command to show type judgements

Some things are not fully implemented / need some tidying, but I want to merge this branch and make new smaller ones before this one gets any more out of hand

This PR is a bit messy. It groups many features and fixes including, but not limited to: - a refactor to split the checker into a proper Midas typer and a Python typer - generic types, with type variables - grouping of properties and methods as "members", stored separately in the registry (previously operations) - function overloads with resolution - builtin type methods and properties defined in a Midas file (including lists) - add option to `compile` command to show type judgements Some things are not fully implemented / need some tidying, but I want to merge this branch and make new smaller ones before this one gets any more out of hand
HEL self-assigned this 2026-06-14 22:13:03 +00:00
HEL added 64 commits 2026-06-14 22:13:03 +00:00
restructure the type checker with a shared TypesRegistry used by MidasTyper and PythonTyper

this commit also relocates some methods in more appropriate places, such as is_subtype and apply_generic (now in TypesRegistry)
if a variable is not already defined when an assignment is visited, it is then defined in the current scope
add `__str__` methods on type structures to improve readability of diagnostics
also rename generic type params to type args (when calling a generic)
make visitor accept calls more explicit with type_of(), resolve_type_expr() and process_stmt()
try to find the most specific overload if multiple matches are found
invalid function calls now return UnknownType even if the function has a return type
HEL merged commit 5b062b46e6 into main 2026-06-14 22:13:14 +00:00
HEL deleted branch feat/generics 2026-06-14 22:13:14 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: HEL/midas#9