Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CyclicCheckVisitor to prohibit self references within an access expression in type syntax #12072

Merged
merged 3 commits into from Oct 9, 2023

Conversation

jeskew
Copy link
Contributor

@jeskew jeskew commented Oct 6, 2023

Resolves #12070

CyclicTypeVisitor permits cycles within type expressions to allow for recursive type definitions. However, this can cause an unhandled stack overflow when a property or array access expression is within a "type container expression" (e.g., ObjectTypePropertySyntax), since access expressions will try to resolve the type of their base expression. For example:

type UsesPermittedRecursion = {
  property: UsesPermittedRecursion? // <-- this is the kind of recursion we want to allow
}

type CausesStackOverflow = {
  property: CausesStackOverflow.property // <-- this wouldn't be a valid type, but we should show a diagnostic, not blow the stack
}
Microsoft Reviewers: Open in CodeFlow

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

Test this change out locally with the following install scripts (Action run 6486604798)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 6486604798
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 6486604798"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 6486604798
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 6486604798"

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

Test Results

     132 files  ±  0       132 suites  ±0   3h 51m 56s ⏱️ - 6m 29s
10 671 tests +  3  10 671 ✔️ +  3  0 💤 ±0  0 ±0 
51 551 runs  +12  51 551 ✔️ +12  0 💤 ±0  0 ±0 

Results for commit 80b1463. ± Comparison against base commit 5684992.

♻️ This comment has been updated with latest results.

@jeskew jeskew merged commit 48a96c1 into main Oct 9, 2023
47 checks passed
@jeskew jeskew deleted the jeskew/12070 branch October 9, 2023 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unhandled exception with partially-typed custom type
2 participants