function Trove.AddPromise(F,t)if F._cleaning then error("\067\097\110\110\111\116 \099\097\108\108 \116\114\111\118\101\058\065\100\100\080\114\111\109\105\115\101\040\041 \119\104\105\108\101 \099\108\101\097\110\105\110\103",2)end AssertPromiseLike(t)if t:getStatus()=="\083\116\097\114\116\101\100"then t:finally(function()if F._cleaning then return end F:_findAndRemoveFromObjects(t,false)end)F:Add(t,"\099\097\110\099\101\108")end return t end

function Trove:AddPromise(promise)
	if self._cleaning then
		error("Cannot call trove:AddPromise() while cleaning", 2)
	end
	AssertPromiseLike(promise)
	if promise:getStatus() == "Started" then
		promise:finally(function()
			if self._cleaning then
				return
			end
			self:_findAndRemoveFromObjects(promise, false)
		end)
		self:Add(promise, "cancel")
	end
	return promise
end
