-
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
Zekun Wang
committed
Mar 15, 2024
1 parent
5ec55c1
commit 1a6837b
Showing
2 changed files
with
122 additions
and
100 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
136 changes: 73 additions & 63 deletions
136
third_party/move/move-compiler-v2/tests/checking/typing/recursive_struct.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 |
---|---|---|
@@ -1,77 +1,87 @@ | ||
module 0x42::simple_recursion { | ||
struct S { | ||
f: T | ||
} | ||
struct T { | ||
f: S | ||
} | ||
|
||
struct S1 { | ||
f: S2 | ||
} | ||
|
||
struct S2 { | ||
f: S3 | ||
} | ||
|
||
struct S3 { | ||
f: S1 | ||
} | ||
|
||
struct S4<T> { | ||
f: S4<bool> | ||
} | ||
|
||
struct S5 { | ||
f: S5 | ||
} | ||
|
||
struct S6 { | ||
f: S7 | ||
} | ||
|
||
struct S7 { | ||
f: S7 | ||
} | ||
struct S { | ||
f: T | ||
} | ||
struct T { | ||
f: S | ||
} | ||
|
||
struct S1 { | ||
f: S2 | ||
} | ||
|
||
struct S2 { | ||
f: S3 | ||
} | ||
|
||
struct S3 { | ||
f: S1 | ||
} | ||
|
||
struct S4<T> { | ||
f: S4<bool> | ||
} | ||
|
||
struct S5 { | ||
f: S5 | ||
} | ||
|
||
struct S6 { | ||
f: S7 | ||
} | ||
|
||
struct S7 { | ||
f: S7 | ||
} | ||
|
||
struct X { | ||
f: Y, | ||
g: Y, | ||
} | ||
|
||
struct Y { | ||
f: X, | ||
g: X | ||
} | ||
} | ||
|
||
module 0x42::type_param { | ||
struct S { | ||
f: G<S> | ||
} | ||
struct S { | ||
f: G<S> | ||
} | ||
|
||
struct U<T> { | ||
f: G<U<T>> | ||
} | ||
struct U<T> { | ||
f: G<U<T>> | ||
} | ||
|
||
struct G<T> { | ||
f: T | ||
} | ||
struct G<T> { | ||
f: T | ||
} | ||
|
||
struct S1 { | ||
f: vector<S1> | ||
} | ||
struct S1 { | ||
f: vector<S1> | ||
} | ||
|
||
struct S2<T1, T2> { | ||
f: S3<u8, S2<T1, T2>> | ||
} | ||
struct S2<T1, T2> { | ||
f: S3<u8, S2<T1, T2>> | ||
} | ||
|
||
struct S3<T1, T2> { | ||
f: S2<u8, S3<u8, u8>> | ||
} | ||
struct S3<T1, T2> { | ||
f: S2<u8, S3<u8, u8>> | ||
} | ||
|
||
struct S4<T> { | ||
f: S4<S4<T>> | ||
} | ||
struct S4<T> { | ||
f: S4<S4<T>> | ||
} | ||
} | ||
|
||
module 0x42::instantiate_with_self { | ||
struct S<T> { | ||
f: T | ||
} | ||
|
||
struct U { | ||
// this is ok | ||
f: S<S<u8>> | ||
} | ||
struct S<T> { | ||
f: T | ||
} | ||
|
||
struct U { | ||
// this is ok | ||
f: S<S<u8>> | ||
} | ||
} |