forked from move-language/move
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move-prover] add a test case for warnings on uninstanted invariants
Closes: #9545
- Loading branch information
1 parent
78a6671
commit e6ce2a8
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
language/move-prover/tests/sources/functional/uninst_global_invariant.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
warning: Failed to instantiate all type parameters in this global invariant | ||
┌─ tests/sources/functional/uninst_global_invariant.move:11:9 | ||
│ | ||
7 │ move_to(&account, S1 {}); | ||
│ ------- When instrumenting the global invariant here | ||
· | ||
11 │ invariant<T> exists<S1>(@0x42) ==> exists<S2<T>>(@0x42); | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
17 changes: 17 additions & 0 deletions
17
language/move-prover/tests/sources/functional/uninst_global_invariant.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module 0x42::Test { | ||
struct S1 has key, store {} | ||
|
||
struct S2<T: store> has key, store { t: T } | ||
|
||
fun foo(account: signer) { | ||
move_to(&account, S1 {}); | ||
} | ||
|
||
spec module { | ||
invariant<T> exists<S1>(@0x42) ==> exists<S2<T>>(@0x42); | ||
|
||
// When applying invariant I to function foo, we cannot | ||
// find a valid instantiation for the type parameter `T`. | ||
// therefore, this global invariant cannot be checked. | ||
} | ||
} |