Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/ui/function-contracts/non_bool_contracts.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
|
| #[kani::requires(a + b)]
| -----------------^^^^^--
| | |
| | expected `bool`, found `u64`
| arguments to this function are incorrect
|

|
| #[kani::ensures(|result| a % *result && b % *result == 0 && *result != 0)]
| ^^^^^^^^^^^ expected `bool`, found `u64`
13 changes: 13 additions & 0 deletions tests/ui/function-contracts/non_bool_contracts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Zfunction-contracts

// This tests that Kani reports the "ideal" error message when contracts are non-boolean expressions
// By "ideal," we mean that the error spans are as narrow as possible
// (c.f. https://github.com/model-checking/kani/issues/3009)

#[kani::requires(a + b)]
#[kani::ensures(|result| a % *result && b % *result == 0 && *result != 0)]
fn gcd(a: u64, b: u64) -> u64 {
0
}