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

ToolBox: stack overflow on compiling Array#toList #10026

Closed
scabug opened this issue Nov 3, 2016 · 6 comments
Closed

ToolBox: stack overflow on compiling Array#toList #10026

scabug opened this issue Nov 3, 2016 · 6 comments

Comments

@scabug
Copy link

scabug commented Nov 3, 2016

The following code crashes with a StackOverflowError:

import scala.reflect.runtime.universe
import scala.tools.reflect.ToolBox
 
val classloader = getClass.getClassLoader
val toolbox = universe.runtimeMirror(classloader).mkToolBox()
println(toolbox.compile(toolbox.parse("Array(1, 2, 3).toList")))

This is a regression from 2.11, where it used to work fine.

The stack trace is (excerpt of the loop):

	at scala.reflect.runtime.SynchronizedOps$SynchronizedBaseTypeSeq$$anon$2.scala$reflect$runtime$SynchronizedOps$SynchronizedBaseTypeSeq$$super$map(SynchronizedOps.scala:34)
	at scala.reflect.runtime.SynchronizedOps$SynchronizedBaseTypeSeq.$anonfun$map$1(SynchronizedOps.scala:27)
	at scala.reflect.runtime.SynchronizedOps$SynchronizedBaseTypeSeq$$anon$2.map(SynchronizedOps.scala:27)
	at scala.reflect.runtime.SynchronizedOps$SynchronizedBaseTypeSeq$$anon$2.lateMap(SynchronizedOps.scala:34)
@scabug
Copy link
Author

scabug commented Nov 3, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10026?orig=1
Reporter: Lars Hupel (larsrh)
Affected Versions: 2.12.0

@scabug
Copy link
Author

scabug commented Nov 4, 2016

Lars Hupel (larsrh) said:
Bisection tells me that this regressed in 893acc1. Paging @jason Zaugg.

@scabug
Copy link
Author

scabug commented Nov 5, 2016

@paulp said:
It's like a paean to inheritance. MappedBaseTypeSeq and SynchronizedBaseTypeSeq both extend BaseTypeSeq, both override lateMap, and neither override ever calls super.lateMap so there's no scenario where new MappedBaseTypeSeq(this, f) with SynchronizedBaseTypeSeq will do the right thing.

There are probably a thousand other bugs in this arrangement, the count only limited by which combinations happen to be exercised at the moment. I bet retronym's change has nothing to do with it per se - it didn't happen because nothing was nearly enough correct to ever reach that code block.

@scabug
Copy link
Author

scabug commented Dec 27, 2016

@jvican said:
The spores project is also affected by this. We cannot release for 2.12 until this is fixed. Happy to see this is planned for 2.12.1.

@scabug
Copy link
Author

scabug commented Jan 24, 2017

@scabug
Copy link
Author

scabug commented Jan 24, 2017

@retronym said:
scala/scala#5659

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