Type* slice_type = args->front()->type();
if (!slice_type->is_slice_type())
{
- error_at(args->front()->location(), "argument 1 must be a slice");
+ if (slice_type->is_nil_type())
+ error_at(args->front()->location(), "use of untyped nil");
+ else
+ error_at(args->front()->location(),
+ "argument 1 must be a slice");
this->set_is_error();
return this;
}
const Expression_list* args = this->args();
if (args == NULL || args->empty())
return Type::make_error_type();
- return args->front()->type();
+ Type *ret = args->front()->type();
+ if (!ret->is_slice_type())
+ return Type::make_error_type();
+ return ret;
}
case BUILTIN_REAL: