summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2016-09-28 13:07:11 -0700
committerSeth Tisue <seth@tisue.net>2016-09-28 13:07:11 -0700
commita3008d5ff4871a6f4b86b48197f01027ffee4245 (patch)
treee770873fcc443ee168cf244b8b09b87fb8d3f6de /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
parent39b236b482202c8f3decc501e779e67f0414999a (diff)
parent5757e047a70504991a176aeb2fd8b829d9e9b093 (diff)
downloadscala-a3008d5ff4871a6f4b86b48197f01027ffee4245.tar.gz
scala-a3008d5ff4871a6f4b86b48197f01027ffee4245.tar.bz2
scala-a3008d5ff4871a6f4b86b48197f01027ffee4245.zip
Merge remote-tracking branch 'origin/2.12.0' into merge-2.12.0-to-2.12.x-sep-24
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 8034d056d7..106b076eef 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -95,6 +95,15 @@ abstract class RefChecks extends Transform {
)
}
+ private val separatelyCompiledScalaSuperclass = perRunCaches.newAnyRefMap[Symbol, Unit]()
+ final def isSeparatelyCompiledScalaSuperclass(sym: Symbol) = if (globalPhase.refChecked){
+ separatelyCompiledScalaSuperclass.contains(sym)
+ } else {
+ // conservative approximation in case someone in pre-refchecks phase asks for `exitingFields(someClass.info)`
+ // and we haven't run the refchecks tree transform which populates `separatelyCompiledScalaSuperclass`
+ false
+ }
+
class RefCheckTransformer(unit: CompilationUnit) extends Transformer {
var localTyper: analyzer.Typer = typer
@@ -854,6 +863,8 @@ abstract class RefChecks extends Transform {
// println("validate base type "+tp)
val baseClass = tp.typeSymbol
if (baseClass.isClass) {
+ if (!baseClass.isTrait && !baseClass.isJavaDefined && !currentRun.compiles(baseClass) && !separatelyCompiledScalaSuperclass.contains(baseClass))
+ separatelyCompiledScalaSuperclass.update(baseClass, ())
val index = clazz.info.baseTypeIndex(baseClass)
if (index >= 0) {
if (seenTypes(index) forall (tp1 => !(tp1 <:< tp)))