Expect/actual companion object: set gutter on leaf element

May fix KT-21113
This commit is contained in:
Mikhail Glukhikh
2018-06-09 14:40:19 +03:00
parent 0a2ed054f1
commit 232d340118
7 changed files with 44 additions and 10 deletions
@@ -333,11 +333,11 @@ private fun collectOverriddenPropertyAccessors(
private val KtNamedDeclaration.expectOrActualAnchor
get() =
nameIdentifier
?: (this as? KtConstructor<*>)?.let {
it.getConstructorKeyword() ?: it.getValueParameterList()?.leftParenthesis
}
?: this
nameIdentifier ?: when (this) {
is KtConstructor<*> -> getConstructorKeyword() ?: getValueParameterList()?.leftParenthesis
is KtObjectDeclaration -> getObjectKeyword()
else -> null
} ?: this
private fun collectActualMarkers(
declaration: KtNamedDeclaration,
@@ -331,11 +331,11 @@ private fun collectOverriddenPropertyAccessors(
private val KtNamedDeclaration.expectOrActualAnchor
get() =
nameIdentifier
?: (this as? KtConstructor<*>)?.let {
it.getConstructorKeyword() ?: it.getValueParameterList()?.leftParenthesis
}
?: this
nameIdentifier ?: when (this) {
is KtConstructor<*> -> getConstructorKeyword() ?: getValueParameterList()?.leftParenthesis
is KtObjectDeclaration -> getObjectKeyword()
else -> null
} ?: this
private fun collectActualMarkers(
declaration: KtNamedDeclaration,
@@ -0,0 +1,7 @@
// !CHECK_HIGHLIGHTING
expect class WithCompanion {
companion object {
}
}
@@ -0,0 +1,5 @@
actual class <lineMarker>WithCompanion</lineMarker> {
actual companion <lineMarker>object</lineMarker> {
}
}
@@ -0,0 +1,5 @@
expect class <lineMarker>WithCompanion</lineMarker> {
companion <lineMarker>object</lineMarker> {
}
}
@@ -0,0 +1,7 @@
// !CHECK_HIGHLIGHTING
actual class WithCompanion {
actual companion object {
}
}
@@ -44,6 +44,11 @@ public class MultiModuleLineMarkerTestGenerated extends AbstractMultiModuleLineM
runTest("idea/testData/multiModuleLineMarker/fromActualAnnotation/");
}
@TestMetadata("fromActualCompanion")
public void testFromActualCompanion() throws Exception {
runTest("idea/testData/multiModuleLineMarker/fromActualCompanion/");
}
@TestMetadata("fromActualPrimaryConstructor")
public void testFromActualPrimaryConstructor() throws Exception {
runTest("idea/testData/multiModuleLineMarker/fromActualPrimaryConstructor/");
@@ -84,6 +89,11 @@ public class MultiModuleLineMarkerTestGenerated extends AbstractMultiModuleLineM
runTest("idea/testData/multiModuleLineMarker/fromCommonToJvmImpl/");
}
@TestMetadata("fromExpectCompanion")
public void testFromExpectCompanion() throws Exception {
runTest("idea/testData/multiModuleLineMarker/fromExpectCompanion/");
}
@TestMetadata("fromExpectedAnnotation")
public void testFromExpectedAnnotation() throws Exception {
runTest("idea/testData/multiModuleLineMarker/fromExpectedAnnotation/");