Skip to content

Breaking changes between Scalac and Dotty -language:Scala2 #4027

Closed
@allanrenucci

Description

@allanrenucci

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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions