Changed containing declaration for PropertyDeclarationInnerScope

This commit is contained in:
Stanislav Erokhin
2015-02-03 21:09:49 +03:00
parent 49b77a1523
commit 3b92cab9e0
13 changed files with 48 additions and 49 deletions
@@ -646,7 +646,7 @@ public class BodyResolver {
}
JetScope propertyDeclarationInnerScope = JetScopeUtils.getPropertyDeclarationInnerScopeForInitializer(
propertyScope, propertyDescriptor.getTypeParameters(), NO_RECEIVER_PARAMETER, trace);
propertyDescriptor, propertyScope, propertyDescriptor.getTypeParameters(), NO_RECEIVER_PARAMETER, trace);
JetScope accessorScope = JetScopeUtils.makeScopeForPropertyAccessor(
propertyDescriptor, parentScopeForAccessor, trace);
@@ -674,7 +674,7 @@ public class BodyResolver {
@NotNull JetScope scope
) {
JetScope propertyDeclarationInnerScope = JetScopeUtils.getPropertyDeclarationInnerScopeForInitializer(
scope, propertyDescriptor.getTypeParameters(), NO_RECEIVER_PARAMETER, trace);
propertyDescriptor, scope, propertyDescriptor.getTypeParameters(), NO_RECEIVER_PARAMETER, trace);
JetType expectedTypeForInitializer = property.getTypeReference() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
CompileTimeConstant<?> compileTimeInitializer = propertyDescriptor.getCompileTimeInitializer();
if (compileTimeInitializer == null) {
@@ -424,7 +424,7 @@ public class DescriptorResolver {
? Visibilities.INHERITED
: Visibilities.INTERNAL;
}
else if (containingDescriptor instanceof FunctionDescriptor) {
else if (containingDescriptor instanceof FunctionDescriptor || containingDescriptor instanceof PropertyDescriptor) {
defaultVisibility = Visibilities.LOCAL;
}
else {
@@ -64,8 +64,8 @@ public class OverloadResolver {
@NotNull MultiMap<FqNameUnsafe, ConstructorDescriptor> inPackages
) {
for (ClassDescriptorWithResolutionScopes klass : c.getDeclaredClasses().values()) {
if (klass.getKind().isSingleton()) {
// Constructors of singletons aren't callable from the code, so they shouldn't participate in overload name checking
if (klass.getKind().isSingleton() || klass.getName().isSpecial()) {
// Constructors of singletons or anonymous object aren't callable from the code, so they shouldn't participate in overload name checking
continue;
}
DeclarationDescriptor containingDeclaration = klass.getContainingDeclaration();
@@ -91,17 +91,17 @@ public final class JetScopeUtils {
}
public static JetScope getPropertyDeclarationInnerScopeForInitializer(
@NotNull PropertyDescriptor propertyDescriptor,
@NotNull JetScope outerScope,
@NotNull List<? extends TypeParameterDescriptor> typeParameters,
@Nullable ReceiverParameterDescriptor receiver,
BindingTrace trace
) {
return getPropertyDeclarationInnerScope(null, outerScope, typeParameters, receiver, trace, false);
return getPropertyDeclarationInnerScope(propertyDescriptor, outerScope, typeParameters, receiver, trace, false);
}
private static JetScope getPropertyDeclarationInnerScope(
@Nullable PropertyDescriptor propertyDescriptor,
// PropertyDescriptor can be null for property scope which hasn't label to property (in this case addLabelForProperty parameter must be false
@NotNull PropertyDescriptor propertyDescriptor,
@NotNull JetScope outerScope,
@NotNull List<? extends TypeParameterDescriptor> typeParameters,
@Nullable ReceiverParameterDescriptor receiver,
@@ -115,7 +115,7 @@ public final class JetScopeUtils {
@NotNull
private static JetScope getPropertyDeclarationInnerScope(
@Nullable PropertyDescriptor propertyDescriptor,
@NotNull PropertyDescriptor propertyDescriptor,
@NotNull JetScope outerScope,
@NotNull List<? extends TypeParameterDescriptor> typeParameters,
@Nullable ReceiverParameterDescriptor receiver,
@@ -123,10 +123,9 @@ public final class JetScopeUtils {
boolean addLabelForProperty
) {
WritableScopeImpl result = new WritableScopeImpl(
outerScope, outerScope.getContainingDeclaration(), redeclarationHandler,
outerScope, propertyDescriptor, redeclarationHandler,
"Property declaration inner scope");
if (addLabelForProperty) {
assert propertyDescriptor != null : "PropertyDescriptor can be null for property scope which hasn't label to property";
result.addLabeledDeclaration(propertyDescriptor);
}
for (TypeParameterDescriptor typeParameterDescriptor : typeParameters) {
@@ -1,10 +1,10 @@
package
internal val packageInternal2Property: <no name provided>
internal val packageInternalProperty: <no name provided>
private val packagePrivateProperty: <no name provided>
protected val packageProtectedProperty: <no name provided>
public val packagePublicProperty: <no name provided>
internal val packageInternal2Property: packageInternal2Property.<no name provided>
internal val packageInternalProperty: packageInternalProperty.<no name provided>
private val packagePrivateProperty: packagePrivateProperty.<no name provided>
protected val packageProtectedProperty: packageProtectedProperty.<no name provided>
public val packagePublicProperty: packagePublicProperty.<no name provided>
internal fun fooPackage(): kotlin.Unit
internal fun packageInternal2Function(): packageInternal2Function.<no name provided>
internal fun packageInternalFunction(): packageInternalFunction.<no name provided>
@@ -13,11 +13,11 @@ public fun packagePublicFunction(): packagePublicFunction.<no name provided>
internal final class Foo {
public constructor Foo()
internal final val internal2Property: Foo.<init>.<no name provided>
internal final val internalProperty: Foo.<init>.<no name provided>
private final val privateProperty: Foo.<init>.<no name provided>
protected final val protectedProperty: Foo.<init>.<no name provided>
public final val publicProperty: Foo.<init>.<no name provided>
internal final val internal2Property: Foo.internal2Property.<no name provided>
internal final val internalProperty: Foo.internalProperty.<no name provided>
private final val privateProperty: Foo.privateProperty.<no name provided>
protected final val protectedProperty: Foo.protectedProperty.<no name provided>
public final val publicProperty: Foo.publicProperty.<no name provided>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal final fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -30,11 +30,11 @@ internal final class Foo {
internal final class FooInner {
public constructor FooInner()
internal final val internal2Property: Foo.FooInner.<init>.<no name provided>
internal final val internalProperty: Foo.FooInner.<init>.<no name provided>
private final val privatePropertyInner: Foo.FooInner.<init>.<no name provided>
protected final val protectedProperty: Foo.FooInner.<init>.<no name provided>
public final val publicProperty: Foo.FooInner.<init>.<no name provided>
internal final val internal2Property: Foo.FooInner.internal2Property.<no name provided>
internal final val internalProperty: Foo.FooInner.internalProperty.<no name provided>
private final val privatePropertyInner: Foo.FooInner.privatePropertyInner.<no name provided>
protected final val protectedProperty: Foo.FooInner.protectedProperty.<no name provided>
public final val publicProperty: Foo.FooInner.publicProperty.<no name provided>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun internal2Function(): Foo.FooInner.internal2Function.<no name provided>
@@ -3,9 +3,9 @@ package
internal val packageInternal2Property: MyClass
internal val packageInternalProperty: MyClass
private val packagePrivateProperty: MyClass
protected val packageProtectedProperty: <no name provided>
protected val packageProtectedProperty: packageProtectedProperty.<no name provided>
public val packagePublic2Property: MyClass
public val packagePublicProperty: <no name provided>
public val packagePublicProperty: packagePublicProperty.<no name provided>
internal fun fooPackage(): kotlin.Unit
internal fun internal2Function(): MyClass
internal fun internalFunction(): MyClass
@@ -20,11 +20,11 @@ internal final class Foo {
public constructor Foo()
internal final val internal2Property: MyClass
internal final val internalProperty: MyClass
private final val privateProperty: Foo.<init>.<no name provided>
private final val privateProperty: Foo.privateProperty.<no name provided>
protected final val protected2Property: MyClass
protected final val protectedProperty: Foo.<init>.<no name provided>
protected final val protectedProperty: Foo.protectedProperty.<no name provided>
public final val public2Property: MyClass
public final val publicProperty: Foo.<init>.<no name provided>
public final val publicProperty: Foo.publicProperty.<no name provided>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal final fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -43,11 +43,11 @@ internal final class Foo {
public constructor FooInner()
internal final val internal2Property: MyClass
internal final val internalProperty: MyClass
private final val privateProperty: Foo.FooInner.<init>.<no name provided>
private final val privateProperty: Foo.FooInner.privateProperty.<no name provided>
protected final val protected2Property: MyClass
protected final val protectedProperty: Foo.FooInner.<init>.<no name provided>
protected final val protectedProperty: Foo.FooInner.protectedProperty.<no name provided>
public final val public2Property: MyClass
public final val publicProperty: Foo.FooInner.<init>.<no name provided>
public final val publicProperty: Foo.FooInner.publicProperty.<no name provided>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun internal2Function(): MyClass
@@ -10,7 +10,7 @@ internal object A {
internal final class Test {
public constructor Test()
private final val y: Test.<init>.<no name provided>
private final val y: Test.y.<no name provided>
internal final val z: [ERROR : Type for y]
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -19,7 +19,7 @@ internal final class Test {
internal final class Test2 {
public constructor Test2()
private final val a: Test2.<init>.<no name provided>
private final val a: Test2.a.<no name provided>
internal final val b: [ERROR : <ERROR PROPERTY TYPE>]
internal final val c: kotlin.Int = 1
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -14,7 +14,7 @@ package kt1806 {
internal final class Test {
public constructor Test()
private final val MyObject1: kt1806.Test.<init>.<no name provided>
private final val MyObject1: kt1806.Test.MyObject1.<no name provided>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun test2(): kotlin.Unit
@@ -2,7 +2,7 @@ package
internal final class Test {
public constructor Test()
private final var x: Test.<init>.<no name provided>
private final var x: Test.x.<no name provided>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -42,12 +42,12 @@
<info>open</info> class Super(<warning>i</warning> : Int)
class TestPCParameters(w : Int, <warning>x</warning> : Int, val <info>y</info> : Int, var <info>z</info> : Int) : Super(w) {
class TestPCParameters(<info>w</info> : Int, <warning>x</warning> : Int, val <info>y</info> : Int, var <info>z</info> : Int) : Super(<info>w</info>) {
val <info>xx</info> = w
val <info>xx</info> = <info descr="Value captured in a closure">w</info>
<info>init</info> {
w + 1
<info>w</info> + 1
}
fun foo() = <error>x</error>
@@ -1,4 +1,4 @@
// PARAM_DESCRIPTOR: local final class <no name provided> defined in root package
// PARAM_DESCRIPTOR: local final class <no name provided> defined in x
// PARAM_TYPES: kotlin.Any
// WITH_RUNTIME
@@ -1,4 +1,4 @@
// PARAM_DESCRIPTOR: local final class <no name provided> defined in root package
// PARAM_DESCRIPTOR: local final class <no name provided> defined in x
// PARAM_TYPES: kotlin.Any
// WITH_RUNTIME
@@ -5,9 +5,9 @@ package foo
native
val ROOT = "Kotlin.modules.JS_TESTS"
native
val PATH_TO_F_CREATOR = "foo.B.B\$f"
val PATH_TO_F_CREATOR = "foo.B.far\$f"
native
val PATH_TO_G_CREATOR = "foo.B.B\$f_0"
val PATH_TO_G_CREATOR = "foo.B.gar\$f"
native("$ROOT.$PATH_TO_F_CREATOR")
val F_CREATOR: Any = noImpl
@@ -24,15 +24,15 @@ open class A {
class B : A() {
fun boo() = "B::boo"
val f = { foo() }
val g = { boo() }
val far = { foo() }
val gar = { boo() }
}
fun box(): String {
val b = B()
val f = b.f
val g = b.g
val f = b.far
val g = b.gar
assertEquals("A::foo", f())
assertEquals("B::boo", g())