Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
neko-kai opened this issue Sep 5, 2022 · 0 comments · Fixed by #15986
Assignees
Milestone

Comments

@neko-kai
Copy link
Contributor

neko-kai commented Sep 5, 2022

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

@neko-kai neko-kai added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 5, 2022
neko-kai added a commit to 7mind/izumi that referenced this issue Sep 5, 2022
… to bug scala/scala3#15976 (#1788)

* Revert parentheses

* Implement ForcedRecompilation token macro for Scala 3

* Disable recompilation trigger functionality on Scala 3 completely due to bug scala/scala3#15976
@odersky odersky self-assigned this Sep 7, 2022
@odersky odersky removed the stat:needs triage Every issue needs to have an "area" and "itype" label label Sep 7, 2022
KacperFKorban added a commit that referenced this issue Sep 9, 2022
Class parent handling was hard to understand because it consisted of
interacting parts that each worked under intricate but separate
conditions. It's more centralized now.

Fixes #15976
neko-kai added a commit to 7mind/izumi that referenced this issue Oct 17, 2022
neko-kai added a commit to 7mind/izumi that referenced this issue Oct 17, 2022
neko-kai added a commit to 7mind/izumi that referenced this issue Jan 27, 2023
neko-kai added a commit to 7mind/izumi that referenced this issue Feb 20, 2023
@Kordyjan Kordyjan added this to the 3.2.2 milestone Aug 1, 2023
neko-kai added a commit to 7mind/izumi that referenced this issue Sep 29, 2023
neko-kai added a commit to 7mind/izumi that referenced this issue Mar 7, 2024
neko-kai added a commit to 7mind/izumi that referenced this issue May 30, 2024
* Revert "Disable recompilation trigger functionality on Scala 3 completely due to bug scala/scala3#15976"

This reverts commit 2ab8bf4.

* use random token again. Waiting on usability fix for scala/scala3#18623 before merge

* CI workaround for scala/scala3#19745

* Due to Scala 3 bug scala/scala3#19745 remove `distage.plugins.{PluginDef,BootstrapPluginDef}` aliases on Scala 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants