Closed mame closed 5 years ago
Sorry, I noticed that adding require "types/core"
solves the latter case.
I guess that in the former case, the array literal is considered as a type of 0-member tuple, but I have not found the solution yet.
You are correct-- in the former case, the literal is considered as tuple type []
, which for soundness reasons is not considered a subtype of Array
(see issue #64 for a more detailed explanation). Currently, you can solve this issue by type casting []
, i.e., @ary = RDL.type_cast([], "Array")
.
The comp-types branch of RDL uses type-level computations to bring a greater level of precision to various library types, including Arrays. It greatly reduces the need for type casts like the aforementioned one. We'll be merging that branch with master very shortly.
What should I do?
Another case: