You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A trait default calling a requirement by its bare name fails on BEAM: unbound variable #759
A trait default that calls one of the trait's own requirements by its bare name passes the checker and runs on the walker. On BEAM it does not compile: the lowering emits the name as an unbound variable.
trait Named do
name :> String
let shout = name.upperCase
end
record Dog do
id : Integer = 0
end
make Dog, implement: Named do
let name = "rex"
end
main do
IO.printLine(Dog {}.shout)
end
$ kex -C min.kex
No errors found.
$ kex -R min.kex
REX
$ kex min.kex
kex_min: unbound variable 'Name' in shout/1
error: erlc failed
The emitted Core Erlang for shout/1 passes Name as a variable instead of calling name on the receiver:
Writing this.name.upperCase works on both backends.
This is the example in plugins/kex/skills/kex/SKILL.md ("Types, records and traits": let shout = label.upperCase), so the guide kex --skill prints teaches a program that fails under the default kex file.kex. skill_test did not catch it because it runs the guide's examples with --run-walker only (tests/skill_test.cxx:144); filed separately.
Activity