Report unification of a logical with itself as a failure.
This commit is contained in:
parent
6c0a9d404b
commit
6953939e4a
|
|
@ -118,6 +118,10 @@ class LogicalImpl<T> : JoinableLogical<T> {
|
|||
val thisRepr = this.find()
|
||||
val otherRepr = (other as LogicalImpl<T>).find()
|
||||
|
||||
if (thisRepr === otherRepr) {
|
||||
throw IllegalStateException("cannnot unite logical with itself")
|
||||
}
|
||||
|
||||
// invariant: thisRepr.rank > otherRepr.rank
|
||||
if (thisRepr.rank() < otherRepr.rank()) {
|
||||
otherRepr.union(thisRepr, reconciler);
|
||||
|
|
|
|||
Loading…
Reference in New Issue