summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-11-30 16:01:14 +0000
committerLex Spoon <lex@lexspoon.org>2007-11-30 16:01:14 +0000
commitc73986baa5ae1570852e708a1cf43ce7ef5cd6ea (patch)
tree26a993ef596b40b719b7052482748ad6910149ce /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent493ab4a848e09908bac5c4ed523ef79bfba563c4 (diff)
downloadscala-c73986baa5ae1570852e708a1cf43ce7ef5cd6ea.tar.gz
scala-c73986baa5ae1570852e708a1cf43ce7ef5cd6ea.tar.bz2
scala-c73986baa5ae1570852e708a1cf43ce7ef5cd6ea.zip
- When -Yself-in-annots is turned on, be carefu...
- When -Yself-in-annots is turned on, be careful not to re-type the same annotation tree and thus use the wrong self symbol. Duplicate the tree each time to prevent this. - mkAttributedQualifier can be given a term symbol to use, if all else fails in converting the type to a tree. - AsSeenFromMap will sometimes use the above facility.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 2fdf3e561f..b1cf36c53c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1804,17 +1804,26 @@ trait Typers { self: Analyzer =>
// and then stripping the "self =>" and substituting
// in the supplied selfsym.
val funcparm = ValDef(NoMods, nme.self, TypeTree(selfsym.info), EmptyTree)
- val func = Function(List(funcparm), annot.constr)
+ val func = Function(List(funcparm), annot.constr.duplicate)
+ // The .duplicate of annot.constr
+ // deals with problems that
+ // accur if this annotation is
+ // later typed again, which
+ // the compiler sometimes does.
+ // The problem is that "self"
+ // ident's within annot.constr
+ // will retain the old symbol
+ // from the previous typing.
val fun1clazz = FunctionClass(1)
val funcType = typeRef(fun1clazz.tpe.prefix,
fun1clazz,
List(selfsym.info, AnnotationClass.tpe))
- typed (func, mode, funcType) match {
+ typed(func, mode, funcType) match {
case t @ Function(List(arg), rhs) =>
val subs =
new TreeSymSubstituter(List(arg.symbol),List(selfsym))
- subs(rhs)
+ subs(rhs)
}
}