Repository: diesel-rs/diesel
File: diesel_derives/tests/auto_type.rs (Rust)

Code before:
        .and(pg_extras::jsonb.has_key(s))
        .and(pg_extras::jsonb.contains(pg_extras::jsonb))
        .and(pg_extras::jsonb.remove(1_i32).eq(pg_extras::jsonb))
        .and(pg_extras::jsonb.remove_by_path(v).eq(pg_extras::jsonb))
        .and(pg_extras::jsonb.is_contained_by(pg_extras::jsonb))
}

#[cfg(feature = "postgres")]
#[auto_type]
fn test_pg_range_expression_methods() -> _ {
    let my_range: (Bound<i32>, Bound<i32>) = (Bound::Included(2), Bound::Included(7));

    pg_extras::range
        .contains_range(my_range)
        .and(pg_extras::range.is_contained_by(my_range))
    // `.contains()` cannot be supported here as
    // the type level constraints are slightly different
    // for `Range<>` than for the other types that provide a `contains()`
    // function. We could likely support it by
    // renaming the function to `.range_contains()` (or something similar)
    // .contains(42_i32)
    //.select(
    // this kind of free standing functions is not supported by auto_type yet
    //lower(pg_extras::range),
    // The auto_trait also dind't like this one
    //int4range(None, Some(5i32), RangeBound::LowerBoundInclusiveUpperBoundInclusive),
    //)
}

#[cfg(feature = "postgres")]
#[auto_type]
fn test_pg_binary_expression_methods() -> _ {
    let b: &'static [u8] = &[];
    pg_extras::blob
        .concat(pg_extras::blob)
        .like(pg_extras::blob)
        .and(pg_extras::blob.not_like(b))
}

#[cfg(feature = "postgres")]
#[auto_type]
fn test_pg_any_json_expression_methods() -> _ {
    let s: &'static str = "";
    let s2: &'static [&'static str] = &[];

    pg_extras::jsonb
        .retrieve_as_object(s)
        .retrieve_as_text(s)
        .eq(s)
        .and(
            pg_extras::jsonb

Review comment (bug):
The `autotype` fails [here](https://github.com/diesel-rs/diesel/actions/runs/9864095934/job/27238332012?pr=4107), but I can understand the reason

Code after:
        .and(pg_extras::jsonb.has_key(s))
        .and(pg_extras::jsonb.contains(pg_extras::jsonb))
        .and(pg_extras::jsonb.remove(1_i32).eq(pg_extras::jsonb))
        .and(pg_extras::jsonb.remove_by_path(v).eq(pg_extras::jsonb))
        .and(pg_extras::jsonb.is_contained_by(pg_extras::jsonb))
}

#[cfg(feature = "postgres")]
#[auto_type]
fn test_pg_range_expression_methods() -> _ {
    let my_range: (Bound<i32>, Bound<i32>) = (Bound::Included(2), Bound::Included(7));

    pg_extras::range
        .contains_range(my_range)
        .and(pg_extras::range.is_contained_by(my_range))
    // `.contains()` cannot be supported here as
    // the type level constraints are slightly different
    // for `Range<>` than for the other types that provide a `contains()`
    // function. We could likely support it by
    // renaming the function to `.range_contains()` (or something similar)
    // .contains(42_i32)
    //.select(
    // this kind of free standing functions is not supported by auto_type yet
    //lower(pg_extras::range),
    // The auto_trait also didn't like this one
    //int4range(None, Some(5i32), RangeBound::LowerBoundInclusiveUpperBoundInclusive),
    //)
}

#[cfg(feature = "postgres")]
#[auto_type]
fn test_pg_binary_expression_methods() -> _ {
    let b: &'static [u8] = &[];
    pg_extras::blob
        .concat(pg_extras::blob)
        .like(pg_extras::blob)
        .and(pg_extras::blob.not_like(b))
}

#[cfg(feature = "postgres")]
#[auto_type]
fn test_pg_any_json_expression_methods() -> _ {
    let s: &'static str = "";
    let s2: &'static [&'static str] = &[];

    pg_extras::jsonb
        .retrieve_as_object(s)
        .retrieve_as_text(s)
        .eq(s)
        .and(
            pg_extras::jsonb