public function getType()
{
$newtype = new Type(NativeQuackType::T_LIST);
$type = (object) ['from' => $this->from->getType(), 'to' => $this->to->getType(), 'by' => null !== $this->by ? $this->by->getType() : null];
$throw_error_on = function ($operand, $got) {
throw new ScopeError(['message' => "Expected number on operand `{$operand}' of range expression. Got {$got}"]);
};
if (!$type->from->isNumber()) {
$throw_error_on('from', $type->from);
}
if (!$type->to->isNumber()) {
$throw_error_on('to', $type->to);
}
if (null !== $type->by && !$type->by->isNumber()) {
$throw_error_on('by', $type->by);
}
$newtype->subtype = Type::getBaseType(array_filter(array_values((array) $type), function ($t) {
return null !== $t;
}));
return $newtype;
}