- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
fancy exceptions
Sat, 2010-11-13, 04:30
The test case I posted in a comment here:
http://lampsvn.epfl.ch/trac/scala/ticket/3995#comment:2
Compiling with r23505.
% SOURCEPATH="/scala/trunk/src/compiler:/soft/inst/jdk/src.jar" \
scalac -Yrich-exceptions ~/Desktop/bug3995.scala
error: [Predef.assert]
75: def assert(assertion: Boolean) {
76: if (!assertion)
77: throw new java.lang.AssertionError("assertion failed")
*78: }
79:
80: /** Tests an expression, throwing an AssertionError if false.
81: * Calls to this method will not be generated if -Xelide-below
[TreeGen.mkAttributedQualifier]
79: mkAttributedThis(sym)
80: } else if (sym.isType) {
81: assert(termSym != NoSymbol)
*82: mkAttributedIdent(termSym) setType tpe
83: } else {
84: mkAttributedRef(pre, sym)
85: }
[TreeGen.mkAttributedQualifier]
42: */
43: def mkAttributedQualifier(tpe: Type): Tree =
44: mkAttributedQualifier(tpe, NoSymbol)
*45:
46: /** Builds a reference to value whose type is given stable prefix.
47: * If the type is unsuitable, e.g. it is a TypeRef for an
48: * abstract type variable, then an Ident will be made using
[TreeGen.mkAttributedRef]
104: /** Builds a reference to given symbol with given stable prefix. */
105: def mkAttributedRef(pre: Type, sym: Symbol): Tree = {
106: val qual = mkAttributedQualifier(pre)
*107: qual match {
108: case EmptyTree => mkAttributedIdent(sym)
109: case This(clazz) if isRootOrEmptyPackageClass(qual.symbol) => mkAttributedIdent(sym)
110: case _ => mkAttributedSelect(qual, sym)
[TreeGen.mkAttributedStableRef]
146: /** Builds a reference with stable type to given symbol */
147: def mkAttributedStableRef(pre: Type, sym: Symbol): Tree =
148: stabilize(mkAttributedRef(pre, sym))
*149:
150: def mkAttributedStableRef(sym: Symbol): Tree =
151: stabilize(mkAttributedRef(sym))
152:
[TreeGen.mkAttributedQualifier]
57: else mkAttributedThis(clazz)
58: case SingleType(pre, sym) =>
59: val qual = mkAttributedStableRef(pre, sym)
*60: qual.tpe match {
61: case MethodType(List(), restpe) =>
62: Apply(qual, List()) setType restpe
63: case _ =>
[TreeGen.mkAttributedQualifier]
42: */
43: def mkAttributedQualifier(tpe: Type): Tree =
44: mkAttributedQualifier(tpe, NoSymbol)
*45:
46: /** Builds a reference to value whose type is given stable prefix.
47: * If the type is unsuitable, e.g. it is a TypeRef for an
48: * abstract type variable, then an Ident will be made using
[Implicits.typedImplicit0]
438: val itree = atPos(tree.pos.focus) {
439: if (info.pre == NoPrefix) Ident(info.name)
440: else Select(gen.mkAttributedQualifier(info.pre), info.name)
*441: }
442: printTyping("typedImplicit0 typing"+ itree +" with wildpt = "+ wildPt +" from implicit "+ info.name+":"+info.tpe)
443: def fail(reason: String): SearchResult = {
444: if (settings.XlogImplicits.value)
[Implicits.typedImplicit]
356: context.openImplicits = (pt, tree.symbol) :: context.openImplicits
357: // println(" "*context.openImplicits.length+"typed implicit "+info+" for "+pt) //@MDEBUG
358: typedImplicit0(info)
*359: } catch {
360: case DivergentImplicit =>
361: // println("DivergentImplicit for pt:"+ pt +", open implicits:"+context.openImplicits) //@MDEBUG
362: if (context.openImplicits.tail.isEmpty) {
[Implicits.tryImplicit$1]
620: SearchFailure
621: else
622: typedImplicit(info)
*623: }
624:
625: def addAppInfos(is: List[ImplicitInfo], m: Map[ImplicitInfo, SearchResult]): Map[ImplicitInfo, SearchResult] = {
626: var applicable = m
[Implicits.apply]
628: if (!isValid(i.sym)) invalidImplicits += i.sym
629: else {
630: val result = tryImplicit(i)
*631: if (result != SearchFailure) applicable += (i -> result)
632: }
633: if (isLocal)
634: for (i <- is) shadowed addEntry i.name
[Implicits.apply]
625: def addAppInfos(is: List[ImplicitInfo], m: Map[ImplicitInfo, SearchResult]): Map[ImplicitInfo, SearchResult] = {
626: var applicable = m
627: for (i <- is)
*628: if (!isValid(i.sym)) invalidImplicits += i.sym
629: else {
630: val result = tryImplicit(i)
631: if (result != SearchFailure) applicable += (i -> result)
[LinearSeqOptimized.foreach]
58: var these = this
59: while (!these.isEmpty) {
60: f(these.head)
*61: these = these.tail
62: }
63: }
64:
[List.foreach]
42: * @define willNotTerminateInf
43: */
44: sealed abstract class List[+A] extends LinearSeq[A]
*45: with Product
46: with GenericTraversableTemplate[A, List]
47: with LinearSeqOptimized[A, List[A]] {
48: override def companion: GenericCompanion[List] = List
[Implicits.addAppInfos$1]
625: def addAppInfos(is: List[ImplicitInfo], m: Map[ImplicitInfo, SearchResult]): Map[ImplicitInfo, SearchResult] = {
626: var applicable = m
627: for (i <- is)
*628: if (!isValid(i.sym)) invalidImplicits += i.sym
629: else {
630: val result = tryImplicit(i)
631: if (result != SearchFailure) applicable += (i -> result)
[Implicits.apply]
642:
643: var applicable = Map[ImplicitInfo, SearchResult]()
644: for (is <- iss) applicable = addAppInfos(is, applicable)
*645:
646: stopCounter(subtypeAppInfos, start)
647: applicable
648: }
[Implicits.apply]
642:
643: var applicable = Map[ImplicitInfo, SearchResult]()
644: for (is <- iss) applicable = addAppInfos(is, applicable)
*645:
646: stopCounter(subtypeAppInfos, start)
647: applicable
648: }
[LinearSeqOptimized.foreach]
58: var these = this
59: while (!these.isEmpty) {
60: f(these.head)
*61: these = these.tail
62: }
63: }
64:
[List.foreach]
42: * @define willNotTerminateInf
43: */
44: sealed abstract class List[+A] extends LinearSeq[A]
*45: with Product
46: with GenericTraversableTemplate[A, List]
47: with LinearSeqOptimized[A, List[A]] {
48: override def companion: GenericCompanion[List] = List
[Implicits.applicableInfos]
642:
643: var applicable = Map[ImplicitInfo, SearchResult]()
644: for (is <- iss) applicable = addAppInfos(is, applicable)
*645:
646: stopCounter(subtypeAppInfos, start)
647: applicable
648: }
[Implicits.searchImplicit]
666:
667: /** A map which takes applicable infos to their attributed trees. */
668: val applicable = applicableInfos(implicitInfoss, isLocal, invalidImplicits)
*669:
670: if (applicable.isEmpty && !invalidImplicits.isEmpty) {
671: setAddendum(tree.pos, () =>
672: "\n Note: implicit "+invalidImplicits.head+" is not applicable here"+
[Implicits.implicitManifestOrOfExpectedType]
886: implicitManifestOrOfExpectedType(pt.bounds.lo)
887: case _ =>
888: searchImplicit(implicitsOfExpectedType, false) // shouldn't we pass `pt` to `implicitsOfExpectedType`, or is the recursive case for an abstract type really only meant for manifests?
*889: }
890:
891: /** The result of the implicit search:
892: * First search implicits visible in current context.
[Implicits.bestImplicit]
911: val succstart = startTimer(oftypeSucceedNanos)
912:
913: result = implicitManifestOrOfExpectedType(pt)
*914:
915: if (result == SearchFailure) {
916: stopTimer(oftypeFailNanos, failstart)
917: } else {
[Implicits.inferImplicit]
51: if (traceImplicits && !tree.isEmpty && !context.undetparams.isEmpty)
52: println("typing implicit with undetermined type params: "+context.undetparams+"\n"+tree)
53: val result = new ImplicitSearch(tree, pt, isView, context.makeImplicit(reportAmbiguous)).bestImplicit
*54: context.undetparams = context.undetparams filterNot (result.subst.from contains _)
55: stopTimer(implicitNanos, start)
56: stopCounter(rawTypeImpl, rawTypeStart)
57: stopCounter(findMemberImpl, findMemberStart)
[Global.inferImplicit]
338:
339: // factory for phases: namer, packageobjects, typer
340: object analyzer extends {
*341: val global: Global.this.type = Global.this
342: } with Analyzer
343:
344: // phaseName = "superaccessors"
[Typers.wrapImplicit$1]
251: case _ =>
252: def wrapImplicit(from: Type): Tree = {
253: val result = inferImplicit(tree, functionType(List(from), to), reportAmbiguous, true, context)
*254: if (result.subst != EmptyTreeTypeSubstituter) result.subst traverse tree
255: result.tree
256: }
257: val result = wrapImplicit(from)
[Typers.inferView]
255: result.tree
256: }
257: val result = wrapImplicit(from)
*258: if (result != EmptyTree) result
259: else wrapImplicit(appliedType(ByNameParamClass.typeConstructor, List(from)))
260: }
261: }
[Typers.adapt]
994: // (14); the condition prevents chains of views
995: if (settings.debug.value) log("inferring view from "+tree.tpe+" to "+pt)
996: val coercion = inferView(tree, tree.tpe, pt, true)
*997: // convert forward views of delegate types into closures wrapped around
998: // the delegate's apply method (the "Invoke" method, which was translated into apply)
999: if (forMSIL && coercion != null && isCorrespondingDelegate(tree.tpe, pt)) {
1000: val meth: Symbol = tree.tpe.member(nme.apply)
[Typers.typed]
4187: tree1.tpe = addAnnotations(tree1, tree1.tpe)
4188:
4189: val result = if (tree1.isEmpty) tree1 else adapt(tree1, mode, pt, tree)
*4190: printTyping("adapted "+tree1+":"+tree1.tpe.widen+" to "+pt+", "+context.undetparams) //DEBUG
4191: // for (t <- tree1.tpe) assert(t != WildcardType)
4192: // if ((mode & TYPEmode) != 0) println("type: "+tree1+" has type "+tree1.tpe)
4193: if (phase.id <= currentRun.typerPhase.id) signalDone(context.asInstanceOf[analyzer.Context], tree, result)
[Typers.typedArg]
2189:
2190: def typedArg(arg: Tree, mode: Int, newmode: Int, pt: Type): Tree =
2191: checkDead(constrTyperIf((mode & SCCmode) != 0).typed(arg, mode & stickyModes | newmode, pt))
*2192:
2193: def typedArgs(args: List[Tree], mode: Int) =
2194: args mapConserve (arg => typedArg(arg, mode, 0, WildcardType))
2195:
[Typers.typedArgToPoly$1]
2477: if (remainingParams.tail.nonEmpty) remainingParams = remainingParams.tail
2478: // println("typedArgToPoly(arg, formal): "+(arg, formal))
2479: val arg1 = typedArg(arg, argMode(fun, mode), newmode, lenientPt)
*2480: val argtparams = context.extractUndetparams()
2481: // println("typedArgToPoly(arg1, argtparams): "+(arg1, argtparams))
2482: if (!argtparams.isEmpty) {
2483: val strictPt = formal.instantiateTypeParams(tparams, strictTargs)
[Typers.apply]
2486: arg1
2487: }
2488: val args1 = (args, formals).zipped map typedArgToPoly
*2489: if (args1 exists (_.tpe.isError)) setError(tree)
2490: else {
2491: if (settings.debug.value) log("infer method inst "+fun+", tparams = "+tparams+", args = "+args1.map(_.tpe)+", pt = "+pt+", lobounds = "+tparams.map(_.tpe.bounds.lo)+", parambounds = "+tparams.map(_.info)) //debug
2492: // define the undetparams which have been fixed by this param list, replace the corresponding symbols in "fun"
[Typers.apply]
2486: arg1
2487: }
2488: val args1 = (args, formals).zipped map typedArgToPoly
*2489: if (args1 exists (_.tpe.isError)) setError(tree)
2490: else {
2491: if (settings.debug.value) log("infer method inst "+fun+", tparams = "+tparams+", args = "+args1.map(_.tpe)+", pt = "+pt+", lobounds = "+tparams.map(_.tpe.bounds.lo)+", parambounds = "+tparams.map(_.info)) //debug
2492: // define the undetparams which have been fixed by this param list, replace the corresponding symbols in "fun"
[Tuple2.apply]
50: * $willNotTerminateInf
51: */
52: def zipped[Repr1, El1, Repr2, El2](implicit w1: T1 => TLike[El1, Repr1], w2: T2 => ILike[El2, Repr2]): Zipped[Repr1, El1, Repr2, El2]
*53: = new Zipped[Repr1, El1, Repr2, El2](_1, _2)
54:
55: class Zipped[+Repr1, +El1, +Repr2, +El2](coll1: TLike[El1, Repr1], coll2: ILike[El2, Repr2]) { // coll2: ILike for filter
56: def map[B, To](f: (El1, El2) => B)(implicit cbf: CBF[Repr1, B, To]): To = {
[Tuple2.apply]
48: *
49: * @see Zipped
50: * $willNotTerminateInf
*51: */
52: def zipped[Repr1, El1, Repr2, El2](implicit w1: T1 => TLike[El1, Repr1], w2: T2 => ILike[El2, Repr2]): Zipped[Repr1, El1, Repr2, El2]
53: = new Zipped[Repr1, El1, Repr2, El2](_1, _2)
54:
[LinearSeqOptimized.foreach]
58: var these = this
59: while (!these.isEmpty) {
60: f(these.head)
*61: these = these.tail
62: }
63: }
64:
[List.foreach]
42: * @define willNotTerminateInf
43: */
44: sealed abstract class List[+A] extends LinearSeq[A]
*45: with Product
46: with GenericTraversableTemplate[A, List]
47: with LinearSeqOptimized[A, List[A]] {
48: override def companion: GenericCompanion[List] = List
[Tuple2.map]
48: *
49: * @see Zipped
50: * $willNotTerminateInf
*51: */
52: def zipped[Repr1, El1, Repr2, El2](implicit w1: T1 => TLike[El1, Repr1], w2: T2 => ILike[El2, Repr2]): Zipped[Repr1, El1, Repr2, El2]
53: = new Zipped[Repr1, El1, Repr2, El2](_1, _2)
54:
[Typers.doTypedApply]
2486: arg1
2487: }
2488: val args1 = (args, formals).zipped map typedArgToPoly
*2489: if (args1 exists (_.tpe.isError)) setError(tree)
2490: else {
2491: if (settings.debug.value) log("infer method inst "+fun+", tparams = "+tparams+", args = "+args1.map(_.tpe)+", pt = "+pt+", lobounds = "+tparams.map(_.tpe.bounds.lo)+", parambounds = "+tparams.map(_.info)) //debug
2492: // define the undetparams which have been fixed by this param list, replace the corresponding symbols in "fun"
[Typers.typedApply$1]
3339: tryTypedApply(fun2, args)
3340: } else {
3341: doTypedApply(tree, fun2, args, mode, pt)
*3342: }
3343: /*
3344: if (fun2.hasSymbol && fun2.symbol.isConstructor && (mode & EXPRmode) != 0) {
3345: res.tpe = res.tpe.notNull
[Typers.typed1]
4027:
4028: case Apply(fun, args) =>
4029: typedApply(fun, args) match {
*4030: case Apply(Select(New(tpt), name), args)
4031: if (tpt.tpe != null &&
4032: tpt.tpe.typeSymbol == ArrayClass &&
4033: args.length == 1 &&
[Typers.typed]
4182: printTyping("typing "+tree+", pt = "+pt+", undetparams = "+context.undetparams+", implicits-enabled = "+context.implicitsEnabled+", silent = "+context.reportGeneralErrors) //DEBUG
4183:
4184: var tree1 = if (tree.tpe ne null) tree else typed1(tree, mode, dropExistential(pt))
*4185: printTyping("typed "+tree1+":"+tree1.tpe+(if (isSingleType(tree1.tpe)) " with underlying "+tree1.tpe.widen else "")+", undetparams = "+context.undetparams+", pt = "+pt) //DEBUG
4186:
4187: tree1.tpe = addAnnotations(tree1, tree1.tpe)
4188:
[Typers.transformedOrTyped]
4327: def transformedOrTyped(tree: Tree, mode: Int, pt: Type): Tree = transformed.get(tree) match {
4328: case Some(tree1) => transformed -= tree; tree1
4329: case None => typed(tree, mode, pt)
*4330: }
4331:
4332: def findManifest(tp: Type, full: Boolean) = atPhase(currentRun.typerPhase) {
4333: inferImplicit(
[Typers.typedDefDef]
1777: typed(ddef.rhs)
1778: } else {
1779: transformedOrTyped(ddef.rhs, EXPRmode, tpt1.tpe)
*1780: }
1781:
1782: if (meth.isPrimaryConstructor && meth.isClassConstructor &&
1783: phase.id <= currentRun.typerPhase.id && !reporter.hasErrors)
[Typers.typed1]
3842:
3843: case ddef @ DefDef(_, _, _, _, _, _) =>
3844: newTyper(context.makeNewScope(tree, sym)).typedDefDef(ddef)
*3845:
3846: case tdef @ TypeDef(_, _, _, _) =>
3847: typedTypeDef(tdef)
3848:
[Typers.typed]
4182: printTyping("typing "+tree+", pt = "+pt+", undetparams = "+context.undetparams+", implicits-enabled = "+context.implicitsEnabled+", silent = "+context.reportGeneralErrors) //DEBUG
4183:
4184: var tree1 = if (tree.tpe ne null) tree else typed1(tree, mode, dropExistential(pt))
*4185: printTyping("typed "+tree1+":"+tree1.tpe+(if (isSingleType(tree1.tpe)) " with underlying "+tree1.tpe.widen else "")+", undetparams = "+context.undetparams+", pt = "+pt) //DEBUG
4186:
4187: tree1.tpe = addAnnotations(tree1, tree1.tpe)
4188:
[Typers.typedStat$1]
2115: val localTyper = if (inBlock || (stat.isDef && !stat.isInstanceOf[LabelDef])) this
2116: else newTyper(context.make(stat, exprOwner))
2117: val result = checkDead(localTyper.typed(stat, EXPRmode | BYVALmode, WildcardType))
*2118: if (treeInfo.isSelfOrSuperConstrCall(result)) {
2119: context.inConstructorSuffix = true
2120: if (treeInfo.isSelfConstrCall(result) && result.symbol.pos.pointOrElse(0) >= exprOwner.enclMethod.pos.pointOrElse(0))
2121: error(stat.pos, "called constructor's definition must precede calling constructor's definition")
[Typers.apply]
2183: }
2184: }
2185: val result = stats mapConserve (typedStat)
*2186: if (phase.erasedTypes) result
2187: else checkNoDoubleDefsAndAddSynthetics(result)
2188: }
2189:
[Typers.apply]
2183: }
2184: }
2185: val result = stats mapConserve (typedStat)
*2186: if (phase.erasedTypes) result
2187: else checkNoDoubleDefsAndAddSynthetics(result)
2188: }
2189:
[List.loop$1]
116: else {
117: val head0 = pending.head
118: val head1 = f(head0)
*119:
120: if (head1 == head0)
121: loop(mapped, unchanged, pending.tail)
122: else {
[List.mapConserve]
132: }
133: }
134: loop(null, this, this)
*135: }
136:
137: // Overridden methods from IterableLike and SeqLike or overloaded variants of such methods
138:
[Typers.typedStats]
2183: }
2184: }
2185: val result = stats mapConserve (typedStat)
*2186: if (phase.erasedTypes) result
2187: else checkNoDoubleDefsAndAddSynthetics(result)
2188: }
2189:
[Typers.typedTemplate]
1537: templ.body flatMap addGetterSetter
1538: else templ.body
1539: val body1 = typedStats(body, templ.symbol)
*1540: treeCopy.Template(templ, parents1, self1, body1) setType clazz.tpe
1541: }
1542:
1543: /** Remove definition annotations from modifiers (they have been saved
[Typers.typedModuleDef]
1340: assert(clazz != NoSymbol)
1341: val impl1 = newTyper(context.make(mdef.impl, clazz, new Scope))
1342: .typedTemplate(mdef.impl, parentTypes(mdef.impl))
*1343: val impl2 = typerAddSyntheticMethods(impl1, clazz, context)
1344:
1345: if (mdef.name == nme.PACKAGEkw)
1346: for (m <- mdef.symbol.info.members)
[Typers.typed1]
3836:
3837: case tree @ ModuleDef(_, _, _) =>
3838: newTyper(context.makeNewScope(tree, sym.moduleClass)).typedModuleDef(tree)
*3839:
3840: case vdef @ ValDef(_, _, _, _) =>
3841: typedValDef(vdef)
3842:
[Typers.typed]
4182: printTyping("typing "+tree+", pt = "+pt+", undetparams = "+context.undetparams+", implicits-enabled = "+context.implicitsEnabled+", silent = "+context.reportGeneralErrors) //DEBUG
4183:
4184: var tree1 = if (tree.tpe ne null) tree else typed1(tree, mode, dropExistential(pt))
*4185: printTyping("typed "+tree1+":"+tree1.tpe+(if (isSingleType(tree1.tpe)) " with underlying "+tree1.tpe.widen else "")+", undetparams = "+context.undetparams+", pt = "+pt) //DEBUG
4186:
4187: tree1.tpe = addAnnotations(tree1, tree1.tpe)
4188:
[Typers.typedStat$1]
2115: val localTyper = if (inBlock || (stat.isDef && !stat.isInstanceOf[LabelDef])) this
2116: else newTyper(context.make(stat, exprOwner))
2117: val result = checkDead(localTyper.typed(stat, EXPRmode | BYVALmode, WildcardType))
*2118: if (treeInfo.isSelfOrSuperConstrCall(result)) {
2119: context.inConstructorSuffix = true
2120: if (treeInfo.isSelfConstrCall(result) && result.symbol.pos.pointOrElse(0) >= exprOwner.enclMethod.pos.pointOrElse(0))
2121: error(stat.pos, "called constructor's definition must precede calling constructor's definition")
[Typers.apply]
2183: }
2184: }
2185: val result = stats mapConserve (typedStat)
*2186: if (phase.erasedTypes) result
2187: else checkNoDoubleDefsAndAddSynthetics(result)
2188: }
2189:
[Typers.apply]
2183: }
2184: }
2185: val result = stats mapConserve (typedStat)
*2186: if (phase.erasedTypes) result
2187: else checkNoDoubleDefsAndAddSynthetics(result)
2188: }
2189:
[List.loop$1]
116: else {
117: val head0 = pending.head
118: val head1 = f(head0)
*119:
120: if (head1 == head0)
121: loop(mapped, unchanged, pending.tail)
122: else {
[List.mapConserve]
132: }
133: }
134: loop(null, this, this)
*135: }
136:
137: // Overridden methods from IterableLike and SeqLike or overloaded variants of such methods
138:
[Typers.typedStats]
2183: }
2184: }
2185: val result = stats mapConserve (typedStat)
*2186: if (phase.erasedTypes) result
2187: else checkNoDoubleDefsAndAddSynthetics(result)
2188: }
2189:
[Typers.typed1]
3829: val annots = sym.annotations
3830: val stats1 = newTyper(context.make(tree, sym.moduleClass, sym.info.decls))
3831: .typedStats(stats, NoSymbol)
*3832: treeCopy.PackageDef(tree, pid1, stats1) setType NoType
3833:
3834: case tree @ ClassDef(_, _, _, _) =>
3835: newTyper(context.makeNewScope(tree, sym)).typedClassDef(tree)
[Typers.typed]
4182: printTyping("typing "+tree+", pt = "+pt+", undetparams = "+context.undetparams+", implicits-enabled = "+context.implicitsEnabled+", silent = "+context.reportGeneralErrors) //DEBUG
4183:
4184: var tree1 = if (tree.tpe ne null) tree else typed1(tree, mode, dropExistential(pt))
*4185: printTyping("typed "+tree1+":"+tree1.tpe+(if (isSingleType(tree1.tpe)) " with underlying "+tree1.tpe.widen else "")+", undetparams = "+context.undetparams+", pt = "+pt) //DEBUG
4186:
4187: tree1.tpe = addAnnotations(tree1, tree1.tpe)
4188:
[Typers.typed]
4231: */
4232: def typed(tree: Tree): Tree = {
4233: val ret = typed(tree, EXPRmode, WildcardType)
*4234: ret
4235: }
4236:
4237: def typedPos(pos: Position)(tree: Tree) = typed(atPos(pos)(tree))
[Analyzer.apply]
84: def apply(unit: CompilationUnit) {
85: try {
86: unit.body = newTyper(rootContext(unit)).typed(unit.body)
*87: if (global.settings.Yrangepos.value && !global.reporter.hasErrors) global.validatePositions(unit.body)
88: for (workItem <- unit.toCheck) workItem()
89: } finally {
90: unit.toCheck.clear()
[Global.apply$mcV$sp]
318: currentRun.currentUnit = unit
319: if (!cancelled(unit))
320: reporter.withSource(unit.source) { apply(unit) }
*321: currentRun.advanceUnit
322: } finally {
323: //assert(currentRun.currentUnit == unit)
324: currentRun.currentUnit = unit0
[Global.apply]
318: currentRun.currentUnit = unit
319: if (!cancelled(unit))
320: reporter.withSource(unit.source) { apply(unit) }
*321: currentRun.advanceUnit
322: } finally {
323: //assert(currentRun.currentUnit == unit)
324: currentRun.currentUnit = unit0
[Global.apply]
318: currentRun.currentUnit = unit
319: if (!cancelled(unit))
320: reporter.withSource(unit.source) { apply(unit) }
*321: currentRun.advanceUnit
322: } finally {
323: //assert(currentRun.currentUnit == unit)
324: currentRun.currentUnit = unit0
[Reporter.withSource]
45: try {
46: source = src
47: op
*48: } finally {
49: source = oldSource
50: }
51: }
[Global.applyPhase]
318: currentRun.currentUnit = unit
319: if (!cancelled(unit))
320: reporter.withSource(unit.source) { apply(unit) }
*321: currentRun.advanceUnit
322: } finally {
323: //assert(currentRun.currentUnit == unit)
324: currentRun.currentUnit = unit0
[Analyzer.apply]
79: val start = startTimer(typerNanos)
80: global.echoPhaseSummary(this)
81: currentRun.units foreach applyPhase
*82: stopTimer(typerNanos, start)
83: }
84: def apply(unit: CompilationUnit) {
85: try {
[Analyzer.apply]
79: val start = startTimer(typerNanos)
80: global.echoPhaseSummary(this)
81: currentRun.units foreach applyPhase
*82: stopTimer(typerNanos, start)
83: }
84: def apply(unit: CompilationUnit) {
85: try {
[Iterator.foreach]
628: * @usecase def foreach(f: A => Unit): Unit
629: */
630: def foreach[U](f: A => U) { while (hasNext) f(next()) }
*631:
632: /** Tests whether a predicate holds for all values produced by this iterator.
633: * $mayNotTerminateInf
634: *
[ListBuffer.foreach]
307: }
308:
309: override def iterator = new Iterator[A] {
*310: var cursor: List[A] = null
311: def hasNext: Boolean = !start.isEmpty && (cursor ne last0)
312: def next(): A =
313: if (!hasNext) {
[Analyzer.run]
79: val start = startTimer(typerNanos)
80: global.echoPhaseSummary(this)
81: currentRun.units foreach applyPhase
*82: stopTimer(typerNanos, start)
83: }
84: def apply(unit: CompilationUnit) {
85: try {
[Global.compileSources]
833: val startTime = currentTime
834: phase = globalPhase
835: globalPhase.run
*836:
837: // write icode to *.icode files
838: if (opt.writeICode && (runIsAt(icodePhase) || opt.printPhase && runIsPast(icodePhase)))
839: writeICode()
[Global.compile]
909: else filenames map getSourceFile
910:
911: compileSources(sources)
*912: }
913: catch { case ex: IOException => error(ex.getMessage()) }
914: }
915:
[Main.process]
103: else {
104: val run = new compiler.Run()
105: run compile command.files
*106: reporter.printSummary()
107: }
108: }
109: }
[Main.main]
119:
120: def main(args: Array[String]) {
121: process(args)
*122: exit(if (reporter.hasErrors) 1 else 0)
123: }
124:
125: }
[Main.main] (Main.scala:-1)
Exception in thread "main" java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:78)
at scala.tools.nsc.ast.TreeGen.mkAttributedQualifier(TreeGen.scala:82)
at scala.tools.nsc.ast.TreeGen.mkAttributedQualifier(TreeGen.scala:45)
at scala.tools.nsc.ast.TreeGen.mkAttributedRef(TreeGen.scala:107)
at scala.tools.nsc.ast.TreeGen.mkAttributedStableRef(TreeGen.scala:149)
at scala.tools.nsc.ast.TreeGen.mkAttributedQualifier(TreeGen.scala:60)
at scala.tools.nsc.ast.TreeGen.mkAttributedQualifier(TreeGen.scala:45)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:441)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit(Implicits.scala:359)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.tryImplicit$1(Implicits.scala:623)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$addAppInfos$1$1.apply(Implicits.scala:631)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$addAppInfos$1$1.apply(Implicits.scala:628)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.addAppInfos$1(Implicits.scala:628)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$applicableInfos$1.apply(Implicits.scala:645)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$applicableInfos$1.apply(Implicits.scala:645)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.applicableInfos(Implicits.scala:645)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:669)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.implicitManifestOrOfExpectedType(Implicits.scala:889)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:914)
at scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:54)
at scala.tools.nsc.Global$analyzer$.inferImplicit(Global.scala:341)
at scala.tools.nsc.typechecker.Typers$Typer.wrapImplicit$1(Typers.scala:254)
at scala.tools.nsc.typechecker.Typers$Typer.inferView(Typers.scala:258)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:997)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4190)
at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2192)
at scala.tools.nsc.typechecker.Typers$Typer.typedArgToPoly$1(Typers.scala:2480)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$30.apply(Typers.scala:2489)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$30.apply(Typers.scala:2489)
at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:53)
at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:51)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.Tuple2$Zipped.map(Tuple2.scala:51)
at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2489)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3342)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4030)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4185)
at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:4330)
at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:1780)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3845)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4185)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2118)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$21.apply(Typers.scala:2186)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$21.apply(Typers.scala:2186)
at scala.collection.immutable.List.loop$1(List.scala:119)
at scala.collection.immutable.List.mapConserve(List.scala:135)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2186)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1540)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1343)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3839)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4185)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2118)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$21.apply(Typers.scala:2186)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$21.apply(Typers.scala:2186)
at scala.collection.immutable.List.loop$1(List.scala:119)
at scala.collection.immutable.List.mapConserve(List.scala:135)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2186)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3832)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4185)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4234)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:87)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:321)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:321)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:321)
at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:321)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:82)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:82)
at scala.collection.Iterator$class.foreach(Iterator.scala:631)
at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:310)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:82)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:836)
at scala.tools.nsc.Global$Run.compile(Global.scala:912)
at scala.tools.nsc.Main$.process(Main.scala:106)
at scala.tools.nsc.Main$.main(Main.scala:122)
at scala.tools.nsc.Main.main(Main.scala)