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

Incorrect collapse of expression bodied member with compiler directive #76820

Closed
lonix1 opened this issue Jan 20, 2025 · 3 comments · Fixed by #76837
Closed

Incorrect collapse of expression bodied member with compiler directive #76820

lonix1 opened this issue Jan 20, 2025 · 3 comments · Fixed by #76837
Labels
Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@lonix1
Copy link

lonix1 commented Jan 20, 2025

I'm unsure which repo this belong in?

This collapses properly:

public class Demo1 {

  public int Foo() {
    return
    #if DEBUG
    10;
    #else
    20;
    #endif
  }

}

This does not:

public class Demo2 {

  public int Foo() =>
    #if DEBUG
    10;
    #else
    20;
    #endif

}
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 20, 2025
@lonix1 lonix1 changed the title Incorrect collapse of expression bodies member with compiler directive Incorrect collapse of expression bodied member with compiler directive Jan 20, 2025
@CyrusNajmabadi
Copy link
Member

Can you clarify what you mean by "incorrect collapse"?

@lonix1
Copy link
Author

lonix1 commented Jan 21, 2025

One expects this:

public class Demo1 {

>  public int Foo() {

}

But it does this:

public class Demo2 {

>  public int Foo() =>
    #else
    20; ...

}

And I've seen this too:

public class Demo2 {

>  public int Foo() =>
    #endif

}

You can see for yourself by copy-pasting into a c# file.

@CyrusNajmabadi CyrusNajmabadi added Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it and removed Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 21, 2025
@github-project-automation github-project-automation bot moved this to InQueue in Small Fixes Jan 21, 2025
@CyrusNajmabadi CyrusNajmabadi added this to the Backlog milestone Jan 21, 2025
@CyrusNajmabadi
Copy link
Member

We'd take a targeted community fix here. Moving to backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE 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.

2 participants