Skip to content

Commit

Permalink
Post-rebase fixes and test regenaration
Browse files Browse the repository at this point in the history
  • Loading branch information
awelc committed Apr 8, 2024
1 parent 796a5b5 commit d1d3193
Show file tree
Hide file tree
Showing 26 changed files with 217 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use move_ir_types::location::Loc;
use std::{collections::BTreeSet, fmt};

// This should be replaced with std::mem::variant::count::<Tok>() if it ever comes out of nightly.
pub const TOK_COUNT: usize = 76;
pub const TOK_COUNT: usize = 77;

#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum Tok {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ const ATTR_STARTS: &[Tok] = &[Tok::Identifier, Tok::For];

pub static ATTR_START_SET: Lazy<TokenSet> = Lazy::new(|| TokenSet::from(ATTR_STARTS));

const FIELD_BINDING_STARTS: &[Tok] = &[Tok::Mut, Tok::Identifier, Tok::RestrictedIdentifier];
const FIELD_BINDING_STARTS: &[Tok] = &[
Tok::Mut,
Tok::Identifier,
Tok::RestrictedIdentifier,
Tok::PeriodPeriod,
];

pub static FIELD_BINDING_START_SET: Lazy<TokenSet> =
Lazy::new(|| TokenSet::from(FIELD_BINDING_STARTS));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
error[E04036]: non-exhaustive pattern
┌─ tests/development/enums/matching/at_patterns.move:30:16
30 │ match (x) {
│ ^ Pattern 'Maybe::Just(_)' not covered

error[E01002]: unexpected token
┌─ tests/development/enums/matching/at_patterns.move:31:13
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
error[E04036]: non-exhaustive pattern
┌─ tests/development/enums/matching/at_patterns_mut_ref.move:30:16
30 │ match (x) {
│ ^ Pattern 'Maybe::Just(_)' not covered

error[E01002]: unexpected token
┌─ tests/development/enums/matching/at_patterns_mut_ref.move:31:13
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
error[E04036]: non-exhaustive pattern
┌─ tests/development/enums/matching/at_patterns_ref.move:30:16
30 │ match (x) {
│ ^ Pattern 'Maybe::Just(_)' not covered

error[E01002]: unexpected token
┌─ tests/development/enums/matching/at_patterns_ref.move:31:13
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module 0x42::m {
}

fun t1(): u64 {
let o: Option<u64> = Option::None;
let mut o: Option<u64> = Option::None;
match (&mut o) {
Option::Some(n) if n == &5 => *n,
Option::None => 3,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
error[E01018]: invalid 'match'
┌─ tests/development/enums/matching/invalid_at.move:8:9
8 │ ╭ match (opt) {
9 │ │ _ @ Option::Some(128u8) => (),
10 │ │ }
│ ╰─────────^ Invalid 'match' form. 'match' must have at least one arm

error[E01002]: unexpected token
┌─ tests/development/enums/matching/invalid_at.move:9:13
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
error[E01018]: invalid 'match'
┌─ tests/development/enums/matching/invalid_match_tuple.move:6:9
6 │ ╭ match (x()) {
7 │ │ (x, y) => ()
8 │ │ }
│ ╰─────────^ Invalid 'match' form. 'match' must have at least one arm

error[E01002]: unexpected token
┌─ tests/development/enums/matching/invalid_match_tuple.move:7:15
Expand All @@ -7,6 +15,15 @@ error[E01002]: unexpected token
│ Unexpected ','
│ Expected ')'

error[E01002]: unexpected token
┌─ tests/development/enums/matching/invalid_match_tuple.move:7:18
7 │ (x, y) => ()
│ ^
│ │
│ Unexpected ')'
│ Expected '=>'

error[E04005]: expected a single type
┌─ tests/development/enums/matching/invalid_match_tuple.move:12:16
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
error[E01018]: invalid 'match'
┌─ tests/development/enums/matching/invalid_match_unit.move:6:9
6 │ ╭ match (x()) {
7 │ │ () => ()
8 │ │ }
│ ╰─────────^ Invalid 'match' form. 'match' must have at least one arm

error[E01002]: unexpected token
┌─ tests/development/enums/matching/invalid_match_unit.move:7:14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ error[E01002]: unexpected token
13 │ Done(x: u64),
│ ^ Cannot use named fields in a positional definition

error[E01002]: unexpected token
┌─ tests/development/enums/parser/enum_invalid.move:14:18
14 │ Add { u64 },
│ ^
│ │
│ Unexpected '}'
│ Expected ':'

Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ error[E01002]: unexpected token
3 │ Done(x: u64),
│ ^ Cannot use named fields in a positional definition

error[E01002]: unexpected token
┌─ tests/development/enums/parser/enum_invalid_2.move:4:18
4 │ Add { u64 },
│ ^
│ │
│ Unexpected '}'
│ Expected ':'

Original file line number Diff line number Diff line change
@@ -1,6 +1,66 @@
error[E04016]: too few arguments
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:10:10
10 │ Option::Other { mut x: mut y } => y,
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Missing pattern for field 'x' in '0x42::m::Option::Other'

error[E01002]: unexpected token
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:10:26
10 │ Option::Other { mut x: mut y } => y,
│ ^^^ 'mut' modifier can only be used on variable bindings

error[E03009]: unbound variable
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:10:44
10 │ Option::Other { mut x: mut y } => y,
│ ^ Unbound variable 'y'

error[E02010]: invalid name
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:11:33
11 │ Option::Other { x: mut y<u64> } => y,
│ ^ Invalid type arguments on a pattern variable
= Type arguments cannot appear on pattern variables

error[E04016]: too few arguments
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:12:10
12 │ Option::Other { mut x: y } => y,
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^ Missing pattern for field 'x' in '0x42::m::Option::Other'

error[E01002]: unexpected token
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:12:26
12 │ Option::Other { mut x: y } => y,
│ ^^^ 'mut' modifier can only be used on variable bindings

error[E03009]: unbound variable
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:12:40
12 │ Option::Other { mut x: y } => y,
│ ^ Unbound variable 'y'

warning[W09002]: unused variable
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:13:10
13 │ x @ mut Option::Some(true) => true,
│ ^ Unused local variable 'x'. Consider removing or prefixing with an underscore: '_x'
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')

error[E01002]: unexpected token
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:13:14
13 │ x @ mut Option::Some(true) => true,
│ ^^^ Invalid 'mut' keyword on non-variable pattern

error[E02010]: invalid name
┌─ tests/development/enums/parser/invalid_mut_usage_match.move:14:10
14 │ mut Option::None => false,
│ ^^^ ------------ This refers to a variant, not a variable binding
│ │
│ 'mut' can only be used with variable bindings in patterns

Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
error[E01018]: invalid 'match'
┌─ tests/development/enums/parser/pattern_ellipsis_invalid.move:9:9
9 │ ╭ match (x) {
10 │ │ ..
11 │ │ }
│ ╰─────────^ Invalid 'match' form. 'match' must have at least one arm

error[E01002]: unexpected token
┌─ tests/development/enums/parser/pattern_ellipsis_invalid.move:10:13
10 │ ..
│ ^^ Invalid pattern
│ ^ Expected a call argument expression

Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
warning[W09002]: unused variable
┌─ tests/move_2024/migration/match_okay.move:3:12
3 │ fun t1(t: u64, match: u64): bool {
│ ^ Unused parameter 't'. Consider removing or prefixing with an underscore: '_t'
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')

error[E01002]: unexpected token
┌─ tests/move_2024/migration/match_okay.move:3:20
3 │ fun t1(t: u64, match: u64): bool {
│ ^ Expected a function parameter

error[E01002]: unexpected token
┌─ tests/move_2024/migration/match_okay.move:5:5
5 │ }
│ ^
│ │
│ Unexpected '}'
│ Expected '('

warning[W09002]: unused variable
┌─ tests/move_2024/migration/match_okay.move:7:12
7 │ fun t2(t: u64, match: u64): bool {
│ ^ Unused parameter 't'. Consider removing or prefixing with an underscore: '_t'
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')

error[E01002]: unexpected token
┌─ tests/move_2024/migration/match_okay.move:3:19
┌─ tests/move_2024/migration/match_okay.move:7:20
3 │ fun t(t: u64, match: u64): bool {
│ ^^^^^
│ │
│ Unexpected 'match'
│ Expected an identifier
7 │ fun t2(t: u64, match: u64): bool {
│ ^ Expected a function parameter

error[E01002]: unexpected token
┌─ tests/move_2024/migration/match_okay.move:7:19
┌─ tests/move_2024/migration/match_okay.move:8:23
7fun t(t: u64, match: u64): bool {
^^^^^
│ │
│ Unexpected 'match'
Expected an identifier
8 if (t == match) { true } else { false }
^
Unexpected ')'
Expected '('

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--- tests/move_2024/migration/match_okay.move
+++ tests/move_2024/migration/match_okay.move
@@ -3,2 +3,2 @@
- fun t(t: u64, match: u64): bool {
- fun t1(t: u64, match: u64): bool {
- t == match
+ fun t(t: u64, `match`: u64): bool {
+ fun t1(t: u64, `match`: u64): bool {
+ t == `match`
@@ -7,2 +7,2 @@
- fun t(t: u64, match: u64): bool {
- fun t2(t: u64, match: u64): bool {
- if (t == match) { true } else { false }
+ fun t(t: u64, `match`: u64): bool {
+ fun t2(t: u64, `match`: u64): bool {
+ if (t == `match`) { true } else { false }
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module a::m {

fun t(t: u64, match: u64): bool {
fun t1(t: u64, match: u64): bool {
t == match
}

fun t(t: u64, match: u64): bool {
fun t2(t: u64, match: u64): bool {
if (t == match) { true } else { false }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ error[E01002]: unexpected token
│ ^
│ Unexpected end-of-file
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', or 'struct'
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', 'struct', or 'enum'

Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ error[E01002]: unexpected token
│ ^
│ Unexpected end-of-file
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', or 'struct'
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', 'struct', or 'enum'

Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ error[E01002]: unexpected token
│ ^
│ Unexpected end-of-file
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', or 'struct'
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', 'struct', or 'enum'

Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ error[E01002]: unexpected token
│ ^
│ Unexpected end-of-file
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', or 'struct'
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', 'struct', or 'enum'

Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ error[E01002]: unexpected token
│ ^
│ Unexpected end-of-file
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', or 'struct'
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', 'struct', or 'enum'

Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ error[E01002]: unexpected token
│ ^
│ Unexpected end-of-file
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', or 'struct'
│ Expected a module member: 'spec', 'use', 'friend', 'const', 'fun', 'struct', or 'enum'

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ error[E04007]: incompatible types
16 │ let _ = Foo <u64>(0);
│ --------^ - Found: integer. It is not compatible with the other type.
│ │ │
│ │ │
│ │ Incompatible arguments to '>'
│ Found: 'bool'. It is not compatible with the other type.

Expand All @@ -33,5 +33,6 @@ error[E04003]: built-in operation not supported
16 │ let _ = Foo <u64>(0);
│ -------- ^ Invalid argument to '>'
│ │
│ │
│ Found: 'bool'. But expected: 'u8', 'u16', 'u32', 'u64', 'u128', 'u256'

Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ error[E01002]: unexpected token
3 │ public struct Foo(x: u64) has copy, drop;
│ ^ Cannot use named fields in a positional definition

Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ error[E01002]: unexpected token
3 │ public struct Foo(f: u64) has copy, drop;
│ ^ Cannot use named fields in a positional definition

Loading

0 comments on commit d1d3193

Please sign in to comment.