-
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.
add ability check on number constraints
- Loading branch information
1 parent
9fa7bae
commit fd0bc1a
Showing
11 changed files
with
237 additions
and
64 deletions.
There are no files selected for viewing
122 changes: 64 additions & 58 deletions
122
.../move-compiler-v2/tests/ability-check/v1-typing/module_call_constraints_not_satisfied.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 |
---|---|---|
@@ -1,213 +1,219 @@ | ||
|
||
Diagnostics: | ||
error: type `S` is missing required ability `key` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:28:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:32:9 | ||
│ | ||
15 │ fun both<R: key, C: copy>(_r: R, _c: C) { | ||
│ - declaration of type parameter `R` | ||
· | ||
28 │ both(S{}, Coin{}); | ||
32 │ both(S{}, Coin{}); | ||
│ ^^^^ | ||
│ | ||
= required by instantiating type parameter `R:key` of function `both` | ||
|
||
error: type `Coin` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:29:9 | ||
│ | ||
15 │ fun both<R: key, C: copy>(_r: R, _c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
29 │ both(0, Coin{}) | ||
│ ^^^^ | ||
error: constraint `integer` does not have required ability `key` | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:33:14 | ||
│ | ||
= required by instantiating type parameter `C:copy` of function `both` | ||
33 │ both(0, Coin{}) | ||
│ ^ | ||
|
||
error: type `Box<C>` is missing required ability `key` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:33:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:37:9 | ||
│ | ||
15 │ fun both<R: key, C: copy>(_r: R, _c: C) { | ||
│ - declaration of type parameter `R` | ||
· | ||
33 │ both(new_box<C>(), new_box<R>()) | ||
37 │ both(new_box<C>(), new_box<R>()) | ||
│ ^^^^ | ||
│ | ||
= required by instantiating type parameter `R:key` of function `both` | ||
|
||
error: type `Box3<C, C, C>` is missing required ability `key` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:37:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:41:9 | ||
│ | ||
23 │ fun rsrc<R: key>(_r: R) { | ||
27 │ fun rsrc<R: key>(_r: R) { | ||
│ - declaration of type parameter `R` | ||
· | ||
37 │ rsrc(new_box3<C, C, C>()); | ||
41 │ rsrc(new_box3<C, C, C>()); | ||
│ ^^^^ | ||
│ | ||
= required by instantiating type parameter `R:key` of function `rsrc` | ||
|
||
error: type `R` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:39:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:43:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
39 │ cpy(new_box3<R, C, C>()); | ||
43 │ cpy(new_box3<R, C, C>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `C` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:40:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:44:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
40 │ cpy(new_box3<C, R, C>()); | ||
44 │ cpy(new_box3<C, R, C>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `C` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:41:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:45:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
41 │ cpy(new_box3<C, C, R>()); | ||
45 │ cpy(new_box3<C, C, R>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `C` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:43:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:47:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
43 │ cpy(new_box3<C, R, R>()); | ||
47 │ cpy(new_box3<C, R, R>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `R` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:44:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:48:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
44 │ cpy(new_box3<R, C, R>()); | ||
48 │ cpy(new_box3<R, C, R>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `R` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:45:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:49:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
45 │ cpy(new_box3<R, R, C>()); | ||
49 │ cpy(new_box3<R, R, C>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `R` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:47:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:51:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
47 │ cpy(new_box3<R, R, R>()); | ||
51 │ cpy(new_box3<R, R, R>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `U` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:51:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:55:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
51 │ cpy(new_box3<U, C, C>()); | ||
55 │ cpy(new_box3<U, C, C>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `C` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:52:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:56:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
52 │ cpy(new_box3<C, U, C>()); | ||
56 │ cpy(new_box3<C, U, C>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `C` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:53:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:57:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
53 │ cpy(new_box3<C, C, U>()); | ||
57 │ cpy(new_box3<C, C, U>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `C` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:55:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:59:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
55 │ cpy(new_box3<C, U, U>()); | ||
59 │ cpy(new_box3<C, U, U>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `U` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:56:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:60:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
56 │ cpy(new_box3<U, C, U>()); | ||
60 │ cpy(new_box3<U, C, U>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `U` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:57:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:61:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
57 │ cpy(new_box3<U, U, C>()); | ||
61 │ cpy(new_box3<U, U, C>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `U` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:59:9 | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:63:9 | ||
│ | ||
19 │ fun cpy<C: copy>(_c: C) { | ||
23 │ fun cpy<C: copy>(_c: C) { | ||
│ - declaration of type parameter `C` | ||
· | ||
59 │ cpy(new_box3<U, U, U>()); | ||
63 │ cpy(new_box3<U, U, U>()); | ||
│ ^^^ | ||
│ | ||
= required by instantiating type parameter `T1` of struct `Box3` | ||
= required by instantiating type parameter `C:copy` of function `cpy` | ||
|
||
error: type `Coin` is missing required ability `copy` (type was inferred) | ||
┌─ tests/ability-check/v1-typing/module_call_constraints_not_satisfied.move:67:9 | ||
│ | ||
19 │ fun both_1<R: copy, C: key>(_r: R, _c: C) { | ||
│ - declaration of type parameter `R` | ||
· | ||
67 │ both_1(Coin{}, 0) | ||
│ ^^^^^^ | ||
│ | ||
= required by instantiating type parameter `R:copy` of function `both_1` |
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
8 changes: 4 additions & 4 deletions
8
...ty/move/move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied2.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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
Diagnostics: | ||
bug: unexpected type: _ | ||
┌─ tests/ability-check/v1-typing/pack_constraint_not_satisfied2.move:6:9 | ||
error: constraint `integer` does not have required ability `key` | ||
┌─ tests/ability-check/v1-typing/pack_constraint_not_satisfied2.move:7:27 | ||
│ | ||
6 │ fun t0() { | ||
│ ^^ | ||
7 │ R {r:_ } = R { r: 0 }; | ||
│ ^ |
Oops, something went wrong.