Skip to content

C#: CSV-based flow summaries #6003

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

Merged
merged 7 commits into from
Jun 22, 2021
Merged

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Jun 3, 2021

@hvitved hvitved force-pushed the csharp/external-summaries branch 2 times, most recently from f4f9d96 to af8adee Compare June 4, 2021 14:07
@hvitved hvitved marked this pull request as ready for review June 4, 2021 14:26
@hvitved hvitved requested a review from a team as a code owner June 4, 2021 14:26
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Jun 4, 2021
tamasvajk
tamasvajk previously approved these changes Jun 7, 2021
Copy link
Contributor

@tamasvajk tamasvajk left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I'll add the Coverage.ql, and then modify the CSV coverage report workflow to handle C# too.

@hvitved hvitved marked this pull request as draft June 16, 2021 12:13
@hvitved hvitved force-pushed the csharp/external-summaries branch from af8adee to 992acaa Compare June 16, 2021 12:17
@hvitved hvitved force-pushed the csharp/external-summaries branch from 992acaa to 4b5612a Compare June 16, 2021 13:39
@hvitved hvitved force-pushed the csharp/external-summaries branch from 4b5612a to 3f6beaf Compare June 16, 2021 17:36
"My.Qltest;D;false;StepPropertySetter;(System.Object);;Argument[0];Property[My.Qltest.D.Property] of Argument[-1];value",
"My.Qltest;D;false;StepElementGetter;();;Element of Argument[-1];ReturnValue;value",
"My.Qltest;D;false;StepElementSetter;(System.Object);;Argument[0];Element of Argument[-1];value",
"My.Qltest;D;false;Apply;(System.Func<My.Qltest.D.Apply.<0>,My.Qltest.D.Apply.<1>>,My.Qltest.D.Apply.<1>);;Argument[1];Parameter[0] of Argument[0];value",
Copy link
Contributor

Choose a reason for hiding this comment

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

This would look nicer with S and T instead of My.Qltest.D.Apply.<0>.

Comment on lines +48 to +58
| Unification.cs:9:10:9:11 | T3 | Unification.cs:38:11:38:22 | Nested<System.Int32>+NestedA<String> |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:38:11:38:22 | Nested<System.Int32>+NestedA<T11> |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:38:11:38:22 | Nested<System.String>+NestedA<Int32> |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:38:11:38:22 | Nested<System.String>+NestedA<T11> |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:39:11:39:17 | Nested<>+NestedB |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:39:11:39:17 | Nested<System.Int32>+NestedB |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:39:11:39:17 | Nested<System.String>+NestedB |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:41:22:41:33 | Nested<>+NestedB+NestedC<T12> |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:41:22:41:33 | Nested<System.Int32>+NestedB+NestedC<Boolean> |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:41:22:41:33 | Nested<System.Int32>+NestedB+NestedC<T12> |
| Unification.cs:9:10:9:11 | T3 | Unification.cs:41:22:41:33 | Nested<System.String>+NestedB+NestedC<Decimal> |
Copy link
Contributor

Choose a reason for hiding this comment

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

Not all type names show up here with fully qualified names. It looks like nested constructed generics are not handled properly.

| overrides.H<>.M<S>(TA, S) | overrides.I2<TA>.M<S>(TA, S) | implements |
| overrides.Outer<>.A10.M<T>(Inner) | overrides.Outer<>.I6.M<T>(Inner) | implements |
| overrides.G.M<S>(string, S) | overrides.I2<System.String>.M<S>(string, S) | implements |
| overrides.H<>.M<S>(TA, S) | overrides.I2<overrides.H<>.<0>>.M<S>(TA, S) | implements |
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised to see TA being changed to overrides.H<>.<0>, but S not being changed. Also, shouldn't all instances of TA be replaced by overrides.H<>.<0>?

@tamasvajk
Copy link
Contributor

tamasvajk commented Jun 17, 2021

Wouldn't it make sense to store the fully qualified names in the DB (if there's an easy built in way of getting it from Roslyn)?

I did a quick search, and couldn't find any APIs for getting it, but SymbolDisplayFormat seems promising, and at the same time it already shows that even Roslyn uses <> notation when displaying "qualified names" of constructed generics types. So the current QL implementation is quite close to theirs, the only two differences seem to be the type parameters and unbound generics ( `4 instead of <,,,>). Here's an instance of SymbolDisplayFormat that we could use if we decided to move this logic to the extractor.

Here are some examples of type names in Roslyn tests:

@tamasvajk
Copy link
Contributor

Wouldn't it make sense to store the fully qualified names in the DB (if there's an easy built in way of getting it from Roslyn)?

I did a quick search, and couldn't find any APIs for getting it, but SymbolDisplayFormat ...

We discussed this in person: Our conclusion was to not use the fully qualified name returned at runtime, and also not match exactly how Roslyn represent qualified names. We're actually quite close to the one implemented by Roslyn, here are some samples of the representation used by us:

  • nested types: NS1.C1+C2
  • constructed generics: NS1.C1<System.Int32,System.Int32>
  • unbound generics: NS1.C1<,>
  • open generics: NS1.C1<T1,T2>.

@hvitved hvitved marked this pull request as ready for review June 20, 2021 15:46
Copy link
Contributor

@tamasvajk tamasvajk left a comment

Choose a reason for hiding this comment

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

LGTM

@hvitved hvitved merged commit 38a38fd into github:main Jun 22, 2021
@hvitved hvitved deleted the csharp/external-summaries branch June 22, 2021 10:59
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