forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move-compiler] More unicode support (MystenLabs#14582)
## Description - Relaxed ASCII restriction for Move files, banning only certain control structures ## Test Plan - New tests --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [X] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes Move comments and byte-strings now support unicode characters. Unicode escape sequences are not yet implemented.
- Loading branch information
Showing
16 changed files
with
136 additions
and
51 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
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
6 changes: 0 additions & 6 deletions
6
...al-crates/move/crates/move-compiler/tests/move_check/parser/invalid_character_comment.exp
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
...l-crates/move/crates/move-compiler/tests/move_check/parser/invalid_character_comment.move
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...rnal-crates/move/crates/move-compiler/tests/move_check/parser/invalid_character_emoji.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,6 @@ | ||
error[E01001]: invalid character | ||
┌─ tests/move_check/parser/invalid_character_emoji.move:5:4 | ||
│ | ||
5 │ ❤️ | ||
│ ^ Unexpected character: '\u{2764}' | ||
|
8 changes: 8 additions & 0 deletions
8
...nal-crates/move/crates/move-compiler/tests/move_check/parser/invalid_character_emoji.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,8 @@ | ||
address 0x1 { | ||
|
||
// Check that we provide good error messages for non-ASCII characters. | ||
module Temp { | ||
❤️ | ||
} | ||
|
||
} |
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
19 changes: 19 additions & 0 deletions
19
...crates/move/crates/move-compiler/tests/move_check/parser/non_ascii_character_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,19 @@ | ||
address 0x1 { | ||
|
||
// Non-ASCII characters in comments (e.g., ф) are also allowed. | ||
module temp { | ||
/// ❤️ Also in doc comments 💝 | ||
public fun foo() {} | ||
/* block | ||
Comment | ||
Γ ⊢ λ x. x : ∀α. α → α | ||
*/ | ||
public fun bar() {} | ||
} | ||
|
||
} | ||
|
||
module a::n { | ||
public fun foo() { 0x1::temp::foo() } | ||
public fun bar() { 0x1::temp::bar() } | ||
} |
5 changes: 5 additions & 0 deletions
5
...-crates/move/crates/move-compiler/tests/move_check/parser/non_ascii_character_string.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,5 @@ | ||
module a::m { | ||
public fun foo(): vector<u8> { | ||
b"Γ ⊢ λ x. x : ∀α. α → α" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
external-crates/move/crates/move-compiler/tests/move_check/parser/trojan_source.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,6 @@ | ||
error[E01001]: invalid character | ||
┌─ tests/move_check/parser/trojan_source.move:3:24 | ||
│ | ||
3 │ agent == b"user // Check if user " | ||
│ Invalid character '\u{202e}' found when reading file. For ASCII, only printable characters (tabs '\t', lf '\n' and crlf '\r'+'\n') are permitted. Unicode can be used in comments and string literals, excluding certain control characters. | ||
|
5 changes: 5 additions & 0 deletions
5
external-crates/move/crates/move-compiler/tests/move_check/parser/trojan_source.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,5 @@ | ||
module a::m { | ||
public fun is_user(agent: vector<u8>): bool { | ||
agent == b"user // Check if user " | ||
} | ||
} |
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