Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Jan 16, 2024
1 parent 8df463d commit edc78aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions lib/rivet/src/checker/builtin_call.ri
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ extend Checker {
err.emit();
}
} else {
for i, mut arg in builtin_call.args {
for i, &mut arg in builtin_call.args {
arg_info := b_func.args[i];
arg.type = self.check_expr(arg.expr);
if arg_info.is_mut {
self.check_expr_is_mut(arg.expr);
}
if !arg_info.is_any {
self.check_types(arg.type, arg_info.type) catch |err| {
mut err2 := report.error_builder(err.to_string(), arg.pos);
err2 := report.error_builder(err.to_string(), arg.pos);
err2.add_note(
"in argument `{}` of builtin function `{}`", arg_info.name,
b_func.name
Expand All @@ -60,7 +60,7 @@ extend Checker {
arg1 := builtin_call.args[at.arg1_idx];
arg2 := builtin_call.args[at.arg2_idx];
if arg2.type != arg1.type {
mut err2 := report.error_builder(
err2 := report.error_builder(
"expected type `{}`, found `{}`".fmt(arg2.type, arg1.type),
arg1.pos
);
Expand Down Expand Up @@ -99,12 +99,12 @@ extend Checker {
}
return_type
} else {
.Void
+mut .Void
};
return builtin_call.type;
}

func check_builtin_as(+mut self, builtin_call: +mut ast.Expr.BuiltinCall) {
func check_builtin_as(+mut self, builtin_call: &mut ast.Expr.BuiltinCall) {
to_type := builtin_call.args[0].type;
from_type := builtin_call.args[1].type;
if to_type == from_type {
Expand All @@ -125,8 +125,8 @@ extend Checker {
);
}
} else if from_ts := from_type.symbol() {
match from_ts.info {
.Trait(trait_info) -> if to_ts := to_type.symbol() {
match from_ts.info.+ {
.Trait(&mut trait_info) -> if to_ts := to_type.symbol() {
if to_ts in trait_info.implements {
trait_info.mark_has_objects();
return;
Expand Down Expand Up @@ -159,7 +159,7 @@ extend Checker {
return; // Valid inside `core` module
}
}
match to_ts.info {
match to_ts.info.+ {
.Enum(enum_info2) if !enum_info2.is_tagged -> {
if self.env.is_int(to_type) && !self.inside_unsafe() {
report.warn(
Expand Down
2 changes: 1 addition & 1 deletion lib/rivet/src/checker/mod.ri
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub struct Checker {
value_type := tuple_info.types[i];
if vd.has_type {
self.check_types(value_type, vd.type) catch |err| {
mut errb := report.error_builder(
errb := report.error_builder(
err.to_string(), right.position()
);
errb.add_note("in element {} of tuple value", i);
Expand Down
2 changes: 1 addition & 1 deletion lib/rivet/src/checker/types.ri
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extend Checker {
}
} else {
self.check_types(got, expected) catch |err| {
mut err2 := report.error_builder(err.to_string(), pos);
err2 := report.error_builder(err.to_string(), pos);
err2.add_note(
"in argument `{}` of {} `{}`".fmt(arg_name, func_kind, func_name)
);
Expand Down

0 comments on commit edc78aa

Please sign in to comment.