Skip to content

Commit 21d38af

Browse files
authored
Merge branch 'main' into issue2855-submodule-init
2 parents 178317f + c447fca commit 21d38af

File tree

272 files changed

+8038
-8765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+8038
-8765
lines changed

.github/workflows/CI.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
os: ["ubuntu-latest", "macos-latest", "windows-2019"]
22+
os: ["ubuntu-latest", "macos-latest", "windows-2025"]
2323
python-version: ["3.10"]
2424
steps:
2525
- uses: actions/checkout@v3
@@ -100,7 +100,10 @@ jobs:
100100
set WIN=1
101101
set MACOS=0
102102
set ENABLE_RUNTIME_STACKTRACE=no
103-
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
103+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
104+
set CC=cl.exe
105+
set CXX=cl.exe
106+
set "PATH=%PATH:C:\mingw64\bin;=%" # Remove mingw from path
104107
xonsh ci\build.xsh
105108
106109
- name: Test (Linux / macOS)
@@ -119,7 +122,10 @@ jobs:
119122
set LFORTRAN_CMAKE_GENERATOR=Ninja
120123
set WIN=1
121124
set MACOS=0
122-
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
125+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
126+
set CC=cl.exe
127+
set CXX=cl.exe
128+
set "PATH=%PATH:C:\mingw64\bin;=%" # Remove mingw from path
123129
xonsh ci\test.xsh
124130
125131
build_to_wasm:

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ include(GNUInstallDirs)
4242
#
4343
# cpack
4444
#
45-
include(InstallRequiredSystemLibraries)
45+
if(NOT WIN32)
46+
include(InstallRequiredSystemLibraries)
47+
endif()
4648
set(CPACK_GENERATOR "TBZ2")
4749
set(CPACK_STRIP_FILES YES)
4850
set(CPACK_PACKAGE_FILE_NAME lpython-${LFORTRAN_VERSION}-${CMAKE_SYSTEM_NAME})

integration_tests/CMakeLists.txt

Lines changed: 65 additions & 65 deletions
Large diffs are not rendered by default.

integration_tests/test_cmath.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from cmath import (exp, log, sqrt, acos, asin, atan, cos, sin, tan,
2-
acosh, asinh, atanh, cosh, sinh, tanh,
3-
phase, polar, rect)
4-
from lpython import c64, c32, f64
1+
from cmath import (acos, acosh, asin, asinh, atan, atanh, cos, cosh, exp, log,
2+
phase, polar, rect, sin, sinh, sqrt, tan, tanh)
3+
4+
from lpython import c32, c64, f64
5+
56

67
def test_power_logarithmic():
78
x: c64
@@ -73,4 +74,4 @@ def test_polar():
7374
test_power_logarithmic()
7475
test_trigonometric()
7576
test_hyperbolic()
76-
test_polar()
77+
test_polar()

integration_tests/test_set_len.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
def test_set():
44
s: set[i32]
55
s = {1, 2, 22, 2, -1, 1}
6+
assert len(s2) == 4
67
s2: set[str]
78
s2 = {'a', 'b', 'cd', 'b', 'abc', 'a'}
89
assert len(s2) == 4

libasr

Submodule libasr updated 1909 files

src/bin/lpython.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ std::string get_kokkos_dir()
9090

9191
int emit_tokens(const std::string &infile, bool line_numbers, const CompilerOptions &compiler_options)
9292
{
93-
std::string input = LCompilers::read_file(infile);
93+
std::string input = LCompilers::read_file_ok(infile);
9494
// Src -> Tokens
9595
Allocator al(64*1024*1024);
9696
std::vector<int> toks;
@@ -103,7 +103,7 @@ int emit_tokens(const std::string &infile, bool line_numbers, const CompilerOpti
103103
LCompilers::LocationManager::FileLocations fl;
104104
fl.in_filename = infile;
105105
lm.files.push_back(fl);
106-
std::string input = LCompilers::read_file(infile);
106+
std::string input = LCompilers::read_file_ok(infile);
107107
lm.init_simple(input);
108108
lm.file_ends.push_back(input.size());
109109
}
@@ -140,7 +140,7 @@ int emit_ast(const std::string &infile,
140140
LCompilers::LocationManager::FileLocations fl;
141141
fl.in_filename = infile;
142142
lm.files.push_back(fl);
143-
std::string input = LCompilers::read_file(infile);
143+
std::string input = LCompilers::read_file_ok(infile);
144144
lm.init_simple(input);
145145
lm.file_ends.push_back(input.size());
146146
}
@@ -161,7 +161,7 @@ int emit_ast(const std::string &infile,
161161
LCompilers::LocationManager::FileLocations fl;
162162
fl.in_filename = infile;
163163
lm.files.push_back(fl);
164-
std::string input = LCompilers::read_file(infile);
164+
std::string input = LCompilers::read_file_ok(infile);
165165
lm.init_simple(input);
166166
lm.file_ends.push_back(input.size());
167167
}
@@ -172,7 +172,7 @@ int emit_ast(const std::string &infile,
172172
LCompilers::LocationManager::FileLocations fl;
173173
fl.in_filename = infile;
174174
lm.files.push_back(fl);
175-
std::string input = LCompilers::read_file(infile);
175+
std::string input = LCompilers::read_file_ok(infile);
176176
lm.init_simple(input);
177177
lm.file_ends.push_back(input.size());
178178
}
@@ -197,7 +197,7 @@ int emit_asr(const std::string &infile,
197197
LCompilers::LocationManager::FileLocations fl;
198198
fl.in_filename = infile;
199199
lm.files.push_back(fl);
200-
std::string input = LCompilers::read_file(infile);
200+
std::string input = LCompilers::read_file_ok(infile);
201201
lm.init_simple(input);
202202
lm.file_ends.push_back(input.size());
203203
}
@@ -250,7 +250,7 @@ int emit_cpp(const std::string &infile,
250250
LCompilers::LocationManager::FileLocations fl;
251251
fl.in_filename = infile;
252252
lm.files.push_back(fl);
253-
std::string input = LCompilers::read_file(infile);
253+
std::string input = LCompilers::read_file_ok(infile);
254254
lm.init_simple(input);
255255
lm.file_ends.push_back(input.size());
256256
}
@@ -295,7 +295,7 @@ int emit_c(const std::string &infile,
295295
LCompilers::LocationManager::FileLocations fl;
296296
fl.in_filename = infile;
297297
lm.files.push_back(fl);
298-
std::string input = LCompilers::read_file(infile);
298+
std::string input = LCompilers::read_file_ok(infile);
299299
lm.init_simple(input);
300300
lm.file_ends.push_back(input.size());
301301
}
@@ -347,7 +347,7 @@ int emit_c_to_file(const std::string &infile, const std::string &outfile,
347347
LCompilers::LocationManager::FileLocations fl;
348348
fl.in_filename = infile;
349349
lm.files.push_back(fl);
350-
std::string input = LCompilers::read_file(infile);
350+
std::string input = LCompilers::read_file_ok(infile);
351351
lm.init_simple(input);
352352
lm.file_ends.push_back(input.size());
353353
}
@@ -401,7 +401,7 @@ int emit_python(const std::string &infile,
401401
LCompilers::LocationManager::FileLocations fl;
402402
fl.in_filename = infile;
403403
lm.files.push_back(fl);
404-
std::string input = LCompilers::read_file(infile);
404+
std::string input = LCompilers::read_file_ok(infile);
405405
lm.init_simple(input);
406406
lm.file_ends.push_back(input.size());
407407
}
@@ -451,7 +451,7 @@ int emit_wat(const std::string &infile,
451451
LCompilers::LocationManager::FileLocations fl;
452452
fl.in_filename = infile;
453453
lm.files.push_back(fl);
454-
std::string input = LCompilers::read_file(infile);
454+
std::string input = LCompilers::read_file_ok(infile);
455455
lm.init_simple(input);
456456
lm.file_ends.push_back(input.size());
457457
}
@@ -495,7 +495,7 @@ int emit_wat(const std::string &infile,
495495
int dump_all_passes(const std::string &infile,
496496
const std::string &runtime_library_dir,
497497
CompilerOptions &compiler_options) {
498-
std::string input = LCompilers::read_file(infile);
498+
std::string input = LCompilers::read_file_ok(infile);
499499

500500
Allocator al(4*1024);
501501
LCompilers::LocationManager lm;
@@ -543,7 +543,7 @@ int get_symbols (const std::string &infile,
543543
LCompilers::LocationManager::FileLocations fl;
544544
fl.in_filename = infile;
545545
lm.files.push_back(fl);
546-
std::string input = LCompilers::read_file(infile);
546+
std::string input = LCompilers::read_file_ok(infile);
547547
lm.init_simple(input);
548548
lm.file_ends.push_back(input.size());
549549
}
@@ -644,7 +644,7 @@ int get_errors (const std::string &infile,
644644
LCompilers::LocationManager::FileLocations fl;
645645
fl.in_filename = infile;
646646
lm.files.push_back(fl);
647-
std::string input = LCompilers::read_file(infile);
647+
std::string input = LCompilers::read_file_ok(infile);
648648
lm.init_simple(input);
649649
lm.file_ends.push_back(input.size());
650650
}
@@ -764,7 +764,7 @@ int emit_llvm(const std::string &infile,
764764
LCompilers::LocationManager::FileLocations fl;
765765
fl.in_filename = infile;
766766
lm.files.push_back(fl);
767-
std::string input = LCompilers::read_file(infile);
767+
std::string input = LCompilers::read_file_ok(infile);
768768
lm.init_simple(input);
769769
lm.file_ends.push_back(input.size());
770770
}
@@ -1057,7 +1057,7 @@ int compile_python_using_llvm(
10571057
lm.files.push_back(fl);
10581058

10591059
auto file_reading_start = std::chrono::high_resolution_clock::now();
1060-
std::string input = LCompilers::read_file(infile);
1060+
std::string input = LCompilers::read_file_ok(infile);
10611061
auto file_reading_end = std::chrono::high_resolution_clock::now();
10621062
times.push_back(std::make_pair("File reading", std::chrono::duration
10631063
<double, std::milli>(file_reading_end - file_reading_start).count()));
@@ -1202,7 +1202,7 @@ int compile_to_binary_wasm(
12021202
lm.files.push_back(fl);
12031203

12041204
auto file_reading_start = std::chrono::high_resolution_clock::now();
1205-
std::string input = LCompilers::read_file(infile);
1205+
std::string input = LCompilers::read_file_ok(infile);
12061206
auto file_reading_end = std::chrono::high_resolution_clock::now();
12071207
times.push_back(std::make_pair("File reading", std::chrono::duration
12081208
<double, std::milli>(file_reading_end - file_reading_start).count()));
@@ -1275,7 +1275,7 @@ int compile_to_binary_x86(
12751275
lm.files.push_back(fl);
12761276

12771277
auto file_reading_start = std::chrono::high_resolution_clock::now();
1278-
std::string input = LCompilers::read_file(infile);
1278+
std::string input = LCompilers::read_file_ok(infile);
12791279
auto file_reading_end = std::chrono::high_resolution_clock::now();
12801280
times.push_back(std::make_pair("File reading", std::chrono::duration
12811281
<double, std::milli>(file_reading_end - file_reading_start).count()));
@@ -1349,7 +1349,7 @@ int compile_to_binary_wasm_to_x86(
13491349
lm.files.push_back(fl);
13501350

13511351
auto file_reading_start = std::chrono::high_resolution_clock::now();
1352-
std::string input = LCompilers::read_file(infile);
1352+
std::string input = LCompilers::read_file_ok(infile);
13531353
auto file_reading_end = std::chrono::high_resolution_clock::now();
13541354
times.push_back(std::make_pair("File reading", std::chrono::duration
13551355
<double, std::milli>(file_reading_end - file_reading_start).count()));
@@ -1626,7 +1626,7 @@ int link_executable(const std::vector<std::string> &infiles,
16261626

16271627
// int emit_c_preprocessor(const std::string &infile, CompilerOptions &compiler_options)
16281628
// {
1629-
// std::string input = read_file(infile);
1629+
// std::string input = read_file_ok(infile);
16301630
//
16311631
// LFortran::CPreprocessor cpp(compiler_options);
16321632
// LFortran::LocationManager lm;
@@ -2076,7 +2076,7 @@ int main(int argc, char *argv[])
20762076
lpython_pass_manager.use_default_passes();
20772077
compiler_options.po.disable_main = true;
20782078
compiler_options.emit_debug_line_column = false;
2079-
compiler_options.generate_object_code = false;
2079+
compiler_options.separate_compilation = false;
20802080
return interactive_python_repl(lpython_pass_manager, compiler_options, arg_v);
20812081
#else
20822082
std::cerr << "Interactive prompt requires the LLVM backend to be enabled. Recompile with `WITH_LLVM=yes`." << std::endl;
@@ -2216,7 +2216,7 @@ int main(int argc, char *argv[])
22162216
}
22172217
compiler_options.emit_debug_info = false;
22182218
compiler_options.emit_debug_line_column = false;
2219-
compiler_options.generate_object_code = false;
2219+
compiler_options.separate_compilation = false;
22202220
return compile_python_using_llvm(arg_file, "", runtime_library_dir,
22212221
lpython_pass_manager, compiler_options, time_report, false, true);
22222222
#else

src/lpython/parser/parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Result<LPython::AST::ast_t*> parse_python_file(Allocator &al,
122122
// We will be using the new parser from now on
123123
new_parser = true;
124124
LCOMPILERS_ASSERT(new_parser)
125-
std::string input = read_file(infile);
125+
std::string input = read_file_ok(infile);
126126
Result<LPython::AST::Module_t*> res = parse(al, input, prev_loc, diagnostics);
127127
if (res.ok) {
128128
ast = (LPython::AST::ast_t*)res.result;

src/lpython/python_kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace LCompilers::LPython {
8080
e.compiler_options.interactive = true;
8181
e.compiler_options.po.disable_main = true;
8282
e.compiler_options.emit_debug_line_column = false;
83-
e.compiler_options.generate_object_code = false;
83+
e.compiler_options.separate_compilation = false;
8484
}
8585
virtual ~custom_interpreter() = default;
8686

0 commit comments

Comments
 (0)