Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert-by-compute fails to substitute type arguments #1446

Open
tjhance opened this issue Feb 12, 2025 · 0 comments
Open

assert-by-compute fails to substitute type arguments #1446

tjhance opened this issue Feb 12, 2025 · 0 comments
Assignees

Comments

@tjhance
Copy link
Collaborator

tjhance commented Feb 12, 2025

Usually this results in invalid AIR. See for example this test, which I attempted to add as part of #1406:

test_verify_one_file! {
    #[ignore] #[test] default_impl_1_issue1406 verus_code! {
        trait Tr {
            spec fn foo(&self) -> bool { true }
        }

        struct X { }

        impl Tr for X {
            spec fn foo(&self) -> bool { false }
        }

        spec fn foo_wrapper<T: Tr>(t: &T) -> bool {
            t.foo()
        }

        proof fn test2() {
            let x = X { };
            assert(foo_wrapper(&x)) by(compute); // FAILS
        }
    } => Err(err) => assert_fails(err, 1)
}

This test is ignored because it currently panics.

This can also be a soundness error, when type parameters have overlapping names. This shouldn't pass, but it does:

trait Tr {
    spec fn foo() -> bool;
}

spec fn hello<A: Tr, B: Tr>() -> bool {
    A::foo()
}

proof fn test<A: Tr, B: Tr>()
    requires A::foo(),
{
    assert(hello::<B, A>()) by(compute);
    assert(B::foo());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants