Refine descriptor renderer test

Now it checks:
- Whether resolveToDescriptor on secondary constructors works well
- If there is explicit primary constructor declaration
  resolveToDescriptor should return it
- Renderer itself works well with constructors
This commit is contained in:
Denis Zharkov
2015-04-07 18:45:24 +03:00
parent 468233b624
commit ce51327509
4 changed files with 13 additions and 5 deletions
@@ -106,7 +106,12 @@ public abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment
val descriptor = getDescriptor(element, resolveSession)
descriptors.add(descriptor)
if (descriptor is ClassDescriptor) {
descriptors.addAll(descriptor.getConstructors())
// if class has primary constructor then we visit it later, otherwise add it artificially
if (element !is JetClass || !element.hasExplicitPrimaryConstructor()) {
if (descriptor.getUnsubstitutedPrimaryConstructor() != null) {
descriptors.add(descriptor.getUnsubstitutedPrimaryConstructor())
}
}
}
element.acceptChildren(this)
}