Skip to content

Commit 05fa324

Browse files
authored
Merge pull request #2854 from swamishiju/sync
Sync
2 parents 5880e96 + 92d9831 commit 05fa324

File tree

262 files changed

+6147
-8697
lines changed

Some content is hidden

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

262 files changed

+6147
-8697
lines changed

integration_tests/CMakeLists.txt

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

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 1805 files

src/bin/lpython.cpp

Lines changed: 20 additions & 20 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;

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;

0 commit comments

Comments
 (0)