Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Inlining collection expression local into a spread could inline more aggressively #73148

Closed
jcouv opened this issue Apr 20, 2024 · 2 comments · Fixed by #76823
Closed

Inlining collection expression local into a spread could inline more aggressively #73148

jcouv opened this issue Apr 20, 2024 · 2 comments · Fixed by #76823
Labels
Area-IDE Feature - Collection Expressions help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@jcouv
Copy link
Member

jcouv commented Apr 20, 2024

Invoking "Inline Temporary Variable" on the first variable:

        string[] eStaticSymbols = [
            "System.Int32 E.StaticProperty { get; }",
            "void E.StaticMethod()",
            "E.Nested",
            "event System.Action E.StaticEvent",
            "System.Int32 E.StaticField"];

        string[] allStaticSymbols = [
            .. eStaticSymbols,
            "System.Int32 E2.StaticProperty { get; }"];

results in the following:

        string[] allStaticSymbols = [
            .. ((string[])([
            "System.Int32 E.StaticProperty { get; }",
            "void E.StaticMethod()",
            "E.Nested",
            "event System.Action E.StaticEvent",
            "System.Int32 E.StaticField"])),
            "System.Int32 E2.StaticProperty { get; }"];

Seems a good opportunity for better inlining.

FYI @CyrusNajmabadi

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 20, 2024
@CyrusNajmabadi
Copy link
Member

Probably better as two features. Inlining just inlines. But there could be a suggestion to collapse a spread of individual expressions instead just being those expressions.

@genlu genlu removed the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 24, 2024
@CyrusNajmabadi CyrusNajmabadi removed their assignment Apr 29, 2024
@CyrusNajmabadi CyrusNajmabadi added the help wanted The issue is "up for grabs" - add a comment if you are interested in working on it label Apr 29, 2024
@CyrusNajmabadi CyrusNajmabadi added this to the Backlog milestone Apr 29, 2024
@MisinformedDNA
Copy link

A suggestion to collapse a spread is valuable, but if inlining could also do that, then it saves us from having to do an additional code fix (unless there are valid scenarios where a user would want to do step 1 without step 2).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area-IDE Feature - Collection Expressions help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

4 participants