Fix binops not using hint properly
This commit is contained in:
parent
ef427f5e58
commit
8bbee5eb41
@ -385,10 +385,12 @@ impl Builder {
|
||||
}
|
||||
Instr::FunctionCall(fun, params) => {
|
||||
let param_types = self.function_data(&fun).params;
|
||||
dbg!(¶ms, ¶m_types);
|
||||
if param_types.len() != params.len() {
|
||||
return Err(()); // TODO error: invalid amount of params
|
||||
}
|
||||
for (a, b) in param_types.iter().zip(params) {
|
||||
dbg!(b.get_type(&self)?);
|
||||
if *a != b.get_type(&self)? {
|
||||
return Err(()); // TODO error: params do not match
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ impl Expression {
|
||||
ExprKind::BinOp(op, lhs, rhs) => {
|
||||
// TODO make sure lhs and rhs can actually do this binary
|
||||
// operation once relevant
|
||||
let lhs_res = lhs.typecheck(state, &typerefs, None);
|
||||
let lhs_res = lhs.typecheck(state, &typerefs, hint_t);
|
||||
let lhs_type = state.or_else(lhs_res, TypeKind::Vague(Vague::Unknown), lhs.1);
|
||||
let rhs_res = rhs.typecheck(state, &typerefs, Some(&lhs_type));
|
||||
let rhs_type = state.or_else(rhs_res, TypeKind::Vague(Vague::Unknown), rhs.1);
|
||||
|
@ -1,3 +1,5 @@
|
||||
struct SDL_Thing {}
|
||||
|
||||
extern fn SDL_malloc(size: u64) -> *SDL_Thing;
|
||||
|
||||
fn main() {
|
||||
|
Loading…
Reference in New Issue
Block a user