Ensure ln is not None in TextInfo.file_number
Fixes a bug that causes output generator to fail with an exception.
Example (06_mxm form LuNA tests):
reworu@DESKTOP-CPJS18K:~/luna/tests/03_integral/06_mxm$ adapt --run prolog mxm.fa
ERROR: python3 /mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py /home/reworu/luna/tests/03_integral/06_mxm/.adapt/reporter/found_errors.json --project-dir /home/reworu/luna/tests/03_integral/06_mxm --build-dir /home/reworu/luna/tests/03_integral/06_mxm/.luna-build failed with exit code 1:
Traceback (most recent call last):
File "/mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py", line 420, in <module>
main(sys.argv[1:])
File "/home/reworu/.local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/home/reworu/.local/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/reworu/.local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/reworu/.local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py", line 416, in main
report_errors(output or sys.stdout, templates_map, text_info, error_list)
File "/mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py", line 358, in report_errors
report_error(output_file, templates_map, text_info, error)
File "/mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py", line 241, in report_error
.replace('$consumption_loop', get_index_range(error['details']['used'], text_info))
File "/mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py", line 116, in get_index_range
f'DF {df_ref["true"]} as {df_ref["local"]} in:\n{get_callstack(df_ref["where"], text_info)}\n'
File "/mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py", line 51, in get_callstack
result += get_callstack_entry(call, text_info)
File "/mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py", line 45, in get_callstack_entry
f' {text_info.code_line(int(call["line"]))}\n'
File "/mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py", line 30, in code_line
while self.line_number(position) < line_number:
File "/mnt/c/Users/misha/Projects/luna/Extraterrestrial/ast-ddg-analyzer/scripts/reporter/adapt_output_generator.py", line 26, in line_number
return ln + 1
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'