-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for no fn attr on 'self' argument
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen] | ||
pub struct A { | ||
inner: u32 | ||
} | ||
|
||
#[wasm_bindgen] | ||
impl A { | ||
#[wasm_bindgen] | ||
pub fn method_with_self_attr1( | ||
#[wasm_bindgen(unchecked_param_type = "number")] | ||
&self, | ||
arg: u32 | ||
) -> JsValue { | ||
(self.inner + arg).into() | ||
} | ||
|
||
#[wasm_bindgen] | ||
pub fn method_with_self_attr2( | ||
#[wasm_bindgen(param_description = "some description")] | ||
&self, | ||
arg: u32 | ||
) -> JsValue { | ||
(self.inner + arg).into() | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: expected non-macro attribute, found attribute macro `wasm_bindgen` | ||
--> ui-tests/invalid-self-fn-attrs.rs:12:11 | ||
| | ||
12 | #[wasm_bindgen(unchecked_param_type = "number")] | ||
| ^^^^^^^^^^^^ not a non-macro attribute | ||
|
||
error: expected non-macro attribute, found attribute macro `wasm_bindgen` | ||
--> ui-tests/invalid-self-fn-attrs.rs:21:11 | ||
| | ||
21 | #[wasm_bindgen(param_description = "some description")] | ||
| ^^^^^^^^^^^^ not a non-macro attribute |