Hello! Please, look at this sample code, errors occurs at 2 lines at the end and I am really confused, why… What is the differnece between “a” and “a2”+“a3”? Thanks!
def all_relation_transformer_classes
{{RelationTransformer.subclasses}}
end
class RelationTransformer
end
class PowerConnectionRelationTransformer < RelationTransformer
end
a : Array(RelationTransformer) = Array(RelationTransformer).new
a << PowerConnectionRelationTransformer.new
pp a # OK
a2 : Array(RelationTransformer) = all_relation_transformer_classes.map { |rtc| rtc.new } # error
a3 : Array(RelationTransformer) = Array{PowerConnectionRelationTransformer.new} # error
# both errors are: Error: type must be Array(RelationTransformer), not Array(PowerConnectionRelationTransformer)