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

Signature help session is not triggered after typing comma in target-typed new expression inside return statement #76499

Open
Peter-Juhasz opened this issue Dec 18, 2024 · 3 comments
Labels
Area-Compilers Feature - Target-Typed New `new (args)` gets the created type inferred from context untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@Peter-Juhasz
Copy link

Version Used: VS 17.13 P2.1

Steps to Reproduce:

20241218-1956-48.4765144.mp4
static A Do()
{
    return new("ASD"$$);
}

public record class A(string Id, int Count);

Expected Behavior:
Signature help session starts.

Actual Behavior:
Signature help session doesn't start.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 18, 2024
@Peter-Juhasz Peter-Juhasz changed the title Signature help session is not triggered after typing comma in target-typed new expression Signature help session is not triggered after typing comma in target-typed new expression inside return statement Dec 18, 2024
@CyrusNajmabadi
Copy link
Member

Debugged through. This is because the compiler is giving back an error type symbol when we ask what the type of this expression is (including the converted type of it).

While tehre's def a problem in that a specific constructor cannot be found. We should still be able to figure out the type here. Assigning to compiler to take a look (note: i think we've heard abotu this in teh past. not sure if there's a bug to dupe this against).

@CyrusNajmabadi
Copy link
Member

Note: the compiler does return the right thing when tehre are no arguments (even though overload resolution fails tehre as well) . So it seems to be if there are args that do have errors that it then fails to figure out the type.

@jcouv jcouv added the Feature - Target-Typed New `new (args)` gets the created type inferred from context label Dec 20, 2024
@davidwengier
Copy link
Contributor

Ran in to this today, and also noticed completion doesn't offer parameter names making it very annoying to deal with constructors with lots of optional parameters. Probably the same root cause, but thought I'd comment because the experience is particularly painful in this scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Feature - Target-Typed New `new (args)` gets the created type inferred from context untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

4 participants