Skip to content

Commit

Permalink
Test for parsing ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed May 12, 2024
1 parent 83e24a2 commit ba80807
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/__snapshots__/parse.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,23 @@ bool::not(any::eq(number::mul(a, b), c))
Image { width: width }
}
foo(int)
}
>>> def foo(a: uint): Image { width } { let width = a + 1; Image { width } } foo(int)
{
def foo(a: uint): Image { width: width } {
let width = number::add(a, 1);
Image { width: width }
}
foo(int)
}
>>> def foo(a: uint): Image { width } { width } foo(int)
{
def foo(a: uint): Image { width: width } {
width
}
foo(int)
}"
`;
Expand Down
2 changes: 2 additions & 0 deletions tests/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ const expressionSnippets: string[] = [
String.raw`def foo(a: int): int = a; foo(int)`,
String.raw`def foo(a: int): int { a + 1 } foo(int)`,
String.raw`def foo(a: uint): Image { width: uint } { let width = a + 1; Image { width: width } } foo(int)`,
String.raw`def foo(a: uint): Image { width } { let width = a + 1; Image { width } } foo(int)`,
String.raw`def foo(a: uint): Image { width } { width } foo(int)`,
];
const invalidExpressionSnippets: string[] = [
String.raw``,
Expand Down

0 comments on commit ba80807

Please sign in to comment.