Merge remote branch 'origin/master'
This commit is contained in:
@@ -229,7 +229,7 @@ public abstract class CodegenContext {
|
|||||||
pd.getName() + "$bridge$" + accessors.size()
|
pd.getName() + "$bridge$" + accessors.size()
|
||||||
);
|
);
|
||||||
JetType receiverType = pd.getReceiverParameter().exists() ? pd.getReceiverParameter().getType() : null;
|
JetType receiverType = pd.getReceiverParameter().exists() ? pd.getReceiverParameter().getType() : null;
|
||||||
myAccessor.setType(pd.getInType(), pd.getOutType(), Collections.<TypeParameterDescriptor>emptyList(), pd.getExpectedThisObject(), receiverType);
|
myAccessor.setType(pd.getOutType(), Collections.<TypeParameterDescriptor>emptyList(), pd.getExpectedThisObject(), receiverType);
|
||||||
|
|
||||||
PropertyGetterDescriptor pgd = new PropertyGetterDescriptor(
|
PropertyGetterDescriptor pgd = new PropertyGetterDescriptor(
|
||||||
myAccessor, Collections.<AnnotationDescriptor>emptyList(), myAccessor.getModality(),
|
myAccessor, Collections.<AnnotationDescriptor>emptyList(), myAccessor.getModality(),
|
||||||
|
|||||||
@@ -672,9 +672,11 @@ public class JetTypeMapper {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public JvmMethodSignature mapSetterSignature(PropertyDescriptor descriptor, OwnerKind kind) {
|
public JvmMethodSignature mapSetterSignature(PropertyDescriptor descriptor, OwnerKind kind) {
|
||||||
JetType inType = descriptor.getInType();
|
if (!descriptor.isVar()) {
|
||||||
if(inType == null)
|
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
JetType outType = descriptor.getOutType();
|
||||||
|
|
||||||
String name = PropertyCodegen.setterName(descriptor.getName());
|
String name = PropertyCodegen.setterName(descriptor.getName());
|
||||||
ArrayList<Type> params = new ArrayList<Type>();
|
ArrayList<Type> params = new ArrayList<Type>();
|
||||||
@@ -694,7 +696,7 @@ public class JetTypeMapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
params.add(mapType(inType));
|
params.add(mapType(outType));
|
||||||
|
|
||||||
// TODO: proper generic signature
|
// TODO: proper generic signature
|
||||||
return new JvmMethodSignature(new Method(name, Type.VOID_TYPE, params.toArray(new Type[params.size()])), null, null, null, null);
|
return new JvmMethodSignature(new Method(name, Type.VOID_TYPE, params.toArray(new Type[params.size()])), null, null, null, null);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
|||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JavaClassDescriptor;
|
import org.jetbrains.jet.lang.resolve.java.JavaClassDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||||
import org.jetbrains.jet.lang.types.JetStandardClasses;
|
import org.jetbrains.jet.lang.types.JetStandardClasses;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
import org.jetbrains.jet.lang.types.TypeProjection;
|
import org.jetbrains.jet.lang.types.TypeProjection;
|
||||||
@@ -206,12 +207,12 @@ public class NamespaceCodegen {
|
|||||||
|
|
||||||
public static String getJVMClassName(String fqName) {
|
public static String getJVMClassName(String fqName) {
|
||||||
if (fqName.length() == 0) {
|
if (fqName.length() == 0) {
|
||||||
return "namespace";
|
return JvmAbi.PACKAGE_CLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = fqName.replace('.', '/') + "/namespace";
|
String name = fqName.replace('.', '/') + "/" + JvmAbi.PACKAGE_CLASS;
|
||||||
if(name.startsWith("<java_root>")) {
|
if(name.startsWith("<java_root>")) {
|
||||||
name = name.substring("<java_root>".length() + 1, name.length() - ".namespace".length());
|
name = name.substring("<java_root>".length() + 1, name.length() - 1 - JvmAbi.PACKAGE_CLASS.length());
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import org.jetbrains.jet.codegen.ClassFileFactory;
|
|||||||
import org.jetbrains.jet.codegen.GeneratedClassLoader;
|
import org.jetbrains.jet.codegen.GeneratedClassLoader;
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||||
import org.jetbrains.jet.plugin.JetMainDetector;
|
import org.jetbrains.jet.plugin.JetMainDetector;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -210,7 +211,7 @@ public class CompileEnvironment {
|
|||||||
Class moduleSetBuilderClass = loader.loadClass("kotlin.modules.ModuleSetBuilder");
|
Class moduleSetBuilderClass = loader.loadClass("kotlin.modules.ModuleSetBuilder");
|
||||||
final IModuleSetBuilder moduleSetBuilder = (IModuleSetBuilder) moduleSetBuilderClass.newInstance();
|
final IModuleSetBuilder moduleSetBuilder = (IModuleSetBuilder) moduleSetBuilderClass.newInstance();
|
||||||
|
|
||||||
Class namespaceClass = loader.loadClass("namespace");
|
Class namespaceClass = loader.loadClass(JvmAbi.PACKAGE_CLASS);
|
||||||
final Field[] fields = namespaceClass.getDeclaredFields();
|
final Field[] fields = namespaceClass.getDeclaredFields();
|
||||||
boolean modulesDefined = false;
|
boolean modulesDefined = false;
|
||||||
for (Field field : fields) {
|
for (Field field : fields) {
|
||||||
@@ -343,7 +344,7 @@ public class CompileEnvironment {
|
|||||||
String mainClass = null;
|
String mainClass = null;
|
||||||
for (JetFile file : session.getSourceFileNamespaces()) {
|
for (JetFile file : session.getSourceFileNamespaces()) {
|
||||||
if (JetMainDetector.hasMain(file.getDeclarations())) {
|
if (JetMainDetector.hasMain(file.getDeclarations())) {
|
||||||
mainClass = JetPsiUtil.getFQName(file) + ".namespace";
|
mainClass = JetPsiUtil.getFQName(file) + "." + JvmAbi.PACKAGE_CLASS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -743,7 +743,7 @@ public class JavaDescriptorResolver {
|
|||||||
i,
|
i,
|
||||||
Collections.<AnnotationDescriptor>emptyList(), // TODO
|
Collections.<AnnotationDescriptor>emptyList(), // TODO
|
||||||
name,
|
name,
|
||||||
null, // TODO : review
|
false,
|
||||||
changeNullable ? TypeUtils.makeNullableAsSpecified(outType, nullable) : outType,
|
changeNullable ? TypeUtils.makeNullableAsSpecified(outType, nullable) : outType,
|
||||||
hasDefaultValue,
|
hasDefaultValue,
|
||||||
varargElementType
|
varargElementType
|
||||||
@@ -767,7 +767,6 @@ public class JavaDescriptorResolver {
|
|||||||
null,
|
null,
|
||||||
DescriptorUtils.getExpectedThisObjectIfNeeded(containingDeclaration),
|
DescriptorUtils.getExpectedThisObjectIfNeeded(containingDeclaration),
|
||||||
field.getName(),
|
field.getName(),
|
||||||
isFinal ? null : type,
|
|
||||||
type);
|
type);
|
||||||
semanticServices.getTrace().record(BindingContext.VARIABLE, field, propertyDescriptor);
|
semanticServices.getTrace().record(BindingContext.VARIABLE, field, propertyDescriptor);
|
||||||
fieldDescriptorCache.put(field, propertyDescriptor);
|
fieldDescriptorCache.put(field, propertyDescriptor);
|
||||||
|
|||||||
+2
-2
@@ -48,7 +48,7 @@ public class JavaPackageScope extends JetScopeImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: what is GlobalSearchScope
|
// TODO: what is GlobalSearchScope
|
||||||
PsiClass psiClass = semanticServices.getDescriptorResolver().javaFacade.findClass(getQualifiedName("namespace"));
|
PsiClass psiClass = semanticServices.getDescriptorResolver().javaFacade.findClass(getQualifiedName(JvmAbi.PACKAGE_CLASS));
|
||||||
if (psiClass == null) {
|
if (psiClass == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ public class JavaPackageScope extends JetScopeImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (PsiClass psiClass : javaPackage.getClasses()) {
|
for (PsiClass psiClass : javaPackage.getClasses()) {
|
||||||
if (isKotlinNamespace && "namespace".equals(psiClass.getName())) continue;
|
if (isKotlinNamespace && JvmAbi.PACKAGE_CLASS.equals(psiClass.getName())) continue;
|
||||||
|
|
||||||
// If this is a Kotlin class, we have already taken it through a containing namespace descriptor
|
// If this is a Kotlin class, we have already taken it through a containing namespace descriptor
|
||||||
ClassDescriptor kotlinClassDescriptor = semanticServices.getKotlinClassDescriptor(psiClass.getQualifiedName());
|
ClassDescriptor kotlinClassDescriptor = semanticServices.getKotlinClassDescriptor(psiClass.getQualifiedName());
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ public class JvmAbi {
|
|||||||
public static final String DEFAULT_PARAMS_IMPL_SUFFIX = "$default";
|
public static final String DEFAULT_PARAMS_IMPL_SUFFIX = "$default";
|
||||||
public static final String GETTER_PREFIX = "get";
|
public static final String GETTER_PREFIX = "get";
|
||||||
public static final String SETTER_PREFIX = "set";
|
public static final String SETTER_PREFIX = "set";
|
||||||
|
public static final String PACKAGE_CLASS = "namespace";
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ public class FunctionDescriptorUtil {
|
|||||||
substitutedDescriptor,
|
substitutedDescriptor,
|
||||||
unsubstitutedValueParameter,
|
unsubstitutedValueParameter,
|
||||||
unsubstitutedValueParameter.getAnnotations(),
|
unsubstitutedValueParameter.getAnnotations(),
|
||||||
unsubstitutedValueParameter.getInType() == null ? null : substitutedType,
|
unsubstitutedValueParameter.isVar(),
|
||||||
substitutedType,
|
substitutedType,
|
||||||
substituteVarargElementType
|
substituteVarargElementType
|
||||||
));
|
));
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ public class LocalVariableDescriptor extends VariableDescriptorImpl {
|
|||||||
@NotNull String name,
|
@NotNull String name,
|
||||||
@Nullable JetType type,
|
@Nullable JetType type,
|
||||||
boolean mutable) {
|
boolean mutable) {
|
||||||
super(containingDeclaration, annotations, name, mutable ? type : null, type);
|
super(containingDeclaration, annotations, name, type);
|
||||||
isVar = mutable;
|
isVar = mutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,23 +71,20 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
|
|||||||
@Nullable JetType receiverType,
|
@Nullable JetType receiverType,
|
||||||
@NotNull ReceiverDescriptor expectedThisObject,
|
@NotNull ReceiverDescriptor expectedThisObject,
|
||||||
@NotNull String name,
|
@NotNull String name,
|
||||||
@Nullable JetType inType,
|
|
||||||
@NotNull JetType outType
|
@NotNull JetType outType
|
||||||
) {
|
) {
|
||||||
this(containingDeclaration, annotations, modality, visibility, isVar, name);
|
this(containingDeclaration, annotations, modality, visibility, isVar, name);
|
||||||
setType(inType, outType, Collections.<TypeParameterDescriptor>emptyList(), expectedThisObject, receiverType);
|
setType(outType, Collections.<TypeParameterDescriptor>emptyList(), expectedThisObject, receiverType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(@Nullable JetType inType, @NotNull JetType outType, @NotNull List<TypeParameterDescriptor> typeParameters, @NotNull ReceiverDescriptor expectedThisObject, @Nullable JetType receiverType) {
|
public void setType(@NotNull JetType outType, @NotNull List<TypeParameterDescriptor> typeParameters, @NotNull ReceiverDescriptor expectedThisObject, @Nullable JetType receiverType) {
|
||||||
ReceiverDescriptor receiver = receiverType == null
|
ReceiverDescriptor receiver = receiverType == null
|
||||||
? NO_RECEIVER
|
? NO_RECEIVER
|
||||||
: new ExtensionReceiver(this, receiverType);
|
: new ExtensionReceiver(this, receiverType);
|
||||||
setType(inType, outType, typeParameters, expectedThisObject, receiver);
|
setType(outType, typeParameters, expectedThisObject, receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(@Nullable JetType inType, @NotNull JetType outType, @NotNull List<TypeParameterDescriptor> typeParameters, @NotNull ReceiverDescriptor expectedThisObject, @NotNull ReceiverDescriptor receiver) {
|
public void setType(@NotNull JetType outType, @NotNull List<TypeParameterDescriptor> typeParameters, @NotNull ReceiverDescriptor expectedThisObject, @NotNull ReceiverDescriptor receiver) {
|
||||||
assert !isVar || inType != null;
|
|
||||||
setInType(inType);
|
|
||||||
setOutType(outType);
|
setOutType(outType);
|
||||||
|
|
||||||
this.typeParemeters = typeParameters;
|
this.typeParemeters = typeParameters;
|
||||||
@@ -123,17 +120,6 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
|
|||||||
return getOutType();
|
return getOutType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public JetType getInType() {
|
|
||||||
return super.getInType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NotNull
|
|
||||||
public JetType getOutType() {
|
|
||||||
return super.getOutType();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isVar() {
|
public boolean isVar() {
|
||||||
return isVar;
|
return isVar;
|
||||||
}
|
}
|
||||||
@@ -170,11 +156,9 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
|
|||||||
List<TypeParameterDescriptor> substitutedTypeParameters = Lists.newArrayList();
|
List<TypeParameterDescriptor> substitutedTypeParameters = Lists.newArrayList();
|
||||||
TypeSubstitutor substitutor = DescriptorSubstitutor.substituteTypeParameters(getTypeParameters(), originalSubstitutor, substitutedDescriptor, substitutedTypeParameters);
|
TypeSubstitutor substitutor = DescriptorSubstitutor.substituteTypeParameters(getTypeParameters(), originalSubstitutor, substitutedDescriptor, substitutedTypeParameters);
|
||||||
|
|
||||||
JetType originalInType = getInType();
|
|
||||||
JetType inType = originalInType == null ? null : substitutor.substitute(originalInType, Variance.IN_VARIANCE);
|
|
||||||
JetType originalOutType = getOutType();
|
JetType originalOutType = getOutType();
|
||||||
JetType outType = substitutor.substitute(originalOutType, Variance.OUT_VARIANCE);
|
JetType outType = substitutor.substitute(originalOutType, Variance.OUT_VARIANCE);
|
||||||
if (inType == null && outType == null) {
|
if (outType == null) {
|
||||||
return null; // TODO : tell the user that the property was projected out
|
return null; // TODO : tell the user that the property was projected out
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +180,7 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
|
|||||||
substitutedReceiverType = null;
|
substitutedReceiverType = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
substitutedDescriptor.setType(inType, outType, substitutedTypeParameters, substitutedExpectedThisObject, substitutedReceiverType);
|
substitutedDescriptor.setType(outType, substitutedTypeParameters, substitutedExpectedThisObject, substitutedReceiverType);
|
||||||
|
|
||||||
return substitutedDescriptor;
|
return substitutedDescriptor;
|
||||||
}
|
}
|
||||||
@@ -231,7 +215,7 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
|
|||||||
DescriptorUtils.convertModality(modality, makeNonAbstract), visibility, isVar,
|
DescriptorUtils.convertModality(modality, makeNonAbstract), visibility, isVar,
|
||||||
getName());
|
getName());
|
||||||
|
|
||||||
propertyDescriptor.setType(getInType(), getOutType(), DescriptorUtils.copyTypeParameters(propertyDescriptor, getTypeParameters()), expectedThisObject, receiver.exists() ? receiver.getType() : null);
|
propertyDescriptor.setType(getOutType(), DescriptorUtils.copyTypeParameters(propertyDescriptor, getTypeParameters()), expectedThisObject, receiver.exists() ? receiver.getType() : null);
|
||||||
|
|
||||||
PropertyGetterDescriptor newGetter = getter == null ? null : new PropertyGetterDescriptor(
|
PropertyGetterDescriptor newGetter = getter == null ? null : new PropertyGetterDescriptor(
|
||||||
propertyDescriptor, Lists.newArrayList(getter.getAnnotations()),
|
propertyDescriptor, Lists.newArrayList(getter.getAnnotations()),
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class PropertySetterDescriptor extends PropertyAccessorDescriptor {
|
|||||||
|
|
||||||
public void initializeDefault() {
|
public void initializeDefault() {
|
||||||
assert parameter == null;
|
assert parameter == null;
|
||||||
parameter = new ValueParameterDescriptorImpl(this, 0, Collections.<AnnotationDescriptor>emptyList(), "<>", null, getCorrespondingProperty().getReturnType(), false, null);
|
parameter = new ValueParameterDescriptorImpl(this, 0, Collections.<AnnotationDescriptor>emptyList(), "<>", false, getCorrespondingProperty().getReturnType(), false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+7
-12
@@ -24,42 +24,37 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
|||||||
int index,
|
int index,
|
||||||
@NotNull List<AnnotationDescriptor> annotations,
|
@NotNull List<AnnotationDescriptor> annotations,
|
||||||
@NotNull String name,
|
@NotNull String name,
|
||||||
@Nullable JetType inType,
|
boolean isVar,
|
||||||
@NotNull JetType outType,
|
@NotNull JetType outType,
|
||||||
boolean hasDefaultValue,
|
boolean hasDefaultValue,
|
||||||
@Nullable JetType varargElementType) {
|
@Nullable JetType varargElementType) {
|
||||||
super(containingDeclaration, annotations, name, inType, outType);
|
super(containingDeclaration, annotations, name, outType);
|
||||||
this.original = this;
|
this.original = this;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.hasDefaultValue = hasDefaultValue;
|
this.hasDefaultValue = hasDefaultValue;
|
||||||
this.varargElementType = varargElementType;
|
this.varargElementType = varargElementType;
|
||||||
this.isVar = inType != null;
|
this.isVar = isVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueParameterDescriptorImpl(
|
public ValueParameterDescriptorImpl(
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull ValueParameterDescriptor original,
|
@NotNull ValueParameterDescriptor original,
|
||||||
@NotNull List<AnnotationDescriptor> annotations,
|
@NotNull List<AnnotationDescriptor> annotations,
|
||||||
@Nullable JetType inType,
|
boolean isVar,
|
||||||
@NotNull JetType outType,
|
@NotNull JetType outType,
|
||||||
@Nullable JetType varargElementType
|
@Nullable JetType varargElementType
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, annotations, original.getName(), inType, outType);
|
super(containingDeclaration, annotations, original.getName(), outType);
|
||||||
this.original = original;
|
this.original = original;
|
||||||
this.index = original.getIndex();
|
this.index = original.getIndex();
|
||||||
this.hasDefaultValue = original.hasDefaultValue();
|
this.hasDefaultValue = original.hasDefaultValue();
|
||||||
this.varargElementType = varargElementType;
|
this.varargElementType = varargElementType;
|
||||||
this.isVar = inType != null;
|
this.isVar = isVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setType(@NotNull JetType type) {
|
public void setType(@NotNull JetType type) {
|
||||||
assert getOutType() == null;
|
|
||||||
setOutType(type);
|
setOutType(type);
|
||||||
if (isVar) {
|
|
||||||
assert getInType() == null;
|
|
||||||
setInType(type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -107,6 +102,6 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public ValueParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner) {
|
public ValueParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner) {
|
||||||
return new ValueParameterDescriptorImpl(newOwner, index, Lists.newArrayList(getAnnotations()), getName(), getInType(), getOutType(), hasDefaultValue, varargElementType);
|
return new ValueParameterDescriptorImpl(newOwner, index, Lists.newArrayList(getAnnotations()), getName(), isVar, getOutType(), hasDefaultValue, varargElementType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,18 +9,9 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
|||||||
* @author abreslav
|
* @author abreslav
|
||||||
*/
|
*/
|
||||||
public interface VariableDescriptor extends CallableDescriptor {
|
public interface VariableDescriptor extends CallableDescriptor {
|
||||||
/**
|
@NotNull
|
||||||
* @return <code>null</code> for write-only variables (i.e. properties), variable value type otherwise
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
JetType getOutType();
|
JetType getOutType();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return <code>null</code> for read-only variables (i.e. val's etc), or the type expected on assignment type otherwise
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
JetType getInType();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"NullableProblems"})
|
@SuppressWarnings({"NullableProblems"})
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
-5
@@ -34,11 +34,6 @@ public class VariableDescriptorBoundToReceiver implements VariableDescriptor {
|
|||||||
return variableDescriptor.getOutType();
|
return variableDescriptor.getOutType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public JetType getInType() {
|
|
||||||
return variableDescriptor.getInType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public DeclarationDescriptor getContainingDeclaration() {
|
public DeclarationDescriptor getContainingDeclaration() {
|
||||||
|
|||||||
+2
-14
@@ -14,19 +14,15 @@ import java.util.Set;
|
|||||||
* @author abreslav
|
* @author abreslav
|
||||||
*/
|
*/
|
||||||
public abstract class VariableDescriptorImpl extends DeclarationDescriptorImpl implements VariableDescriptor {
|
public abstract class VariableDescriptorImpl extends DeclarationDescriptorImpl implements VariableDescriptor {
|
||||||
private JetType inType;
|
|
||||||
private JetType outType;
|
private JetType outType;
|
||||||
|
|
||||||
public VariableDescriptorImpl(
|
public VariableDescriptorImpl(
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull List<AnnotationDescriptor> annotations,
|
@NotNull List<AnnotationDescriptor> annotations,
|
||||||
@NotNull String name,
|
@NotNull String name,
|
||||||
@Nullable JetType inType,
|
@NotNull JetType outType) {
|
||||||
@Nullable JetType outType) {
|
|
||||||
super(containingDeclaration, annotations, name);
|
super(containingDeclaration, annotations, name);
|
||||||
assert (inType != null) || (outType != null);
|
|
||||||
|
|
||||||
this.inType = inType;
|
|
||||||
this.outType = outType;
|
this.outType = outType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,16 +40,8 @@ public abstract class VariableDescriptorImpl extends DeclarationDescriptorImpl i
|
|||||||
return outType;
|
return outType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public JetType getInType() {
|
|
||||||
return inType;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setInType(JetType inType) {
|
|
||||||
this.inType = inType;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setOutType(JetType outType) {
|
protected void setOutType(JetType outType) {
|
||||||
|
assert this.outType == null;
|
||||||
this.outType = outType;
|
this.outType = outType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ public class DescriptorResolver {
|
|||||||
index,
|
index,
|
||||||
annotationResolver.createAnnotationStubs(valueParameter.getModifierList()),
|
annotationResolver.createAnnotationStubs(valueParameter.getModifierList()),
|
||||||
JetPsiUtil.safeName(valueParameter.getName()),
|
JetPsiUtil.safeName(valueParameter.getName()),
|
||||||
valueParameter.isMutable() ? variableType : null,
|
valueParameter.isMutable(),
|
||||||
variableType,
|
variableType,
|
||||||
valueParameter.getDefaultValue() != null,
|
valueParameter.getDefaultValue() != null,
|
||||||
varargElementType
|
varargElementType
|
||||||
@@ -479,7 +479,7 @@ public class DescriptorResolver {
|
|||||||
JetPsiUtil.safeName(objectDeclaration.getName())
|
JetPsiUtil.safeName(objectDeclaration.getName())
|
||||||
);
|
);
|
||||||
|
|
||||||
propertyDescriptor.setType(null, classDescriptor.getDefaultType(), Collections.<TypeParameterDescriptor>emptyList(), DescriptorUtils.getExpectedThisObjectIfNeeded(containingDeclaration), ReceiverDescriptor.NO_RECEIVER);
|
propertyDescriptor.setType(classDescriptor.getDefaultType(), Collections.<TypeParameterDescriptor>emptyList(), DescriptorUtils.getExpectedThisObjectIfNeeded(containingDeclaration), ReceiverDescriptor.NO_RECEIVER);
|
||||||
propertyDescriptor.initialize(null, null);
|
propertyDescriptor.initialize(null, null);
|
||||||
|
|
||||||
JetObjectDeclarationName nameAsDeclaration = objectDeclaration.getNameAsDeclaration();
|
JetObjectDeclarationName nameAsDeclaration = objectDeclaration.getNameAsDeclaration();
|
||||||
@@ -553,8 +553,7 @@ public class DescriptorResolver {
|
|||||||
|
|
||||||
JetType type = getVariableType(propertyScope, property, DataFlowInfo.EMPTY, true);
|
JetType type = getVariableType(propertyScope, property, DataFlowInfo.EMPTY, true);
|
||||||
|
|
||||||
JetType inType = isVar ? type : null;
|
propertyDescriptor.setType(type, typeParameterDescriptors, DescriptorUtils.getExpectedThisObjectIfNeeded(containingDeclaration), receiverDescriptor);
|
||||||
propertyDescriptor.setType(inType, type, typeParameterDescriptors, DescriptorUtils.getExpectedThisObjectIfNeeded(containingDeclaration), receiverDescriptor);
|
|
||||||
|
|
||||||
PropertyGetterDescriptor getter = resolvePropertyGetterDescriptor(scopeWithTypeParameters, property, propertyDescriptor);
|
PropertyGetterDescriptor getter = resolvePropertyGetterDescriptor(scopeWithTypeParameters, property, propertyDescriptor);
|
||||||
PropertySetterDescriptor setter = resolvePropertySetterDescriptor(scopeWithTypeParameters, property, propertyDescriptor);
|
PropertySetterDescriptor setter = resolvePropertySetterDescriptor(scopeWithTypeParameters, property, propertyDescriptor);
|
||||||
@@ -686,11 +685,11 @@ public class DescriptorResolver {
|
|||||||
JetType type;
|
JetType type;
|
||||||
JetTypeReference typeReference = parameter.getTypeReference();
|
JetTypeReference typeReference = parameter.getTypeReference();
|
||||||
if (typeReference == null) {
|
if (typeReference == null) {
|
||||||
type = propertyDescriptor.getInType(); // TODO : this maybe unknown at this point
|
type = propertyDescriptor.getOutType(); // TODO : this maybe unknown at this point
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
type = typeResolver.resolveType(scope, typeReference);
|
type = typeResolver.resolveType(scope, typeReference);
|
||||||
JetType inType = propertyDescriptor.getInType();
|
JetType inType = propertyDescriptor.getOutType();
|
||||||
if (inType != null) {
|
if (inType != null) {
|
||||||
if (!TypeUtils.equalTypes(type, inType)) {
|
if (!TypeUtils.equalTypes(type, inType)) {
|
||||||
// trace.getErrorHandler().genericError(typeReference.getNode(), "Setter parameter type must be equal to the type of the property, i.e. " + inType);
|
// trace.getErrorHandler().genericError(typeReference.getNode(), "Setter parameter type must be equal to the type of the property, i.e. " + inType);
|
||||||
@@ -842,8 +841,7 @@ public class DescriptorResolver {
|
|||||||
isMutable,
|
isMutable,
|
||||||
name == null ? "<no name>" : name
|
name == null ? "<no name>" : name
|
||||||
);
|
);
|
||||||
JetType inType = isMutable ? type : null;
|
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(), DescriptorUtils.getExpectedThisObjectIfNeeded(classDescriptor), ReceiverDescriptor.NO_RECEIVER);
|
||||||
propertyDescriptor.setType(inType, type, Collections.<TypeParameterDescriptor>emptyList(), DescriptorUtils.getExpectedThisObjectIfNeeded(classDescriptor), ReceiverDescriptor.NO_RECEIVER);
|
|
||||||
|
|
||||||
PropertyGetterDescriptor getter = createDefaultGetter(propertyDescriptor);
|
PropertyGetterDescriptor getter = createDefaultGetter(propertyDescriptor);
|
||||||
PropertySetterDescriptor setter = createDefaultSetter(propertyDescriptor);
|
PropertySetterDescriptor setter = createDefaultSetter(propertyDescriptor);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class ErrorUtils {
|
|||||||
null,
|
null,
|
||||||
ReceiverDescriptor.NO_RECEIVER,
|
ReceiverDescriptor.NO_RECEIVER,
|
||||||
"<ERROR PROPERTY>",
|
"<ERROR PROPERTY>",
|
||||||
ERROR_PROPERTY_TYPE, ERROR_PROPERTY_TYPE);
|
ERROR_PROPERTY_TYPE);
|
||||||
private static final Set<VariableDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY);
|
private static final Set<VariableDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY);
|
||||||
|
|
||||||
private static FunctionDescriptor createErrorFunction(List<TypeParameterDescriptor> typeParameters, List<JetType> positionedValueArgumentTypes) {
|
private static FunctionDescriptor createErrorFunction(List<TypeParameterDescriptor> typeParameters, List<JetType> positionedValueArgumentTypes) {
|
||||||
@@ -165,7 +165,7 @@ public class ErrorUtils {
|
|||||||
i,
|
i,
|
||||||
Collections.<AnnotationDescriptor>emptyList(),
|
Collections.<AnnotationDescriptor>emptyList(),
|
||||||
"<ERROR VALUE_PARAMETER>",
|
"<ERROR VALUE_PARAMETER>",
|
||||||
ERROR_PARAMETER_TYPE,
|
true,
|
||||||
ERROR_PARAMETER_TYPE,
|
ERROR_PARAMETER_TYPE,
|
||||||
false,
|
false,
|
||||||
null));
|
null));
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ public class JetStandardClasses {
|
|||||||
List<ValueParameterDescriptor> valueParameters = Lists.newArrayList();
|
List<ValueParameterDescriptor> valueParameters = Lists.newArrayList();
|
||||||
for (int i = first; i <= last; i++) {
|
for (int i = first; i <= last; i++) {
|
||||||
JetType parameterType = arguments.get(i).getType();
|
JetType parameterType = arguments.get(i).getType();
|
||||||
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(functionDescriptor, i, Collections.<AnnotationDescriptor>emptyList(), "p" + i, null, parameterType, false, null);
|
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(functionDescriptor, i, Collections.<AnnotationDescriptor>emptyList(), "p" + i, false, parameterType, false, null);
|
||||||
valueParameters.add(valueParameterDescriptor);
|
valueParameters.add(valueParameterDescriptor);
|
||||||
}
|
}
|
||||||
return valueParameters;
|
return valueParameters;
|
||||||
|
|||||||
+1
-1
@@ -145,7 +145,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
if (functionTypeExpected && !hasDeclaredValueParameters && expectedValueParameters.size() == 1) {
|
if (functionTypeExpected && !hasDeclaredValueParameters && expectedValueParameters.size() == 1) {
|
||||||
ValueParameterDescriptor valueParameterDescriptor = expectedValueParameters.get(0);
|
ValueParameterDescriptor valueParameterDescriptor = expectedValueParameters.get(0);
|
||||||
ValueParameterDescriptor it = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptor it = new ValueParameterDescriptorImpl(
|
||||||
functionDescriptor, 0, Collections.<AnnotationDescriptor>emptyList(), "it", valueParameterDescriptor.getInType(), valueParameterDescriptor.getOutType(), valueParameterDescriptor.hasDefaultValue(), valueParameterDescriptor.getVarargElementType()
|
functionDescriptor, 0, Collections.<AnnotationDescriptor>emptyList(), "it", false, valueParameterDescriptor.getOutType(), valueParameterDescriptor.hasDefaultValue(), valueParameterDescriptor.getVarargElementType()
|
||||||
);
|
);
|
||||||
valueParameterDescriptors.add(it);
|
valueParameterDescriptors.add(it);
|
||||||
context.trace.record(AUTO_CREATED_IT, it);
|
context.trace.record(AUTO_CREATED_IT, it);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.jetbrains.jet.lang.diagnostics.Renderer;
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||||
import org.jetbrains.jet.lang.types.JetStandardClasses;
|
import org.jetbrains.jet.lang.types.JetStandardClasses;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
|
import org.jetbrains.jet.lexer.JetTokens;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -135,7 +136,7 @@ public class DescriptorRenderer implements Renderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void visitVariableDescriptor(VariableDescriptor descriptor, StringBuilder builder) {
|
public Void visitVariableDescriptor(VariableDescriptor descriptor, StringBuilder builder) {
|
||||||
String typeString = renderPropertyPrefixAndComputeTypeString(builder, Collections.<TypeParameterDescriptor>emptyList(), ReceiverDescriptor.NO_RECEIVER, descriptor.getOutType(), descriptor.getInType());
|
String typeString = renderPropertyPrefixAndComputeTypeString(builder, Collections.<TypeParameterDescriptor>emptyList(), ReceiverDescriptor.NO_RECEIVER, descriptor.getOutType());
|
||||||
renderName(descriptor, builder);
|
renderName(descriptor, builder);
|
||||||
builder.append(" : ").append(escape(typeString));
|
builder.append(" : ").append(escape(typeString));
|
||||||
return super.visitVariableDescriptor(descriptor, builder);
|
return super.visitVariableDescriptor(descriptor, builder);
|
||||||
@@ -145,26 +146,16 @@ public class DescriptorRenderer implements Renderer {
|
|||||||
@NotNull StringBuilder builder,
|
@NotNull StringBuilder builder,
|
||||||
@NotNull List<TypeParameterDescriptor> typeParameters,
|
@NotNull List<TypeParameterDescriptor> typeParameters,
|
||||||
@NotNull ReceiverDescriptor receiver,
|
@NotNull ReceiverDescriptor receiver,
|
||||||
@Nullable JetType outType,
|
@Nullable JetType outType) {
|
||||||
@Nullable JetType inType) {
|
|
||||||
String typeString = lt() + "no type>";
|
String typeString = lt() + "no type>";
|
||||||
if (inType != null && outType != null) {
|
if (outType != null) {
|
||||||
builder.append(renderKeyword("var")).append(" ");
|
builder.append(renderKeyword("var")).append(" ");
|
||||||
if (inType.equals(outType)) {
|
typeString = renderType(outType);
|
||||||
typeString = renderType(outType);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
typeString = "<" + renderKeyword("in") + ": " + renderType(inType) + " " + renderKeyword("out") + ": " + renderType(outType) + ">";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (outType != null) {
|
else if (outType != null) {
|
||||||
builder.append(renderKeyword("val")).append(" ");
|
builder.append(renderKeyword("val")).append(" ");
|
||||||
typeString = renderType(outType);
|
typeString = renderType(outType);
|
||||||
}
|
}
|
||||||
else if (inType != null) {
|
|
||||||
builder.append(lt()).append("write-only> ");
|
|
||||||
typeString = renderType(inType);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderTypeParameters(typeParameters, builder);
|
renderTypeParameters(typeParameters, builder);
|
||||||
|
|
||||||
@@ -181,8 +172,7 @@ public class DescriptorRenderer implements Renderer {
|
|||||||
String typeString = renderPropertyPrefixAndComputeTypeString(
|
String typeString = renderPropertyPrefixAndComputeTypeString(
|
||||||
builder, descriptor.getTypeParameters(),
|
builder, descriptor.getTypeParameters(),
|
||||||
descriptor.getReceiverParameter(),
|
descriptor.getReceiverParameter(),
|
||||||
descriptor.getOutType(),
|
descriptor.getOutType());
|
||||||
descriptor.getInType());
|
|
||||||
renderName(descriptor, builder);
|
renderName(descriptor, builder);
|
||||||
builder.append(" : ").append(escape(typeString));
|
builder.append(" : ").append(escape(typeString));
|
||||||
return null;
|
return null;
|
||||||
@@ -268,7 +258,7 @@ public class DescriptorRenderer implements Renderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void visitNamespaceDescriptor(NamespaceDescriptor namespaceDescriptor, StringBuilder builder) {
|
public Void visitNamespaceDescriptor(NamespaceDescriptor namespaceDescriptor, StringBuilder builder) {
|
||||||
builder.append(renderKeyword("namespace")).append(" ");
|
builder.append(renderKeyword(JetTokens.NAMESPACE_KEYWORD.getValue())).append(" ");
|
||||||
renderName(namespaceDescriptor, builder);
|
renderName(namespaceDescriptor, builder);
|
||||||
return super.visitNamespaceDescriptor(namespaceDescriptor, builder);
|
return super.visitNamespaceDescriptor(namespaceDescriptor, builder);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ var x : Int = 1 + x
|
|||||||
|
|
||||||
val xx : Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1 + x<!>
|
val xx : Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1 + x<!>
|
||||||
get() : Int = 1
|
get() : Int = 1
|
||||||
<!VAL_WITH_SETTER!>set(value : Long) {}<!>
|
<!VAL_WITH_SETTER!>set(value : <!WRONG_SETTER_PARAMETER_TYPE!>Long<!>) {}<!>
|
||||||
|
|
||||||
val p : Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1<!>
|
val p : Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1<!>
|
||||||
get() = 1
|
get() = 1
|
||||||
@@ -26,4 +26,4 @@ class Test() {
|
|||||||
a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
|
a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
|
||||||
}
|
}
|
||||||
public val <!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>i<!> = 1
|
public val <!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>i<!> = 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.intellij.util.SmartList;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.codegen.JetTypeMapper;
|
import org.jetbrains.jet.codegen.JetTypeMapper;
|
||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||||
import org.jetbrains.jet.plugin.JetFileType;
|
import org.jetbrains.jet.plugin.JetFileType;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -72,7 +73,7 @@ public class JavaElementFinder extends PsiElementFinder {
|
|||||||
for (JetFile file : filesInScope) {
|
for (JetFile file : filesInScope) {
|
||||||
final String packageName = JetPsiUtil.getFQName(file);
|
final String packageName = JetPsiUtil.getFQName(file);
|
||||||
if (packageName != null && qualifiedName.startsWith(packageName)) {
|
if (packageName != null && qualifiedName.startsWith(packageName)) {
|
||||||
if (qualifiedName.equals(fqn(packageName, "namespace"))) {
|
if (qualifiedName.equals(fqn(packageName, JvmAbi.PACKAGE_CLASS))) {
|
||||||
answer.add(new JetLightClass(psiManager, file, qualifiedName));
|
answer.add(new JetLightClass(psiManager, file, qualifiedName));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -122,7 +123,7 @@ public class JavaElementFinder extends PsiElementFinder {
|
|||||||
String packageFQN = psiPackage.getQualifiedName();
|
String packageFQN = psiPackage.getQualifiedName();
|
||||||
for (JetFile psiFile : collectProjectJetFiles(project, GlobalSearchScope.allScope(project))) {
|
for (JetFile psiFile : collectProjectJetFiles(project, GlobalSearchScope.allScope(project))) {
|
||||||
if (packageFQN.equals(JetPsiUtil.getFQName(psiFile))) {
|
if (packageFQN.equals(JetPsiUtil.getFQName(psiFile))) {
|
||||||
answer.add("namespace");
|
answer.add(JvmAbi.PACKAGE_CLASS);
|
||||||
for (JetDeclaration declaration : psiFile.getDeclarations()) {
|
for (JetDeclaration declaration : psiFile.getDeclarations()) {
|
||||||
if (declaration instanceof JetClassOrObject) {
|
if (declaration instanceof JetClassOrObject) {
|
||||||
answer.add(getLocalName(declaration));
|
answer.add(getLocalName(declaration));
|
||||||
@@ -160,7 +161,7 @@ public class JavaElementFinder extends PsiElementFinder {
|
|||||||
String packageFQN = psiPackage.getQualifiedName();
|
String packageFQN = psiPackage.getQualifiedName();
|
||||||
for (JetFile file : filesInScope) {
|
for (JetFile file : filesInScope) {
|
||||||
if (packageFQN.equals(JetPsiUtil.getFQName(file))) {
|
if (packageFQN.equals(JetPsiUtil.getFQName(file))) {
|
||||||
answer.add(new JetLightClass(psiManager, file, fqn(packageFQN, "namespace")));
|
answer.add(new JetLightClass(psiManager, file, fqn(packageFQN, JvmAbi.PACKAGE_CLASS)));
|
||||||
for (JetDeclaration declaration : file.getDeclarations()) {
|
for (JetDeclaration declaration : file.getDeclarations()) {
|
||||||
if (declaration instanceof JetClassOrObject) {
|
if (declaration instanceof JetClassOrObject) {
|
||||||
answer.add(new JetLightClass(psiManager, file, fqn(packageFQN, getLocalName(declaration))));
|
answer.add(new JetLightClass(psiManager, file, fqn(packageFQN, getLocalName(declaration))));
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.intellij.psi.stubs.StubElement;
|
|||||||
import com.intellij.util.containers.Stack;
|
import com.intellij.util.containers.Stack;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.codegen.ClassBuilder;
|
import org.jetbrains.jet.codegen.ClassBuilder;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassVisitor;
|
import org.objectweb.asm.ClassVisitor;
|
||||||
import org.objectweb.asm.FieldVisitor;
|
import org.objectweb.asm.FieldVisitor;
|
||||||
@@ -52,7 +53,7 @@ public class StubClassBuilder extends ClassBuilder {
|
|||||||
v = new StubBuildingVisitor<Object>(null, EMPTY_STRATEGY, parent, access);
|
v = new StubBuildingVisitor<Object>(null, EMPTY_STRATEGY, parent, access);
|
||||||
|
|
||||||
super.defineClass(origin, version, access, name, signature, superName, interfaces);
|
super.defineClass(origin, version, access, name, signature, superName, interfaces);
|
||||||
if (name.equals("namespace") || name.endsWith("/namespace")) {
|
if (name.equals(JvmAbi.PACKAGE_CLASS) || name.endsWith("/" + JvmAbi.PACKAGE_CLASS)) {
|
||||||
isNamespace = true;
|
isNamespace = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||||
import org.jetbrains.jet.plugin.JetMainDetector;
|
import org.jetbrains.jet.plugin.JetMainDetector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,7 +45,7 @@ public class JetRunConfigurationProducer extends RuntimeConfigurationProducer im
|
|||||||
if (JetMainDetector.hasMain(jetFile.getDeclarations())) {
|
if (JetMainDetector.hasMain(jetFile.getDeclarations())) {
|
||||||
mySourceElement = jetFile;
|
mySourceElement = jetFile;
|
||||||
String fqName = JetPsiUtil.getFQName(jetFile);
|
String fqName = JetPsiUtil.getFQName(jetFile);
|
||||||
String className = fqName.length() == 0 ? "namespace" : fqName + ".namespace";
|
String className = fqName.length() == 0 ? JvmAbi.PACKAGE_CLASS : fqName + "." + JvmAbi.PACKAGE_CLASS;
|
||||||
return createConfigurationByQName(module, configurationContext, className);
|
return createConfigurationByQName(module, configurationContext, className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +60,7 @@ public class JetRunConfigurationProducer extends RuntimeConfigurationProducer im
|
|||||||
RunnerAndConfigurationSettings settings = cloneTemplateConfiguration(module.getProject(), context);
|
RunnerAndConfigurationSettings settings = cloneTemplateConfiguration(module.getProject(), context);
|
||||||
JetRunConfiguration configuration = (JetRunConfiguration) settings.getConfiguration();
|
JetRunConfiguration configuration = (JetRunConfiguration) settings.getConfiguration();
|
||||||
configuration.setModule(module);
|
configuration.setModule(module);
|
||||||
configuration.setName(StringUtil.trimEnd(fqName, ".namespace"));
|
configuration.setName(StringUtil.trimEnd(fqName, "." + JvmAbi.PACKAGE_CLASS));
|
||||||
configuration.MAIN_CLASS_NAME = fqName;
|
configuration.MAIN_CLASS_NAME = fqName;
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
val xx : Int = <error>1 + x</error>
|
val xx : Int = <error>1 + x</error>
|
||||||
get() : Int = 1
|
get() : Int = 1
|
||||||
<error>set(value : Long) {}</error>
|
<error>set(value : <error>Long</error>) {}</error>
|
||||||
|
|
||||||
val p : Int = <error>1</error>
|
val p : Int = <error>1</error>
|
||||||
get() = 1
|
get() = 1
|
||||||
@@ -25,4 +25,4 @@ class Test() {
|
|||||||
<error>$b</error> = $a
|
<error>$b</error> = $a
|
||||||
a = <error>$b</error>
|
a = <error>$b</error>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user