Skip to content

Commit 62a3bee

Browse files
committed
Add remote FromReflect to compile tests
1 parent 8d2268c commit 62a3bee

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

crates/bevy_reflect_compile_fail_tests/tests/reflect_remote/nested.fail.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,40 @@ mod external_crate {
88
mod missing_attribute {
99
use bevy_reflect::{reflect_remote, Reflect};
1010

11-
#[reflect_remote(super::external_crate::TheirOuter<T>)]
11+
#[reflect_remote(super::external_crate::TheirOuter<T>, FromReflect)]
1212
struct MyOuter<T: Reflect> {
1313
// Reason: Missing `#[reflect(remote = "...")]` attribute
1414
pub inner: super::external_crate::TheirInner<T>,
1515
}
1616

17-
#[reflect_remote(super::external_crate::TheirInner<T>)]
17+
#[reflect_remote(super::external_crate::TheirInner<T>, FromReflect)]
1818
struct MyInner<T: Reflect>(pub T);
1919
}
2020

2121
mod incorrect_inner_type {
2222
use bevy_reflect::{reflect_remote, Reflect};
2323

24-
#[reflect_remote(super::external_crate::TheirOuter<T>)]
24+
#[reflect_remote(super::external_crate::TheirOuter<T>, FromReflect)]
2525
struct MyOuter<T: Reflect> {
2626
// Reason: Should not use `MyInner<T>` directly
2727
pub inner: MyInner<T>,
2828
}
2929

30-
#[reflect_remote(super::external_crate::TheirInner<T>)]
30+
#[reflect_remote(super::external_crate::TheirInner<T>, FromReflect)]
3131
struct MyInner<T: Reflect>(pub T);
3232
}
3333

3434
mod mismatched_remote_type {
3535
use bevy_reflect::{reflect_remote, Reflect};
3636

37-
#[reflect_remote(super::external_crate::TheirOuter<T>)]
37+
#[reflect_remote(super::external_crate::TheirOuter<T>, FromReflect)]
3838
struct MyOuter<T: Reflect> {
3939
// Reason: Should be `MyInner<T>`
4040
#[reflect(remote = "MyOuter<T>")]
4141
pub inner: super::external_crate::TheirInner<T>,
4242
}
4343

44-
#[reflect_remote(super::external_crate::TheirInner<T>)]
44+
#[reflect_remote(super::external_crate::TheirInner<T>, FromReflect)]
4545
struct MyInner<T: Reflect>(pub T);
4646
}
4747

crates/bevy_reflect_compile_fail_tests/tests/reflect_remote/nested.fail.stderr

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1+
error[E0308]: `?` operator has incompatible types
2+
--> tests/reflect_remote/nested.fail.rs:24:5
3+
|
4+
24 | #[reflect_remote(super::external_crate::TheirOuter<T>, FromReflect)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `TheirInner`, found struct `incorrect_inner_type::MyInner`
6+
|
7+
= note: `?` operator cannot convert from `incorrect_inner_type::MyInner<T>` to `TheirInner<T>`
8+
= note: expected struct `TheirInner<T>`
9+
found struct `incorrect_inner_type::MyInner<T>`
10+
= note: this error originates in the attribute macro `reflect_remote` (in Nightly builds, run with -Z macro-backtrace for more info)
11+
112
error[E0277]: the trait bound `TheirInner<T>: Reflect` is not satisfied
213
--> tests/reflect_remote/nested.fail.rs:24:5
314
|
4-
24 | #[reflect_remote(super::external_crate::TheirOuter<T>)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Reflect` is not implemented for `TheirInner<T>`
15+
24 | #[reflect_remote(super::external_crate::TheirOuter<T>, FromReflect)]
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Reflect` is not implemented for `TheirInner<T>`
617
|
718
= help: the following other types implement trait `Reflect`:
819
&'static Path
@@ -20,8 +31,8 @@ error[E0277]: the trait bound `TheirInner<T>: Reflect` is not satisfied
2031
error[E0277]: the trait bound `TheirInner<T>: Reflect` is not satisfied
2132
--> tests/reflect_remote/nested.fail.rs:24:5
2233
|
23-
24 | #[reflect_remote(super::external_crate::TheirOuter<T>)]
24-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Reflect` is not implemented for `TheirInner<T>`
34+
24 | #[reflect_remote(super::external_crate::TheirOuter<T>, FromReflect)]
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Reflect` is not implemented for `TheirInner<T>`
2536
|
2637
= help: the following other types implement trait `Reflect`:
2738
&'static Path
@@ -39,8 +50,8 @@ error[E0277]: the trait bound `TheirInner<T>: Reflect` is not satisfied
3950
error[E0277]: the trait bound `TheirInner<T>: Reflect` is not satisfied
4051
--> tests/reflect_remote/nested.fail.rs:24:5
4152
|
42-
24 | #[reflect_remote(super::external_crate::TheirOuter<T>)]
43-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Reflect` is not implemented for `TheirInner<T>`
53+
24 | #[reflect_remote(super::external_crate::TheirOuter<T>, FromReflect)]
54+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Reflect` is not implemented for `TheirInner<T>`
4455
|
4556
= help: the following other types implement trait `Reflect`:
4657
&'static Path
@@ -57,8 +68,8 @@ error[E0277]: the trait bound `TheirInner<T>: Reflect` is not satisfied
5768
error[E0308]: mismatched types
5869
--> tests/reflect_remote/nested.fail.rs:37:5
5970
|
60-
37 | #[reflect_remote(super::external_crate::TheirOuter<T>)]
61-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `TheirInner`, found struct `TheirOuter`
71+
37 | #[reflect_remote(super::external_crate::TheirOuter<T>, FromReflect)]
72+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `TheirInner`, found struct `TheirOuter`
6273
...
6374
41 | pub inner: super::external_crate::TheirInner<T>,
6475
| ------------------------------------ expected due to this

crates/bevy_reflect_compile_fail_tests/tests/reflect_remote/nested.pass.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ mod external_crate {
77
pub struct TheirInner<T>(pub T);
88
}
99

10-
#[reflect_remote(external_crate::TheirOuter<T>)]
10+
#[reflect_remote(external_crate::TheirOuter<T>, FromReflect)]
1111
struct MyOuter<T: Reflect> {
1212
#[reflect(remote = "MyInner<T>")]
1313
pub inner: external_crate::TheirInner<T>,
1414
}
1515

16-
#[reflect_remote(external_crate::TheirInner<T>)]
16+
#[reflect_remote(external_crate::TheirInner<T>, FromReflect)]
1717
struct MyInner<T: Reflect>(pub T);
1818

1919
fn main() {}

0 commit comments

Comments
 (0)