Skip to content

Regression trouble inferring type of java wildcard in 2.12.10 #11905

Open
@frosforever

Description

@frosforever

reproduction steps

Using the dependency: "io.grpc" % "grpc-core" % "1.18.0", the following code fails to compile in 2.12.10 and 2.13.1 but compiles just fine in 2.11.12

import io.grpc.ManagedChannelBuilder

trait Test {
  val grpcChannel = ManagedChannelBuilder
    .forAddress(
      "host",
      1234
    )
    .maxInboundMessageSize(20)
    .usePlaintext()
    .build()
}

problem

Fails with:

 value usePlaintext is not a member of ?0
[error] possible cause: maybe a semicolon is missing before `value usePlaintext'?
[error]     .usePlaintext()
[error]      ^
[error] one error found

expectation

This compiles fine in 2.11.12. It also compiles if Test is an object instead of a trait. From what I can tell, this was also an issue in 2.10 that got fixed in 2.11 but has now come back in 2.12 and 2.13.

See also grpc/grpc-java#2813 (comment) and https://stackoverflow.com/questions/44899041/unable-to-build-grpc-managedchannel-with-scala for historical context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    f-boundsfixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)should compile

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions