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
classCrinjamoduleObjectendaliasRaw=Int32|Crinja::Object|Array(Value)
structValuegetter raw : Rawdefinitialize(@raw : Raw)
enddefraw_eachcase object =@rawwhenIterable(Value)
RawIterator.new(object.each)
elseraiseRuntimeError.new("#{object.class} is not iterable")
endendclassRawIteratorincludeIterator(Raw)
definitialize(@iterator : Iterator(Value))
enddefnextcase value =@iterator.next
whenValue
value.raw
else
stop
endendendendclassTupleincludeIndexable(Value)
includeObjectdefunsafe_fetch(index : Int)
Crinja::Value.new(1)
enddefsize1endendendstructStructWithIteratorincludeCrinja::Objectinclude ::Iterable(Crinja::Value)
defeach
iter = uninitialized Iterator(Crinja::Value)
iter
endend# also crashes with an invalid memory access sometimesCrinja::Value.new(Crinja::Tuple.new).raw_each.next # => #<Iterator::Stop:0x7f24db1b8fe0>
The above should print 1 instead. The error goes away if either include inside StructWithIterator is removed, or if StructWithIterator#each returns a more specific type like [Crinja::Value.new(1)].each. This might be related to #7044 or #10967.
The text was updated successfully, but these errors were encountered:
Taken from straight-shoota/crinja#70:
The above should print 1 instead. The error goes away if either
include
insideStructWithIterator
is removed, or ifStructWithIterator#each
returns a more specific type like[Crinja::Value.new(1)].each
. This might be related to #7044 or #10967.The text was updated successfully, but these errors were encountered: