Sitelet https://web.archive.org/web/20260605074251/https://github.com/github/codeql/pull/6268
Skip to content

C#: Remove type args/params from generic type names in extractor#6268

Merged
tamasvajk merged 10 commits into
github:mainfrom
tamasvajk:feature/generic-type-name
Aug 16, 2021
Merged

C#: Remove type args/params from generic type names in extractor#6268
tamasvajk merged 10 commits into
github:mainfrom
tamasvajk:feature/generic-type-name

Conversation

@tamasvajk
Copy link
Copy Markdown
Contributor

@tamasvajk tamasvajk commented Jul 13, 2021 •

This PR changes the extractor to remove <,,,> and <T1,T2,T3>-like suffixes from unbound and constructed generic types. With this change, the type names stored in the DB are always "undecorated" for generic types. Additionally, the QL library is adjusted to handle the name change (in unbound/constructed generic types, nullable types, and tuples).

@github-actions github-actions Bot added the C# label Jul 13, 2021
@tamasvajk tamasvajk force-pushed the feature/generic-type-name branch from c9a5a9f to 178598b Compare July 13, 2021 09:26
@tamasvajk tamasvajk marked this pull request as ready for review July 14, 2021 07:37
@tamasvajk tamasvajk requested a review from a team as a code owner July 14, 2021 07:37
@tamasvajk tamasvajk added the no-change-note-required This PR does not need a change note label Jul 14, 2021
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.

We should also generate a DB upgrade script for adjusting the third column of the types relation.

Comment thread csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs Outdated
Comment thread csharp/ql/src/semmle/code/csharp/Type.qll Outdated
Comment thread csharp/ql/src/semmle/code/csharp/Generics.qll Outdated
Comment thread csharp/ql/src/semmle/code/csharp/Generics.qll Outdated
@tamasvajk
Copy link
Copy Markdown
Contributor Author

@hvitved I adjusted this PR based on your feedback. This is my first upgrade script, so please double check. I've ran the DB upgrade on a dummy DB, which was extracted with the previous version of the extractor, and I could query the generic types afterwards.

hvitved
hvitved previously approved these changes Jul 15, 2021
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.

The upgrade script looks correct to me. I have approved the PR, but please do not merge before the rc/3.2 release branch has been created, as there is no need for this change to go into the release.

@tamasvajk
Copy link
Copy Markdown
Contributor Author

@tamasvajk
Copy link
Copy Markdown
Contributor Author

@tamasvajk
Copy link
Copy Markdown
Contributor Author

tamasvajk commented Aug 10, 2021 •

@tamasvajk
Copy link
Copy Markdown
Contributor Author

tamasvajk commented Aug 10, 2021 •

@tamasvajk
Copy link
Copy Markdown
Contributor Author

@hvitved The diff jobs show better performance now. The first one shows some perf change in DefaultToString (+45s), and the second one with the getMember inlining improves it (-41s).

The failing test seems to be unrelated.

@tamasvajk tamasvajk merged commit 166a6b0 into github:main Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C# no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants