Open michaellilltokiwa opened 1 month ago
This might be easier than it appears to be: For any operation on numeric
whose result type is numeric.this
, we could propagate the expected type provided that the target is a numeric literal.
This should also work for, e.g.,
b f64 => 1 + 2/3
where the type f64
is first propagated to the target 1
of numeric.infix +
, and then propagated as the expected argument type of 2/3
, where it is propagated to the target 2
of numeric.infix /
, then propagated as the expected argument type of 3
.
Consider the following example:
Currently during inference
i32
is assumed to be the type of the numliterals. Since the outer feature has a valid numliteral type, in these cases we could also take this type as the inferred type.I am not sure though if this is confusing in more complex examples...