Closed as not planned
Description
Scala version: 2.13.13 (under Xsource:3
)
The following code, under Xsource:3
with Scala 2.13.13:
type Point = Point.Type
object Point {
type Type <: Any
def apply(x: Int): Point = x.asInstanceOf[Point]
implicit final class MyExt(val myInt: Point) extends AnyVal {
def +(other: Int): Point = ???
}
}
val p = Point(3)
val p2 = p + 2
Produces the following error:
type mismatch;
found : Int(2)
required: String
val p2 = p + 2
Problem
The problem started after upgrading to Scala 2.13.13. We use the scala-newtype library, and some of our newtypes that define a +
operator started to fail with the error above.
The code snippet is the simplified "expanded" version of the newtype macro that also exhibits the problem:
@newtype case class Point(i: Int)
def +(other: Int): Point
}
In all previous versions, this code compiled fine under Xsource:3.
Metadata
Metadata
Assignees
Labels
No labels