Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/arkreactor/Builtins/Mathematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ namespace Ark::internal::Builtins::Mathematics
*/
Value isnan_(std::vector<Value>& n, VM* vm [[maybe_unused]])
{
if (!types::check(n, ValueType::Any))
throw types::TypeCheckingError(
"math:NaN?",
{ { types::Contract { { types::Typedef("value", ValueType::Any) } } } },
n);

if (n[0].valueType() != ValueType::Number)
return falseSym;

Expand All @@ -150,12 +144,6 @@ namespace Ark::internal::Builtins::Mathematics
*/
Value isinf_(std::vector<Value>& n, VM* vm [[maybe_unused]])
{
if (!types::check(n, ValueType::Any))
throw types::TypeCheckingError(
"math:Inf?",
{ { types::Contract { { types::Typedef("value", ValueType::Any) } } } },
n);

if (n[0].valueType() != ValueType::Number)
return falseSym;

Expand Down
2 changes: 1 addition & 1 deletion src/arkreactor/VM/VM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ namespace Ark
}
else if (consecutive_similar_traces == 0)
{
fmt::println("{0:^{1}}", "...", 21 + func_name.size() + loc_as_text.size());
fmt::println(os, " ...");
++consecutive_similar_traces;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:ln -1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
math:ln: value -1 must be greater than 0

In file tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.ark
1 | (math:ln -1)
| ^~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ In file tests/unittests/resources/DiagnosticsSuite/runtime/recursion_depth.ark
5 | }))

[2047] In function `foo' (tests/unittests/resources/DiagnosticsSuite/runtime/recursion_depth.ark:3)
...
[ 1] In global scope (tests/unittests/resources/DiagnosticsSuite/runtime/recursion_depth.ark:7)

Current scope variables values:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(await 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function await expected 1 argument
-> future (UserType) was of type Number

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/await_num.ark
1 | (await 1)
| ^~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(io:appendToFile 1 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Function io:appendToFile expected 2 arguments
-> filename (String) was of type Number
-> content (any)

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.ark
1 | (io:appendToFile 1 2)
| ^~~~~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(io:dir? 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function io:dir? expected 1 argument
-> path (String) was of type Number

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.ark
1 | (io:dir? 1)
| ^~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(io:fileExists? 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function io:fileExists? expected 1 argument
-> filename (String) was of type Number

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.ark
1 | (io:fileExists? 1)
| ^~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(io:listFiles 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function io:listFiles expected 1 argument
-> path (String) was of type Number

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.ark
1 | (io:listFiles 1)
| ^~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(io:makeDir 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function io:makeDir expected 1 argument
-> path (String) was of type Number

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.ark
1 | (io:makeDir 1)
| ^~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(io:readFile "non-existing-file.weird")
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
io:readFile: couldn't read file "non-existing-file.weird" because it doesn't exist

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.ark
1 | (io:readFile "non-existing-file.weird")
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(io:readFile 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function io:readFile expected 1 argument
-> filename (String) was of type Number

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.ark
1 | (io:readFile 1)
| ^~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(io:removeFiles 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Function io:removeFiles expected 2 arguments but got 1
-> filename (String) was of type Number
-> variadic filenames (String) was not provided

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.ark
1 | (io:removeFiles 1)
| ^~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(io:writeFile "hello" "content")
(io:removeFiles "hello" 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Function io:removeFiles expected 2 arguments
-> filename (String)
-> variadic filenames (String) 1 argument do not match

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.ark
1 | (io:writeFile "hello" "content")
2 | (io:removeFiles "hello" 1)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
3 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(io:writeFile 1 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Function io:writeFile expected 2 arguments
-> filename (String) was of type Number
-> content (any)

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.ark
1 | (io:writeFile 1 2)
| ^~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(list:fill "hello")
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Function list:fill expected 2 arguments but got 1
-> size (Number) was of type String
-> value (any) was not provided

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.ark
1 | (list:fill "hello")
| ^~~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(list:find "hello" 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Function list:find expected 2 arguments
-> list (List) was of type String
-> value (any)

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.ark
1 | (list:find "hello" 1)
| ^~~~~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(list:reverse "hello")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function list:reverse expected 1 argument
-> list (List) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.ark
1 | (list:reverse "hello")
| ^~~~~~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(list:setAt "hello")
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Function list:setAt expected 3 arguments but got 1
-> list (List) was of type String
-> index (Number) was not provided
-> value (any) was not provided

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.ark
1 | (list:setAt "hello")
| ^~~~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(list:slice "hello" 1 true nil)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Function list:slice expected 4 arguments
-> list (List) was of type String
-> start (Number)
-> end (Number) was of type Bool
-> step (Number) was of type Nil

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.ark
1 | (list:slice "hello" 1 true nil)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(list:sort "hello")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function list:sort expected 1 argument
-> list (List) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.ark
1 | (list:sort "hello")
| ^~~~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:acosh "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:acosh expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.ark
1 | (math:acosh "1")
| ^~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:arccos "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:arccos expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.ark
1 | (math:arccos "1")
| ^~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:arcsin "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:arcsin expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.ark
1 | (math:arcsin "1")
| ^~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:arctan "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:arctan expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.ark
1 | (math:arctan "1")
| ^~~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:asinh "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:asinh expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.ark
1 | (math:asinh "1")
| ^~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:atanh "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:atanh expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.ark
1 | (math:atanh "1")
| ^~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:ceil "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:ceil expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.ark
1 | (math:ceil "1")
| ^~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:cos "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:cos expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.ark
1 | (math:cos "1")
| ^~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:cosh "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:cosh expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.ark
1 | (math:cosh "1")
| ^~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:exp "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:exp expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.ark
1 | (math:exp "1")
| ^~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:floor "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:floor expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.ark
1 | (math:floor "1")
| ^~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:ln "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:ln expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.ark
1 | (math:ln "1")
| ^~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:round "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:round expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.ark
1 | (math:round "1")
| ^~~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:sin "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:sin expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.ark
1 | (math:sin "1")
| ^~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:sinh "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:sinh expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.ark
1 | (math:sinh "1")
| ^~~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:tan "1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Function math:tan expected 1 argument
-> value (Number) was of type String

In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.ark
1 | (math:tan "1")
| ^~~~~~~~~~~~~
2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(math:tanh "1")
Loading
Loading