Skip to content

Commit 8e56852

Browse files
committed
Proper parsing of opaque types without bounds
1 parent c472e47 commit 8e56852

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

chalk-parse/src/parser.lalrpop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,13 @@ AssocTyDefn: AssocTyDefn = {
251251
};
252252

253253
OpaqueTyDefn: OpaqueTyDefn = {
254-
"opaque" "type" <name:Id> <p:Angle<VariableKind>> ":" <b:Plus<QuantifiedInlineBound>>
254+
"opaque" "type" <name:Id> <p:Angle<VariableKind>> <b:(":" <Plus<QuantifiedInlineBound>>)?>
255255
<w:QuantifiedWhereClauses> "=" <ty:Ty> ";" => {
256256
OpaqueTyDefn {
257257
ty,
258258
variable_kinds: p,
259259
name,
260-
bounds: b,
260+
bounds: b.unwrap_or(vec![]),
261261
where_clauses: w,
262262
}
263263
}

tests/display/const_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn test_basic_const_values_in_opaque_ty_values() {
4040
reparse_test!(
4141
program {
4242
struct Foo<const N> { }
43-
opaque type Zed: = Foo<0>;
43+
opaque type Zed = Foo<0>;
4444
}
4545
);
4646
}

tests/display/fn_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn test_opaque_ty_with_fn_def() {
4141
// Test printing opaque types in function definitions
4242
reparse_test!(
4343
program {
44-
opaque type Bar: = ();
44+
opaque type Bar = ();
4545
fn gives_bar() -> Bar;
4646
fn receives_bar(param: Bar) -> ();
4747
}

tests/display/opaque_ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn opaque_ty_no_bounds() {
2323
// Test printing opaque types without any bounds
2424
reparse_test!(
2525
program {
26-
opaque type Foo: = ();
26+
opaque type Foo = ();
2727
}
2828
);
2929
}

0 commit comments

Comments
 (0)