diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-11 11:13:56 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-11 12:07:29 +0200 |
commit | ce535898e6f9758840db4da7cbc18a57e632a26a (patch) | |
tree | 4467dd93dfecfae27ffe1311f081469c5024a96f /src/dotty/tools/dotc/core | |
parent | ab63413f2cbd82111aa33e625d22f7e9924776eb (diff) | |
download | dotty-ce535898e6f9758840db4da7cbc18a57e632a26a.tar.gz dotty-ce535898e6f9758840db4da7cbc18a57e632a26a.tar.bz2 dotty-ce535898e6f9758840db4da7cbc18a57e632a26a.zip |
Add SyntheticMethods miniphase
New phase for Synthetic Method generation. Scala 2.x did it in Typer, but
it's cleaner to do it in a separate phase.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala index 123e6e671..82ed3ce1d 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -423,6 +423,8 @@ class Definitions { lazy val RootImports = List[Symbol](JavaLangPackageVal, ScalaPackageVal, ScalaPredefModule, DottyPredefModule) + lazy val overriddenBySynthetic = Set[Symbol](Any_equals, Any_hashCode, Any_toString, Product_canEqual) + def isTupleType(tp: Type)(implicit ctx: Context) = { val arity = tp.dealias.argInfos.length arity <= MaxTupleArity && (tp isRef TupleClass(arity)) diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 8ec5c7295..50c729df1 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1149,7 +1149,11 @@ object Types { (lastSymbol eq null) || (lastSymbol.defRunId != sym.defRunId) || (lastSymbol.defRunId == NoRunId) || - (lastSymbol.infoOrCompleter == ErrorType), + (lastSymbol.infoOrCompleter == ErrorType || + defn.overriddenBySynthetic.contains(lastSymbol) + // for overriddenBySynthetic symbols a TermRef such as SomeCaseClass.this.hashCode + // might be rewritten from Object#hashCode to the hashCode generated at SyntheticMethods + ), s"data race? overwriting symbol of $this / ${this.getClass} / ${lastSymbol.id} / ${sym.id}") protected def sig: Signature = Signature.NotAMethod |