Browse Source

report error when builtin min/max has 1 (non-type) param

jakubtomsu 9 months ago
parent
commit
71880eb1ff
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/check_builtin.cpp

+ 9 - 0
src/check_builtin.cpp

@@ -3170,6 +3170,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
 			return false;
 			return false;
 		}
 		}
 
 
+		if (ce->args.count <= 1) {
+			error(call, "Too few arguments for 'min', two or more are required");
+			return false;
+		}
 
 
 		bool all_constant = operand->mode == Addressing_Constant;
 		bool all_constant = operand->mode == Addressing_Constant;
 
 
@@ -3343,6 +3347,11 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
 			gb_string_free(type_str);
 			gb_string_free(type_str);
 			return false;
 			return false;
 		}
 		}
+		
+		if (ce->args.count <= 1) {
+			error(call, "Too few arguments for 'max', two or more are required");
+			return false;
+		}
 
 
 		bool all_constant = operand->mode == Addressing_Constant;
 		bool all_constant = operand->mode == Addressing_Constant;