From 3e7d63e7331807d3b92921fc4b1bc2bcfbf30d83 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 25 Nov 2014 15:30:05 +0100 Subject: Fixed data race in ResolveSuper The datarace happened because for method "transform" implemented by ResolveSuper which disambiguated overridden methods. Previously, there was a reference FirstTransform.this.transform of type termRefWithSig to the method implemented in a super trait. Now the same reference points to the newly implemented method. Solved because ResolveSuper now generates symbolic references. --- src/dotty/tools/dotc/core/Types.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/dotty/tools/dotc/core/Types.scala') diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index feee05d86..017b7cadc 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1542,6 +1542,8 @@ object Types { object TermRef { + private def symbolicRefs(implicit ctx: Context) = ctx.phase.symbolicRefs + /** Create term ref with given name, without specifying a signature. * Its meaning is the (potentially multi-) denotation of the member(s) * of prefix with given name. @@ -1562,7 +1564,7 @@ object Types { * signature, if denotation is not yet completed. */ def apply(prefix: Type, name: TermName, denot: Denotation)(implicit ctx: Context): TermRef = { - if ((prefix eq NoPrefix) || denot.symbol.isFresh || ctx.erasedTypes) + if ((prefix eq NoPrefix) || denot.symbol.isFresh || symbolicRefs) apply(prefix, denot.symbol.asTerm) else denot match { case denot: SymDenotation if denot.isCompleted => withSig(prefix, name, denot.signature) @@ -1584,7 +1586,7 @@ object Types { * (2) The name in the term ref need not be the same as the name of the Symbol. */ def withSymAndName(prefix: Type, sym: TermSymbol, name: TermName)(implicit ctx: Context): TermRef = - if ((prefix eq NoPrefix) || sym.isFresh || ctx.erasedTypes) + if ((prefix eq NoPrefix) || sym.isFresh || symbolicRefs) withFixedSym(prefix, name, sym) else if (sym.defRunId != NoRunId && sym.isCompleted) withSig(prefix, name, sym.signature) withSym (sym, sym.signature) @@ -1595,7 +1597,7 @@ object Types { * (which must be completed). */ def withSig(prefix: Type, sym: TermSymbol)(implicit ctx: Context): TermRef = - if ((prefix eq NoPrefix) || sym.isFresh || ctx.erasedTypes) withFixedSym(prefix, sym.name, sym) + if ((prefix eq NoPrefix) || sym.isFresh || symbolicRefs) withFixedSym(prefix, sym.name, sym) else withSig(prefix, sym.name, sym.signature).withSym(sym, sym.signature) /** Create a term ref with given prefix, name and signature */ @@ -1604,7 +1606,7 @@ object Types { /** Create a term ref with given prefix, name, signature, and initial denotation */ def withSigAndDenot(prefix: Type, name: TermName, sig: Signature, denot: Denotation)(implicit ctx: Context): TermRef = { - if ((prefix eq NoPrefix) || denot.symbol.isFresh || ctx.erasedTypes) + if ((prefix eq NoPrefix) || denot.symbol.isFresh || symbolicRefs) withFixedSym(prefix, denot.symbol.asTerm.name, denot.symbol.asTerm) else withSig(prefix, name, sig) -- cgit v1.2.3