Skip to content

Regression: Spurious missing type parameter error when inheriting a class without call parentheses() #15976

@neko-kai

Description

@neko-kai

Compiler version

3.1.3 and 3.2.0-RC1

Minimized code

runnable: https://scastie.scala-lang.org/A0WmEXknRni7y3aMGI8b8A

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

class BadNoParens[T](implicit ev: ForcedRecompilationToken[T])

// error
object X extends BadNoParens

// ok
object Y extends BadNoParens()

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

Output

Missing type parameter for BadNoParens

Expectation

Expected to compile, as in Scala 2 (https://scastie.scala-lang.org/vQmM43J4QzO8g06TcfI0DA)
Expected the parentheses to be purely cosmetic in this position.

Workaround: only removing all type parameters from BadNoParens allows not writing the call parentheses() There is no alternative to using a type parameter in this situation without value-dependent class types.

This code is a minimized version of real library code in https://github.com/izumi/izumi which we're trying to port to Scala 3

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions