Skip to content

Commit

Permalink
Add compile fail tests for custom where
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGVSV committed Jan 28, 2024
1 parent 6ea40de commit fcce728
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use bevy_reflect::Reflect;
use std::marker::PhantomData;

#[derive(Clone)]
struct ReflectMyTrait;

#[derive(Reflect)]
#[reflect(MyTrait, where)]
pub struct Foo<T> {
value: String,
_marker: PhantomData<T>,
}

#[derive(Reflect)]
#[reflect(where, MyTrait)]
pub struct Bar<T> {
value: String,
_marker: PhantomData<T>,
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: expected identifier, found keyword `where`
--> tests/reflect_derive/custom_where.fail.rs:8:20
|
8 | #[reflect(MyTrait, where)]
| ^^^^^

error: unexpected token
--> tests/reflect_derive/custom_where.fail.rs:15:16
|
15 | #[reflect(where, MyTrait)]
| ^
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use bevy_reflect::Reflect;
use std::marker::PhantomData;

#[derive(Clone)]
struct ReflectMyTrait;

#[derive(Reflect)]
#[reflect(MyTrait)]
#[reflect(where)]
pub struct Foo<T> {
value: String,
_marker: PhantomData<T>,
}

#[derive(Reflect)]
#[reflect(where)]
#[reflect(MyTrait)]
pub struct Bar<T> {
value: String,
_marker: PhantomData<T>,
}

fn main() {}

0 comments on commit fcce728

Please sign in to comment.