Skip to content

Conversation

@lolgab
Copy link
Contributor

@lolgab lolgab commented Dec 18, 2025

@tgodzik tgodzik self-assigned this Dec 18, 2025
@tgodzik
Copy link
Contributor

tgodzik commented Dec 18, 2025

Thanks for working on this. Let me know when this is ready! Seems like github actions are having a tough day though, so we'll need to rerun some jobs.

@lolgab
Copy link
Contributor Author

lolgab commented Dec 18, 2025

Thanks for working on this. Let me know when this is ready! Seems like github actions are having a tough day though, so we'll need to rerun some jobs.

I want to port the tests as well, but I'm having trouble running the tests.

I get:

sbt:scala3-nonbootstrapped> last scala3-library-nonbootstrapped / scalaInstance
[error] java.lang.RuntimeException: Missing Scala tool configuration from the 'update' report.  Explicitly define scalaInstance or scalaHome or include Scala dependencies in the 'scala-tool' configuration.
[error]         at scala.sys.package$.error(package.scala:30)
[error]         at sbt.Defaults$.$anonfun$scalaInstanceFromUpdate$10(Defaults.scala:1214)
[error]         at scala.Option.getOrElse(Option.scala:189)
[error]         at sbt.Defaults$.$anonfun$scalaInstanceFromUpdate$1(Defaults.scala:1214)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at
......
[error] (scala3-library-nonbootstrapped / scalaInstance) Missing Scala tool configuration from the 'update' report.  Explicitly define scalaInstance or scalaHome or include Scala dependencies in the 'scala-tool' configuration.

@tgodzik
Copy link
Contributor

tgodzik commented Dec 18, 2025

I think for coverage it should be sbt scala3-compiler-nonbootstrapped/testOnly dotty.tools.dotc.coverage.CoverageTests does it work for you?

@lolgab
Copy link
Contributor Author

lolgab commented Dec 18, 2025

@tgodzik Thank you. I needed to cleanup my workspace directory since I had last compiled Scala3 a long time ago and something was broken in the target directories. I can run tests now

@lolgab lolgab force-pushed the incremental-coverage branch from a3f67fd to 6ac0a8f Compare December 18, 2025 16:05
@lolgab lolgab force-pushed the incremental-coverage branch from 6ac0a8f to 2017109 Compare December 18, 2025 19:07
@lolgab lolgab marked this pull request as ready for review December 18, 2025 19:48
@lolgab
Copy link
Contributor Author

lolgab commented Dec 19, 2025

@tgodzik I'm ready for review

lolgab and others added 15 commits December 19, 2025 14:11
In capture checking, a type mismatch might happen for a synthesized tree
(say from implicit search). It can be helpful to show this tree. Before
capture checking a helpful message is less likely since we don't synthesize
implicit trees that then don't match under the standard typing rules.
Fields are only allowed in stateful classes unless marked with @untrackedCaptures.
Co-authored-by: Oliver Bračevac <bracevac@users.noreply.github.com>
Previously, method type parameters were always renamed if they had the same name as any class type parameter, regardless of whether the class type parameter was actually used in the method signature.

As a result, we rename methods's type params for unnecessary names like: scala#24671
(Note that renaming actually doesn't cause binary incompatibility, and this change is just for make generic signature a bit clear and silence false-positive MIMA reporting).

For example, in an example below, the Scala compiler rename the generic signature of `bar` to something like `bar[T1](x: T1): T1` because `T` is used by `Foo[T]`. However, this is unnessary rename because none of T in method signature refer the `T` of `Foo[T]`.

```scala
class Foo[T]:
  def bar[T](x: T): T = ???
```

This commit makes the renaming conditional:
Method type parameters are only renamed when
- (1) A class type parameter is referenced in the method signature, and
- (2) That class type parameter is shadowed by a method type parameter
Co-authored-by: Lukas Rytz <lukas.rytz@gmail.com>
Move isTypeParameterInMethSig as a local function and simplify it: collecting method type parameters by checking owner directly instead of searching the initialSymbol's typeParams list.
Add test cases for nested class generic signatures when
method type parameters shadow enclosing class type parameters.
The tests verify that Scala 3 correctly handles type parameter name conflicts in nested generic classes by renaming method-level type parameters to avoid clashing with outer class type parameters.

Closes scala#24619
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.

4 participants