Use DefaultAnalyzerFacade for common code in diagnostic tests

Because of incomplete infrastructure, introduce a few dirty hacks to make
diagnostic tests analyze the common code via DefaultAnalyzerFacade, and also
add common module sources to analysis of platform-specific modules.

Also do not render 'platform' declarations from platform-specific modules to
the .txt file, since they are very likely to be exact copies of the same
declaration in the common module (see RecursiveDescriptorComparator)
This commit is contained in:
Alexander Udalov
2016-11-07 14:26:05 +03:00
parent a4169416ad
commit 926b81fb35
4 changed files with 108 additions and 18 deletions
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.renderer.*;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.MemberComparator;
import org.jetbrains.kotlin.resolve.MultiTargetPlatform;
import org.jetbrains.kotlin.resolve.scopes.ChainedMemberScope;
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
import org.jetbrains.kotlin.test.KotlinTestUtils;
@@ -204,6 +205,10 @@ public class RecursiveDescriptorComparator {
}
}
// 'platform' declarations do not belong to the platform-specific module, even though they participate in the analysis
if (descriptor instanceof MemberDescriptor && ((MemberDescriptor) descriptor).isPlatform() &&
module.getCapability(MultiTargetPlatform.CAPABILITY) != MultiTargetPlatform.Common.INSTANCE) return false;
return module.equals(DescriptorUtils.getContainingModule(descriptor));
}