diff --git a/bin/dotc b/bin/dotc index 3d6e15a54b64..2ffe20f0781b 100755 --- a/bin/dotc +++ b/bin/dotc @@ -6,7 +6,7 @@ # Configuration SCALA_VERSION=2.11.5 SCALA_BINARY_VERSION=2.11 -SCALA_COMPILER_VERSION=2.11.5-20150402-193021-0c75410da3 +SCALA_COMPILER_VERSION=2.11.5-20150416-144435-09c4a520e1 DOTTY_VERSION=0.1 JLINE_VERSION=2.12 bootcp=true @@ -57,13 +57,13 @@ checkjar $TEST_JAR test:package # Autodetecting the scala-library location, in case it wasn't provided by an environment variable if [ "$SCALA_LIBRARY_JAR" == "" ] -then +then SCALA_LIBRARY_JAR=$HOME/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-$SCALA_VERSION.jar # this is location where sbt stores it in ivy cache fi # save as for scala-library now for scala-reflect if [ "$SCALA_REFLECT_JAR" == "" ] -then +then SCALA_REFLECT_JAR=$HOME/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-$SCALA_VERSION.jar fi if [ "$SCALA_COMPILER_JAR" == "" ] @@ -72,13 +72,13 @@ then fi if [ "$JLINE_JAR" == "" ] -then +then JLINE_JAR=$HOME/.ivy2//cache/jline/jline/jars/jline-$JLINE_VERSION.jar fi if [ ! -f "$SCALA_LIBRARY_JAR" -o ! -f "$SCALA_REFLECT_JAR" -o ! -f "$SCALA_COMPILER_JAR" -o ! -f "$JLINE_JAR" ] then - echo To use this script please set + echo To use this script please set echo SCALA_LIBRARY_JAR to point to scala-library-$SCALA_VERSION.jar "(currently $SCALA_LIBRARY_JAR)" echo SCALA_REFLECT_JAR to point to scala-reflect-$SCALA_VERSION.jar "(currently $SCALA_REFLECT_JAR)" echo SCALA_COMPILER_JAR to point to scala-compiler-$SCALA_VERSION.jar with bcode patches "(currently $SCALA_COMPILER_JAR)" diff --git a/project/Build.scala b/project/Build.scala index e5c4a0699e3d..edb730815b4d 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -31,7 +31,7 @@ object DottyBuild extends Build { // get reflect and xml onboard libraryDependencies ++= Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value, "org.scala-lang.modules" %% "scala-xml" % "1.0.1", - "me.d-d" % "scala-compiler" % "2.11.5-20150402-193021-0c75410da3", + "me.d-d" % "scala-compiler" % "2.11.5-20150416-144435-09c4a520e1", "jline" % "jline" % "2.12"), // get junit onboard diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index e9c8dbc80362..009b7fb2b9f7 100644 --- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -61,7 +61,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ type Alternative = tpd.Alternative type DefDef = tpd.DefDef type Template = tpd.Template - type Select = tpd.Select + type Select = tpd.Tree // Actually tpd.Select || tpd.Ident type Bind = tpd.Bind type New = tpd.New type Super = tpd.Super @@ -103,6 +103,10 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ val BoxesRunTimeModule = ctx.requiredModule("scala.runtime.BoxesRunTime") val BoxesRunTimeClass = toDenot(BoxesRunTimeModule).moduleClass.asClass + // require LambdaMetafactory: scalac uses getClassIfDefined, but we need those always. + override lazy val LambdaMetaFactory = ctx.requiredClass("java.lang.invoke.LambdaMetafactory") + override lazy val MethodHandle = ctx.requiredClass("java.lang.invoke.MethodHandle") + val nme_valueOf: Name = StdNames.nme.valueOf val nme_apply = StdNames.nme.apply val NothingClass: Symbol = defn.NothingClass @@ -243,7 +247,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ } case t: TypeApply if (t.fun.symbol == Predef_classOf) => av.visit(name, t.args.head.tpe.classSymbol.denot.info.toTypeKind(bcodeStore)(innerClasesStore).toASMType) - case t: Select => + case t: tpd.Select => if (t.symbol.denot.is(Flags.Enum)) { val edesc = innerClasesStore.typeDescriptor(t.tpe.asInstanceOf[bcodeStore.int.Type]) // the class descriptor of the enumeration class. val evalue = t.symbol.name.toString // value the actual enumeration value. @@ -416,14 +420,14 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def isQualifierSafeToElide(qual: Tree): Boolean = tpd.isIdempotentExpr(qual) - def desugarIdent(i: Ident): Option[Select] = { + def desugarIdent(i: Ident): Option[tpd.Select] = { i.tpe match { case TermRef(prefix: TermRef, name) => Some(tpd.ref(prefix).select(i.symbol)) case TermRef(prefix: ThisType, name) => Some(tpd.This(prefix.cls).select(i.symbol)) case TermRef(NoPrefix, name) => - if (i.symbol is Flags.Method) Some(This(i.symbol.enclosingClass).select(i.symbol)) // workaround #342 todo: remove after fixed + if (i.symbol is Flags.Method) Some(This(i.symbol.topLevelClass).select(i.symbol)) // workaround #342 todo: remove after fixed else None case _ => None } @@ -857,8 +861,29 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ } object Select extends SelectDeconstructor { - def _1: Tree = field.qualifier - def _2: Name = field.name + + var desugared: tpd.Select = null + + override def isEmpty: Boolean = + desugared eq null + + def _1: Tree = desugared.qualifier + + def _2: Name = desugared.name + + override def unapply(s: Select): this.type = { + s match { + case t: tpd.Select => desugared = t + case t: Ident => + desugarIdent(t) match { + case Some(t) => desugared = t + case None => desugared = null + } + case _ => desugared = null + } + + this + } } object Apply extends ApplyDeconstructor {