rename best_upper_bound
to postdom_upper_bound
This commit is contained in:
parent
a54b91ff5b
commit
1630c7912f
2 changed files with 9 additions and 9 deletions
|
@ -104,7 +104,7 @@ impl FreeRegionMap {
|
||||||
let r_a = ty::ReFree(fr_a);
|
let r_a = ty::ReFree(fr_a);
|
||||||
let r_b = ty::ReFree(fr_b);
|
let r_b = ty::ReFree(fr_b);
|
||||||
let result = if fr_a == fr_b { r_a } else {
|
let result = if fr_a == fr_b { r_a } else {
|
||||||
match self.relation.best_upper_bound(&r_a, &r_b) {
|
match self.relation.postdom_upper_bound(&r_a, &r_b) {
|
||||||
None => ty::ReStatic,
|
None => ty::ReStatic,
|
||||||
Some(r) => *r,
|
Some(r) => *r,
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ impl<T:Debug+PartialEq> TransitiveRelation<T> {
|
||||||
///
|
///
|
||||||
/// Examples are probably clearer than any prose I could write
|
/// Examples are probably clearer than any prose I could write
|
||||||
/// (there are corresponding tests below, btw). In each case,
|
/// (there are corresponding tests below, btw). In each case,
|
||||||
/// the query is `best_upper_bound(a, b)`:
|
/// the query is `postdom_upper_bound(a, b)`:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// // returns Some(x), which is also LUB
|
/// // returns Some(x), which is also LUB
|
||||||
|
@ -127,7 +127,7 @@ impl<T:Debug+PartialEq> TransitiveRelation<T> {
|
||||||
/// a -> a1
|
/// a -> a1
|
||||||
/// b -> b1
|
/// b -> b1
|
||||||
/// ```
|
/// ```
|
||||||
pub fn best_upper_bound(&self, a: &T, b: &T) -> Option<&T> {
|
pub fn postdom_upper_bound(&self, a: &T, b: &T) -> Option<&T> {
|
||||||
let mut mubs = self.minimal_upper_bounds(a, b);
|
let mut mubs = self.minimal_upper_bounds(a, b);
|
||||||
loop {
|
loop {
|
||||||
match mubs.len() {
|
match mubs.len() {
|
||||||
|
@ -422,7 +422,7 @@ fn mubs_best_choice_scc() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bub_crisscross() {
|
fn pdub_crisscross() {
|
||||||
// diagonal edges run left-to-right
|
// diagonal edges run left-to-right
|
||||||
// a -> a1 -> x
|
// a -> a1 -> x
|
||||||
// \/ ^
|
// \/ ^
|
||||||
|
@ -438,11 +438,11 @@ fn bub_crisscross() {
|
||||||
relation.add("b1", "x");
|
relation.add("b1", "x");
|
||||||
|
|
||||||
assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"a1", &"b1"]);
|
assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"a1", &"b1"]);
|
||||||
assert_eq!(relation.best_upper_bound(&"a", &"b"), Some(&"x"));
|
assert_eq!(relation.postdom_upper_bound(&"a", &"b"), Some(&"x"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bub_crisscross_more() {
|
fn pdub_crisscross_more() {
|
||||||
// diagonal edges run left-to-right
|
// diagonal edges run left-to-right
|
||||||
// a -> a1 -> a2 -> a3 -> x
|
// a -> a1 -> a2 -> a3 -> x
|
||||||
// \/ \/ ^
|
// \/ \/ ^
|
||||||
|
@ -467,11 +467,11 @@ fn bub_crisscross_more() {
|
||||||
|
|
||||||
assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"a1", &"b1"]);
|
assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"a1", &"b1"]);
|
||||||
assert_eq!(relation.minimal_upper_bounds(&"a1", &"b1"), vec![&"a2", &"b2"]);
|
assert_eq!(relation.minimal_upper_bounds(&"a1", &"b1"), vec![&"a2", &"b2"]);
|
||||||
assert_eq!(relation.best_upper_bound(&"a", &"b"), Some(&"x"));
|
assert_eq!(relation.postdom_upper_bound(&"a", &"b"), Some(&"x"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bub_lub() {
|
fn pdub_lub() {
|
||||||
// a -> a1 -> x
|
// a -> a1 -> x
|
||||||
// ^
|
// ^
|
||||||
// |
|
// |
|
||||||
|
@ -484,7 +484,7 @@ fn bub_lub() {
|
||||||
relation.add("b1", "x");
|
relation.add("b1", "x");
|
||||||
|
|
||||||
assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"x"]);
|
assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"x"]);
|
||||||
assert_eq!(relation.best_upper_bound(&"a", &"b"), Some(&"x"));
|
assert_eq!(relation.postdom_upper_bound(&"a", &"b"), Some(&"x"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue