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

Scala: Detect consumed symbols in self-type annotations #20960

Merged
merged 3 commits into from
May 28, 2024

Conversation

alonsodomin
Copy link
Contributor

Fixes #20959.

@alonsodomin alonsodomin added backend: JVM JVM backend-related issues category:bugfix Bug fixes for released features labels May 27, 2024
@alonsodomin alonsodomin modified the milestones: 2.19.x, 2.20.x May 27, 2024
@alonsodomin alonsodomin modified the milestones: 2.20.x, 2.19.x May 27, 2024
@benjyw
Copy link
Contributor

benjyw commented May 27, 2024

Nice fix!

I don't think this warrants cherry-picking though, and certainly not back to 2.19.x. It's on the border between a bugfix and a feature, and there has always been a workaround via a manual dep, so I think it's best to treat this as a new feature and keep it in 2.22.x and not expect a bunch more releases, especially since we want to stabilize 2.21.0 now.

WDYT?

@alonsodomin
Copy link
Contributor Author

In a way it feels like a bug as the parser is blind to a Scala language feature and requires for a user workaround.

But it's true that it also could be categorised as a new feature: Scala dependency inference now supports self-types.

Either way, I don't need it backported to 2.19 and since it's workaround-able I'm happy having it coming in 2.22.

I added the milestone and cherry picking after the suggestion in the ticket, but was also waiting for someone else to chime in.

@alonsodomin alonsodomin added category:new feature and removed needs-cherrypick category:bugfix Bug fixes for released features labels May 27, 2024
@alonsodomin alonsodomin removed this from the 2.19.x milestone May 27, 2024
@alonsodomin alonsodomin merged commit 772e321 into pantsbuild:main May 28, 2024
25 checks passed
benjyw pushed a commit that referenced this pull request Jun 26, 2024
…ckage (#21053)

Fixes #20302

Types in match patterns are not detected as consumed symbols. So
dependency inference fails to detect symbols in the same package in a
different file unless imported or added to dependencies manually.

This fixes inference for cases like:
```scala
// A.scala
package pkg
class AClass

// B.scala
package pkg
def myFn = {
  case v: AClass =>
}
```

Similar to a another recent fix
[here](#20960)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: JVM JVM backend-related issues category:new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scala Dependency Inference ignores self-type annotations when they are in the same package.
3 participants