Handle protocol inheritance. Allow overlapping protocol methods. Remove the need for &self in protocol declarations. Fix cast rules for protocol. Fix cast rules for bitstruct #1034.

This commit is contained in:
Christoffer Lerno
2023-10-08 01:54:30 +02:00
committed by Christoffer Lerno
parent 99cfaa1583
commit 312a39ee24
17 changed files with 615 additions and 52 deletions

View File

@@ -6,8 +6,8 @@ const int PRINTF_NTOA_BUFFER_SIZE = 256;
protocol Printable
{
fn String to_string(&self, Allocator *using) @optional;
fn usz! to_format(&self, Formatter* formatter) @optional;
fn String to_string(Allocator *using) @optional;
fn usz! to_format(Formatter* formatter) @optional;
}
fault PrintFault

View File

@@ -2,13 +2,13 @@ module std::math::random;
protocol Random
{
fn void set_seed(&self, char[] input);
fn char next_byte(&self);
fn ushort next_short(&self);
fn uint next_int(&self);
fn ulong next_long(&self);
fn uint128 next_int128(&self);
fn void next_bytes(&self, char[] buffer);
fn void set_seed(char[] input);
fn char next_byte();
fn ushort next_short();
fn uint next_int();
fn ulong next_long();
fn uint128 next_int128();
fn void next_bytes(char[] buffer);
}
macro Random.seed(&self, seed)