Created
December 20, 2019 22:32
-
-
Save chetkhatri/9a9db80d52c1b8e19aae31945cd7520f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def monotonizeCommitTimestamps[T <: CommitMarker](commits: Array[T]): Array[T] = { | |
commits.tail.scanLeft(commits.head)((prev, current) => { | |
assert(prev.getVersion < current.getVersion, "Unordered commits provided.") | |
if (prev.getTimestamp >= current.getTimestamp) { | |
logWarning(s"Found Delta commit ${prev.getVersion} with a timestamp ${prev.getTimestamp} " + | |
s"which is greater than the next commit timestamp ${current.getTimestamp}.") | |
current.withTimestamp(prev.getTimestamp + 1).asInstanceOf[T] | |
} | |
else { | |
current | |
} | |
}) | |
} |
does changing the signature to private def monotonizeCommitTimestamps[T <: CommitMarker : scala.reflect.ClassTag](commits: Array[T]): Array[T]
compile?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this gives an error,
is there anyway without changing the return type actual I can return Array[T]?