[Invariant fix] Fix false positive internal visibility diagnostic
Effectively, this commit allows for common module to see internal content of all expect-modules The problem is that when computing the member scope for A (see the test) we're building a special member scope for CommonAbstract viewed from JVM and it's effectively has a fake override of actual member from Jvm/ExpectBase. OverridingUtil checks if it's visible in CommonAbstract and finds that it's not thus creating a fake_invisible fake override The latter results in A::foo override being marked as INVISIBLE_MEMBER_OVERRIDE Probably, the fix might be smarter (passing a requested module to OverridingUtil::createAndBindFakeOverride) but allowing using internal member seems to be safe & simple because it's reasonable to assume there's no cyclic dependencies between expected/actual modules
This commit is contained in:
committed by
Dmitry Savvinov
parent
d20516779a
commit
d744192e6f
@@ -125,7 +125,12 @@ class ModuleDescriptorImpl @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun shouldSeeInternalsOf(targetModule: ModuleDescriptor): Boolean {
|
override fun shouldSeeInternalsOf(targetModule: ModuleDescriptor): Boolean {
|
||||||
return this == targetModule || targetModule in dependencies!!.modulesWhoseInternalsAreVisible || targetModule in expectedByModules
|
if (this == targetModule) return true
|
||||||
|
if (targetModule in dependencies!!.modulesWhoseInternalsAreVisible) return true
|
||||||
|
if (targetModule in expectedByModules) return true
|
||||||
|
if (this in targetModule.expectedByModules) return true
|
||||||
|
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
private val id: String
|
private val id: String
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
internal expect abstract class ExpectBase() {
|
||||||
|
abstract fun foo(cause: Throwable?)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface I {
|
||||||
|
fun foo(cause: Throwable?)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal abstract class CommonAbstract : ExpectBase()
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
private class A : CommonAbstract() {
|
||||||
|
override fun foo(cause: Throwable?) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal actual abstract class ExpectBase actual constructor() : I {
|
||||||
|
actual abstract override fun foo(cause: Throwable?)
|
||||||
|
}
|
||||||
Generated
+5
@@ -104,6 +104,11 @@ public class MultiPlatformHighlightingTestGenerated extends AbstractMultiPlatfor
|
|||||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/internalDependencyFromTests/");
|
runTest("idea/testData/multiModuleHighlighting/multiplatform/internalDependencyFromTests/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("internalInheritanceToCommon")
|
||||||
|
public void testInternalInheritanceToCommon() throws Exception {
|
||||||
|
runTest("idea/testData/multiModuleHighlighting/multiplatform/internalInheritanceToCommon/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("javaUsesPlatformFacade")
|
@TestMetadata("javaUsesPlatformFacade")
|
||||||
public void testJavaUsesPlatformFacade() throws Exception {
|
public void testJavaUsesPlatformFacade() throws Exception {
|
||||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/javaUsesPlatformFacade/");
|
runTest("idea/testData/multiModuleHighlighting/multiplatform/javaUsesPlatformFacade/");
|
||||||
|
|||||||
Reference in New Issue
Block a user