diff --git a/crates/parser/src/grammar/generic_args.rs b/crates/parser/src/grammar/generic_args.rs index 762d0218c1..948873ae2d 100644 --- a/crates/parser/src/grammar/generic_args.rs +++ b/crates/parser/src/grammar/generic_args.rs @@ -99,9 +99,8 @@ pub(super) fn const_arg_expr(p: &mut Parser) { expressions::literal(p); lm.complete(p, PREFIX_EXPR); } - // test const_arg_path - // type T = S; _ => { + // This shouldn't be hit by `const_arg` let lm = p.start(); paths::use_path(p); lm.complete(p, PATH_EXPR); diff --git a/crates/parser/src/grammar/generic_params.rs b/crates/parser/src/grammar/generic_params.rs index 9797de1ff0..fbd514078d 100644 --- a/crates/parser/src/grammar/generic_params.rs +++ b/crates/parser/src/grammar/generic_params.rs @@ -85,6 +85,9 @@ fn const_param(p: &mut Parser, m: Marker) { // test const_param_default_expression // struct A; + + // test const_param_default_path + // struct A; generic_args::const_arg_expr(p); } diff --git a/crates/parser/test_data/parser/inline/ok/0188_const_arg_path.rast b/crates/parser/test_data/parser/inline/ok/0188_const_arg_path.rast deleted file mode 100644 index 62ddefa5a8..0000000000 --- a/crates/parser/test_data/parser/inline/ok/0188_const_arg_path.rast +++ /dev/null @@ -1,30 +0,0 @@ -SOURCE_FILE - TYPE_ALIAS - TYPE_KW "type" - WHITESPACE " " - NAME - IDENT "T" - WHITESPACE " " - EQ "=" - WHITESPACE " " - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "S" - GENERIC_ARG_LIST - L_ANGLE "<" - TYPE_ARG - PATH_TYPE - PATH - PATH - PATH_SEGMENT - NAME_REF - IDENT "u32" - COLON2 "::" - PATH_SEGMENT - NAME_REF - IDENT "MAX" - R_ANGLE ">" - SEMICOLON ";" - WHITESPACE "\n" diff --git a/crates/parser/test_data/parser/inline/ok/0188_const_arg_path.rs b/crates/parser/test_data/parser/inline/ok/0188_const_arg_path.rs deleted file mode 100644 index 1383d0d6d5..0000000000 --- a/crates/parser/test_data/parser/inline/ok/0188_const_arg_path.rs +++ /dev/null @@ -1 +0,0 @@ -type T = S; diff --git a/crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rast b/crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rast new file mode 100644 index 0000000000..11002bf98d --- /dev/null +++ b/crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rast @@ -0,0 +1,36 @@ +SOURCE_FILE + STRUCT + STRUCT_KW "struct" + WHITESPACE " " + NAME + IDENT "A" + GENERIC_PARAM_LIST + L_ANGLE "<" + CONST_PARAM + CONST_KW "const" + WHITESPACE " " + NAME + IDENT "N" + COLON ":" + WHITESPACE " " + PATH_TYPE + PATH + PATH_SEGMENT + NAME_REF + IDENT "i32" + WHITESPACE " " + EQ "=" + WHITESPACE " " + PATH_EXPR + PATH + PATH + PATH_SEGMENT + NAME_REF + IDENT "i32" + COLON2 "::" + PATH_SEGMENT + NAME_REF + IDENT "MAX" + R_ANGLE ">" + SEMICOLON ";" + WHITESPACE "\n" diff --git a/crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rs b/crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rs new file mode 100644 index 0000000000..f3da43ca06 --- /dev/null +++ b/crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rs @@ -0,0 +1 @@ +struct A;