1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Error reporting improvements for functions & overloads

This commit is contained in:
Étienne Fildadut 2024-01-06 15:14:15 +01:00
parent 7f71569e07
commit b004946266
20 changed files with 114 additions and 89 deletions

View file

@ -5,7 +5,7 @@
--- text ---
| {}"" {}"42" {}"" |
--- error ---
identifier "z" is undefined in branch 7dfcaa5b-2163-4f36-116ed-c4ab6bc8d28b
identifier "z" is undefined in branch 46991f07-7340-4104-9f35-c1fb62e95088
↳ from test/tests/exported variable nested.ans:12:3 in identifier: z
↳ from test/tests/exported variable nested.ans:12:1 in text interpolation: | {z} |
↳ from ? in block: :f = ($() _)…

View file

@ -1,14 +1,18 @@
--# run #--
--- error ---
can't call overload overload<($(table::($(x) <lua function>)) _), ($(tuple::($(x) type(x) == "tuple" | type(x) == "list")) _), ($(range::($(x) type(x) == t)) _), ($(s::($(x) <lua function>)) <lua function>)>: no function match (42), possible functions were:
• (table::($(x) <lua function>)): type check failure for parameter table in function (table::($(x) <lua function>))
• (tuple::($(x) type(x) == "tuple" | type(x) == "list")): type check failure for parameter tuple in function (tuple::($(x) type(x) == "tuple" | type(x) == "list"))
• (range::($(x) type(x) == t)): type check failure for parameter range in function (range::($(x) type(x) == t))
• (s::($(x) <lua function>)): type check failure for parameter s in function (s::($(x) <lua function>))
↳ from for.ans:3:18 in call: iter(var)
↳ from for.ans:3:12 in definition: :iterator = iter(var)
↳ from for.ans:2:1 in block: :iterator = iter(var)…
↳ from for.ans:2:68 in call: _
can't call overload iter: no function match arguments (42), possible functions were:
• $(table::is table) (from stdlib/for.ans:46:1):
type check failure for parameter table
• $(tuple::is sequence) (from stdlib/for.ans:37:1):
type check failure for parameter tuple
• $(range::is range) (from stdlib/for.ans:19:1):
type check failure for parameter range
• $(s::is struct) (from stdlib/for.ans:3:14):
type check failure for parameter s
↳ from stdlib/for.ans:3:18 in call: iter(var)
↳ from stdlib/for.ans:3:12 in definition: :iterator = iter(var)
↳ from stdlib/for.ans:2:1 in block: :iterator = iter(var)…
↳ from stdlib/for.ans:2:71 in call: _
↳ from test/tests/for invalid iterator.ans:1:4 in call: for(:x, 42)
↳ from ? in block: for(:x, 42)…
--# saved #--

View file

@ -1,6 +1,6 @@
--# run #--
--- error ---
can't call function $(a, b) _: expected 2 arguments, received 1
can't call function f: expected 2 arguments, received 1
↳ from test/tests/function args arity check fail.ans:4:2 in call: f("ok")
↳ from ? in block: :f = ($(a, b) _)…
--# saved #--

View file

@ -1,6 +1,6 @@
--# run #--
--- error ---
a function with parameters (a, b) is already defined in the overload
a function with parameters $(a, b) is already defined in the overload
↳ from test/tests/function conflict.ans:5:1 in definition: :f = ($(a, b) 0)
↳ from ? in block: :f = ($(a, b) 0)…
--# saved #--

View file

@ -4,9 +4,11 @@
--- text ---
| {}"" {}"idk" {}" is esperanto" |
--- error ---
can't call overload overload<($(name::($(x) type(x) == t)) _), ($(name::($(x) type(x) == t)) _)>: no function match (type(5, "nope")), possible functions were:
• (name::($(x) type(x) == t)): type check failure for parameter name in function (name::($(x) type(x) == t))
• (name::($(x) type(x) == t)): type check failure for parameter name in function (name::($(x) type(x) == t))
can't call overload a: no function match arguments (type(5, "nope")), possible functions were:
• $(name::($(x) type(x) == t)) (from test/tests/function custom type dispatch error.ans:7:1):
type check failure for parameter name
• $(name::($(x) type(x) == t)) (from test/tests/function custom type dispatch error.ans:4:1):
type check failure for parameter name
↳ from test/tests/function custom type dispatch error.ans:14:2 in call: a(type(5, "nope"))
↳ from ? in block: :french name = "french name"…
--# saved #--

View file

@ -2,14 +2,14 @@
--- text ---
| {}"a" |
--- text ---
| {}"b" |
--- text ---
| {}"c" |
--- text ---
| {}"a" |
--- text ---
| {}"a" |
--- text ---
| {}"c" |
| {}"b" |
--- return ---
()
--# saved #--
{"a.checkpoint":false, "a.run":3, "c.checkpoint":false, "c.run":2}
{"a.checkpoint":false, "a.run":2, "b.checkpoint":false, "b.run":2, "c.checkpoint":false, "c.run":1}

View file

@ -1,6 +1,6 @@
--# run #--
--- error ---
identifier "b" is undefined in branch 7dfcaa5b-2163-4f36-116ed-c4ab6bc8d28b
identifier "b" is undefined in branch 46991f07-7340-4104-9f35-c1fb62e95088
↳ from test/tests/function scope wrong.ans:4:7 in identifier: b
↳ from test/tests/function scope wrong.ans:4:1 in text interpolation: | a: {b} |
↳ from ? in block: :a = ($() _)…

View file

@ -1,12 +1,18 @@
--# run #--
--- error ---
can't call overload overload<($(s::($(x) type(x) == t), k::($(x) <lua function>)) = val; _), ($(s::($(x) type(x) == t), k::($(x) <lua function>)) = val; _), ($(s::($(x) type(x) == t), k::($(x) <lua function>)) _), ($(c::($(x) <lua function>), s::($(x) <lua function>)) = v; <lua function>), ($(c::($(x) <lua function>), s::($(x) <lua function>)) = v; <lua function>), ($(c::($(x) <lua function>), s::($(x) <lua function>)) <lua function>)>: no function match (overload<($(b) _), ($(x) _), ($() _)>, "a"), possible functions were:
• (s::($(x) type(x) == t), k::($(x) <lua function>)) = val: expected 3 arguments, received 2
• (s::($(x) type(x) == t), k::($(x) <lua function>)) = val: expected 3 arguments, received 2
• (s::($(x) type(x) == t), k::($(x) <lua function>)): type check failure for parameter s in function (s::($(x) type(x) == t), k::($(x) <lua function>))
• (c::($(x) <lua function>), s::($(x) <lua function>)) = v: expected 3 arguments, received 2
• (c::($(x) <lua function>), s::($(x) <lua function>)) = v: expected 3 arguments, received 2
• (c::($(x) <lua function>), s::($(x) <lua function>)): type check failure for parameter c in function (c::($(x) <lua function>), s::($(x) <lua function>))
can't call overload _._: no function match arguments (overload([($(b) _), ($(x) _), ($() _)]), "a"), possible functions were:
• $(s::is script, k::is symbol) = val (from stdlib/script.ans:44:1):
expected 3 arguments, received 2
• $(s::is script, k::is string) = val (from stdlib/script.ans:42:1):
expected 3 arguments, received 2
• $(s::is script, k::is string) (from stdlib/script.ans:40:1):
type check failure for parameter s
• $(c::is function, s::is symbol) = v (from test/tests/function separate variable from variants.ans:10:4):
expected 3 arguments, received 2
• $(c::is function, s::is string) = v (from test/tests/function separate variable from variants.ans:10:4):
expected 3 arguments, received 2
• $(c::is function, s::is string) (from test/tests/function separate variable from variants.ans:10:4):
type check failure for parameter c
↳ from test/tests/function separate variable from variants.ans:10:4 in call: f . "a"
↳ from test/tests/function separate variable from variants.ans:10:1 in text interpolation: | {f . "a"} = 2 |
↳ from ? in block: :f = ($() _)…

View file

@ -1,9 +1,9 @@
--# run #--
--- error ---
can't call overload overload<($(a::($(x) <lua function>)) _), ($(x::($(x) <lua function>)) _)>: more than one function match (5), matching functions were at least (specificity 1.3):
(x::($(x) <lua function>))
(a::($(x) <lua function>))
can't call overload fn: more than one function match arguments (5), matching functions were at least (specificity 1.2):
$(x::is number) (from test/tests/function type dispatch ambigous.ans:1:1)
$(a::is number) (from test/tests/function type dispatch ambigous.ans:4:1)
↳ from test/tests/function type dispatch ambigous.ans:7:3 in call: fn(5)
↳ from ? in block: :fn = ($(x::number) _)…
↳ from ? in block: :fn = ($(x::is number) _)…
--# saved #--
{}

View file

@ -4,14 +4,14 @@
↳ from test/tests/merge nested mutable error bis.ans:14:7 in call: error("abort")
↳ from test/tests/merge nested mutable error bis.ans:3:1 in block: insert(a, b)…
↳ from test/tests/merge nested mutable error bis.ans:3:18 in call: _
↳ from script.ans:30:6 in call: fn!
↳ from script.ans:28:3 in block: resume target = ()…
↳ from script.ans:28:7 in call: else!
↳ from script.ans:24:2 in block: if(fn . "current checkpoint")…
↳ from script.ans:24:9 in call: _
↳ from script.ans:38:9 in call: value(s)!
↳ from script.ans:37:1 in block: value(s)!
↳ from script.ans:37:20 in call: _
↳ from stdlib/script.ans:30:6 in call: fn!
↳ from stdlib/script.ans:28:3 in block: resume target = ()…
↳ from stdlib/script.ans:28:7 in call: else!
↳ from stdlib/script.ans:24:2 in block: if(fn . "current checkpoint")…
↳ from stdlib/script.ans:24:9 in call: _
↳ from stdlib/script.ans:38:9 in call: value(s)!
↳ from stdlib/script.ans:37:1 in block: value(s)!
↳ from stdlib/script.ans:37:20 in call: _
↳ from test/tests/merge nested mutable error bis.ans:19:2 in call: f!
↳ from ? in block: :a = *[1]…
--# post run check #--

View file

@ -4,14 +4,14 @@
↳ from test/tests/merge nested mutable error.ans:14:7 in call: error("abort")
↳ from test/tests/merge nested mutable error.ans:3:1 in block: insert(a, b)…
↳ from test/tests/merge nested mutable error.ans:3:18 in call: _
↳ from script.ans:30:6 in call: fn!
↳ from script.ans:28:3 in block: resume target = ()…
↳ from script.ans:28:7 in call: else!
↳ from script.ans:24:2 in block: if(fn . "current checkpoint")…
↳ from script.ans:24:9 in call: _
↳ from script.ans:38:9 in call: value(s)!
↳ from script.ans:37:1 in block: value(s)!
↳ from script.ans:37:20 in call: _
↳ from stdlib/script.ans:30:6 in call: fn!
↳ from stdlib/script.ans:28:3 in block: resume target = ()…
↳ from stdlib/script.ans:28:7 in call: else!
↳ from stdlib/script.ans:24:2 in block: if(fn . "current checkpoint")…
↳ from stdlib/script.ans:24:9 in call: _
↳ from stdlib/script.ans:38:9 in call: value(s)!
↳ from stdlib/script.ans:37:1 in block: value(s)!
↳ from stdlib/script.ans:37:20 in call: _
↳ from test/tests/merge nested mutable error.ans:19:2 in call: f!
↳ from ? in block: :a = *[1]…
--# post run check #--