The market operates under the assumption that all other companies that stay profitable long enough will eventually do the same. And as long as management is seen as competent, is indifferent about whether "eventually" comes tomorrow or 20 years from now.
For an extreme example, the markets have long rewarded Berkshire Hathaway for its growth in profits, even though no money was returned in any way to investors for 40 years. (There has since been a small buyback.)