Skip to content

Singleton types are lost when used on the left of a right-associative operator #11117

Open
scala/scala
#7741
@xuwei-k

Description

@xuwei-k
Welcome to Scala 2.13.0-pre-1f68c6c (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_181).
Type in expressions for evaluation. Or try :help.

scala> class A[B](val b: B) { def c: List[b.type] = List(b) }
defined class A

scala> class A[B](val b: B) { def c: List[b.type] = b :: Nil }
                                                    ^
       error: type mismatch;
        found   : rassoc$1.type (with underlying type B)
        required: A.this.b.type

#10726 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)typer

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions