Skip to content

Regression in disneystreaming/smithy-translate for inferred wildcard Java types #20078

Closed
@WojciechMazur

Description

@WojciechMazur

Based on Open CB failure in disneystreaming/smithy-translate - builds logs

Compiler version

3.5.0-RC1-nightly

Last good release: 3.4.2-RC1-bin-20240324-a6c40b1-NIGHTLY
First bad release: 3.5.0-RC1-bin-20240326-43ed9fd-NIGHTLY

Bisect points to 0f30c98

Minimized code

@main def Test = 
  val builder: AbstractShapeBuilder[? <: AbstractShapeBuilder[?, ?], ? <: Shape] = ???
  List.empty[Trait].foreach(builder.addTrait(_))
public abstract class AbstractShapeBuilder<B extends AbstractShapeBuilder<B, S>, S extends Shape> {
	abstract public B addTrait(Trait trait);
}
public interface Shape {}
public interface Trait {}

Output

-- [E057] Type Mismatch Error: /Users/wmazur/projects/scala3/bisect/main.scala:3:35 
3 |  List.empty[Trait].foreach(builder.addTrait(_))
  |                                   ^
  |Type argument ?1.CAP does not conform to upper bound AbstractShapeBuilder[?1.CAP, ?2.CAP] in inferred type AbstractShapeBuilder[?1.CAP, ?2.CAP]
  |
  |where:    ?1 is an unknown value of type scala.runtime.TypeBox[Nothing,
  |  AbstractShapeBuilder[AbstractShapeBuilder[?, ?], ? <: Shape]]
  |          ?2 is an unknown value of type scala.runtime.TypeBox[Nothing, Shape]
  |
  | longer explanation available when compiling with `-explain`

Expectation

Should compile

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions