Skip to content

Commit

Permalink
Further refactor macro internals
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jan 16, 2023
1 parent b98689d commit ab5b696
Show file tree
Hide file tree
Showing 14 changed files with 707 additions and 662 deletions.
1 change: 1 addition & 0 deletions crates/objc2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
* Allow empty structs in `declare_class!` macro.
* Allow using `extern_methods!` without the `ClassType` trait in scope.
* Fixed a few small issues with `declare_class!`.


## 0.3.0-beta.4 - 2022-12-24
Expand Down
36 changes: 36 additions & 0 deletions crates/objc2/src/declare/declare_class_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,39 @@ declare_class!(
fn test_all_the_bool() {
let _ = DeclareClassAllTheBool::class();
}

declare_class!(
struct DeclareClassUnreachable;

unsafe impl ClassType for DeclareClassUnreachable {
type Super = NSObject;
}

// Ensure none of these warn
unsafe impl DeclareClassUnreachable {
#[method(unreachable)]
fn unreachable(&self) -> bool {
unreachable!()
}

#[method(unreachableClass)]
fn unreachable_class() -> bool {
unreachable!()
}

#[method(unreachableVoid)]
fn unreachable_void(&self) {
unreachable!()
}

#[method(unreachableClassVoid)]
fn unreachable_class_void() {
unreachable!()
}
}
);

#[test]
fn test_unreachable() {
let _ = DeclareClassUnreachable::class();
}
Loading

0 comments on commit ab5b696

Please sign in to comment.