scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Strange inliner behavior after upgrading to 2.11.7 #9372

Closed scabug closed 6 years ago

scabug commented 9 years ago

After upgrading to 2.11.7, some scala.meta quasiquotes used in certain circumstances lead to really weird errors. Since the circumstances are very specific, I've no idea where to start minimization. Maybe you'll have some ideas.

13:36 ~/Projects/scalameta (master)$ git remote -v
origin  git@github.com:scalameta/scalameta.git (push)
origin  git@github.com:scalameta/scalameta.git (fetch)

13:36 ~/Projects/scalameta (master)$ git rev-parse HEAD
1aaadbfef7801da8d2cea284bebd21383bbbb0a5

13:36 ~/Projects/scalameta (master)$ sbt
[info] Loading project definition from /Users/xeno_by/Projects/core/project
[info] Set current project to core (in build file:/Users/xeno_by/Projects/core/)
[info] Set current project to root (in build file:/Users/xeno_by/Projects/core/)
> project scalameta
[info] Set current project to scalameta (in build file:/Users/xeno_by/Projects/core/)
> console
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import scala.meta._, scala.meta.dialects.Scala211
import scala.meta._
import scala.meta.dialects.Scala211

scala> val q"(i: $r, y: Int) => 42" = q"(i: Int, y: Int) => 42"
r: scala.meta.Type.Arg = Int

scala> val q"(i: $r, y: Int) => 42" = q"(i: Int, y: Int) => 42"
error: Unable to locate class corresponding to inner class entry for Name in owner scala.meta.Term$Param$
error: Unable to locate class corresponding to inner class entry for Name in owner scala.meta.internal.ast.Term$Param$
error: Unable to locate class corresponding to inner class entry for Ref in owner scala.meta.internal.ast.Pat$Type$
error: Unable to locate class corresponding to inner class entry for Name in owner scala.meta.internal.ast.Type$Param$

scala> val q"(i: $r, y: Int) => 42" = q"(i: Int, y: Int) => 42"
warning: there was one inliner warning; re-run with -Yinline-warnings for details
r: scala.meta.Type.Arg = Int

Notes: 1) The errors only manifest themselves on the second execution of the same line of code. Not on the first, not on the third or subsequent executions. 2) Removing -optimise from scalacOptions makes the errors go away. 3) Running the REPL via scala, not via sbt console makes the errors go away.

scabug commented 9 years ago

Imported From: https://issues.scala-lang.org/browse/SI-9372?orig=1 Reporter: @xeno-by Affected Versions: 2.11.7

Atry commented 7 years ago

I experienced the same error message as well

Atry commented 7 years ago

https://travis-ci.org/ThoughtWorksInc/DeepLearning.scala/jobs/253073806

lrytz commented 7 years ago

A small / minimized example or at least clear steps how to reproduce the issue would make it a lot more likely for this to get fixed.

som-snytt commented 7 years ago

Maybe https://github.com/scala/bug/issues/8779 addressed in https://github.com/scala/scala/pull/5544? Sorry it's too deep in the night for me to look right now.

SethTisue commented 6 years ago

closing all quasiquotes tickets; see #10755

also perhaps this changed anyway in the new back end