Skip to content

Commit 3abc61d

Browse files
committed
tweak tables ui test
1 parent a98ab14 commit 3abc61d

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

crates/bindings/tests/ui/tables.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ struct TypeParam<T> {
1414
struct ConstParam<const X: u8> {}
1515

1616
#[derive(spacetimedb::SpacetimeType)]
17-
enum Alpha { Beta, Gamma }
17+
struct Alpha {
18+
beta: u8,
19+
}
1820

1921
#[spacetimedb::table(name = delta)]
2022
struct Delta {
@@ -27,8 +29,8 @@ struct Delta {
2729

2830
#[spacetimedb::reducer]
2931
fn bad_filter_on_index(ctx: &spacetimedb::ReducerContext) {
30-
ctx.db.delta().compound_a().find(Alpha::Beta);
31-
ctx.db.delta().compound_b().filter(Alpha::Gamma);
32+
ctx.db.delta().compound_a().find(Alpha { beta: 0 });
33+
ctx.db.delta().compound_b().filter(Alpha { beta: 1 });
3234
}
3335

3436
fn main() {}

crates/bindings/tests/ui/tables.stderr

+13-13
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,22 @@ note: required by a bound in `spacetimedb::spacetimedb_lib::ser::SerializeNamedP
118118
| ^^^^^^^^^ required by this bound in `SerializeNamedProduct::serialize_element`
119119

120120
error[E0277]: `&'a Alpha` cannot appear as an argument to an index filtering operation
121-
--> tests/ui/tables.rs:30:33
121+
--> tests/ui/tables.rs:32:33
122122
|
123-
30 | ctx.db.delta().compound_a().find(Alpha::Beta);
123+
32 | ctx.db.delta().compound_a().find(Alpha { beta: 0 });
124124
| ^^^^ should be an integer type, `bool`, `String`, `&str`, `Identity`, `ConnectionId`, or `Hash`, not `&'a Alpha`
125125
|
126126
= help: the trait `for<'a> FilterableValue` is not implemented for `&'a Alpha`
127127
= note: The allowed set of types are limited to integers, bool, strings, `Identity`, `ConnectionId`, and `Hash`
128128
= help: the following other types implement trait `FilterableValue`:
129129
&ConnectionId
130130
&Identity
131+
&Lifecycle
132+
&RawMiscModuleExportV9
133+
&TableAccess
134+
&TableType
131135
&bool
132136
&ethnum::int::I256
133-
&ethnum::uint::U256
134-
&i128
135-
&i16
136-
&i32
137137
and $N others
138138
note: required by a bound in `UniqueColumn::<Tbl, <Col as spacetimedb::table::Column>::ColType, Col>::find`
139139
--> src/table.rs
@@ -145,22 +145,22 @@ note: required by a bound in `UniqueColumn::<Tbl, <Col as spacetimedb::table::Co
145145
| ^^^^^^^^^^^^^^^ required by this bound in `UniqueColumn::<Tbl, <Col as Column>::ColType, Col>::find`
146146

147147
error[E0277]: the trait bound `Alpha: IndexScanRangeBounds<(Alpha,), SingleBound>` is not satisfied
148-
--> tests/ui/tables.rs:31:40
148+
--> tests/ui/tables.rs:33:40
149149
|
150-
31 | ctx.db.delta().compound_b().filter(Alpha::Gamma);
151-
| ------ ^^^^^^^^^^^^ the trait `FilterableValue` is not implemented for `Alpha`
150+
33 | ctx.db.delta().compound_b().filter(Alpha { beta: 1 });
151+
| ------ ^^^^^^^^^^^^^^^^^ the trait `FilterableValue` is not implemented for `Alpha`
152152
| |
153153
| required by a bound introduced by this call
154154
|
155155
= help: the following other types implement trait `FilterableValue`:
156156
&ConnectionId
157157
&Identity
158+
&Lifecycle
159+
&RawMiscModuleExportV9
160+
&TableAccess
161+
&TableType
158162
&bool
159163
&ethnum::int::I256
160-
&ethnum::uint::U256
161-
&i128
162-
&i16
163-
&i32
164164
and $N others
165165
= note: required for `Alpha` to implement `IndexScanRangeBounds<(Alpha,), SingleBound>`
166166
note: required by a bound in `RangedIndex::<Tbl, IndexType, Idx>::filter`

0 commit comments

Comments
 (0)