Skip to content

Commit

Permalink
Merge pull request #2039 from scalamacros/ticket/7046
Browse files Browse the repository at this point in the history
SI-7046 reflection now auto-initializes knownDirectSubclasses
  • Loading branch information
xeno-by committed Feb 4, 2013
2 parents 5aa225f + 2403d1d commit 8d25d05
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/reflect/scala/reflect/internal/Symbols.scala
Expand Up @@ -86,7 +86,11 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
case n: TypeName => if (isClass) newClassSymbol(n, pos, newFlags) else newNonClassSymbol(n, pos, newFlags)
}

def knownDirectSubclasses = children
def knownDirectSubclasses = {
if (!isCompilerUniverse && needsInitialize(isFlagRelated = false, mask = 0)) initialize
children
}

def baseClasses = info.baseClasses
def module = sourceModule
def thisPrefix: Type = thisType
Expand Down
2 changes: 2 additions & 0 deletions test/files/run/t7046.check
@@ -0,0 +1,2 @@
Set(class D, class E)
Set(class D, class E)
13 changes: 13 additions & 0 deletions test/files/run/t7046.scala
@@ -0,0 +1,13 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}

sealed class C
class D extends C
class E extends C

object Test extends App {
val c = cm.staticClass("C")
println(c.knownDirectSubclasses)
c.typeSignature
println(c.knownDirectSubclasses)
}

2 comments on commit 8d25d05

@scala-jenkins
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job pr-rangepos-per-commit failed for 8d25d05 (results):


Took 9 s.
sad kitty
to rebuild, comment "PLS REBUILD/pr-rangepos-per-commit@8d25d05e9bf848d763e7b657d9c7e96ea5cb8daf"on PR #2112

@scala-jenkins
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job pr-checkin-per-commit failed for 8d25d05 (results):


Took 9 s.
sad kitty
to rebuild, comment "PLS REBUILD/pr-checkin-per-commit@8d25d05e9bf848d763e7b657d9c7e96ea5cb8daf"on PR #2112

Please sign in to comment.