diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-08-15 13:37:26 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-08-15 17:46:11 +0200 |
commit | 46d57d47e81c8794a9a3594e080576788cc92324 (patch) | |
tree | b527c1dfb44d2753c8ae925580838d688e5fccd0 /src/compiler/scala/tools/nsc | |
parent | ce90a46a6964e524933ffe193ac38d58d3df07be (diff) | |
download | scala-46d57d47e81c8794a9a3594e080576788cc92324.tar.gz scala-46d57d47e81c8794a9a3594e080576788cc92324.tar.bz2 scala-46d57d47e81c8794a9a3594e080576788cc92324.zip |
cleanup of reflection- and macro-related stuff
mostly removes [Eugene] marks that I left back then and reviews related code
some of those tokens got left in place, because I don't know to how fix them
without imposing risks on 2.10.0
Diffstat (limited to 'src/compiler/scala/tools/nsc')
15 files changed, 33 insertions, 78 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index c60a3c941f..574129a2f1 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -43,8 +43,6 @@ class Global(var currentSettings: Settings, var reporter: Reporter) with DocComments with Positions { self => - // [Eugene++] would love to find better homes for the new things dumped into Global - // the mirror -------------------------------------------------- override def isCompilerUniverse = true @@ -62,16 +60,14 @@ class Global(var currentSettings: Settings, var reporter: Reporter) } def RootClass: ClassSymbol = rootMirror.RootClass def EmptyPackageClass: ClassSymbol = rootMirror.EmptyPackageClass - // [Eugene++] this little inconvenience gives us precise types for Expr.mirror and TypeTag.mirror - // by the way, is it possible to define variant type members? - - override def settings = currentSettings import definitions.findNamedMember def findMemberFromRoot(fullName: Name): Symbol = rootMirror.findMemberFromRoot(fullName) // alternate constructors ------------------------------------------ + override def settings = currentSettings + def this(reporter: Reporter) = this(new Settings(err => reporter.error(null, err)), reporter) @@ -873,8 +869,6 @@ class Global(var currentSettings: Settings, var reporter: Reporter) /** Is given package class a system package class that cannot be invalidated? */ private def isSystemPackageClass(pkg: Symbol) = - // [Eugene++ to Martin] please, verify -// was: pkg == definitions.RootClass || pkg == RootClass || pkg == definitions.ScalaPackageClass || { val pkgname = pkg.fullName @@ -937,8 +931,6 @@ class Global(var currentSettings: Settings, var reporter: Reporter) else new MergedClassPath(elems, classPath.context) val oldEntries = mkClassPath(subst.keys) val newEntries = mkClassPath(subst.values) - // [Eugene++ to Martin] please, verify -// was: reSync(definitions.RootClass, Some(classPath), Some(oldEntries), Some(newEntries), invalidated, failed) reSync(RootClass, Some(classPath), Some(oldEntries), Some(newEntries), invalidated, failed) } } @@ -998,8 +990,6 @@ class Global(var currentSettings: Settings, var reporter: Reporter) invalidateOrRemove(root) } else { if (classesFound) { - // [Eugene++ to Martin] please, verify -// was: if (root.isRoot) invalidateOrRemove(definitions.EmptyPackageClass) if (root.isRoot) invalidateOrRemove(EmptyPackageClass) else failed += root } diff --git a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala index 1fdf4c631e..0b54eda66d 100644 --- a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala +++ b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala @@ -145,8 +145,7 @@ abstract class NodePrinters { str.toString } def printModifiers(tree: MemberDef) { - // [Eugene++] there's most likely a bug here (?) - // see `Printers.printAnnotations` for more information + // SI-5885: by default this won't print annotations of not yet initialized symbols val annots0 = tree.symbol.annotations match { case Nil => tree.mods.annotations case xs => xs map annotationInfoToString diff --git a/src/compiler/scala/tools/nsc/ast/Positions.scala b/src/compiler/scala/tools/nsc/ast/Positions.scala index 74d1f8ab4b..d8fb632f73 100644 --- a/src/compiler/scala/tools/nsc/ast/Positions.scala +++ b/src/compiler/scala/tools/nsc/ast/Positions.scala @@ -11,13 +11,6 @@ trait Positions extends scala.reflect.internal.Positions { def validatePositions(tree: Tree) {} - // [Eugene] disabling this for now. imo it doesn't justify pollution of the public API - // override def _checkSetAnnotation(tree: Tree, annot: TreeAnnotation): Unit = { - // if (tree.pos != NoPosition && tree.pos != annot.pos) debugwarn("Overwriting annotation "+ tree.annotation +" of tree "+ tree +" with annotation "+ annot) - // // if ((tree.annotation.isInstanceOf[scala.reflect.internal.util.Position] || !annot.isInstanceOf[scala.reflect.internal.util.Position]) && tree.isInstanceOf[Block]) - // // println("Updating block from "+ tree.annotation +" to "+ annot) - // } - class ValidatingPosAssigner extends PosAssigner { var pos: Position = _ override def traverse(t: Tree) { diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index 381b834a0c..6f17a7d625 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -117,10 +117,7 @@ trait Trees extends reflect.internal.Trees { self: Global => if (vparamss1.isEmpty || !vparamss1.head.isEmpty && vparamss1.head.head.mods.isImplicit) vparamss1 = List() :: vparamss1; val superRef: Tree = atPos(superPos)(gen.mkSuperSelect) - def mkApply(fun: Tree, args: List[Tree]) = Apply(fun, args) - val superCall = (superRef /: argss) (mkApply) - // [Eugene++] no longer compiles after I moved the `Apply` case class into scala.reflect.internal - // val superCall = (superRef /: argss) (Apply) + val superCall = (superRef /: argss) (Apply.apply) List( atPos(wrappingPos(superPos, lvdefs ::: argss.flatten)) ( DefDef(constrMods, nme.CONSTRUCTOR, List(), vparamss1, TypeTree(), Block(lvdefs ::: List(superCall), Literal(Constant()))))) diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index ab856f09b8..898045e410 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -546,10 +546,7 @@ abstract class TreeBuilder { rhs1, List( atPos(pat1.pos) { - def mkIdent(name: Name) = Ident(name) - CaseDef(pat1, EmptyTree, makeTupleTerm(vars map (_._1) map mkIdent, true)) - // [Eugene++] no longer compiles after I moved the `Ident` case class into scala.reflect.internal - // CaseDef(pat1, EmptyTree, makeTupleTerm(vars map (_._1) map Ident, true)) + CaseDef(pat1, EmptyTree, makeTupleTerm(vars map (_._1) map Ident.apply, true)) } )) } diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala index 327436ed20..89195020c4 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala @@ -176,7 +176,7 @@ trait ModelFactoryImplicitSupport { val appliedTree = new ApplyImplicitView(viewTree, List(Ident("<argument>") setType viewTree.tpe.paramTypes.head)) val appliedTreeTyped: Tree = { val newContext = context.makeImplicit(context.ambiguousErrors) - newContext.macrosEnabled = false // [Eugene] I assume you want macro signature, not macro expansion + newContext.macrosEnabled = false val newTyper = global.analyzer.newTyper(newContext) newTyper.silent(_.typed(appliedTree, global.analyzer.EXPRmode, WildcardType), false) match { diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala index 6eadc1e63b..96d7dadbd7 100644 --- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala +++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala @@ -145,7 +145,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends private def _initSources = List(new BatchSourceFile("<init>", "class $repl_$init { }")) private def _initialize() = { try { - // [Eugene] todo. if this crashes, REPL will hang + // todo. if this crashes, REPL will hang new _compiler.Run() compileSources _initSources _initializeComplete = true true diff --git a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala index d6604499b4..9dcc4006a3 100644 --- a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala +++ b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala @@ -213,7 +213,7 @@ trait TypeStrings { private def tparamString[T: ru.TypeTag] : String = { def typeArguments: List[ru.Type] = ru.typeOf[T] match { case ru.TypeRef(_, _, args) => args; case _ => Nil } - // [Eugene++] todo. need to use not the `rootMirror`, but a mirror with the REPL's classloader + // [Eugene to Paul] need to use not the `rootMirror`, but a mirror with the REPL's classloader // how do I get to it? acquiring context classloader seems unreliable because of multithreading def typeVariables: List[java.lang.Class[_]] = typeArguments map (targ => ru.rootMirror.runtimeClass(targ)) brackets(typeArguments map (jc => tvarString(List(jc))): _*) diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index db97308f41..282c7251e3 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -436,7 +436,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val sClassMap = anyrefSpecCache.getOrElseUpdate(sClass, mutable.Map[Symbol, Symbol]()) sClassMap.getOrElseUpdate(tparam, - tparam.cloneSymbol(sClass, tparam.flags, (tparam.name append tpnme.SPECIALIZED_SUFFIX).asInstanceOf[Name]) // [Eugene++] why do we need this cast? + tparam.cloneSymbol(sClass, tparam.flags, (tparam.name append tpnme.SPECIALIZED_SUFFIX).asInstanceOf[Name]) // [Eugene] why do we need this cast? modifyInfo (info => TypeBounds(info.bounds.lo, AnyRefClass.tpe)) ).tpe } @@ -1772,10 +1772,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { private def forwardCall(pos: scala.reflect.internal.util.Position, receiver: Tree, paramss: List[List[ValDef]]): Tree = { val argss = mmap(paramss)(x => Ident(x.symbol)) - def mkApply(fun: Tree, args: List[Tree]) = Apply(fun, args) - atPos(pos) { (receiver /: argss) (mkApply) } - // [Eugene++] no longer compiles after I moved the `Apply` case class into scala.reflect.internal - // atPos(pos) { (receiver /: argss) (Apply) } + atPos(pos) { (receiver /: argss) (Apply.apply) } } /** Forward to the generic class constructor. If the current class initializes @@ -1817,10 +1814,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { else Ident(x.symbol) ) - def mkApply(fun: Tree, args: List[Tree]) = Apply(fun, args) - atPos(pos) { (receiver /: argss) (mkApply) } - // [Eugene++] no longer compiles after I moved the `Apply` case class into scala.reflect.internal - // atPos(pos) { (receiver /: argss) (Apply) } + atPos(pos) { (receiver /: argss) (Apply.apply) } } /** Add method m to the set of symbols for which we need an implementation tree diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index f9035f26b9..924d590edb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1185,10 +1185,6 @@ trait Implicits { // ClassTags are not path-dependent, so their materializer doesn't care about prefixes if (tagClass eq ClassTagClass) gen.mkBasisUniverseRef else pre match { - // [Eugene to Martin] this is the crux of the interaction between - // implicits and reifiers here we need to turn a (supposedly - // path-dependent) type into a tree that will be used as a prefix I'm - // not sure if I've done this right - please, review case SingleType(prePre, preSym) => gen.mkAttributedRef(prePre, preSym) setType pre // necessary only to compile typetags used inside the Universe cake @@ -1373,7 +1369,8 @@ trait Implicits { /** The result of the implicit search: * First search implicits visible in current context. * If that fails, search implicits in expected type `pt`. - * // [Eugene] the following lines should be deleted after we migrate delegate tag materialization to implicit macros + * + * todo. the following lines should be deleted after we migrate delegate tag materialization to implicit macros * If that fails, and `pt` is an instance of a ClassTag, try to construct a class tag. * If that fails, and `pt` is an instance of a TypeTag, try to construct a type tag. * If that fails, and `pt` is an instance of a ClassManifest, try to construct a class manifest. diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index c8bf70e9e0..c2ab5edbb6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -132,9 +132,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { // there are some more clever cases when seemingly non-static method ends up being statically accessible // however, the code below doesn't account for these guys, because it'd take a look of time to get it right // for now I leave it as a todo and move along to more the important stuff - // [Eugene] relies on the fact that macro implementations can only be defined in static classes - // [Martin to Eugene++] There's similar logic buried in Symbol#flatname. Maybe we can refactor? - // [Eugene] we will refactor once I get my hands on https://issues.scala-lang.org/browse/SI-5498 + // todo. refactor when fixing SI-5498 def className: String = { def loop(sym: Symbol): String = sym match { case sym if sym.owner.isPackageClass => @@ -445,7 +443,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { // because it's adapt which is responsible for automatic expansion during typechecking def typecheckRhs(rhs: Tree): Tree = { try { - val prevNumErrors = reporter.ERROR.count // [Eugene] funnily enough, the isErroneous check is not enough + val prevNumErrors = reporter.ERROR.count var rhs1 = if (hasError) EmptyTree else typer.typed1(rhs, EXPRmode, WildcardType) def typecheckedWithErrors = (rhs1 exists (_.isErroneous)) || reporter.ERROR.count != prevNumErrors def rhsNeedsMacroExpansion = rhs1.symbol != null && rhs1.symbol.isTermMacro && !rhs1.symbol.isErroneous @@ -681,8 +679,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { // transform type parameters of a macro implementation into type parameters of a macro definition runtimeType = runtimeType map { case TypeRef(pre, sym, args) => - // [Eugene] not sure which of these deSkolemizes are necessary - // sym.paramPos is unreliable (see another case below) + // sym.paramPos is unreliable (see an example in `macroArgs`) val tparams = macroImpl.typeParams map (_.deSkolemize) val paramPos = tparams indexOf sym.deSkolemize val sym1 = @@ -745,7 +742,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { * Loads classes from from -cp (aka the library classpath). * Is also capable of detecting REPL and reusing its classloader. */ - private lazy val macroClassloader: ClassLoader = { + lazy val macroClassloader: ClassLoader = { if (global.forMSIL) throw new UnsupportedOperationException("Scala reflection not available on this platform") @@ -753,7 +750,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { macroLogVerbose("macro classloader: initializing from -cp: %s".format(classpath)) val loader = ScalaClassLoader.fromURLs(classpath, self.getClass.getClassLoader) - // [Eugene] a heuristic to detect the REPL + // a heuristic to detect the REPL if (global.settings.exposeEmptyPackage.value) { macroLogVerbose("macro classloader: initializing from a REPL classloader".format(global.classPath.asURLs)) import scala.tools.nsc.interpreter._ @@ -787,9 +784,11 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { val methName = binding.methName macroLogVerbose(s"resolved implementation as $className.$methName") - // [Eugene++] I don't use Scala reflection here, because it seems to interfere with JIT magic + // I don't use Scala reflection here, because it seems to interfere with JIT magic // whenever you instantiate a mirror (and not do anything with in, just instantiate), performance drops by 15-20% // I'm not sure what's the reason - for me it's pure voodoo + // upd. my latest experiments show that everything's okay + // it seems that in 2.10.1 we can easily switch to Scala reflection try { macroTraceVerbose("loading implementation class: ")(className) macroTraceVerbose("classloader is: ")(ReflectionUtils.show(macroClassloader)) @@ -889,7 +888,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { val targ = binding.targs(paramPos).tpe.typeSymbol val tpe = if (targ.isTypeParameterOrSkolem) { if (targ.owner == macroDef) { - // [Eugene] doesn't work when macro def is compiled separately from its usages + // doesn't work when macro def is compiled separately from its usages // then targ is not a skolem and isn't equal to any of macroDef.typeParams // val argPos = targ.deSkolemize.paramPos val argPos = macroDef.typeParams.indexWhere(_.name == targ.name) @@ -970,7 +969,6 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { // so I added this dummy local for the ease of debugging var expectedTpe = expandee.tpe - // [Eugene] weird situation. what's the conventional way to deal with it? val isNullaryInvocation = expandee match { case TypeApply(Select(_, _), _) => true case TypeApply(Ident(_), _) => true @@ -1117,8 +1115,9 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { macroLogLite("typechecking macro expansion %s at %s".format(expandee, expandee.pos)) macroArgs(typer, expandee).fold(failExpansion(): MacroExpansionResult) { args => (args: @unchecked) match { - // [Eugene++] crashes virtpatmat: + // crashes virtpatmat: // case args @ ((context: MacroContext) :: _) => + // todo. extract a minimized test case case args @ (context0 :: _) => val context = context0.asInstanceOf[MacroContext] if (nowDelayed) { @@ -1197,7 +1196,6 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { } private def handleMacroExpansionException(typer: Typer, expandee: Tree, ex: Throwable): MacroExpansionResult = { - // [Eugene] any ideas about how to improve this one? val realex = ReflectionUtils.unwrapThrowable(ex) realex match { case realex: reflect.macros.runtime.AbortMacroException => diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index dd180e6b76..f7ba189e0f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -31,7 +31,6 @@ trait MethodSynthesis { else DefDef(sym, body) def applyTypeInternal(tags: List[TT[_]]): Type = { - // [Eugene++ to Paul] needs review!! val symbols = tags map compilerSymbolFromTag val container :: args = symbols val tparams = container.typeConstructor.typeParams @@ -53,21 +52,14 @@ trait MethodSynthesis { applyTypeInternal(List(t1)) def applyType[CC[X1], X1](implicit t1: TT[CC[_]], t2: TT[X1]): Type = - applyTypeInternal(List[TT[_]](t1, t2)) + applyTypeInternal(List(t1, t2)) def applyType[CC[X1, X2], X1, X2](implicit t1: TT[CC[_,_]], t2: TT[X1], t3: TT[X2]): Type = - // [Eugene++] without an explicit type annotation for List, we get this: - // [scalacfork] C:\Projects\KeplerUnderRefactoring\src\compiler\scala\tools\nsc\typechecker\MethodSynthesis.scala:59: error: no type parameters for method apply: (xs: A*)List[A] in object List exist so that it can be applied to arguments (scala.tools.nsc.typechecker.MethodSynthesis.synthesisUtil.TT[CC[_, _]], scala.tools.nsc.typechecker.MethodSynthesis.synthesisUtil.TT[X1], scala.tools.nsc.typechecker.MethodSynthesis.synthesisUtil.TT[X2]) - // [scalacfork] --- because --- - // [scalacfork] undetermined type - // [scalacfork] applyTypeInternal(List(t1, t2, t3)) - applyTypeInternal(List[TT[_]](t1, t2, t3)) + applyTypeInternal(List(t1, t2, t3)) def applyType[CC[X1, X2, X3], X1, X2, X3](implicit t1: TT[CC[_,_,_]], t2: TT[X1], t3: TT[X2], t4: TT[X3]): Type = - applyTypeInternal(List[TT[_]](t1, t2, t3, t4)) + applyTypeInternal(List(t1, t2, t3, t4)) - // [Martin->Eugene] !!! reinstantiate when typeables are in. - // [Eugene++->Martin] now this compiles, will soon check it out def newMethodType[F](owner: Symbol)(implicit t: TT[F]): Type = { val fnSymbol = compilerSymbolFromTag(t) val formals = compilerTypeFromTag(t).typeArguments diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala index c7c9d2f4aa..d227f485c2 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala @@ -63,7 +63,7 @@ trait SyntheticMethods extends ast.TreeDSL { // in the original order. def accessors = clazz.caseFieldAccessors sortBy { acc => originalAccessors indexWhere { orig => - (acc.name == orig.name) || (acc.name startsWith (orig.name append "$").asInstanceOf[Name]) // [Eugene++] why do we need this cast? + (acc.name == orig.name) || (acc.name startsWith (orig.name append "$").asInstanceOf[Name]) // [Eugene] why do we need this cast? } } val arity = accessors.size @@ -87,7 +87,7 @@ trait SyntheticMethods extends ast.TreeDSL { ) def forwardToRuntime(method: Symbol): Tree = - forwardMethod(method, getMember(ScalaRunTimeModule, (method.name prepend "_").asInstanceOf[Name]))(mkThis :: _) // [Eugene++] why do we need this cast? + forwardMethod(method, getMember(ScalaRunTimeModule, (method.name prepend "_").asInstanceOf[Name]))(mkThis :: _) // [Eugene] why do we need this cast? def callStaticsMethod(name: String)(args: Tree*): Tree = { val method = termMember(RuntimeStaticsModule, name) diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index 4a0977eb90..f0dca64a00 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -462,7 +462,6 @@ trait TypeDiagnostics { case CyclicReference(sym, info: TypeCompleter) => if (context0.owner.isTermMacro) { // see comments to TypeSigError for an explanation of this special case - // [Eugene] is there a better way? throw ex } else { val pos = info.tree match { diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index a6d7fcda75..7c509f4d33 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -51,7 +51,6 @@ trait Typers extends Modes with Adaptations with Tags { transformed.clear() } - // [Eugene] shouldn't this be converted to resetAllAttrs? object UnTyper extends Traverser { override def traverse(tree: Tree) = { if (tree != EmptyTree) tree.tpe = null @@ -909,7 +908,7 @@ trait Typers extends Modes with Adaptations with Tags { def adaptType(): Tree = { if (inFunMode(mode)) { - // [Eugene++] the commented line below makes sense for typechecking, say, TypeApply(Ident(`some abstract type symbol`), List(...)) + // todo. the commented line below makes sense for typechecking, say, TypeApply(Ident(`some abstract type symbol`), List(...)) // because otherwise Ident will have its tpe set to a TypeRef, not to a PolyType, and `typedTypeApply` will fail // but this needs additional investigation, because it crashes t5228, gadts1 and maybe something else // tree setType tree.tpe.normalize @@ -2609,7 +2608,7 @@ trait Typers extends Modes with Adaptations with Tags { val stats1 = typedStats(stats, NoSymbol) // this code kicks in only after typer, so `stats` will never be filled in time // as a result, most of compound type trees with non-empty stats will fail to reify - // [Eugene++] todo. investigate whether something can be done about this + // todo. investigate whether something can be done about this val att = templ.attachments.get[CompoundTypeTreeOriginalAttachment].getOrElse(CompoundTypeTreeOriginalAttachment(Nil, Nil)) templ.removeAttachment[CompoundTypeTreeOriginalAttachment] templ addAttachment att.copy(stats = stats1) @@ -3416,7 +3415,7 @@ trait Typers extends Modes with Adaptations with Tags { } if (hasError) annotationError - else AnnotationInfo(annType, List(), nvPairs map {p => (p._1.asInstanceOf[Name], p._2.get)}).setOriginal(Apply(typedFun, args).setPos(ann.pos)) // [Eugene+] why do we need this cast? + else AnnotationInfo(annType, List(), nvPairs map {p => (p._1.asInstanceOf[Name], p._2.get)}).setOriginal(Apply(typedFun, args).setPos(ann.pos)) // [Eugene] why do we need this cast? } } else if (requireJava) { reportAnnotationError(NestedAnnotationError(ann, annType)) @@ -5105,7 +5104,7 @@ trait Typers extends Modes with Adaptations with Tags { erasure.GenericArray.unapply(tpt.tpe).isDefined) => // !!! todo simplify by using extractor // convert new Array[T](len) to evidence[ClassTag[T]].newArray(len) // convert new Array^N[T](len) for N > 1 to evidence[ClassTag[Array[...Array[T]...]]].newArray(len), where Array HK gets applied (N-1) times - // [Eugene] no more MaxArrayDims. ClassTags are flexible enough to allow creation of arrays of arbitrary dimensionality (w.r.t JVM restrictions) + // no more MaxArrayDims. ClassTags are flexible enough to allow creation of arrays of arbitrary dimensionality (w.r.t JVM restrictions) val Some((level, componentType)) = erasure.GenericArray.unapply(tpt.tpe) val tagType = List.iterate(componentType, level)(tpe => appliedType(ArrayClass.toTypeConstructor, List(tpe))).last val newArrayApp = atPos(tree.pos) { |