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

C#: Add cs/call-to-object-tostring to the CCR query suite. #18866

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

michaelnebel
Copy link
Contributor

No description provided.

@Copilot Copilot bot review requested due to automatic review settings February 26, 2025 10:23
@michaelnebel michaelnebel requested a review from a team as a code owner February 26, 2025 10:23

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

@github-actions github-actions bot added the C# label Feb 26, 2025
tamasvajk
tamasvajk previously approved these changes Feb 26, 2025
@michaelnebel michaelnebel marked this pull request as draft February 28, 2025 14:55
@michaelnebel michaelnebel force-pushed the csharp/ccr-call-to-object-tostring branch from 5e6e4be to 562071f Compare February 28, 2025 14:56
string y1 = x1.Prop;

var x2 = new C(); // Has type `var` as this overrides the implicitly typed keyword `var`.
var y2 = x2.Prop; // Unknown type as `x2` har type `var`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: typo in har vs has.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for looking into the changes! I put the branch in draft mode again, as it is being used for experiments with extractor changes as well.
It turns out that both the roslyn and mono repo suffers from "broken" types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So no need to review yet :-D (will re-request a review when all the back and forth stuff has been handled).

return false;
}
// (1) public class { ... } is a broken type and doesn't have a name.
// (2) public class var { ... } is a an allowed type, but it overrides the var keyword for all uses.
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: typo in is a an allowed

Comment on lines +67 to +71
if (IsBrokenType(Symbol))
return Kinds.TypeKind.UNKNOWN;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would the symbol for C show up as a broken one in the below?

class C { 
  int i;
}
class C {
  int j;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No.
The "only" types that are categorised broken are either a type named var or if there is not any name supplied (syntax error).
We could make it more advanced if needs be. Right now I am just looking in the issues we can see from results to cs/call-to-object-tostring.

@michaelnebel michaelnebel force-pushed the csharp/ccr-call-to-object-tostring branch from 562071f to f9f3e99 Compare March 3, 2025 13:17
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