Skip to content

Unability to use objects with name eq when compiled with Scala 2 #6242

Closed
@buzden

Description

@buzden

Dotty thinks that every package compiled by Scala 2 has the eq method in it. This gives two consequences.


First, strange code compiles. Considering as an example, you have cats library in dependencies, you have

val z = cats.eq(new Object) // Compiles!

Second, all objects that have name eq in such packages, become unavailable. Considering, for example, you have cats-laws library in dependencies, this code

import cats.laws.discipline.eq._

fails with

[error] -- Error: dotty-eq-bug/src/main/scala/dottyeq/tst-pos.scala:4:28 
[error] 4 |import cats.laws.discipline.eq._
[error]   |       ^^^^^^^^^^^^^^^^^^^^^^^
[error]   |       Object => Boolean is not stable

This error appears both in pure dotty mode and in dotty's scala 2 compatibility mode.


The minimal project showing both errors can be found here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions