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/tools/dotc/core/Types.scala | |
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/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 14 |
1 files changed, 10 insertions, 4 deletions
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 |