-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler-v2] Add missing ability check of receiver function type pa…
…rameters (#14987) * Adding better error message for bytecode verifier ability check, plus displaying message in compiler pipeline. This also demonstrates the problem with bug #14813 * [compiler-v2] Add missing ability check of receiver function type parameters Closes #14813 The first commit here demonstrates the error and improves on how we display bytecode verification errors, the 2nd fixes the issue in the compiler.
- Loading branch information
Showing
14 changed files
with
75 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
12 changes: 12 additions & 0 deletions
12
third_party/move/move-compiler-v2/tests/checking/abilities/bug_14813_fun_call_ability.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,12 @@ | ||
|
||
Diagnostics: | ||
error: type `V` is missing required ability `drop` | ||
┌─ tests/checking/abilities/bug_14813_fun_call_ability.move:6:9 | ||
│ | ||
6 │ self.search(key) | ||
│ ^^^^^^^^^^^^^^^^ | ||
· | ||
9 │ fun search<V: drop>(self: &Map<V>, key: u256): bool { | ||
│ - declaration of type parameter `V` | ||
│ | ||
= required by instantiating type parameter `V:drop` of function `search` |
12 changes: 12 additions & 0 deletions
12
third_party/move/move-compiler-v2/tests/checking/abilities/bug_14813_fun_call_ability.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,12 @@ | ||
module 0x815::red_black_map { | ||
|
||
struct Map<phantom V> has drop {} | ||
|
||
public fun contains<V>(self: &Map<V>, key: u256): bool { | ||
self.search(key) | ||
} | ||
|
||
fun search<V: drop>(self: &Map<V>, key: u256): bool { | ||
true | ||
} | ||
} |
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
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
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
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
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
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
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
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
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