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

don't inline new Class without class body #157

Merged
merged 3 commits into from
Jan 28, 2020
Merged

Conversation

dansanduleac
Copy link
Contributor

Before this PR

An early change allows inlining an expression if the last level is a constructor call e.g. new SomeClass. This is good for anonymous classes, as we can inline the new SomeClass() bit and let the body use the next lines.
However, it's not good for new class expressions without a custom body, because it ends up allowing an inlining that breaks at the new class' parameters, e.g.

long someVariable = foo(a, b, new Foo(
        x, y, z));

After this PR

==COMMIT_MSG==
Don't inline constructor calls without a custom body (i.e. if they are not anonymous classes).

Fixes #153.
==COMMIT_MSG==

Possible downsides?

@changelog-app
Copy link

changelog-app bot commented Jan 28, 2020

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Don't inline constructor calls without a custom body (i.e. if they are not anonymous classes).

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from iamdanfox January 28, 2020 16:34
@bulldozer-bot bulldozer-bot bot merged commit 3d94f42 into develop Jan 28, 2020
@bulldozer-bot bulldozer-bot bot deleted the ds/new-class branch January 28, 2020 16:55
@svc-autorelease
Copy link
Collaborator

Released 0.3.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new Class() shouldn't be breakable
3 participants