Introduce KotlinSyntheticClass.Kind.LOCAL_TRAIT_IMPL

This commit is contained in:
Alexander Udalov
2015-02-13 21:44:48 +03:00
parent ce26ce0458
commit e812c4e67f
7 changed files with 31 additions and 29 deletions
@@ -29,7 +29,9 @@ public fun isKotlinCompiledFile(file: VirtualFile): Boolean {
}
val header = KotlinBinaryClassCache.getKotlinBinaryClass(file)?.getClassHeader()
return header != null && header.syntheticClassKind != KotlinSyntheticClass.Kind.TRAIT_IMPL
return header != null &&
header.syntheticClassKind != KotlinSyntheticClass.Kind.TRAIT_IMPL &&
header.syntheticClassKind != KotlinSyntheticClass.Kind.LOCAL_TRAIT_IMPL
}
public fun isKotlinWithCompatibleAbiVersion(file: VirtualFile): Boolean {
@@ -23,6 +23,9 @@ fun f() {
class MyLocalClass {
}
trait MyLocalTrait {
}
val myAnonymousObject = object {
}
@@ -37,7 +37,7 @@ public abstract class AbstractInternalCompiledClassesTest : JetLightCodeInsightF
}
protected fun doTestTraitImplClassIsVisibleAsJavaClass() {
val project = getProject()!!
val project = getProject()
doTest("trait impl", isSyntheticClassOfKind(TRAIT_IMPL)) {
val psiFile = PsiManager.getInstance(project).findFile(this)!!
Assert.assertTrue("Should not be kotlin file",
@@ -50,7 +50,7 @@ public abstract class AbstractInternalCompiledClassesTest : JetLightCodeInsightF
decompiledPsiFile is PsiJavaFile)
val classes = (decompiledPsiFile as PsiJavaFile).getClasses()
Assert.assertTrue("Should have some decompiled text",
classes.size == 1 && classes[0].getName()!!.endsWith(JvmAbi.TRAIT_IMPL_SUFFIX))
classes.size() == 1 && classes[0].getName()!!.endsWith(JvmAbi.TRAIT_IMPL_SUFFIX))
}
}
@@ -58,7 +58,7 @@ public abstract class AbstractInternalCompiledClassesTest : JetLightCodeInsightF
doTestNoPsiFilesAreBuiltFor(kind.toString(), isSyntheticClassOfKind(kind))
protected fun doTestNoPsiFilesAreBuiltFor(fileKind: String, acceptFile: VirtualFile.() -> Boolean) {
val project = getProject()!!
val project = getProject()
doTest(fileKind, acceptFile) {
val psiFile = PsiManager.getInstance(project).findFile(this)
Assert.assertNull("PSI files for $fileKind classes should not be build, is was build for: ${this.getPresentableName()}",