std json parser
This commit is contained in:
@@ -596,6 +596,15 @@ impl<'a> TypeChecker<'a> {
|
||||
|
||||
match &func_type.params {
|
||||
FnParams::Normal(params) => {
|
||||
if params.is_empty() || params[0] != receiver_type {
|
||||
return error!(
|
||||
method.loc,
|
||||
format!(
|
||||
"first parameter of the method must be of type {}",
|
||||
receiver_type
|
||||
)
|
||||
);
|
||||
}
|
||||
if params.len() != args.len() + 1 {
|
||||
return error!(
|
||||
method.loc,
|
||||
@@ -606,15 +615,6 @@ impl<'a> TypeChecker<'a> {
|
||||
)
|
||||
);
|
||||
}
|
||||
if params[0] != receiver_type {
|
||||
return error!(
|
||||
method.loc,
|
||||
format!(
|
||||
"first parameter of the method must be of type {}",
|
||||
receiver_type
|
||||
)
|
||||
);
|
||||
}
|
||||
for (i, arg) in args.iter().enumerate() {
|
||||
expect_type!(self.typecheck_expr(env, arg)?, params[i + 1], method.loc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user