summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-09-27 09:40:17 +1000
committerJason Zaugg <jzaugg@gmail.com>2016-09-27 09:50:39 +1000
commite07585c256b3dd2ab4d197c5480d1d962607879e (patch)
tree85330593fbecbb6f5810eb2b7415b27ebf3035dd /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
parentc0450f0c12f265674bc657cfb469778cd35d1c40 (diff)
downloadscala-e07585c256b3dd2ab4d197c5480d1d962607879e.tar.gz
scala-e07585c256b3dd2ab4d197c5480d1d962607879e.tar.bz2
scala-e07585c256b3dd2ab4d197c5480d1d962607879e.zip
Make isSeparateCompiled... robust against rogue phase time travel
We don't hit this code path during bootstrapping, but we could conceivably hit it with macros or compiler plugins peering into the future through atPhase before refchecks as run. Also rename a method to reflect the generality of the info transform (it does more than mixin, now.)
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 24b4334ec4..106b076eef 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -96,7 +96,13 @@ abstract class RefChecks extends Transform {
}
private val separatelyCompiledScalaSuperclass = perRunCaches.newAnyRefMap[Symbol, Unit]()
- final def isSeparatelyCompiledScalaSuperclass(sym: Symbol) = separatelyCompiledScalaSuperclass.contains(sym)
+ 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 {