Change object resolution strategy in lazy resolve
This commit is contained in:
+110
@@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2013 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.lang.resolve.lazy.data;
|
||||||
|
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.ClassKind;
|
||||||
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
|
import org.jetbrains.jet.lang.resolve.lazy.descriptors.LazyClassDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SyntheticClassObjectInfo implements JetClassLikeInfo {
|
||||||
|
private final JetClassLikeInfo classInfo;
|
||||||
|
private final LazyClassDescriptor classDescriptor;
|
||||||
|
|
||||||
|
public SyntheticClassObjectInfo(@NotNull JetClassLikeInfo classInfo, @NotNull LazyClassDescriptor classDescriptor) {
|
||||||
|
this.classInfo = classInfo;
|
||||||
|
this.classDescriptor = classDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public LazyClassDescriptor getClassDescriptor() {
|
||||||
|
return classDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public FqName getContainingPackageFqName() {
|
||||||
|
return classInfo.getContainingPackageFqName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public List<JetDelegationSpecifier> getDelegationSpecifiers() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JetModifierList getModifierList() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JetClassObject getClassObject() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public PsiElement getScopeAnchor() {
|
||||||
|
return classInfo.getScopeAnchor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JetClassOrObject getCorrespondingClassOrObject() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public List<JetTypeParameter> getTypeParameters() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public List<? extends JetParameter> getPrimaryConstructorParameters() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public ClassKind getClassKind() {
|
||||||
|
return ClassKind.CLASS_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public List<JetDeclaration> getDeclarations() {
|
||||||
|
// There can be no declarations in a synthetic class object, all its members are fake overrides
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "class object of " + classInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
-13
@@ -198,10 +198,10 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
|||||||
resolveSession.getInjector().getAnnotationResolver().resolveAnnotationsArguments(propertyDescriptor, resolveSession.getTrace(), resolutionScope);
|
resolveSession.getInjector().getAnnotationResolver().resolveAnnotationsArguments(propertyDescriptor, resolveSession.getTrace(), resolutionScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Objects are also properties
|
// Enum entries are also properties
|
||||||
Collection<JetClassOrObject> classOrObjectDeclarations = declarationProvider.getClassOrObjectDeclarations(name);
|
Collection<JetClassOrObject> classOrObjectDeclarations = declarationProvider.getClassOrObjectDeclarations(name);
|
||||||
for (JetClassOrObject classOrObjectDeclaration : classOrObjectDeclarations) {
|
for (JetClassOrObject classOrObjectDeclaration : classOrObjectDeclarations) {
|
||||||
if (declaresObjectOrEnumConstant(classOrObjectDeclaration)) {
|
if (classOrObjectDeclaration instanceof JetEnumEntry) {
|
||||||
ClassDescriptor classifier = getObjectDescriptor(name);
|
ClassDescriptor classifier = getObjectDescriptor(name);
|
||||||
if (classifier == null) {
|
if (classifier == null) {
|
||||||
throw new IllegalStateException("Object declaration " + name + " found in the DeclarationProvider " + declarationProvider + " but not in the scope " + this);
|
throw new IllegalStateException("Object declaration " + name + " found in the DeclarationProvider " + declarationProvider + " but not in the scope " + this);
|
||||||
@@ -259,25 +259,19 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
|||||||
if (declaration instanceof JetEnumEntry) {
|
if (declaration instanceof JetEnumEntry) {
|
||||||
JetEnumEntry jetEnumEntry = (JetEnumEntry) declaration;
|
JetEnumEntry jetEnumEntry = (JetEnumEntry) declaration;
|
||||||
Name name = safeNameForLazyResolve(jetEnumEntry);
|
Name name = safeNameForLazyResolve(jetEnumEntry);
|
||||||
if (name != null) {
|
result.all.addAll(getProperties(name));
|
||||||
result.all.addAll(getProperties(name));
|
result.objects.add(getObjectDescriptor(name));
|
||||||
result.objects.add(getObjectDescriptor(name));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (declaration instanceof JetObjectDeclaration) {
|
else if (declaration instanceof JetObjectDeclaration) {
|
||||||
JetObjectDeclaration objectDeclaration = (JetObjectDeclaration) declaration;
|
JetObjectDeclaration objectDeclaration = (JetObjectDeclaration) declaration;
|
||||||
Name name = safeNameForLazyResolve(objectDeclaration.getNameAsDeclaration());
|
Name name = safeNameForLazyResolve(objectDeclaration.getNameAsDeclaration());
|
||||||
if (name != null) {
|
result.all.addAll(getProperties(name));
|
||||||
result.all.addAll(getProperties(name));
|
result.objects.add(getObjectDescriptor(name));
|
||||||
result.objects.add(getObjectDescriptor(name));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (declaration instanceof JetClassOrObject) {
|
else if (declaration instanceof JetClassOrObject) {
|
||||||
JetClassOrObject classOrObject = (JetClassOrObject) declaration;
|
JetClassOrObject classOrObject = (JetClassOrObject) declaration;
|
||||||
Name name = safeNameForLazyResolve(classOrObject.getNameAsName());
|
Name name = safeNameForLazyResolve(classOrObject.getNameAsName());
|
||||||
if (name != null) {
|
result.all.addAll(classDescriptors.invoke(name));
|
||||||
result.all.addAll(classDescriptors.invoke(name));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (declaration instanceof JetFunction) {
|
else if (declaration instanceof JetFunction) {
|
||||||
JetFunction function = (JetFunction) declaration;
|
JetFunction function = (JetFunction) declaration;
|
||||||
|
|||||||
+33
-24
@@ -40,6 +40,7 @@ import org.jetbrains.jet.lang.resolve.lazy.ScopeProvider;
|
|||||||
import org.jetbrains.jet.lang.resolve.lazy.data.FilteringClassLikeInfo;
|
import org.jetbrains.jet.lang.resolve.lazy.data.FilteringClassLikeInfo;
|
||||||
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassInfoUtil;
|
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassInfoUtil;
|
||||||
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassLikeInfo;
|
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassLikeInfo;
|
||||||
|
import org.jetbrains.jet.lang.resolve.lazy.data.SyntheticClassObjectInfo;
|
||||||
import org.jetbrains.jet.lang.resolve.lazy.declarations.ClassMemberDeclarationProvider;
|
import org.jetbrains.jet.lang.resolve.lazy.declarations.ClassMemberDeclarationProvider;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.*;
|
import org.jetbrains.jet.lang.resolve.scopes.*;
|
||||||
@@ -52,7 +53,7 @@ import org.jetbrains.jet.storage.StorageManager;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isEnumClassObject;
|
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isSyntheticClassObject;
|
||||||
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.*;
|
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.*;
|
||||||
import static org.jetbrains.jet.lang.resolve.name.SpecialNames.getClassObjectName;
|
import static org.jetbrains.jet.lang.resolve.name.SpecialNames.getClassObjectName;
|
||||||
|
|
||||||
@@ -99,8 +100,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.originalClassInfo = classLikeInfo;
|
this.originalClassInfo = classLikeInfo;
|
||||||
JetClassLikeInfo classLikeInfoForMembers =
|
JetClassLikeInfo classLikeInfoForMembers = classLikeInfo.getClassKind() != ClassKind.ENUM_CLASS ? classLikeInfo : noEnumEntries();
|
||||||
classLikeInfo.getClassKind() != ClassKind.ENUM_CLASS ? classLikeInfo : noEnumEntries(classLikeInfo);
|
|
||||||
this.declarationProvider =
|
this.declarationProvider =
|
||||||
resolveSession.getDeclarationProviderFactory().getClassMemberDeclarationProvider(classLikeInfoForMembers);
|
resolveSession.getDeclarationProviderFactory().getClassMemberDeclarationProvider(classLikeInfoForMembers);
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
Modality defaultModality = kind == ClassKind.TRAIT ? Modality.ABSTRACT : Modality.FINAL;
|
Modality defaultModality = kind == ClassKind.TRAIT ? Modality.ABSTRACT : Modality.FINAL;
|
||||||
this.modality = resolveModalityFromModifiers(modifierList, defaultModality);
|
this.modality = resolveModalityFromModifiers(modifierList, defaultModality);
|
||||||
}
|
}
|
||||||
this.visibility = isEnumClassObject(this)
|
this.visibility = isSyntheticClassObject(this)
|
||||||
? DescriptorUtils.getSyntheticClassObjectVisibility()
|
? DescriptorUtils.getSyntheticClassObjectVisibility()
|
||||||
: resolveVisibilityFromModifiers(modifierList, getDefaultClassVisibility(this));
|
: resolveVisibilityFromModifiers(modifierList, getDefaultClassVisibility(this));
|
||||||
this.isInner = isInnerClass(modifierList);
|
this.isInner = isInnerClass(modifierList);
|
||||||
@@ -271,11 +271,12 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
return JetClassInfoUtil.createClassLikeInfo(objectDeclaration);
|
return JetClassInfoUtil.createClassLikeInfo(objectDeclaration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if (getKind() == ClassKind.OBJECT) {
|
||||||
if (getKind() == ClassKind.ENUM_CLASS) {
|
return new SyntheticClassObjectInfo(originalClassInfo, this);
|
||||||
// Enum classes always have class objects, and enum constants are their members
|
}
|
||||||
return enumClassObjectInfo(originalClassInfo);
|
else if (getKind() == ClassKind.ENUM_CLASS) {
|
||||||
}
|
// Enum classes always have class objects, and enum constants are their members
|
||||||
|
return enumClassObjectInfo();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -358,20 +359,25 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
if (resolveSession.isClassSpecial(DescriptorUtils.getFQName(LazyClassDescriptor.this))) {
|
if (resolveSession.isClassSpecial(DescriptorUtils.getFQName(LazyClassDescriptor.this))) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
JetClassOrObject classOrObject = declarationProvider.getOwnerInfo().getCorrespondingClassOrObject();
|
|
||||||
if (classOrObject == null) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
List<JetType> allSupertypes = resolveSession.getInjector().getDescriptorResolver()
|
|
||||||
.resolveSupertypes(getScopeForClassHeaderResolution(),
|
|
||||||
LazyClassDescriptor.this, classOrObject,
|
|
||||||
resolveSession.getTrace());
|
|
||||||
|
|
||||||
return Lists.newArrayList(Collections2.filter(allSupertypes, VALID_SUPERTYPE));
|
JetClassLikeInfo info = declarationProvider.getOwnerInfo();
|
||||||
|
if (info instanceof SyntheticClassObjectInfo) {
|
||||||
|
LazyClassDescriptor descriptor = ((SyntheticClassObjectInfo) info).getClassDescriptor();
|
||||||
|
if (descriptor.getKind().isSingleton()) {
|
||||||
|
return Collections.singleton(descriptor.getDefaultType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JetClassOrObject classOrObject = info.getCorrespondingClassOrObject();
|
||||||
|
if (classOrObject == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<JetType> allSupertypes = resolveSession.getInjector().getDescriptorResolver()
|
||||||
|
.resolveSupertypes(getScopeForClassHeaderResolution(), LazyClassDescriptor.this, classOrObject,
|
||||||
|
resolveSession.getTrace());
|
||||||
|
|
||||||
|
return Lists.newArrayList(Collections2.filter(allSupertypes, VALID_SUPERTYPE));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Function1<Boolean, Collection<JetType>>() {
|
new Function1<Boolean, Collection<JetType>>() {
|
||||||
@@ -472,12 +478,14 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private JetClassLikeInfo noEnumEntries(JetClassLikeInfo classLikeInfo) {
|
@NotNull
|
||||||
return new FilteringClassLikeInfo(resolveSession.getStorageManager(), classLikeInfo, Predicates.not(ONLY_ENUM_ENTRIES));
|
private JetClassLikeInfo noEnumEntries() {
|
||||||
|
return new FilteringClassLikeInfo(resolveSession.getStorageManager(), originalClassInfo, Predicates.not(ONLY_ENUM_ENTRIES));
|
||||||
}
|
}
|
||||||
|
|
||||||
private JetClassLikeInfo enumClassObjectInfo(JetClassLikeInfo classLikeInfo) {
|
@NotNull
|
||||||
return new FilteringClassLikeInfo(resolveSession.getStorageManager(), classLikeInfo, ONLY_ENUM_ENTRIES) {
|
private JetClassLikeInfo enumClassObjectInfo() {
|
||||||
|
return new FilteringClassLikeInfo(resolveSession.getStorageManager(), originalClassInfo, ONLY_ENUM_ENTRIES) {
|
||||||
@Override
|
@Override
|
||||||
public JetClassOrObject getCorrespondingClassOrObject() {
|
public JetClassOrObject getCorrespondingClassOrObject() {
|
||||||
return null;
|
return null;
|
||||||
@@ -503,6 +511,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
private ScopeProvider getScopeProvider() {
|
private ScopeProvider getScopeProvider() {
|
||||||
return resolveSession.getInjector().getScopeProvider();
|
return resolveSession.getInjector().getScopeProvider();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
test.A(a = 12.toInt(): jet.Int, c = "Hello": jet.String) internal val SomeObject: test.SomeObject
|
|
||||||
|
|
||||||
internal final annotation class A : jet.Annotation {
|
internal final annotation class A : jet.Annotation {
|
||||||
/*primary*/ public constructor A(/*0*/ a: jet.Int = ..., /*1*/ b: jet.String = ..., /*2*/ c: jet.String)
|
/*primary*/ public constructor A(/*0*/ a: jet.Int = ..., /*1*/ b: jet.String = ..., /*2*/ c: jet.String)
|
||||||
internal final val a: jet.Int
|
internal final val a: jet.Int
|
||||||
@@ -11,4 +9,8 @@ internal final annotation class A : jet.Annotation {
|
|||||||
|
|
||||||
test.A(a = 12.toInt(): jet.Int, c = "Hello": jet.String) internal object SomeObject {
|
test.A(a = 12.toInt(): jet.Int, c = "Hello": jet.String) internal object SomeObject {
|
||||||
/*primary*/ private constructor SomeObject()
|
/*primary*/ private constructor SomeObject()
|
||||||
|
|
||||||
|
public class object <class-object-for-SomeObject> : test.SomeObject {
|
||||||
|
/*primary*/ private constructor <class-object-for-SomeObject>()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
[ERROR : Unresolved annotation type: BadAnnotation]() internal val SomeObject: test.SomeObject
|
|
||||||
internal val some: test.SomeObject
|
internal val some: test.SomeObject
|
||||||
|
|
||||||
[ERROR : Unresolved annotation type: BadAnnotation]() internal object SomeObject {
|
[ERROR : Unresolved annotation type: BadAnnotation]() internal object SomeObject {
|
||||||
/*primary*/ private constructor SomeObject()
|
/*primary*/ private constructor SomeObject()
|
||||||
|
|
||||||
|
public class object <class-object-for-SomeObject> : test.SomeObject {
|
||||||
|
/*primary*/ private constructor <class-object-for-SomeObject>()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
test.BadAnnotation(s = 1.toInt(): jet.Int) internal val SomeObject: test.SomeObject
|
|
||||||
internal val some: test.SomeObject
|
internal val some: test.SomeObject
|
||||||
|
|
||||||
internal final annotation class BadAnnotation : jet.Annotation {
|
internal final annotation class BadAnnotation : jet.Annotation {
|
||||||
@@ -9,4 +8,8 @@ internal final annotation class BadAnnotation : jet.Annotation {
|
|||||||
|
|
||||||
test.BadAnnotation(s = 1.toInt(): jet.Int) internal object SomeObject {
|
test.BadAnnotation(s = 1.toInt(): jet.Int) internal object SomeObject {
|
||||||
/*primary*/ private constructor SomeObject()
|
/*primary*/ private constructor SomeObject()
|
||||||
|
|
||||||
|
public class object <class-object-for-SomeObject> : test.SomeObject {
|
||||||
|
/*primary*/ private constructor <class-object-for-SomeObject>()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,14 @@ package test
|
|||||||
|
|
||||||
internal final class A {
|
internal final class A {
|
||||||
/*primary*/ public constructor A()
|
/*primary*/ public constructor A()
|
||||||
internal final val B: test.A.B
|
|
||||||
|
|
||||||
internal object B {
|
internal object B {
|
||||||
/*primary*/ private constructor B()
|
/*primary*/ private constructor B()
|
||||||
internal final fun foo(/*0*/ a: jet.Int): jet.String
|
internal final fun foo(/*0*/ a: jet.Int): jet.String
|
||||||
|
|
||||||
|
public class object <class-object-for-B> : test.A.B {
|
||||||
|
/*primary*/ private constructor <class-object-for-B>()
|
||||||
|
internal final override /*1*/ /*fake_override*/ fun foo(/*0*/ a: jet.Int): jet.String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
internal val SomeObject: test.SomeObject
|
|
||||||
|
|
||||||
internal object SomeObject {
|
internal object SomeObject {
|
||||||
/*primary*/ private constructor SomeObject()
|
/*primary*/ private constructor SomeObject()
|
||||||
internal final fun test(/*0*/ a: jet.Int): jet.Int
|
internal final fun test(/*0*/ a: jet.Int): jet.Int
|
||||||
|
|
||||||
|
public class object <class-object-for-SomeObject> : test.SomeObject {
|
||||||
|
/*primary*/ private constructor <class-object-for-SomeObject>()
|
||||||
|
internal final override /*1*/ /*fake_override*/ fun test(/*0*/ a: jet.Int): jet.Int
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
internal val Bar: test.Bar
|
|
||||||
|
|
||||||
internal object Bar {
|
internal object Bar {
|
||||||
/*primary*/ private constructor Bar()
|
/*primary*/ private constructor Bar()
|
||||||
|
|
||||||
|
public class object <class-object-for-Bar> : test.Bar {
|
||||||
|
/*primary*/ private constructor <class-object-for-Bar>()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public val Obj: test.Obj
|
|
||||||
|
|
||||||
public object Obj {
|
public object Obj {
|
||||||
/*primary*/ private constructor Obj()
|
/*primary*/ private constructor Obj()
|
||||||
public final val v: jet.String
|
public final val v: jet.String
|
||||||
public final fun <get-v>(): jet.String
|
public final fun <get-v>(): jet.String
|
||||||
public final fun f(): jet.String
|
public final fun f(): jet.String
|
||||||
|
|
||||||
|
public class object <class-object-for-Obj> : test.Obj {
|
||||||
|
/*primary*/ private constructor <class-object-for-Obj>()
|
||||||
|
public final override /*1*/ /*fake_override*/ val v: jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun <get-v>(): jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun f(): jet.String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,18 @@ package test
|
|||||||
|
|
||||||
public final class Outer {
|
public final class Outer {
|
||||||
/*primary*/ public constructor Outer()
|
/*primary*/ public constructor Outer()
|
||||||
public final val Obj: test.Outer.Obj
|
|
||||||
|
|
||||||
public object Obj {
|
public object Obj {
|
||||||
/*primary*/ private constructor Obj()
|
/*primary*/ private constructor Obj()
|
||||||
public final val v: jet.String
|
public final val v: jet.String
|
||||||
public final fun <get-v>(): jet.String
|
public final fun <get-v>(): jet.String
|
||||||
public final fun f(): jet.String
|
public final fun f(): jet.String
|
||||||
|
|
||||||
|
public class object <class-object-for-Obj> : test.Outer.Obj {
|
||||||
|
/*primary*/ private constructor <class-object-for-Obj>()
|
||||||
|
public final override /*1*/ /*fake_override*/ val v: jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun <get-v>(): jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun f(): jet.String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,19 @@ public final class Outer {
|
|||||||
|
|
||||||
public class object <class-object-for-Outer> {
|
public class object <class-object-for-Outer> {
|
||||||
/*primary*/ private constructor <class-object-for-Outer>()
|
/*primary*/ private constructor <class-object-for-Outer>()
|
||||||
public final val Obj: test.Outer.Obj
|
|
||||||
|
|
||||||
public object Obj {
|
public object Obj {
|
||||||
/*primary*/ private constructor Obj()
|
/*primary*/ private constructor Obj()
|
||||||
public final val v: jet.String
|
public final val v: jet.String
|
||||||
public final fun <get-v>(): jet.String
|
public final fun <get-v>(): jet.String
|
||||||
public final fun f(): jet.String
|
public final fun f(): jet.String
|
||||||
|
|
||||||
|
public class object <class-object-for-Obj> : test.Outer.Obj {
|
||||||
|
/*primary*/ private constructor <class-object-for-Obj>()
|
||||||
|
public final override /*1*/ /*fake_override*/ val v: jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun <get-v>(): jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun f(): jet.String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,23 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public val Outer: test.Outer
|
|
||||||
|
|
||||||
public object Outer {
|
public object Outer {
|
||||||
/*primary*/ private constructor Outer()
|
/*primary*/ private constructor Outer()
|
||||||
public final val Obj: test.Outer.Obj
|
|
||||||
|
public class object <class-object-for-Outer> : test.Outer {
|
||||||
|
/*primary*/ private constructor <class-object-for-Outer>()
|
||||||
|
}
|
||||||
|
|
||||||
public object Obj {
|
public object Obj {
|
||||||
/*primary*/ private constructor Obj()
|
/*primary*/ private constructor Obj()
|
||||||
public final val v: jet.String
|
public final val v: jet.String
|
||||||
public final fun <get-v>(): jet.String
|
public final fun <get-v>(): jet.String
|
||||||
public final fun f(): jet.String
|
public final fun f(): jet.String
|
||||||
|
|
||||||
|
public class object <class-object-for-Obj> : test.Outer.Obj {
|
||||||
|
/*primary*/ private constructor <class-object-for-Obj>()
|
||||||
|
public final override /*1*/ /*fake_override*/ val v: jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun <get-v>(): jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun f(): jet.String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public val Obj: test.Obj
|
|
||||||
internal val x: jet.Int
|
internal val x: jet.Int
|
||||||
internal fun <get-x>(): jet.Int
|
internal fun <get-x>(): jet.Int
|
||||||
|
|
||||||
@@ -9,4 +8,11 @@ public object Obj {
|
|||||||
public final val v: jet.String
|
public final val v: jet.String
|
||||||
public final fun <get-v>(): jet.String
|
public final fun <get-v>(): jet.String
|
||||||
public final fun f(): jet.String
|
public final fun f(): jet.String
|
||||||
|
|
||||||
|
public class object <class-object-for-Obj> : test.Obj {
|
||||||
|
/*primary*/ private constructor <class-object-for-Obj>()
|
||||||
|
public final override /*1*/ /*fake_override*/ val v: jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun <get-v>(): jet.String
|
||||||
|
public final override /*1*/ /*fake_override*/ fun f(): jet.String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -396,12 +396,7 @@ public class DescriptorValidator {
|
|||||||
public Void visitClassDescriptor(
|
public Void visitClassDescriptor(
|
||||||
ClassDescriptor descriptor, JetScope scope
|
ClassDescriptor descriptor, JetScope scope
|
||||||
) {
|
) {
|
||||||
if (descriptor.getKind().isSingleton()) {
|
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName()));
|
||||||
assertFound(scope, descriptor, scope.getObjectDescriptor(descriptor.getName()));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName()));
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -327,6 +327,16 @@ public class DescriptorUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isSyntheticClassObject(@NotNull DeclarationDescriptor descriptor) {
|
||||||
|
if (isClassObject(descriptor)) {
|
||||||
|
DeclarationDescriptor containing = descriptor.getContainingDeclaration();
|
||||||
|
if (containing != null) {
|
||||||
|
return isEnumClass(containing) || isObject(containing) || isEnumEntry(containing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static Visibility getDefaultConstructorVisibility(@NotNull ClassDescriptor classDescriptor) {
|
public static Visibility getDefaultConstructorVisibility(@NotNull ClassDescriptor classDescriptor) {
|
||||||
ClassKind classKind = classDescriptor.getKind();
|
ClassKind classKind = classDescriptor.getKind();
|
||||||
|
|||||||
Reference in New Issue
Block a user