diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java index f10296c0801..ae0d051f2bc 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java @@ -1314,7 +1314,7 @@ public class DescriptorResolver { classDescriptor, valueParameter.getAnnotations(), resolveModalityFromModifiers(parameter, Modality.FINAL), - resolveVisibilityFromModifiers(parameter, Visibilities.INTERNAL), + resolveVisibilityFromModifiers(parameter, getDefaultVisibility(parameter, classDescriptor)), isMutable, name, CallableMemberDescriptor.Kind.DECLARATION diff --git a/compiler/testData/diagnostics/tests/override/PropertyInConstructor.kt b/compiler/testData/diagnostics/tests/override/PropertyInConstructor.kt new file mode 100644 index 00000000000..409fbb14b2e --- /dev/null +++ b/compiler/testData/diagnostics/tests/override/PropertyInConstructor.kt @@ -0,0 +1,11 @@ +open class Base { + protected open val prot: Int = 1 + internal open val int: Int = 1 + public open val pub: Int = 1 +} + +class Child( + override val prot: Int, + override val int: Int, + override val pub: Int +) : Base() \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructor.kt b/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructor.kt new file mode 100644 index 00000000000..e5528303b04 --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructor.kt @@ -0,0 +1,15 @@ +//ALLOW_AST_ACCESS + +package test + +open class Base { + protected open val prot = 1 + internal open val int = 1 + public open val pub: Int = 1 +} + +class Child( + override val prot: Int, + override val int: Int, + override val pub: Int +) : Base() \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructor.txt b/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructor.txt new file mode 100644 index 00000000000..8613baa9429 --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructor.txt @@ -0,0 +1,21 @@ +package test + +internal open class Base { + /*primary*/ public constructor Base() + internal open val int: kotlin.Int = 1 + internal open fun (): kotlin.Int + protected open val prot: kotlin.Int = 1 + protected open fun (): kotlin.Int + public open val pub: kotlin.Int = 1 + public open fun (): kotlin.Int +} + +internal final class Child : test.Base { + /*primary*/ public constructor Child(/*0*/ prot: kotlin.Int, /*1*/ int: kotlin.Int, /*2*/ pub: kotlin.Int) + internal open override /*1*/ val int: kotlin.Int + internal open override /*1*/ fun (): kotlin.Int + protected open override /*1*/ val prot: kotlin.Int + protected open override /*1*/ fun (): kotlin.Int + public open override /*1*/ val pub: kotlin.Int + public open override /*1*/ fun (): kotlin.Int +} \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructorExplicitVisibility.kt b/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructorExplicitVisibility.kt new file mode 100644 index 00000000000..5be5eddef9e --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructorExplicitVisibility.kt @@ -0,0 +1,15 @@ +//ALLOW_AST_ACCESS + +package test + +open class Base { + protected open val prot: Int = 1 + internal open val int: Int = 1 + public open val pub: Int = 1 +} + +class Child( + public override val prot: Int, + public override val int: Int, + public override val pub: Int +) : Base() \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructorExplicitVisibility.txt b/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructorExplicitVisibility.txt new file mode 100644 index 00000000000..0ba950c87b8 --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructorExplicitVisibility.txt @@ -0,0 +1,21 @@ +package test + +internal open class Base { + /*primary*/ public constructor Base() + internal open val int: kotlin.Int = 1 + internal open fun (): kotlin.Int + protected open val prot: kotlin.Int = 1 + protected open fun (): kotlin.Int + public open val pub: kotlin.Int = 1 + public open fun (): kotlin.Int +} + +internal final class Child : test.Base { + /*primary*/ public constructor Child(/*0*/ prot: kotlin.Int, /*1*/ int: kotlin.Int, /*2*/ pub: kotlin.Int) + public open override /*1*/ val int: kotlin.Int + public open override /*1*/ fun (): kotlin.Int + public open override /*1*/ val prot: kotlin.Int + public open override /*1*/ fun (): kotlin.Int + public open override /*1*/ val pub: kotlin.Int + public open override /*1*/ fun (): kotlin.Int +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index b5904f23301..01bce137e4e 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -6117,6 +6117,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest("compiler/testData/diagnostics/tests/override/ParentInheritsManyImplementations.kt"); } + @TestMetadata("PropertyInConstructor.kt") + public void testPropertyInConstructor() throws Exception { + doTest("compiler/testData/diagnostics/tests/override/PropertyInConstructor.kt"); + } + @TestMetadata("ProtectedAndPrivateFromSupertypes.kt") public void testProtectedAndPrivateFromSupertypes() throws Exception { doTest("compiler/testData/diagnostics/tests/override/ProtectedAndPrivateFromSupertypes.kt"); diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java index 1bd1fd17db0..a2603aff606 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java @@ -3023,6 +3023,16 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest { doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/visibility/PrivateTopLevelVal.kt"); } + @TestMetadata("PropertyInConstructor.kt") + public void testPropertyInConstructor() throws Exception { + doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructor.kt"); + } + + @TestMetadata("PropertyInConstructorExplicitVisibility.kt") + public void testPropertyInConstructorExplicitVisibility() throws Exception { + doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructorExplicitVisibility.kt"); + } + @TestMetadata("TopLevelVarWithPrivateSetter.kt") public void testTopLevelVarWithPrivateSetter() throws Exception { doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/visibility/TopLevelVarWithPrivateSetter.kt"); diff --git a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java index a7c2642e4a9..5a1ea4bfa20 100644 --- a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java @@ -1491,6 +1491,16 @@ public class LazyResolveRecursiveComparingTestGenerated extends AbstractLazyReso doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/visibility/PrivateTopLevelVal.kt"); } + @TestMetadata("PropertyInConstructor.kt") + public void testPropertyInConstructor() throws Exception { + doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructor.kt"); + } + + @TestMetadata("PropertyInConstructorExplicitVisibility.kt") + public void testPropertyInConstructorExplicitVisibility() throws Exception { + doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructorExplicitVisibility.kt"); + } + @TestMetadata("TopLevelVarWithPrivateSetter.kt") public void testTopLevelVarWithPrivateSetter() throws Exception { doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/visibility/TopLevelVarWithPrivateSetter.kt"); diff --git a/idea/tests/org/jetbrains/jet/plugin/stubs/LazyResolveByStubTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/stubs/LazyResolveByStubTestGenerated.java index 71fafd92a3c..1b017812a97 100644 --- a/idea/tests/org/jetbrains/jet/plugin/stubs/LazyResolveByStubTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/stubs/LazyResolveByStubTestGenerated.java @@ -1491,6 +1491,16 @@ public class LazyResolveByStubTestGenerated extends AbstractLazyResolveByStubTes doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/visibility/PrivateTopLevelVal.kt"); } + @TestMetadata("PropertyInConstructor.kt") + public void testPropertyInConstructor() throws Exception { + doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructor.kt"); + } + + @TestMetadata("PropertyInConstructorExplicitVisibility.kt") + public void testPropertyInConstructorExplicitVisibility() throws Exception { + doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/visibility/PropertyInConstructorExplicitVisibility.kt"); + } + @TestMetadata("TopLevelVarWithPrivateSetter.kt") public void testTopLevelVarWithPrivateSetter() throws Exception { doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/visibility/TopLevelVarWithPrivateSetter.kt");