Skip to content

(Maybe) typer regression in nebula-contrib/testcontainers-nebula #24695

@WojciechMazur

Description

@WojciechMazur

Based on the OpenCB failure in nebula-contrib/testcontainers-nebula - build logs

Depending on how we construct map invocation the code might fail to compile. In case of Scala 3.7.4/3.8.0-RC3 the first 2 cases compiled, the last one did not.
In current nightlies all 3 fail to compile

I'm not exactly sure if the code should fail to compile, I suspect the new behaviour might be correct, but I would need a confirmation

Compiler version

Last good release: 3.8.0-RC1-bin-20251103-714f3b6-NIGHTLY
First bad release: 3.8.0-RC1-bin-20251104-b83b3d9-NIGHTLY

Bisect points to one of:
f3aea49
5b03dca
Both are commits from #24231

Not present in 3.8.0-RCs, merged after 3.8.0 cutoff, but before change of build developed version

Minimized code

// originally defines in Java as
// public class GenericContainer<SELF extends GenericContainer<SELF>>
trait GenericContainer[SELF <: GenericContainer[SELF]]

private lazy val graphds: List[GenericContainer[?]] = ???
private def await[S <: GenericContainer[S]](container: GenericContainer[S]): Int = ???

def Test = 
  val works1 = graphds.map(gd => await(gd))
  val works2 = graphds.map(await(_))
  val failsIn3_7 = graphds.map(await)

Output

Compiling project (Scala 3.8.0-RC2, JVM (21))
[error] ./test.scala:11:27
[error] Type argument Any does not conform to upper bound GenericContainer[Any]
[error]   val fails = graphds.map(await)
[error]                           ^
Error compiling project (Scala 3.8.0-RC2, JVM (21))
Compiling project (Scala 3.8.1-RC1-bin-20251207-68396ca-NIGHTLY, JVM (21))
[error] ./test.scala:10:34
[error] Type argument Any does not conform to upper bound GenericContainer[Any]
[error]   val works1 = graphds.map(gd => await(gd))
[error]                                  ^
[error] ./test.scala:11:28
[error] Type argument Any does not conform to upper bound GenericContainer[Any]
[error]   val works2 = graphds.map(await(_))
[error]                            ^
[error] ./test.scala:12:32
[error] Type argument Any does not conform to upper bound GenericContainer[Any]
[error]   val failsIn3_7 = graphds.map(await)
[error]                                ^
Error compiling project (Scala 3.8.1-RC1-bin-20251207-68396ca-NIGHTLY, JVM (21))

Expectation

To confirm if new behaviour is a regression or expected behaviour

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions