-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move][move-compiler] Revise block comment parsing to be more-resilie…
…nt (#20424) ## Description Partially revise block comment parsing, plus fix issues around parsing `/**/` ## Test plan New tests that work now --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
- Loading branch information
Showing
5 changed files
with
126 additions
and
58 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
18 changes: 18 additions & 0 deletions
18
external-crates/move/crates/move-compiler/tests/move_check/parser/block_comments_inline.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,18 @@ | ||
warning[W01004]: invalid documentation comment | ||
┌─ tests/move_check/parser/block_comments_inline.move:11:61 | ||
│ | ||
11 │ let /*comment*/s = S { /***/w, /**/x, /*comment*/y, /** doc */z }; | ||
│ ^^^^^^^^ Documentation comment cannot be matched to a language item | ||
|
||
warning[W01004]: invalid documentation comment | ||
┌─ tests/move_check/parser/block_comments_inline.move:12:17 | ||
│ | ||
12 │ let S { /****/w, /**/x, /*comment*/y, /** doc */z } = /*comment*/s; | ||
│ ^^^^ Documentation comment cannot be matched to a language item | ||
|
||
warning[W01004]: invalid documentation comment | ||
┌─ tests/move_check/parser/block_comments_inline.move:12:47 | ||
│ | ||
12 │ let S { /****/w, /**/x, /*comment*/y, /** doc */z } = /*comment*/s; | ||
│ ^^^^^^^^ Documentation comment cannot be matched to a language item | ||
|
15 changes: 15 additions & 0 deletions
15
external-crates/move/crates/move-compiler/tests/move_check/parser/block_comments_inline.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,15 @@ | ||
module 0x42::m { | ||
|
||
struct S { | ||
/*comment*/ w: u64, | ||
/*comment*/ x: u64, | ||
/**/ y: u64, | ||
/** doc */ z: u64, | ||
} | ||
|
||
fun t(w: u64, x: u64, /*ignore*/y: u64, z:u64/**/): (u64, u64, u64, u64) { | ||
let /*comment*/s = S { /***/w, /**/x, /*comment*/y, /** doc */z }; | ||
let S { /****/w, /**/x, /*comment*/y, /** doc */z } = /*comment*/s; | ||
(w, x, y, z) | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
external-crates/move/crates/move-compiler/tests/move_check/parser/empty_doc_comment.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,16 @@ | ||
module 0x42::m { | ||
/* */ | ||
struct A { } | ||
/** **/ | ||
struct B { } | ||
/** */ | ||
struct C { } | ||
/*** */ | ||
struct D { } | ||
/****/ | ||
struct E { } | ||
/***/ | ||
struct F { } | ||
/**/ | ||
struct G { } | ||
} |