diff --git a/compiler/src/dotty/tools/backend/jvm/GenBCode.scala b/compiler/src/dotty/tools/backend/jvm/GenBCode.scala index 4ce9926eb3b8..e991bbe01b81 100644 --- a/compiler/src/dotty/tools/backend/jvm/GenBCode.scala +++ b/compiler/src/dotty/tools/backend/jvm/GenBCode.scala @@ -115,12 +115,11 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter case class Item2(arrivalPos: Int, mirror: asm.tree.ClassNode, plain: asm.tree.ClassNode, - bean: asm.tree.ClassNode, outFolder: scala.tools.nsc.io.AbstractFile) { def isPoison = { arrivalPos == Int.MaxValue } } - private val poison2 = Item2(Int.MaxValue, null, null, null, null) + private val poison2 = Item2(Int.MaxValue, null, null, null) private val q2 = new _root_.java.util.LinkedList[Item2] /* ---------------- q3 ---------------- */ @@ -140,7 +139,6 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter case class Item3(arrivalPos: Int, mirror: SubItem3, plain: SubItem3, - bean: SubItem3, outFolder: scala.tools.nsc.io.AbstractFile) { def isPoison = { arrivalPos == Int.MaxValue } @@ -152,7 +150,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter else 1 } } - private val poison3 = Item3(Int.MaxValue, null, null, null, null) + private val poison3 = Item3(Int.MaxValue, null, null, null) private val q3 = new java.util.PriorityQueue[Item3](1000, i3comparator) /* @@ -243,21 +241,12 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter store.visitAttribute(dataAttr) } - // -------------- bean info class, if needed -------------- - val beanC = - if (claszSymbol hasAnnotation int.BeanInfoAttr) { - beanInfoCodeGen.genBeanInfoClass( - claszSymbol, cunit, - int.symHelper(claszSymbol).fieldSymbols, - int.symHelper(claszSymbol).methodSymbols - ) - } else null // ----------- hand over to pipeline-2 val item2 = Item2(arrivalPos, - mirrorC, plainC, beanC, + mirrorC, plainC, outF) q2 add item2 // at the very end of this method so that no Worker2 thread starts mutating before we're done. @@ -307,19 +296,17 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter cw.toByteArray } - val Item2(arrivalPos, mirror, plain, bean, outFolder) = item + val Item2(arrivalPos, mirror, plain, outFolder) = item val mirrorC = if (mirror == null) null else SubItem3(mirror.name, getByteArray(mirror)) val plainC = SubItem3(plain.name, getByteArray(plain)) - val beanC = if (bean == null) null else SubItem3(bean.name, getByteArray(bean)) if (AsmUtils.traceSerializedClassEnabled && plain.name.contains(AsmUtils.traceSerializedClassPattern)) { if (mirrorC != null) AsmUtils.traceClass(mirrorC.jclassBytes) AsmUtils.traceClass(plainC.jclassBytes) - if (beanC != null) AsmUtils.traceClass(beanC.jclassBytes) } - q3 add Item3(arrivalPos, mirrorC, plainC, beanC, outFolder) + q3 add Item3(arrivalPos, mirrorC, plainC, outFolder) } @@ -453,7 +440,6 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter val outFolder = item.outFolder sendToDisk(item.mirror, outFolder) sendToDisk(item.plain, outFolder) - sendToDisk(item.bean, outFolder) expected += 1 } } diff --git a/compiler/src/dotty/tools/dotc/Run.scala b/compiler/src/dotty/tools/dotc/Run.scala index 44dca7e1dd6b..62c8bbe70cde 100644 --- a/compiler/src/dotty/tools/dotc/Run.scala +++ b/compiler/src/dotty/tools/dotc/Run.scala @@ -143,7 +143,7 @@ class Run(comp: Compiler, ictx: Context) { } private sealed trait PrintedTree - private final case class SomePrintedTree(phase: String, tree: String) extends PrintedTree + private /*final*/ case class SomePrintedTree(phase: String, tree: String) extends PrintedTree private object NoPrintedTree extends PrintedTree private def printTree(last: PrintedTree)(implicit ctx: Context): PrintedTree = { diff --git a/compiler/src/dotty/tools/dotc/core/Symbols.scala b/compiler/src/dotty/tools/dotc/core/Symbols.scala index fd30a9b89212..85ef64c237ca 100644 --- a/compiler/src/dotty/tools/dotc/core/Symbols.scala +++ b/compiler/src/dotty/tools/dotc/core/Symbols.scala @@ -31,6 +31,7 @@ import collection.mutable import io.AbstractFile import language.implicitConversions import util.{NoSource, DotClass} +import scala.collection.JavaConverters._ /** Creation methods for symbols */ trait Symbols { this: Context => @@ -724,25 +725,14 @@ object Symbols { def clear(): Unit = value.clear() - def filter(p: ((Symbol, T)) => Boolean): Map[Symbol, T] = { - import scala.collection.JavaConversions._ - value.toMap.filter(p) - } + def filter(p: ((Symbol, T)) => Boolean): Map[Symbol, T] = + value.asScala.toMap.filter(p) - def iterator: Iterator[(Symbol, T)] = { - import scala.collection.JavaConversions._ - value.iterator - } + def iterator: Iterator[(Symbol, T)] = value.asScala.iterator - def keysIterator: Iterator[Symbol] = { - import scala.collection.JavaConversions._ - value.keySet().iterator - } + def keysIterator: Iterator[Symbol] = value.keySet().asScala.iterator - def toMap: Map[Symbol, T] = { - import scala.collection.JavaConversions._ - value.toMap - } + def toMap: Map[Symbol, T] = value.asScala.toMap } @inline def newMutableSymbolMap[T]: MutableSymbolMap[T] = diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index 09e6b2d20915..c08da6aa2559 100644 --- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -425,7 +425,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas // symbols that were pickled with Pickler.writeSymInfo val nameref = readNat() - var name = at(nameref, readName) + var name = at(nameref, () => readName()(ctx)) val owner = readSymbolRef() var flags = unpickleScalaFlags(readLongNat(), name.isTypeName) @@ -543,12 +543,12 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas denot.privateWithin = if (!isSymbolRef(inforef)) NoSymbol else { - val pw = at(inforef, readSymbol) + val pw = at(inforef, () => readSymbol()) inforef = readNat() pw } // println("reading type for " + denot) // !!! DEBUG - val tp = at(inforef, readType) + val tp = at(inforef, () => readType()(ctx)) denot match { case denot: ClassDenotation => val selfInfo = if (atEnd) NoType else readTypeRef() @@ -599,11 +599,11 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas val end = readNat() + readIndex if (tag == POLYtpe) { val unusedRestpeRef = readNat() - until(end, readSymbolRef).asInstanceOf[List[TypeSymbol]] + until(end, () => readSymbolRef()(ctx)).asInstanceOf[List[TypeSymbol]] } else Nil } private def loadTypeParams(implicit ctx: Context) = - atReadPos(index(infoRef), readTypeParams) + atReadPos(index(infoRef), () => readTypeParams()(ctx)) /** Force reading type params early, we need them in setClassInfo of subclasses. */ def init()(implicit ctx: Context) = loadTypeParams @@ -741,7 +741,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas } else TypeRef(pre, sym.name.asTypeName) - val args = until(end, readTypeRef) + val args = until(end, () => readTypeRef()) if (sym == defn.ByNameParamClass2x) ExprType(args.head) else if (args.nonEmpty) tycon.safeAppliedTo(EtaExpandIfHK(sym.typeParams, args.map(translateTempPoly))) else if (sym.typeParams.nonEmpty) tycon.EtaExpand(sym.typeParams) @@ -752,7 +752,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas val clazz = readSymbolRef() val decls = symScope(clazz) symScopes(clazz) = EmptyScope // prevent further additions - val parents = until(end, readTypeRef) + val parents = until(end, () => readTypeRef()) val parent = parents.reduceLeft(AndType(_, _)) if (decls.isEmpty) parent else { @@ -765,10 +765,10 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas } case CLASSINFOtpe => val clazz = readSymbolRef() - TempClassInfoType(until(end, readTypeRef), symScope(clazz), clazz) + TempClassInfoType(until(end, () => readTypeRef()), symScope(clazz), clazz) case METHODtpe | IMPLICITMETHODtpe => val restpe = readTypeRef() - val params = until(end, readSymbolRef).asInstanceOf[List[TermSymbol]] + val params = until(end, () => readSymbolRef()).asInstanceOf[List[TermSymbol]] def isImplicit = tag == IMPLICITMETHODtpe || params.nonEmpty && (params.head is Implicit) @@ -776,15 +776,15 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas maker.fromSymbols(params, restpe) case POLYtpe => val restpe = readTypeRef() - val typeParams = until(end, readSymbolRef) + val typeParams = until(end, () => readSymbolRef()) if (typeParams.nonEmpty) TempPolyType(typeParams.asInstanceOf[List[TypeSymbol]], restpe.widenExpr) else ExprType(restpe) case EXISTENTIALtpe => val restpe = readTypeRef() - val boundSyms = until(end, readSymbolRef) + val boundSyms = until(end, () => readSymbolRef()) elimExistentials(boundSyms, restpe) case ANNOTATEDtpe => - AnnotatedType.make(readTypeRef(), until(end, readAnnotationRef)) + AnnotatedType.make(readTypeRef(), until(end, () => readAnnotationRef())) case _ => noSuchTypeTag(tag, end) } @@ -795,7 +795,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas val end = readNat() + readIndex if (tag == POLYtpe) { val unusedRestperef = readNat() - until(end, readSymbolRef) + until(end, () => readSymbolRef()) } else Nil } @@ -859,26 +859,26 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas } protected def readDisambiguatedSymbolRef(p: Symbol => Boolean)(implicit ctx: Context): Symbol = - at(readNat(), readDisambiguatedSymbol(p)) + at(readNat(), () => readDisambiguatedSymbol(p)()) - protected def readNameRef()(implicit ctx: Context): Name = at(readNat(), readName) + protected def readNameRef()(implicit ctx: Context): Name = at(readNat(), () => readName()) protected def readTypeRef()(implicit ctx: Context): Type = at(readNat(), () => readType()) // after the NMT_TRANSITION period, we can leave off the () => ... () - protected def readConstantRef()(implicit ctx: Context): Constant = at(readNat(), readConstant) + protected def readConstantRef()(implicit ctx: Context): Constant = at(readNat(), () => readConstant()) protected def readTypeNameRef()(implicit ctx: Context): TypeName = readNameRef().toTypeName protected def readTermNameRef()(implicit ctx: Context): TermName = readNameRef().toTermName - protected def readAnnotationRef()(implicit ctx: Context): Annotation = at(readNat(), readAnnotation) + protected def readAnnotationRef()(implicit ctx: Context): Annotation = at(readNat(), () => readAnnotation()) protected def readModifiersRef(isType: Boolean)(implicit ctx: Context): Modifiers = at(readNat(), () => readModifiers(isType)) - protected def readTreeRef()(implicit ctx: Context): Tree = at(readNat(), readTree) + protected def readTreeRef()(implicit ctx: Context): Tree = at(readNat(), () => readTree()) /** Read an annotation argument, which is pickled either * as a Constant or a Tree. */ protected def readAnnotArg(i: Int)(implicit ctx: Context): Tree = bytes(index(i)) match { - case TREE => at(i, readTree) - case _ => Literal(at(i, readConstant)) + case TREE => at(i, () => readTree()) + case _ => Literal(at(i, () => readConstant())) } /** Read a ClassfileAnnotArg (argument to a classfile annotation) @@ -899,8 +899,8 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas } protected def readClassfileAnnotArg(i: Int)(implicit ctx: Context): Tree = bytes(index(i)) match { - case ANNOTINFO => at(i, readAnnotInfoArg) - case ANNOTARGARRAY => at(i, readArrayAnnotArg) + case ANNOTINFO => at(i, () => readAnnotInfoArg()) + case ANNOTARGARRAY => at(i, () => readArrayAnnotArg()) case _ => readAnnotArg(i) } @@ -916,7 +916,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas val argref = readNat() t += { if (isNameEntry(argref)) { - val name = at(argref, readName) + val name = at(argref, () => readName()) val arg = readClassfileAnnotArg(readNat()) NamedArg(name.asTermName, arg) } else readAnnotArg(argref) @@ -1007,13 +1007,13 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case PACKAGEtree => setSym() val pid = readTreeRef().asInstanceOf[RefTree] - val stats = until(end, readTreeRef) + val stats = until(end, () => readTreeRef()) PackageDef(pid, stats) case CLASStree => setSymModsName() val impl = readTemplateRef() - val tparams = until(end, readTypeDefRef) + val tparams = until(end, () => readTypeDefRef()) val cls = symbol.asClass val ((constr: DefDef) :: Nil, stats) = impl.body.partition(_.symbol == cls.primaryConstructor) @@ -1031,8 +1031,8 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case DEFDEFtree => setSymModsName() - val tparams = times(readNat(), readTypeDefRef) - val vparamss = times(readNat(), () => times(readNat(), readValDefRef)) + val tparams = times(readNat(), () => readTypeDefRef()) + val vparamss = times(readNat(), () => times(readNat(), () => readValDefRef())) val tpt = readTreeRef() val rhs = readTreeRef() DefDef(symbol.asTerm, rhs) @@ -1040,13 +1040,13 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case TYPEDEFtree => setSymModsName() val rhs = readTreeRef() - val tparams = until(end, readTypeDefRef) + val tparams = until(end, () => readTypeDefRef()) TypeDef(symbol.asType) case LABELtree => setSymName() val rhs = readTreeRef() - val params = until(end, readIdentRef) + val params = until(end, () => readIdentRef()) val ldef = DefDef(symbol.asTerm, rhs) def isCaseLabel(sym: Symbol) = sym.name.startsWith(nme.CASEkw.toString) if (isCaseLabel(symbol)) ldef @@ -1067,15 +1067,15 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case TEMPLATEtree => setSym() - val parents = times(readNat(), readTreeRef) + val parents = times(readNat(), () => readTreeRef()) val self = readValDefRef() - val body = until(end, readTreeRef) + val body = until(end, () => readTreeRef()) untpd.Template(???, parents, self, body) // !!! TODO: pull out primary constructor .withType(symbol.namedType) case BLOCKtree => val expr = readTreeRef() - val stats = until(end, readTreeRef) + val stats = until(end, () => readTreeRef()) Block(stats, expr) case CASEtree => @@ -1085,7 +1085,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas CaseDef(pat, guard, body) case ALTERNATIVEtree => - Alternative(until(end, readTreeRef)) + Alternative(until(end, () => readTreeRef())) case STARtree => readTreeRef() @@ -1097,19 +1097,19 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case UNAPPLYtree => val fun = readTreeRef() - val args = until(end, readTreeRef) + val args = until(end, () => readTreeRef()) UnApply(fun, Nil, args, defn.AnyType) // !!! this is wrong in general case ARRAYVALUEtree => val elemtpt = readTreeRef() - val trees = until(end, readTreeRef) + val trees = until(end, () => readTreeRef()) SeqLiteral(trees, elemtpt) // note can't deal with trees passed to Java methods as arrays here case FUNCTIONtree => setSym() val body = readTreeRef() - val vparams = until(end, readValDefRef) + val vparams = until(end, () => readValDefRef()) val applyType = MethodType(vparams map (_.name), vparams map (_.tpt.tpe), body.tpe) val applyMeth = ctx.newSymbol(symbol.owner, nme.apply, Method, applyType) Closure(applyMeth, Function.const(body.changeOwner(symbol, applyMeth)) _) @@ -1127,7 +1127,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case MATCHtree => val selector = readTreeRef() - val cases = until(end, readCaseDefRef) + val cases = until(end, () => readCaseDefRef()) Match(selector, cases) case RETURNtree => @@ -1137,7 +1137,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case TREtree => val block = readTreeRef() val finalizer = readTreeRef() - val catches = until(end, readCaseDefRef) + val catches = until(end, () => readCaseDefRef()) Try(block, catches, finalizer) case THROWtree => @@ -1153,12 +1153,12 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case TYPEAPPLYtree => val fun = readTreeRef() - val args = until(end, readTreeRef) + val args = until(end, () => readTreeRef()) TypeApply(fun, args) case APPLYtree => val fun = readTreeRef() - val args = until(end, readTreeRef) + val args = until(end, () => readTreeRef()) /* if (fun.symbol.isOverloaded) { fun.setType(fun.symbol.info) @@ -1170,7 +1170,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case APPLYDYNAMICtree => setSym() val qual = readTreeRef() - val args = until(end, readTreeRef) + val args = until(end, () => readTreeRef()) unimplementedTree("APPLYDYNAMIC") case SUPERtree => @@ -1218,7 +1218,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case APPLIEDTYPEtree => val tpt = readTreeRef() - val args = until(end, readTreeRef) + val args = until(end, () => readTreeRef()) AppliedTypeTree(tpt, args) case TYPEBOUNDStree => @@ -1228,7 +1228,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case EXISTENTIALTYPEtree => val tpt = readTreeRef() - val whereClauses = until(end, readTreeRef) + val whereClauses = until(end, () => readTreeRef()) TypeTree(tpe) case _ => diff --git a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala index ec781de43d47..d6401bba8371 100644 --- a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala @@ -323,7 +323,7 @@ object JavaParsers { if (in.token == LT) { in.nextToken() val t1 = convertToTypeId(t) - val args = repsep(typeArg, COMMA) + val args = repsep(() => typeArg(), COMMA) acceptClosingAngle() atPos(t1.pos.start) { AppliedTypeTree(t1, args) @@ -435,7 +435,7 @@ object JavaParsers { def formalParams(): List[ValDef] = { accept(LPAREN) - val vparams = if (in.token == RPAREN) List() else repsep(formalParam, COMMA) + val vparams = if (in.token == RPAREN) List() else repsep(() => formalParam(), COMMA) accept(RPAREN) vparams } @@ -459,7 +459,7 @@ object JavaParsers { def optThrows(): Unit = { if (in.token == THROWS) { in.nextToken() - repsep(typ, COMMA) + repsep(() => typ(), COMMA) } } @@ -675,7 +675,7 @@ object JavaParsers { def interfacesOpt() = if (in.token == IMPLEMENTS) { in.nextToken() - repsep(typ, COMMA) + repsep(() => typ(), COMMA) } else { List() } @@ -708,7 +708,7 @@ object JavaParsers { val parents = if (in.token == EXTENDS) { in.nextToken() - repsep(typ, COMMA) + repsep(() => typ(), COMMA) } else { List(javaLangObject()) } diff --git a/compiler/src/dotty/tools/dotc/parsing/MarkupParserCommon.scala b/compiler/src/dotty/tools/dotc/parsing/MarkupParserCommon.scala index eb7671605f9d..a3781343e92c 100644 --- a/compiler/src/dotty/tools/dotc/parsing/MarkupParserCommon.scala +++ b/compiler/src/dotty/tools/dotc/parsing/MarkupParserCommon.scala @@ -159,7 +159,7 @@ private[dotty] trait MarkupParserCommon { Utility.parseCharRef(() => c, () => { c = it.next() }, reportSyntaxError _, truncatedError _) } - def xCharRef: String = xCharRef(() => ch, nextch) + def xCharRef: String = xCharRef(() => ch, () => nextch()) /** Create a lookahead reader which does not influence the input */ def lookahead(): BufferedIterator[Char] diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 88e90ba915d0..311834121aa4 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -928,9 +928,9 @@ object Parsers { in.nextToken() otherArgs(NamedArg(name, typ()), namedTypeArg) case firstArg => - otherArgs(firstArg, typ) + otherArgs(firstArg, () => typ()) } - else commaSeparated(typParser) + else commaSeparated(() => typParser()) } /** FunArgType ::= Type | `=>' Type @@ -1851,7 +1851,7 @@ object Parsers { TypeDef(name, lambdaAbstract(hkparams, bounds)).withMods(mods) } } - commaSeparated(typeParam) + commaSeparated(() => typeParam()) } def typeParamClauseOpt(ownerKind: ParamOwner.Value): List[TypeDef] = @@ -1924,7 +1924,7 @@ object Parsers { implicitOffset = in.offset imods = implicitMods() } - commaSeparated(param) + commaSeparated(() => param()) } } def clauses(): List[List[ValDef]] = { @@ -2309,7 +2309,7 @@ object Parsers { classDefRest(start, mods1, id.name.toTypeName) else if (in.token == COMMA) { in.nextToken() - val ids = commaSeparated(termIdent) + val ids = commaSeparated(() => termIdent()) PatDef(mods1, id :: ids, TypeTree(), EmptyTree) } else diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index e89b5f565a3a..5677542c0605 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -540,9 +540,9 @@ object Scanners { def fetchSingleQuote() = { nextChar() if (isIdentifierStart(ch)) - charLitOr(getIdentRest) + charLitOr(() => getIdentRest()) else if (isOperatorPart(ch) && (ch != '\\')) - charLitOr(getOperatorRest) + charLitOr(() => getOperatorRest()) else { getLitChar() if (ch == '\'') { diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcherOld.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcherOld.scala index 154a788b4427..c0ab94b02386 100644 --- a/compiler/src/dotty/tools/dotc/transform/PatternMatcherOld.scala +++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcherOld.scala @@ -286,7 +286,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer { } } } - final case class Suppression(exhaustive: Boolean, unreachable: Boolean) + /*final*/ case class Suppression(exhaustive: Boolean, unreachable: Boolean) object Suppression { val NoSuppression = Suppression(false, false) } @@ -1061,7 +1061,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer { case _ => BoundTree(freshSym(tree.pos, pt, PatMatPName), tree) } - final case class BoundTree(binder: Symbol, tree: Tree) { + /*final*/ case class BoundTree(binder: Symbol, tree: Tree) { private lazy val extractor = ExtractorCall(tree, binder) def pos = tree.pos @@ -1179,7 +1179,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer { } // a list of TreeMakers that encode `patTree`, and a list of arguments for recursive invocations of `translatePattern` to encode its subpatterns - final case class TranslationStep(makers: List[TreeMaker], subpatterns: List[BoundTree]) { + /*final*/ case class TranslationStep(makers: List[TreeMaker], subpatterns: List[BoundTree]) { def merge(f: BoundTree => List[TreeMaker]): List[TreeMaker] = makers ::: (subpatterns flatMap f) override def toString = if (subpatterns.isEmpty) "" else subpatterns.mkString("(", ", ", ")") } @@ -1611,7 +1611,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer { override def toString = "" } - final case class Patterns(fixed: List[Pattern], star: Pattern) { + /*final*/ case class Patterns(fixed: List[Pattern], star: Pattern) { def hasStar = star != NoPattern def starArity = if (hasStar) 1 else 0 def nonStarArity = fixed.length @@ -1645,7 +1645,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer { * @param fixed The non-sequence types which are extracted * @param repeated The sequence type which is extracted */ - final case class Extractor(whole: Type, fixed: List[Type], repeated: Repeated) { + /*final*/ case class Extractor(whole: Type, fixed: List[Type], repeated: Repeated) { require(whole != NoType, s"expandTypes($whole, $fixed, $repeated)") def prodArity = fixed.length @@ -1666,7 +1666,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer { override def toString = "%s => %s".format(whole, offeringString) } - final case class TypedPat(pat: Pattern, tpe: Type) { + /*final*/ case class TypedPat(pat: Pattern, tpe: Type) { override def toString = s"$pat: $tpe" } @@ -1677,7 +1677,7 @@ class PatternMatcherOld extends MiniPhase with DenotTransformer { * sequence which can populate at least patterns. * < 0: There are more products than patterns: compile time error. */ - final case class Aligned(patterns: Patterns, extractor: Extractor) { + /*final*/ case class Aligned(patterns: Patterns, extractor: Extractor) { def elementArity = patterns.nonStarArity - prodArity def prodArity = extractor.prodArity def starArity = patterns.starArity diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 8b3ff0022771..ee824534d6d0 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -764,7 +764,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } def typedFunctionValue(tree: untpd.Function, pt: Type)(implicit ctx: Context) = { - val untpd.Function(params: List[untpd.ValDef], body) = tree + val untpd.Function(params: List[untpd.ValDef] @unchecked, body) = tree pt match { case pt: TypeVar if untpd.isFunctionWithUnknownParamType(tree) => diff --git a/compiler/src/dotty/tools/dotc/util/ShowPickled.scala b/compiler/src/dotty/tools/dotc/util/ShowPickled.scala index 3e06b3f91960..a0939141f804 100644 --- a/compiler/src/dotty/tools/dotc/util/ShowPickled.scala +++ b/compiler/src/dotty/tools/dotc/util/ShowPickled.scala @@ -197,17 +197,17 @@ object ShowPickled { case CONSTANTtpe => printTypeRef(); printConstantRef() case TYPEREFtpe => - printTypeRef(); printSymbolRef(); buf.until(end, printTypeRef) + printTypeRef(); printSymbolRef(); buf.until(end, () => printTypeRef()) case TYPEBOUNDStpe => printTypeRef(); printTypeRef() case REFINEDtpe => - printSymbolRef(); buf.until(end, printTypeRef) + printSymbolRef(); buf.until(end, () => printTypeRef()) case CLASSINFOtpe => - printSymbolRef(); buf.until(end, printTypeRef) + printSymbolRef(); buf.until(end, () => printTypeRef()) case METHODtpe | IMPLICITMETHODtpe => - printTypeRef(); buf.until(end, printTypeRef) + printTypeRef(); buf.until(end, () => printTypeRef()) case POLYtpe => - printTypeRef(); buf.until(end, printSymbolRef) + printTypeRef(); buf.until(end, () => printSymbolRef()) case LITERALboolean => out.print(if (buf.readLong(len) == 0L) " false" else " true") case LITERALbyte => @@ -233,17 +233,17 @@ object ShowPickled { case LITERALclass => printTypeRef() case CHILDREN => - printSymbolRef(); buf.until(end, printSymbolRef) + printSymbolRef(); buf.until(end, () => printSymbolRef()) case SYMANNOT => - printSymbolRef(); printTypeRef(); buf.until(end, printAnnotArgRef) + printSymbolRef(); printTypeRef(); buf.until(end, () => printAnnotArgRef()) case ANNOTATEDtpe => - printTypeRef(); buf.until(end, printAnnotInfoRef) + printTypeRef(); buf.until(end, () => printAnnotInfoRef()) case ANNOTINFO => - printTypeRef(); buf.until(end, printAnnotArgRef) + printTypeRef(); buf.until(end, () => printAnnotArgRef()) case ANNOTARGARRAY => - buf.until(end, printConstAnnotArgRef) + buf.until(end, () => printConstAnnotArgRef()) case EXISTENTIALtpe => - printTypeRef(); buf.until(end, printSymbolRef) + printTypeRef(); buf.until(end, () => printSymbolRef()) case _ => } diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index d9b2fc284638..903a098c34d0 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -128,7 +128,7 @@ trait ParallelTesting extends RunnerOrchestration { self => /** A group of files that may all be compiled together, with the same flags * and output directory */ - private final case class JointCompilationSource( + private case class JointCompilationSource( name: String, files: Array[JFile], flags: TestFlags, @@ -143,7 +143,7 @@ trait ParallelTesting extends RunnerOrchestration { self => /** A test source whose files will be compiled separately according to their * suffix `_X` */ - private final case class SeparateCompilationSource( + private case class SeparateCompilationSource( name: String, dir: JFile, flags: TestFlags, diff --git a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala index eab9f54b9abe..8edf4598beef 100644 --- a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala +++ b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala @@ -92,7 +92,7 @@ trait RunnerOrchestration { if (didAddCleanupCallback.compareAndSet(false, true)) { // If for some reason the test runner (i.e. sbt) doesn't kill the VM, we // need to clean up ourselves. - summaryReport.addCleanup(killAll) + summaryReport.addCleanup(() => killAll()) } assert(process ne null, "Runner was killed and then reused without setting a new process") diff --git a/doc-tool/src/dotty/tools/dottydoc/model/comment/CommentParser.scala b/doc-tool/src/dotty/tools/dottydoc/model/comment/CommentParser.scala index 5ff28f914ad3..f5b1b35cc8ee 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/comment/CommentParser.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/comment/CommentParser.scala @@ -219,8 +219,8 @@ trait CommentParser extends util.MemberLookup { def name: String } - private final case class SimpleTagKey(name: String) extends TagKey - private final case class SymbolTagKey(name: String, symbol: String) extends TagKey + private /*final*/ case class SimpleTagKey(name: String) extends TagKey + private /*final*/ case class SymbolTagKey(name: String, symbol: String) extends TagKey /** Something that should not have happened, happened, and Scaladoc should exit. */ private def oops(msg: String): Nothing = diff --git a/doc-tool/src/dotty/tools/dottydoc/staticsite/ResourceFinder.scala b/doc-tool/src/dotty/tools/dottydoc/staticsite/ResourceFinder.scala index 6a01e89fe39f..630b26e61dcc 100644 --- a/doc-tool/src/dotty/tools/dottydoc/staticsite/ResourceFinder.scala +++ b/doc-tool/src/dotty/tools/dottydoc/staticsite/ResourceFinder.scala @@ -6,7 +6,7 @@ trait ResourceFinder { /** If, for some reason, the supplied default files cannot be found - this * exception will be thrown in `layouts`. */ - final case class ResourceNotFoundException(message: String) extends Exception(message) + /*final*/ case class ResourceNotFoundException(message: String) extends Exception(message) protected def getResource(r: String): String = Option(getClass.getResourceAsStream(r)) diff --git a/project/Build.scala b/project/Build.scala index 39ee33dc50b1..0cebad53caab 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -121,6 +121,8 @@ object Build { scalacOptions ++= Seq( "-feature", "-deprecation", + "-unchecked", + "-Xfatal-warnings", "-encoding", "UTF8", "-language:existentials,higherKinds,implicitConversions" ), diff --git a/scala-backend b/scala-backend index 9dfe905943d0..b4f91888b6e7 160000 --- a/scala-backend +++ b/scala-backend @@ -1 +1 @@ -Subproject commit 9dfe905943d0fc946677f75caf38d10915c185ae +Subproject commit b4f91888b6e778fd1ea0aee2dbf832ae8b59a48a