Skip to content

Commit 077a401

Browse files
committed
Fix the rest of the test cases
1 parent f185c0b commit 077a401

5 files changed

Lines changed: 39 additions & 20 deletions

File tree

include/cstd.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ MACOS specific
4747
%EXCLUDE OSReadSwapInt16 OSReadSwapInt32 OSReadSwapInt64 OSWriteSwapInt16 OSWriteSwapInt32 OSWriteSwapInt64
4848
%EXCLUDE _OSSwapInt16 _OSSwapInt32 _OSSwapInt64 __darwin_check_fd_set __darwin_fd_clr __darwin_fd_isset
4949
%EXCLUDE __darwin_fd_set __sigbits __sputc
50+
51+
ARM specific
52+
%EXCLUDE _ZGVnN4vv_atan2f _ZGVnN4v_acosf _ZGVnN4v_asinf _ZGVnN4v_atanf _ZGVnN4v_cosf _ZGVnN4v_expf _ZGVnN4v_exp10f _ZGVnN4v_exp2f
53+
%EXCLUDE _ZGVnN4v_expm1f _ZGVnN4v_logf _ZGVnN4v_log10f _ZGVnN4v_log1pf _ZGVnN4v_log2f _ZGVnN4v_sinf _ZGVnN4v_tanf _ZGVnN2vv_atan2
54+
%EXCLUDE _ZGVnN2v_acos _ZGVnN2v_asin _ZGVnN2v_atan _ZGVnN2v_cos _ZGVnN2v_exp _ZGVnN2v_exp10 _ZGVnN2v_exp2 _ZGVnN2v_expm1 _ZGVnN2v_log
55+
%EXCLUDE _ZGVnN2v_log10 _ZGVnN2v_log1p _ZGVnN2v_log2 _ZGVnN2v_sin _ZGVnN2v_tan _ZGVsMxvv_atan2f _ZGVsMxv_acosf _ZGVsMxv_asinf
56+
%EXCLUDE _ZGVsMxv_atanf _ZGVsMxv_cosf _ZGVsMxv_expf _ZGVsMxv_exp10f _ZGVsMxv_exp2f _ZGVsMxv_expm1f _ZGVsMxv_logf _ZGVsMxv_log10f
57+
%EXCLUDE _ZGVsMxv_log1pf _ZGVsMxv_log2f _ZGVsMxv_sinf _ZGVsMxv_tanf _ZGVsMxvv_atan2 _ZGVsMxv_acos _ZGVsMxv_asin _ZGVsMxv_atan
58+
%EXCLUDE _ZGVsMxv_cos _ZGVsMxv_exp _ZGVsMxv_exp10 _ZGVsMxv_exp2 _ZGVsMxv_expm1 _ZGVsMxv_log _ZGVsMxv_log10 _ZGVsMxv_log1p
59+
%EXCLUDE _ZGVsMxv_log2 _ZGVsMxv_sin _ZGVsMxv_tan
5060
*/
5161

5262
#include <stdlib.h>

include/gencstd.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ def to_symbol(self, n: int, file: File) -> str:
355355
PRIMITIVES = {
356356
clang.TypeKind.VOID: void,
357357
clang.TypeKind.CHAR_S: Integer("char"),
358+
clang.TypeKind.CHAR_U: Integer("char"),
358359
clang.TypeKind.SCHAR: Integer("char"),
359360
clang.TypeKind.UCHAR: Integer("uint8"),
360361
clang.TypeKind.SHORT: Integer("short"),
@@ -632,7 +633,8 @@ def extract(node: clang.Cursor):
632633
file.GLOBALS[node.spelling] = ConstDecl(node.spelling, PRIMITIVES[clang.TypeKind.DOUBLE], token.spelling)
633634
except ValueError: pass
634635
except InvalidType as e:
635-
print("Warning: Invalid type!")
636+
print(node.location)
637+
print(e)
636638

637639
index = clang.Index.create()
638640
tu = index.parse(folder / f"{name}.h", args = ARGS, options =

src/consteval.pr

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -896,25 +896,31 @@ export def compile_queued_functions {
896896
recursion_guard = true
897897
let debug = toolchain::debug_sym
898898
toolchain::debug_sym = false
899-
900-
for var fdef in @function_queue.keys() {
901-
let entry = function_queue(fdef)
902-
903-
if not entry.node {
904-
// Create dyn dispatch
905-
let function = compiler::predeclare_function(fdef, const_module)
906-
compiler::generate_vtable_function(function, fdef, compiler_state)
907-
const_module.result.add_function(function.name, function)
908-
continue
909-
}
910899

911-
// Compile function
912-
let function = compiler::create_function(entry.node, fdef, entry.node.value.def_.body, entry.node.inner_scope, null, compiler_state, params = entry.node.value.def_.params)
913-
914-
if function and function.defer_functions {
915-
for var i in 0..vector::length(function.defer_functions) {
916-
let deferf = function.defer_functions(i)
917-
const_module.result.add_function(deferf.name, deferf)
900+
// This might add new functions to the queue while compiling, so we loop until it's empty
901+
while function_queue.size > 0 {
902+
for var fdef in @function_queue.keys() {
903+
let entry = function_queue(fdef)
904+
function_queue.remove(fdef)
905+
906+
if not entry.node {
907+
// Create dyn dispatch
908+
// TODO This also happens for stuff like destructors and doesn't need to
909+
// Just checking if the node is null doesn't work
910+
let function = compiler::predeclare_function(fdef, const_module)
911+
compiler::generate_vtable_function(function, fdef, compiler_state)
912+
const_module.result.add_function(function.name, function)
913+
continue
914+
}
915+
916+
// Compile function
917+
let function = compiler::create_function(entry.node, fdef, entry.node.value.def_.body, entry.node.inner_scope, null, compiler_state, params = entry.node.value.def_.params)
918+
919+
if function and function.defer_functions {
920+
for var i in 0..vector::length(function.defer_functions) {
921+
let deferf = function.defer_functions(i)
922+
const_module.result.add_function(deferf.name, deferf)
923+
}
918924
}
919925
}
920926
}

src/typechecking.pr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,6 +2535,7 @@ export def implements_interface(
25352535
let parameter_t = vector::make(NamedParameter)
25362536
parameter_t.push([tpe = tpe.id] !NamedParameter)
25372537
for var param in member.parameter_t {
2538+
param.name = "" // We need to check based on position not name
25382539
parameter_t.push(param)
25392540
}
25402541

test/test_repl.pr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ def #test test_func_call {
1111
}
1212

1313
def #test test_reflection {
14-
assert run_repl("int.size") == "4"
14+
assert run_repl("import reflection; int.size") == "4"
1515
}

0 commit comments

Comments
 (0)