Error: undefined method 'size' for optional Enumerables
christopherzimmerman opened this issue · comments
Chris Zimmerman commented
When a method is generated to accept Enumerable?
as an argument, the generated code leaves paths with certain variables undefined, causing compile-time errors.
Minimal example:
require "gobject"
require_gobject "Arrow"
b = Arrow::Buffer.new(Bytes.new(10))
arr = Arrow::Tensor.new(Arrow::UInt8DataType.new, b, [10], [1], nil)
puts arr
# > 21190 | if strides
# > 21191 | __strides = strides ? (__strides_ary = strides.map { |__item| Int64.new(__item) }.to_a).to_unsafe : Pointer(Int64).null
# > 21192 | n_strides = __strides_ary.size
# ^---
# Error: undefined method 'size' for Nil (compile-time type is (Array(Int64) | Nil))