-
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.
- Loading branch information
1 parent
ade516d
commit b309830
Showing
3 changed files
with
82 additions
and
25 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
third_party/move/move-compiler-v2/tests/checking/typing/bug_15274.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,41 @@ | ||
|
||
Diagnostics: | ||
error: type `T` is missing required ability `store` | ||
┌─ tests/checking/typing/bug_15274.move:16:30 | ||
│ | ||
16 │ unwrap_non_receiver(&Wrapper<T>[account]) | ||
│ ^^^^^^^^^^ | ||
│ | ||
= required by instantiating type parameter `T:copy` of struct `Wrapper` | ||
= required by instantiating type parameter `T:key` of function `borrow_global` | ||
|
||
error: type `T` is missing required ability `store` | ||
┌─ tests/checking/typing/bug_15274.move:20:9 | ||
│ | ||
20 │ Wrapper<T>[account].unwrap() | ||
│ ^^^^^^^^^^ | ||
│ | ||
= required by instantiating type parameter `T:copy` of struct `Wrapper` | ||
= required by instantiating type parameter `T:key` of function `borrow_global` | ||
|
||
error: type `T` is missing required ability `copy` | ||
┌─ tests/checking/typing/bug_15274.move:23:39 | ||
│ | ||
3 │ struct Wrapper<T: copy> has drop, key, store, copy { | ||
│ - declaration of type parameter `T` | ||
· | ||
23 │ fun test_vec<T>(v: vector<Wrapper<T>>): T { | ||
│ ^ | ||
│ | ||
= required by instantiating type parameter `T:copy` of struct `Wrapper` | ||
|
||
error: type `T` is missing required ability `copy` | ||
┌─ tests/checking/typing/bug_15274.move:24:9 | ||
│ | ||
7 │ fun unwrap<T: copy>(self: &Wrapper<T>): T { | ||
│ - declaration of type parameter `T` | ||
· | ||
24 │ v[0].unwrap() | ||
│ ^^^^^^^^^^^^^ | ||
│ | ||
= required by instantiating type parameter `T:copy` of function `unwrap` |
27 changes: 27 additions & 0 deletions
27
third_party/move/move-compiler-v2/tests/checking/typing/bug_15274.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,27 @@ | ||
module 0x42::test { | ||
|
||
struct Wrapper<T: copy> has drop, key, store, copy { | ||
inner: T | ||
} | ||
|
||
fun unwrap<T: copy>(self: &Wrapper<T>): T { | ||
self.inner | ||
} | ||
|
||
fun unwrap_non_receiver<T: copy>(self1: &Wrapper<T>): T { | ||
self1.inner | ||
} | ||
|
||
fun dispatch_non_receiver<T: copy>(account: address): T acquires Wrapper { | ||
unwrap_non_receiver(&Wrapper<T>[account]) | ||
} | ||
|
||
fun dispatch<T: copy>(account: address): T acquires Wrapper { | ||
Wrapper<T>[account].unwrap() | ||
} | ||
|
||
fun test_vec<T>(v: vector<Wrapper<T>>): T { | ||
v[0].unwrap() | ||
} | ||
|
||
} |
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