Skip to content

Commit cb74417

Browse files
committed
fix error in converison to string
1 parent 5f4deb8 commit cb74417

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

lib/conversions/src/RLCToRuby.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,9 @@ namespace mlir::rlc
479479
w.writenl("def to_s");
480480
{
481481
auto _ = w.indent();
482-
w.writenl("__string = String.malloc");
483-
w.writenl(
484-
overload.getMangledName(),
485-
"(__string.content.to_ptr, @content.to_ptr)");
486-
w.writenl("return __string.content.to_s");
482+
w.write("__string = RLC::_");
483+
w.writenl(overload.getMangledName(), "(self)");
484+
w.writenl("return RLC::to_ruby_str(__string)");
487485
}
488486
w.writenl("end");
489487
}

tool/rlc/test/wrappers/ruby_tic_tac_toe.rl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import serialization.to_byte_vector
1212
import string
1313
import action
14+
import learn
1415

1516
cls Board:
1617
BInt<0, 3>[9] slots
@@ -148,9 +149,19 @@ fun pretty_print(Game g):
148149
print(to_print)
149150
i = i + 1
150151

151-
fun ensure_template_creation(Game g):
152-
from_string(g, to_string(g))
153152

154153
#--- to_run.rb
155154
require_relative 'library'
156155
puts(RLC::to_ruby_str(RLC::to_string(RLC::play)))
156+
157+
action = RLC::RLCAnyGameAction.new
158+
_actions = RLC::enumerate(action)
159+
puts(_actions)
160+
actions = (0..._actions.size).map { |i| RLC::RLCAnyGameAction.new(_actions.get(i)) }
161+
puts(actions[0])
162+
puts(actions[1])
163+
puts(actions[2])
164+
state = RLC::play
165+
puts(state)
166+
RLC::apply(actions[0], state)
167+
puts(state)

0 commit comments

Comments
 (0)