diff options
author | Paul Phillips <paulp@improving.org> | 2013-01-26 11:16:58 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-01-26 11:19:37 -0800 |
commit | f01e001c77bca0bf09c6594251af6573c76f1c4c (patch) | |
tree | df0c5849b02ca9048c19c0d1c6700507d711e150 /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | 3623432292d660b3420c13d584871a1164a71727 (diff) | |
download | scala-f01e001c77bca0bf09c6594251af6573c76f1c4c.tar.gz scala-f01e001c77bca0bf09c6594251af6573c76f1c4c.tar.bz2 scala-f01e001c77bca0bf09c6594251af6573c76f1c4c.zip |
Make sure typed isn't called with an erroneous tree.
I can't see that it makes any difference, but this is
approximately the way it was before.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index f79723002e..4e4cbabd9d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3390,6 +3390,14 @@ trait Typers extends Adaptations with Tags { var hasError: Boolean = false val pending = ListBuffer[AbsTypeError]() + def finish(res: AnnotationInfo): AnnotationInfo = { + if (hasError) { + pending.foreach(ErrorUtils.issueTypeError) + ErroneousAnnotation + } + else res + } + def reportAnnotationError(err: AbsTypeError) = { pending += err hasError = true @@ -3470,6 +3478,8 @@ trait Typers extends Adaptations with Tags { // begin typedAnnotation val treeInfo.Applied(fun0, targs, argss) = ann + if (fun0.isErroneous) + return finish(ErroneousAnnotation) val typedFun0 = typed(fun0, mode.forFunMode, WildcardType) val typedFunPart = ( // If there are dummy type arguments in typeFun part, it suggests we @@ -3483,9 +3493,9 @@ trait Typers extends Adaptations with Tags { val treeInfo.Applied(typedFun @ Select(New(annTpt), _), _, _) = typedFunPart val annType = annTpt.tpe - val res = if (typedFun.isErroneous) ErroneousAnnotation - else { - if (typedFun.isErroneous) ErroneousAnnotation + finish( + if (typedFun.isErroneous) + ErroneousAnnotation else if (annType.typeSymbol isNonBottomSubClass ClassfileAnnotationClass) { // annotation to be saved as java classfile annotation val isJava = typedFun.symbol.owner.isJavaDefined @@ -3558,7 +3568,7 @@ trait Typers extends Adaptations with Tags { val Function(arg :: Nil, rhs) = typed(func, mode, funcType) rhs.substituteSymbols(arg.symbol :: Nil, selfsym :: Nil) - } + } def annInfo(t: Tree): AnnotationInfo = t match { case Apply(Select(New(tpt), nme.CONSTRUCTOR), args) => @@ -3585,13 +3595,7 @@ trait Typers extends Adaptations with Tags { if ((typedAnn.tpe == null) || typedAnn.tpe.isErroneous) ErroneousAnnotation else annInfo(typedAnn) - } - } - - if (hasError) { - pending.foreach(ErrorUtils.issueTypeError) - ErroneousAnnotation - } else res + }) } def isRawParameter(sym: Symbol) = // is it a type parameter leaked by a raw type? |