From be534f5e511a1d3836254b827cdaa2b8c309f5c4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 24 Aug 2025 14:18:22 -0400 Subject: Constructors and functions with underscore arguments should be allowed to be called, but only if the underscore arguments are not provided but are implicit from the default values. Same for constructing structs with private fields. --- src/typecheck.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/typecheck.h') diff --git a/src/typecheck.h b/src/typecheck.h index b2be77bf..34fc33a1 100644 --- a/src/typecheck.h +++ b/src/typecheck.h @@ -4,6 +4,7 @@ #include #include +#include #include "ast.h" #include "environment.h" @@ -25,7 +26,12 @@ PUREFUNC bool can_be_mutated(env_t *env, ast_t *ast); type_t *parse_type_string(env_t *env, const char *str); type_t *get_method_type(env_t *env, ast_t *self, const char *name); PUREFUNC bool is_constant(env_t *env, ast_t *ast); -bool is_valid_call(env_t *env, arg_t *spec_args, arg_ast_t *call_args, bool promotion_allowed); PUREFUNC bool can_compile_to_type(env_t *env, ast_t *ast, type_t *needed); +typedef struct { + bool promotion : 1, underscores : 1; +} call_opts_t; + +bool is_valid_call(env_t *env, arg_t *spec_args, arg_ast_t *call_args, call_opts_t options); + // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 -- cgit v1.2.3