Skip to content

C#: Change TrapStackBehaviour of local functions#4316

Merged
tamasvajk merged 1 commit intogithub:mainfrom
tamasvajk:feature/local-functions
Sep 23, 2020
Merged

C#: Change TrapStackBehaviour of local functions#4316
tamasvajk merged 1 commit intogithub:mainfrom
tamasvajk:feature/local-functions

Conversation

@tamasvajk
Copy link
Copy Markdown
Contributor

@tamasvajk tamasvajk commented Sep 22, 2020

@github-actions github-actions bot added the C# label Sep 22, 2020
@tamasvajk
Copy link
Copy Markdown
Contributor Author

I ran the following query on the before and after snapshots of roslyn.

  private predicate testExpr(Expr e, LocalFunction lf) {
    e.getEnclosingCallable() = lf and
    not exists(lf.getALocation())
  }

The before one returns 40369 results. The after one returns 0.

The following query returns 4 (2 duplicated) expressions in the before snapshot:

  private predicate test(Expr e) {
    e.getLocation().getStartLine() = 35 and
    e.getFile().getStem() = "CommandLineTestBase"
  }

And the same query correctly returns only 2 expressions in the after snapshot.

@tamasvajk
Copy link
Copy Markdown
Contributor Author

I have no clue how to add a test case for this issue.

@tamasvajk tamasvajk requested a review from a team September 23, 2020 09:09
@tamasvajk tamasvajk marked this pull request as ready for review September 23, 2020 09:09
Copy link
Copy Markdown
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent. I checked that we didn't get any "TagStack unexpectedly empty" errors in the csharp.log files of dotnet/roslyn and dotnet/runtime.

@tamasvajk tamasvajk merged commit 9b14a70 into github:main Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants