Allow multiple num impls to be imported at once

If we import num::num, it gets reexported implicitly and causes collisions if
you try to import (for example) int::num and i8::num at the same time.
This commit is contained in:
Ben Striegel 2012-06-09 01:36:26 -04:00
parent 56c6c65186
commit d14d4155de
2 changed files with 3 additions and 5 deletions

View file

@ -1,6 +1,5 @@
import T = inst::T;
import cmp::{eq, ord};
import num::num;
export min_value, max_value;
export min, max;
@ -124,7 +123,7 @@ impl eq of eq for T {
}
}
impl num of num for T {
impl num of num::num for T {
fn add(&&other: T) -> T { ret self + other; }
fn sub(&&other: T) -> T { ret self - other; }
fn mul(&&other: T) -> T { ret self * other; }
@ -196,7 +195,7 @@ fn test_to_str() {
#[test]
fn test_ifaces() {
fn test<U:num>(ten: U) {
fn test<U:num::num>(ten: U) {
assert (ten.to_int() == 10);
let two = ten.from_int(2);

View file

@ -1,6 +1,5 @@
import T = inst::T;
import cmp::{eq, ord};
import num::num;
export min_value, max_value;
export min, max;
@ -65,7 +64,7 @@ impl eq of eq for T {
}
}
impl num of num for T {
impl num of num::num for T {
fn add(&&other: T) -> T { ret self + other; }
fn sub(&&other: T) -> T { ret self - other; }
fn mul(&&other: T) -> T { ret self * other; }