aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-04-06 10:54:34 +0200
committerMartin Odersky <odersky@gmail.com>2015-04-07 23:53:59 +0200
commit3ec795a4a22d1cdd72af98d984776ff5bd5c3a60 (patch)
tree301d2a7d9e5b32489e765af87ebeb2b5c5828095 /src/dotty/tools/dotc/core/Types.scala
parent0f4111cb798960cbbe642633b623f9c5ce7e2d01 (diff)
downloaddotty-3ec795a4a22d1cdd72af98d984776ff5bd5c3a60.tar.gz
dotty-3ec795a4a22d1cdd72af98d984776ff5bd5c3a60.tar.bz2
dotty-3ec795a4a22d1cdd72af98d984776ff5bd5c3a60.zip
Fixes to double binding check.
There was a spurious error when doing pickling tests with -YnoDoubleBindings The test manifested itself when compiling `Trees` and `untpd`. The problem was a sourious double assignment to the `untpd$` TypeRef. The problem was that the old `untpd` symbol did get a runId of 3, because it was looked at immediately before being overritten with the new symbol. So the system detected a race condition. The new test looks at the denotations previous run id instead of the symbol's when setting a denotation. That runId was still 2, so not real double binding occurred.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 9d692f39f..363e3006a 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1256,9 +1256,14 @@ object Types {
private def checkSymAssign(sym: Symbol)(implicit ctx: Context) =
assert(
(lastSymbol eq sym) ||
- (lastSymbol eq null) ||
- (lastSymbol.defRunId != sym.defRunId) ||
- (lastSymbol.defRunId == NoRunId) ||
+ (lastSymbol eq null) || {
+ val lastDefRunId = lastDenotation match {
+ case d: SymDenotation => d.validFor.runId
+ case _ => lastSymbol.defRunId
+ }
+ (lastDefRunId != sym.defRunId) ||
+ (lastDefRunId == NoRunId)
+ } ||
(lastSymbol.infoOrCompleter == ErrorType ||
defn.overriddenBySynthetic.contains(lastSymbol)
// for overriddenBySynthetic symbols a TermRef such as SomeCaseClass.this.hashCode