diff options
author | Martin Odersky <odersky@gmail.com> | 2015-12-08 20:16:03 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-12-14 14:30:08 +0100 |
commit | ac99941234da48427d1ca10823e45aa740baa354 (patch) | |
tree | 8e19632f197d0430ba0bd44b00ec5d04163a795b /src/dotty | |
parent | 6c9168467d9278e13c06fc7e56ae7bf331ae0198 (diff) | |
download | dotty-ac99941234da48427d1ca10823e45aa740baa354.tar.gz dotty-ac99941234da48427d1ca10823e45aa740baa354.tar.bz2 dotty-ac99941234da48427d1ca10823e45aa740baa354.zip |
Do not report data races between symbols defined in class and its selftype
Analogous to the previous situation where we do not report a data race
if the previous symbol comes from a superclass, we now do the same if
the previous symbol comes from a given self type. Makes overrideDataRace.scala pass,
and finally enables stdlib test with TraverableViewLike.scala added.
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index e33f9651e..2a76f18d8 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -368,7 +368,7 @@ object Symbols { type ThisName <: Name - //assert(_id != 30214) + //assert(id != 4285) /** The last denotation of this symbol */ private[this] var lastDenot: SymDenotation = _ diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 596d1ba24..710d45e24 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1386,7 +1386,11 @@ object Types { if (owner.isTerm) d else d.asSeenFrom(prefix) } - private def checkSymAssign(sym: Symbol)(implicit ctx: Context) = + private def checkSymAssign(sym: Symbol)(implicit ctx: Context) = { + def ownerSelfType = sym.owner.info match { + case info: ClassInfo => info.givenSelfType + case _ => NoType + } assert( (lastSymbol eq sym) || (lastSymbol eq null) || { @@ -1398,9 +1402,11 @@ object Types { (lastDefRunId == NoRunId) } || (lastSymbol.infoOrCompleter == ErrorType || - sym.owner.derivesFrom(lastSymbol.owner) && sym.owner != lastSymbol.owner - ), - s"data race? overwriting symbol of ${this.show} / $this / ${this.getClass} / ${lastSymbol.id} / ${sym.id} / ${sym.owner} / ${lastSymbol.owner} / ${ctx.phase} at run ${ctx.runId}") + sym.owner != lastSymbol.owner && + (sym.owner.derivesFrom(lastSymbol.owner) || + ownerSelfType.derivesFrom(lastSymbol.owner))), + s"data race? overwriting symbol of ${this.show} / $this / ${this.getClass} / ${lastSymbol.id} / ${sym.id} / ${lastSymbol.owner} / ${sym.owner} / ${ctx.phase} at run ${ctx.runId}") + } protected def sig: Signature = Signature.NotAMethod |