This commit is contained in:
Бондарев Иван 2019-12-22 12:34:07 +01:00
parent 4bb828705d
commit 3b7bf665ef
3 changed files with 14 additions and 0 deletions

View file

@ -0,0 +1,6 @@
function f1(x: byte := 1) := x;
begin
var s := $'{f1}';
assert(s = '1');
end.

View file

@ -2156,6 +2156,12 @@ namespace PascalABCCompiler.TreeConverter
// Потому что не учитывается вызов - в вызове может быть функция!!
delete_greater_functions(set_of_possible_functions,tcll); // SSM 06/06/19 refactoring
if (set_of_possible_functions.Count == 1)
{
check_single_possible_convertion(loc, tcll[0]);
convert_function_call_expressions(set_of_possible_functions[0], parameters, tcll[0]);
return set_of_possible_functions[0];
}
//Тупая заглушка для примитивных типов. иначе не работает +=, у нас лишком много неявных приведений
//в дальнейшем может вызвать странное поведение, это надо проверить
if (set_of_possible_functions.Count == 2 && indefinits.Count == 0)

View file

@ -4443,6 +4443,7 @@ namespace PascalABCCompiler.TreeRealization
|| fn.simple_function_node is compiled_function_node && (fn.simple_function_node as compiled_function_node).ConnectedToType != null)
&& fn.simple_function_node.parameters.Count == 2 && fn.simple_function_node.parameters[1].default_value != null)
{
int param_num = (fn.simple_function_node is common_namespace_function_node && (fn.simple_function_node as common_namespace_function_node).ConnectedToType != null || fn.simple_function_node is compiled_function_node && (fn.simple_function_node as compiled_function_node).ConnectedToType != null) ? 1 : 0;
base_function_call copy_fn = null;
if (fn.simple_function_node.return_value_type == ctn)
@ -4457,6 +4458,7 @@ namespace PascalABCCompiler.TreeRealization
{
continue;
}
//TODO: Очень внимательно рассмотреть. Если преобразование типов должно идти через compile_time_executor.
possible_type_convertions ptc = type_table.get_convertions(fn.simple_function_node.return_value_type, ctn);
if ((ptc.first == null) || (ptc.first.convertion_method == null))