Skip to content

Type alias for generic is lost in repl #5177

Open
@abeln

Description

@abeln

In the repl:

scala> class C[T]
// defined class C

scala> type B = C
// defined alias type B = C

scala> def b: B[String] = ??? 
def b: C[String]

Notice that b's type is displayed as C[String], as opposed to the declared B[String].

This seems to be a repl issue, because -Xprint:frontend in the compiler shows:

  class Foo() extends Object() { 
    class C[T >: Nothing <: Any]() extends Object() { 
       T
    }
    type B = C
    def c: Foo.this.C[String] = ???
    def b: Foo.this.B[String] = this.c
  }
}

Which seems fine.

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