Rewrite the Ruby compiler's type system

Merged Yorick Peterse requested to merge new-type-system into master



  • Start by defining the individual type structures and write tests, instead of immediately hooking these up into the compiler.
  • Remove memoizing from the type database as this won't translate well to Inko (it's also not really necessary).
  • Get rid of Type::Boolean (somehow) in favour of just using Type::Object
  • Remove Type::Nil in favour of using Type::Object and the std::marker::Optional trait. This requires that types have access to the type database so they can look up types in other modules.
  • Split Type::TypeParameterTable into two separate structures: one for storing type parameters and one for mapping these to their instances
  • Spec out how type compatibility with regular objects is actually supposed to work
  • Return Type::Error instead of Type::Dynamic when producing errors
  • Don't produce errors when sending messages to Type::Error to prevent cascading type errors
  • Determine how we should initialise generic types
  • Stop using the horrible Inspect module
  • Change type parameter syntax from !(X, Y, Z) to [X, Y, Z]. This is easier to type (on a QWERTY keyboard it doesn't require the use of shift).
Edited by Yorick Peterse

Merge request reports