-- ROBLOX deviation: no annotation for "..." args

function getLabelPrinter(...): PrintLabel
	local strings: Array<string> = { ... }

	local maxLength = Array.reduce(strings, function(max, string_)
		return math.max(#string_, max)
	end, 0)

	return function(string_: string): string
		-- ROBLOX deviation: We need to throw an error since string.rep called for
		-- a negative repetition doesn't actually throw whereas upstream
		-- would throw
		if #string_ > maxLength then
			error("Cannot print label for string with length larger than the max allowed of " .. maxLength)
		end
		return string.format("%s: %s", string_, string.rep(" ", maxLength - #string_))
	end
end

function matcherErrorMessage(
	hint: string, -- assertion returned from call to matcherHint
	generic: string, -- condition which correct value must fulfill
	specific: string? -- incorrect value returned from call to printWithType
): string
	if typeof(specific) == "string" then
		return string.format("%s\n\n%s: %s%s", hint, BOLD_WEIGHT("Matcher error"), generic, "\n\n" .. specific)
	else
		return string.format("%s\n\n%s: %s%s", hint, BOLD_WEIGHT("Matcher error"), generic, "")
	end
end
