weak contextual string-literal inference
This commit is contained in:
@@ -2804,9 +2804,9 @@ infer_call_comptime_values :: proc(
|
||||
for value_bound in bound {
|
||||
all_bound = all_bound && value_bound
|
||||
}
|
||||
// Concrete arguments bind first. Numeric constants and `null` are contextual and
|
||||
// therefore only contribute after stronger evidence has had a chance to bind the
|
||||
// parameter type.
|
||||
// Concrete arguments bind first. Numeric constants, string literals, and `null`
|
||||
// are contextual and therefore only contribute after stronger evidence has had a
|
||||
// chance to bind the parameter type.
|
||||
weak_passes := [2]bool{false, true}
|
||||
for weak in weak_passes {
|
||||
for arg_id, source_index in args {
|
||||
@@ -2819,7 +2819,8 @@ infer_call_comptime_values :: proc(
|
||||
}
|
||||
arg_expr := checker.ast_module.exprs[arg_id]
|
||||
is_null := arg_expr.kind == .Null
|
||||
is_weak := is_numeric_constant_expr(checker, arg_id) || is_null
|
||||
is_weak := is_numeric_constant_expr(checker, arg_id) ||
|
||||
arg_expr.kind == .String || is_null
|
||||
if is_weak != weak {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user