Skip to content
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

Infinite recursion between bridge methods for @specialized and manually specialized declarations of a method. #12947

Open
noresttherein opened this issue Feb 11, 2024 · 0 comments

Comments

@noresttherein
Copy link

Reproduction steps

Scala version: 2.13.12
infinite recursion in @specialized methods is nothing new, but, everything I saw so far involved multiple definitions of a method, and a call to super. This one is on new level for me.

trait I[@specialized(Int) T] {
	def hehe :T
}
trait IInt extends I[Int] {
	def hehe :Int
	def hihi = hehe
}
class Spec[@specialized(Int) T] extends I[T] {
	override def hehe :T = ???
}
class IntSpec extends Spec[Int] with IInt

(new IntSpec).hehe

Problem

Exception in thread "main" java.lang.StackOverflowError
	at IInt.hehe$mcI$sp(Playground.scala:23)
	at IInt.hehe$mcI$sp$(Playground.scala:23)
	at IntSpec.hehe$mcI$sp(Playground.scala:29)
	at Spec$mcI$sp.hehe(Playground.scala:27)
	at IInt.hehe$mcI$sp(Playground.scala:23)
	at IInt.hehe$mcI$sp$(Playground.scala:23)
	at IntSpec.hehe$mcI$sp(Playground.scala:29)
	at Spec$mcI$sp.hehe(Playground.scala:27)
	at IInt.hehe$mcI$sp(Playground.scala:23)
	at IInt.hehe$mcI$sp$(Playground.scala:23)
	at IntSpec.hehe$mcI$sp(Playground.scala:29)

Thankfully, the error goes away with removing the declaration in IInt, which doesn't really help, when I.hehe is already specialized.

Is it fixable?

@SethTisue SethTisue added this to the Backlog milestone Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants