Looks like you're missing a type parameter on your return type:
proc newStackObj*[T](vals: varargs[T]): StackObj =
should be:
proc newStackObj*[T](vals: varargs[T]): StackObj[T] =
(I had similar misleading errors when forgetting type parameters in various places. I've learned to check those well...)