diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2010-04-27 14:04:02 +0000 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2010-04-27 14:04:02 +0000 |
commit | 15fecdc78e66bb93ff0db9f4cdcf50f9c85fc190 (patch) | |
tree | f56da78b70c319702aab21994213c38e3dedc593 | |
parent | fa715fdd66f444d756ffe91417ac0937f7de6592 (diff) | |
download | scala-15fecdc78e66bb93ff0db9f4cdcf50f9c85fc190.tar.gz scala-15fecdc78e66bb93ff0db9f4cdcf50f9c85fc190.tar.bz2 scala-15fecdc78e66bb93ff0db9f4cdcf50f9c85fc190.zip |
fixed #3349 : method symbol cached too aggressi...
fixed #3349 : method symbol cached too aggressively
cooking raw types changes a symbol's info, but the change was masked by
caching in MethodSymbol
review by odersky
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t3349/AbstractTupleSet.java | 9 | ||||
-rw-r--r-- | test/files/pos/t3349/Table.java | 9 | ||||
-rw-r--r-- | test/files/pos/t3349/Test.scala | 5 | ||||
-rw-r--r-- | test/files/pos/t3349/TupleSet.java | 4 |
5 files changed, 31 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 3c7fdd4e3e..ebab5d9be7 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -1747,20 +1747,22 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => private var mtpePeriod = NoPeriod private var mtpePre: Type = _ private var mtpeResult: Type = _ + private var mtpeInfo: Type = _ override def cloneSymbolImpl(owner: Symbol): Symbol = new MethodSymbol(owner, pos, name).copyAttrsFrom(this) def typeAsMemberOf(pre: Type): Type = { if (mtpePeriod == currentPeriod) { - if (mtpePre eq pre) return mtpeResult + if ((mtpePre eq pre) && (mtpeInfo eq info)) return mtpeResult } else if (isValid(mtpePeriod)) { mtpePeriod = currentPeriod - if (mtpePre eq pre) return mtpeResult + if ((mtpePre eq pre) && (mtpeInfo eq info)) return mtpeResult } val res = pre.computeMemberType(this) mtpePeriod = currentPeriod mtpePre = pre + mtpeInfo = info mtpeResult = res res } diff --git a/test/files/pos/t3349/AbstractTupleSet.java b/test/files/pos/t3349/AbstractTupleSet.java new file mode 100644 index 0000000000..38e4743ef4 --- /dev/null +++ b/test/files/pos/t3349/AbstractTupleSet.java @@ -0,0 +1,9 @@ +public abstract class AbstractTupleSet implements TupleSet { + public void addColumn(String name, Class type) { + throw new UnsupportedOperationException(); + } + + public void addColumn(String name, String expr) { + throw new UnsupportedOperationException(); + } +} diff --git a/test/files/pos/t3349/Table.java b/test/files/pos/t3349/Table.java new file mode 100644 index 0000000000..1609367623 --- /dev/null +++ b/test/files/pos/t3349/Table.java @@ -0,0 +1,9 @@ +public class Table extends AbstractTupleSet { + public void addColumn(String name, Class type) { + throw new UnsupportedOperationException(); + } + + public void addColumn(String name, String expr) { + throw new UnsupportedOperationException(); + } +}
\ No newline at end of file diff --git a/test/files/pos/t3349/Test.scala b/test/files/pos/t3349/Test.scala new file mode 100644 index 0000000000..8174e4c4f8 --- /dev/null +++ b/test/files/pos/t3349/Test.scala @@ -0,0 +1,5 @@ +object Test { + val label = "name" + val table: Table = error("") + table.addColumn( label, label.getClass ) +}
\ No newline at end of file diff --git a/test/files/pos/t3349/TupleSet.java b/test/files/pos/t3349/TupleSet.java new file mode 100644 index 0000000000..14a073a950 --- /dev/null +++ b/test/files/pos/t3349/TupleSet.java @@ -0,0 +1,4 @@ +public interface TupleSet { + public void addColumn(String name, Class type); + public void addColumn(String name, String expr); +}
\ No newline at end of file |