summaryrefslogtreecommitdiff
path: root/core/src/main/scala/forge/discover
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-11-05 14:12:48 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-05 14:12:48 -0800
commit44bd42587532755439fcdc175eb95604966bbea8 (patch)
tree400e2a16dc02f6b60ab9af30907fd7b3d96d053c /core/src/main/scala/forge/discover
parent2fd4c498cc005182ef65a20db30f461f0893508a (diff)
downloadmill-44bd42587532755439fcdc175eb95604966bbea8.tar.gz
mill-44bd42587532755439fcdc175eb95604966bbea8.tar.bz2
mill-44bd42587532755439fcdc175eb95604966bbea8.zip
Add a simple consistency checker on `Discovered` to test if any of the observable `Target`s in the given base are not being properly cached
Diffstat (limited to 'core/src/main/scala/forge/discover')
-rw-r--r--core/src/main/scala/forge/discover/Discovered.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/main/scala/forge/discover/Discovered.scala b/core/src/main/scala/forge/discover/Discovered.scala
index 964732be..8d340569 100644
--- a/core/src/main/scala/forge/discover/Discovered.scala
+++ b/core/src/main/scala/forge/discover/Discovered.scala
@@ -12,6 +12,13 @@ class Discovered[T](val value: Seq[(Seq[String], Format[_], T => Target[_])]){
}
object Discovered {
+ def consistencyCheck[T](base: T, d: Discovered[T]) = {
+ val inconsistent = for{
+ (path, formatter, targetGen) <- d.value
+ if targetGen(base) ne targetGen(base)
+ } yield path
+ inconsistent
+ }
def makeTuple[T, V](path: Seq[String], func: T => Target[V])(implicit f: Format[V]) = {
(path, f, func)
}