Skip to content

Support references to generic types in quoted code #47

@shadaj

Description

@shadaj

fold initialization with Default: better error messages

I was puzzled by the fact that my KVS<V> that stores V's was compiling but failing at runtime due to

.fold(q!(|| V::default()), q!(|acc, i| *acc = i));

Turns out that Claude knew that I could use Default::default():

.fold(q!(|| Default::default()), q!(|acc, i| *acc = i));

That makes sense to me based on what I know about q!, but it'd be helpful to have better messages than:

error[E0433]: failed to resolve: use of undeclared type `V`
   --> examples/_process_0_549E49F2.rs:852:48
    |
852 | ...                   || V::default()
    |                          ^ use of undeclared type `V`
    ```

_Originally posted by @jhellerstein in https://github.com/hydro-project/hydro/discussions/2223#discussioncomment-14808784_

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions