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 use deprecated scalameta methods #3426

Merged
merged 1 commit into from
Dec 28, 2022
Merged

Conversation

kitbellew
Copy link
Collaborator

No description provided.

@kitbellew kitbellew requested a review from tgodzik December 27, 2022 23:26
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

Could we not use .internal.Impl especially when it can be avoided.

Comment on lines 2076 to 2078
case ParamClauseParent(
t @ Defn.ExtensionGroup.internal.Impl(_, b: Term.Block)
) if isBlockStart(b, nft) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
case ParamClauseParent(
t @ Defn.ExtensionGroup.internal.Impl(_, b: Term.Block)
) if isBlockStart(b, nft) =>
case ParamClauseParent(
t : Defn.ExtensionGroup
) if isBlockStart(t.body, nft) =>

I would avoid using the internal Impl classes since they might not be binary compatible.

Some(new OptionalBracesRegion {
def owner = Some(t)
def splits = Some(getSplitsMaybeBlock(ft, nft, b))
def rightBrace = blockLast(b)
})
case t @ Term.If(_, thenp, _) if !nft.right.is[T.KwThen] && {
case t @ Term.If.internal.Impl(_, thenp, _, _)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
case t @ Term.If.internal.Impl(_, thenp, _, _)
case t : Term.If

and then just use t.thenp

Some(new OptionalBracesRegion {
def owner = Some(t)
def splits = Some(getSplitsMaybeBlock(ft, nft, b))
def rightBrace = blockLast(b)
})
case t @ Term.If(_, thenp, _) if !nft.right.is[T.KwThen] && {
case t @ Term.If.internal.Impl(_, thenp, _, _)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
case t @ Term.If.internal.Impl(_, thenp, _, _)
case t : Term.If

and then just use t.thenp.

Also in other places in the file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will do. however, why would we need (or expect) binary compatibility here? for every upgrade of the parser, we explicitly modify the formatter. the whole point to add those internal.Impl.unapply methods was for a case like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... binary compat might not be a problem yeah. Maybe I went overeager, but I still think it's a bit easier to just annotate type

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM

@kitbellew kitbellew merged commit 7567a6c into scalameta:master Dec 28, 2022
@kitbellew kitbellew deleted the 3426 branch December 28, 2022 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants