Prohibit platformName on secondary constructor
#KT-6999 Fixed
This commit is contained in:
@@ -295,7 +295,8 @@ public class ModifiersChecker {
|
|||||||
JetAnnotationEntry annotationEntry = trace.get(BindingContext.ANNOTATION_DESCRIPTOR_TO_PSI_ELEMENT, annotation);
|
JetAnnotationEntry annotationEntry = trace.get(BindingContext.ANNOTATION_DESCRIPTOR_TO_PSI_ELEMENT, annotation);
|
||||||
if (annotationEntry == null) return;
|
if (annotationEntry == null) return;
|
||||||
|
|
||||||
if (!DescriptorUtils.isTopLevelDeclaration(descriptor) || !(descriptor instanceof FunctionDescriptor)) {
|
if (!DescriptorUtils.isTopLevelDeclaration(descriptor) || !(descriptor instanceof FunctionDescriptor) ||
|
||||||
|
descriptor instanceof ConstructorDescriptor) {
|
||||||
trace.report(INAPPLICABLE_ANNOTATION.on(annotationEntry));
|
trace.report(INAPPLICABLE_ANNOTATION.on(annotationEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -1,4 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||||
|
|
||||||
import kotlin.platform.*
|
import kotlin.platform.*
|
||||||
|
|
||||||
@@ -32,7 +32,8 @@ var vardef: Int = 1
|
|||||||
set
|
set
|
||||||
|
|
||||||
[<!INAPPLICABLE_ANNOTATION!>platformName("C")<!>]
|
[<!INAPPLICABLE_ANNOTATION!>platformName("C")<!>]
|
||||||
class C {
|
class C [platformName("primary")]() { // TODO: modifiers check on primary constructor KT-7057
|
||||||
|
<!INAPPLICABLE_ANNOTATION!>platformName("ctr")<!> constructor(x: Int): this() {}
|
||||||
[<!INAPPLICABLE_ANNOTATION!>platformName("a")<!>]
|
[<!INAPPLICABLE_ANNOTATION!>platformName("a")<!>]
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -10,7 +10,8 @@ internal fun foo1(): kotlin.Unit
|
|||||||
kotlin.platform.platformName(name = "b": kotlin.String) internal fun kotlin.Any.foo(): kotlin.Unit
|
kotlin.platform.platformName(name = "b": kotlin.String) internal fun kotlin.Any.foo(): kotlin.Unit
|
||||||
|
|
||||||
kotlin.platform.platformName(name = "C": kotlin.String) internal final class C {
|
kotlin.platform.platformName(name = "C": kotlin.String) internal final class C {
|
||||||
public constructor C()
|
kotlin.platform.platformName(name = "primary": kotlin.String) public constructor C()
|
||||||
|
kotlin.platform.platformName(name = "ctr": kotlin.String) public constructor C(/*0*/ x: kotlin.Int)
|
||||||
kotlin.platform.platformName(name = "c": kotlin.String) internal final val px: kotlin.Int = 1
|
kotlin.platform.platformName(name = "c": kotlin.String) internal final val px: kotlin.Int = 1
|
||||||
internal final val valx: kotlin.Int
|
internal final val valx: kotlin.Int
|
||||||
internal final var varx: kotlin.Int
|
internal final var varx: kotlin.Int
|
||||||
|
|||||||
Reference in New Issue
Block a user