Closed
Description
This is a meta issue aimed at listing all the breaking changes there are between Scalac and Dotty under Scala2 mode. This should make migration easier.
- Structural types need an explicit import in Dotty
val o: { def foo: Int } = new Object { def foo = 1 }
o.foo // Error in Dotty
import scala.reflect.Selectable.reflectiveSelectable
o.foo // OK
- Scalac infers structural types
val o = new Object { def foo = 1 }
o.foo // OK in Scalac
import scala.reflect.Selectable.reflectiveSelectable
o.foo // Error in Dotty
- Overridden members without explicit type inherit type from parent in Dotty
class A { def opt: Option[Int] = None }
class B extends A { override def opt = Some(1) }
val some: Some[Int] = (new B).opt // Error in Dotty
- See Eta-expansion of structural types under Scala2 mode #4026
- Macros are not supported in Dotty
- Introduced new keyword:
unused
,enum
,opaque
,augment