Skip to content

Spurious is not a class type error when inheriting a class without call parentheses() through a type alias #18623

Closed
@neko-kai

Description

@neko-kai

Compiler version

3.3.1

Minimized code

https://scastie.scala-lang.org/1OfTRArhRuKz5Kq59dUcHg

final abstract class ForcedRecompilationToken[T]
object ForcedRecompilationToken {
  implicit def default: ForcedRecompilationToken["abc"] = null
}

class GoodNoParens[T](implicit ev: ForcedRecompilationToken[T])
type BadNoParens[T] = GoodNoParens[T]

// error
object A extends BadNoParens

// ok
object B extends BadNoParens()
object C extends GoodNoParens

object App extends App {
  println("compiled")
}

Output

GoodNoParens is not a class type

Expectation

Similar situation as in #15976, but this time merely using a type alias to refer to the class breaks the fix for the aforementioned issue and causes a spurious 'not a class type' error.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions