Skip to content

Commit

Permalink
Updated for generalized binary operators.
Browse files Browse the repository at this point in the history
Type inference with operators was changed in rust-lang/rust#23673.
  • Loading branch information
SSheldon committed Apr 2, 2015
1 parent 1e1706b commit 8ca01ec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ mod tests {
let result: *const Object = unsafe {
msg_send![obj, self]
};
let obj_ptr: *const Object = &*obj;
assert!(result == obj_ptr);
assert!(result == &*obj);
}

#[test]
Expand Down Expand Up @@ -146,9 +145,12 @@ mod tests {
let superclass = test_utils::custom_class();
unsafe {
let _: () = msg_send![obj, setFoo:4u32];
assert!(msg_send![super(obj, superclass), foo] == 4u32);
let foo: u32 = msg_send![super(obj, superclass), foo];
assert!(foo == 4);

// The subclass is overriden to return foo + 2
assert!(msg_send![obj, foo] == 6u32);
let foo: u32 = msg_send![obj, foo];
assert!(foo == 6);
}
}
}
5 changes: 2 additions & 3 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,7 @@ mod tests {
let cls = Class::get("NSObject").unwrap();
let obj = test_utils::sample_object();
assert!(obj.class() == cls);
let isa = unsafe { *obj.get_ivar("isa") };
let cls_ptr: *const Class = cls;
assert!(isa == cls_ptr);
let isa: *const Class = unsafe { *obj.get_ivar("isa") };
assert!(isa == cls);
}
}
2 changes: 1 addition & 1 deletion src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub fn custom_subclass() -> &'static Class {
let mut decl = ClassDecl::new(superclass, "CustomSubclassObject").unwrap();

extern fn custom_subclass_get_foo(this: &Object, _cmd: Sel) -> u32 {
let foo = unsafe {
let foo: u32 = unsafe {
msg_send![super(this, custom_class()), foo]
};
foo + 2
Expand Down

0 comments on commit 8ca01ec

Please sign in to comment.