diff --git a/.idea/modules.xml b/.idea/modules.xml index 9c559c5bba1..299b0102691 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -11,6 +11,7 @@ + diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/CallableMethod.java b/compiler/backend/src/org/jetbrains/jet/codegen/CallableMethod.java index ffffaffb1ec..f93b818b852 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/CallableMethod.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/CallableMethod.java @@ -3,13 +3,11 @@ package org.jetbrains.jet.codegen; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.CallableDescriptor; import org.jetbrains.jet.lang.descriptors.ClassDescriptor; -import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; -import org.jetbrains.jet.lang.descriptors.FunctionDescriptor; +import org.jetbrains.jet.lang.resolve.java.JvmAbi; import org.jetbrains.jet.lang.types.JetType; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; import org.objectweb.asm.commons.InstructionAdapter; -import org.objectweb.asm.commons.Method; import java.util.List; @@ -87,7 +85,8 @@ public class CallableMethod implements Callable { else { if(getInvokeOpcode() != Opcodes.INVOKESTATIC) desc = desc.replace("(", "(L" + getOwner() + ";"); - v.visitMethodInsn(Opcodes.INVOKESTATIC, getInvokeOpcode() == Opcodes.INVOKEINTERFACE ? getOwner() + "$$TImpl" : getOwner(), getSignature().getAsmMethod().getName() + "$default", desc); + v.visitMethodInsn(Opcodes.INVOKESTATIC, getInvokeOpcode() == Opcodes.INVOKEINTERFACE ? getOwner() + JvmAbi.TRAIT_IMPL_SUFFIX + : getOwner(), getSignature().getAsmMethod().getName() + JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX, desc); } } diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java index c8c9f3dee79..a1b241edd99 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java @@ -6,7 +6,8 @@ import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.DescriptorUtils; -import org.jetbrains.jet.lang.resolve.java.StdlibNames; +import org.jetbrains.jet.lang.resolve.java.JvmAbi; +import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Label; @@ -68,6 +69,10 @@ public class FunctionCodegen { { flags |= ACC_VARARGS; } + + if (functionDescriptor.getModality() == Modality.FINAL) { + flags |= ACC_FINAL; + } OwnerKind kind = context.getContextKind(); @@ -88,48 +93,48 @@ public class FunctionCodegen { if(kind != OwnerKind.TRAIT_IMPL) { AnnotationVisitor av = mv.visitAnnotation(JetTypeMapper.JET_METHOD_TYPE.getDescriptor(), true); if(functionDescriptor.getReturnType().isNullable()) { - av.visit(StdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD, true); + av.visit(JvmStdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD, true); } if (jvmSignature.getKotlinReturnType() != null) { - av.visit(StdlibNames.JET_METHOD_RETURN_TYPE_FIELD, jvmSignature.getKotlinReturnType()); + av.visit(JvmStdlibNames.JET_METHOD_RETURN_TYPE_FIELD, jvmSignature.getKotlinReturnType()); } if (jvmSignature.getKotlinTypeParameter() != null) { - av.visit(StdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD, jvmSignature.getKotlinTypeParameter()); + av.visit(JvmStdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD, jvmSignature.getKotlinTypeParameter()); } av.visitEnd(); } if(kind == OwnerKind.TRAIT_IMPL) { - AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); - av.visit(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$self"); + AnnotationVisitor av = mv.visitParameterAnnotation(start++, JvmStdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$self"); av.visitEnd(); } if(receiverParameter.exists()) { - AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); - av.visit(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$receiver"); + AnnotationVisitor av = mv.visitParameterAnnotation(start++, JvmStdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$receiver"); if(receiverParameter.getType().isNullable()) { - av.visit(StdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD, true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD, true); } - av.visit(StdlibNames.JET_VALUE_PARAMETER_RECEIVER_FIELD, true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_RECEIVER_FIELD, true); av.visitEnd(); } for (final TypeParameterDescriptor typeParameterDescriptor : typeParameters) { - AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_TYPE_PARAMETER.getDescriptor(), true); - av.visit(StdlibNames.JET_TYPE_PARAMETER_NAME_FIELD, typeParameterDescriptor.getName()); + AnnotationVisitor av = mv.visitParameterAnnotation(start++, JvmStdlibNames.JET_TYPE_PARAMETER.getDescriptor(), true); + av.visit(JvmStdlibNames.JET_TYPE_PARAMETER_NAME_FIELD, typeParameterDescriptor.getName()); av.visitEnd(); } for(int i = 0; i != paramDescrs.size(); ++i) { - AnnotationVisitor av = mv.visitParameterAnnotation(i + start, StdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); + AnnotationVisitor av = mv.visitParameterAnnotation(i + start, JvmStdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); ValueParameterDescriptor parameterDescriptor = paramDescrs.get(i); - av.visit(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, parameterDescriptor.getName()); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, parameterDescriptor.getName()); if(parameterDescriptor.hasDefaultValue()) { - av.visit(StdlibNames.JET_VALUE_PARAMETER_HAS_DEFAULT_VALUE_FIELD, true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_HAS_DEFAULT_VALUE_FIELD, true); } if(parameterDescriptor.getOutType().isNullable()) { - av.visit(StdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD, true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD, true); } if (jvmSignature.getKotlinParameterTypes() != null && jvmSignature.getKotlinParameterTypes().get(i) != null) { - av.visit(StdlibNames.JET_VALUE_PARAMETER_TYPE_FIELD, jvmSignature.getKotlinParameterTypes().get(i)); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_TYPE_FIELD, jvmSignature.getKotlinParameterTypes().get(i)); } av.visitEnd(); } @@ -300,7 +305,7 @@ public class FunctionCodegen { boolean isConstructor = "".equals(jvmSignature.getName()); if(!isStatic && !isConstructor) descriptor = descriptor.replace("(","(L" + ownerInternalName + ";"); - final MethodVisitor mv = v.newMethod(null, flags | (isConstructor ? 0 : ACC_STATIC), isConstructor ? "" : jvmSignature.getName() + "$default", descriptor, null, null); + final MethodVisitor mv = v.newMethod(null, flags | (isConstructor ? 0 : ACC_STATIC), isConstructor ? "" : jvmSignature.getName() + JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX, descriptor, null, null); InstructionAdapter iv = new InstructionAdapter(mv); if (v.generateCode()) { mv.visitCode(); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java index 852b12ac22e..494742a8192 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java @@ -6,7 +6,7 @@ import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.OverridingUtil; -import org.jetbrains.jet.lang.resolve.java.StdlibNames; +import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames; import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant; import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.TypeProjection; @@ -47,19 +47,33 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { boolean isAbstract = false; boolean isInterface = false; + boolean isFinal = false; if(myClass instanceof JetClass) { - if(((JetClass) myClass).hasModifier(JetTokens.ABSTRACT_KEYWORD)) + JetClass jetClass = (JetClass) myClass; + if (jetClass.hasModifier(JetTokens.ABSTRACT_KEYWORD)) isAbstract = true; - if(((JetClass) myClass).isTrait()) { + if (jetClass.isTrait()) { isAbstract = true; isInterface = true; } + if (!jetClass.hasModifier(JetTokens.OPEN_KEYWORD)) { + isFinal = true; + } } + int access = 0; + access |= Opcodes.ACC_PUBLIC; + if (isAbstract) { + access |= Opcodes.ACC_ABSTRACT; + } + if (isInterface) { + access |= Opcodes.ACC_INTERFACE; // ACC_SUPER + } + if (isFinal) { + access |= Opcodes.ACC_FINAL; + } v.defineClass(myClass, Opcodes.V1_6, - Opcodes.ACC_PUBLIC | (isAbstract ? Opcodes.ACC_ABSTRACT : 0) | (isInterface - ? Opcodes.ACC_INTERFACE - : 0/*Opcodes.ACC_SUPER*/), + access, signature.getName(), signature.getJavaGenericSignature(), signature.getSuperclassName(), @@ -72,8 +86,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { } if(myClass instanceof JetClass && signature.getKotlinGenericSignature() != null) { - AnnotationVisitor annotationVisitor = v.newAnnotation(myClass, StdlibNames.JET_CLASS.getDescriptor(), true); - annotationVisitor.visit(StdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature()); + AnnotationVisitor annotationVisitor = v.newAnnotation(myClass, JvmStdlibNames.JET_CLASS.getDescriptor(), true); + annotationVisitor.visit(JvmStdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature()); annotationVisitor.visitEnd(); } } @@ -106,7 +120,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { { // superinterfaces - superInterfacesLinkedHashSet.add(StdlibNames.JET_OBJECT.getInternalName()); + superInterfacesLinkedHashSet.add(JvmStdlibNames.JET_OBJECT.getInternalName()); for (JetDelegationSpecifier specifier : myClass.getDelegationSpecifiers()) { JetType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference()); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/JetTypeMapper.java b/compiler/backend/src/org/jetbrains/jet/codegen/JetTypeMapper.java index 7bcb0463f3c..12dbbe2a4cd 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/JetTypeMapper.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/JetTypeMapper.java @@ -13,6 +13,7 @@ import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver; import org.jetbrains.jet.lang.resolve.java.JavaNamespaceDescriptor; +import org.jetbrains.jet.lang.resolve.java.JvmAbi; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor; import org.jetbrains.jet.lang.types.*; import org.jetbrains.jet.lexer.JetTokens; @@ -335,7 +336,7 @@ public class JetTypeMapper { if (descriptor instanceof ClassDescriptor) { String name = getFQName(descriptor); - Type asmType = Type.getObjectType(name + (kind == OwnerKind.TRAIT_IMPL ? "$$TImpl" : "")); + Type asmType = Type.getObjectType(name + (kind == OwnerKind.TRAIT_IMPL ? JvmAbi.TRAIT_IMPL_SUFFIX : "")); if (signatureVisitor != null) { signatureVisitor.writeClassBegin(asmType.getInternalName(), jetType.isNullable()); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java index f9167601b55..e797dadb554 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java @@ -6,6 +6,7 @@ import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethod; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.psi.JetExpression; import org.jetbrains.jet.lang.resolve.calls.ResolvedCall; +import org.jetbrains.jet.lang.resolve.java.JvmAbi; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor; import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lexer.JetTokens; @@ -754,7 +755,7 @@ public abstract class StackValue { @Override public void put(Type type, InstructionAdapter v) { if(isSuper && isInterface) { - v.visitMethodInsn(Opcodes.INVOKESTATIC, owner + "$$TImpl", getter.getName(), getter.getDescriptor().replace("(","(L" + owner + ";")); + v.visitMethodInsn(Opcodes.INVOKESTATIC, owner + JvmAbi.TRAIT_IMPL_SUFFIX, getter.getName(), getter.getDescriptor().replace("(","(L" + owner + ";")); } else { if (getter == null) { @@ -770,7 +771,7 @@ public abstract class StackValue { @Override public void store(InstructionAdapter v) { if(isSuper && isInterface) { - v.visitMethodInsn(Opcodes.INVOKESTATIC, owner + "$$TImpl", setter.getName(), setter.getDescriptor().replace("(","(L" + owner + ";")); + v.visitMethodInsn(Opcodes.INVOKESTATIC, owner + JvmAbi.TRAIT_IMPL_SUFFIX, setter.getName(), setter.getDescriptor().replace("(","(L" + owner + ";")); } else { if (setter == null) { diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaClassMembersScope.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaClassMembersScope.java index c46e086ab25..d32a0457bac 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaClassMembersScope.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaClassMembersScope.java @@ -106,7 +106,10 @@ public class JavaClassMembersScope implements JetScope { for (PsiClass innerClass : psiClass.getAllInnerClasses()) { if (name.equals(innerClass.getName())) { if (innerClass.hasModifierProperty(PsiModifier.STATIC) != staticMembers) return null; - return semanticServices.getDescriptorResolver().resolveClass(innerClass); + ClassDescriptor classDescriptor = semanticServices.getDescriptorResolver().resolveClass(innerClass); + if (classDescriptor != null) { + return classDescriptor; + } } } return null; diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java index 6948e7ac5fe..549a4b9e0ed 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java @@ -9,7 +9,6 @@ import com.intellij.psi.*; import com.intellij.psi.search.DelegatingGlobalSearchScope; import com.intellij.psi.search.GlobalSearchScope; import jet.typeinfo.TypeInfoVariance; -import org.eclipse.jdt.internal.core.JavaModelManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.*; @@ -107,9 +106,14 @@ public class JavaDescriptorResolver { this.semanticServices = semanticServices; } - @NotNull + @Nullable public ClassDescriptor resolveClass(@NotNull PsiClass psiClass) { String qualifiedName = psiClass.getQualifiedName(); + + if (qualifiedName.endsWith(JvmAbi.TRAIT_IMPL_SUFFIX)) { + // TODO: only if -$$TImpl class is created by Kotlin + return null; + } // First, let's check that this is a real Java class, not a Java's view on a Kotlin class: ClassDescriptor kotlinClassDescriptor = semanticServices.getKotlinClassDescriptor(qualifiedName); @@ -128,6 +132,12 @@ public class JavaDescriptorResolver { @Nullable public ClassDescriptor resolveClass(@NotNull String qualifiedName) { + + if (qualifiedName.endsWith(JvmAbi.TRAIT_IMPL_SUFFIX)) { + // TODO: only if -$$TImpl class is created by Kotlin + return null; + } + // First, let's check that this is a real Java class, not a Java's view on a Kotlin class: ClassDescriptor kotlinClassDescriptor = semanticServices.getKotlinClassDescriptor(qualifiedName); if (kotlinClassDescriptor != null) { @@ -234,8 +244,8 @@ public class JavaDescriptorResolver { private List resolveClassTypeParameters(PsiClass psiClass, JavaClassDescriptor classDescriptor) { for (PsiAnnotation annotation : psiClass.getModifierList().getAnnotations()) { - if (annotation.getQualifiedName().equals(StdlibNames.JET_CLASS.getFqName())) { - PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_CLASS_SIGNATURE); + if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_CLASS.getFqName())) { + PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_CLASS_SIGNATURE); if (attributeValue != null) { String typeParametersString = (String) attributeValue.getValue(); if (typeParametersString != null) { @@ -608,18 +618,19 @@ public class JavaDescriptorResolver { String typeFromAnnotation = null; boolean receiver = false; + boolean hasDefaultValue = false; // TODO: must be very slow, make it lazy? String name = parameter.getName() != null ? parameter.getName() : "p" + i; for (PsiAnnotation annotation : parameter.getModifierList().getAnnotations()) { - if (annotation.getQualifiedName().equals(StdlibNames.JET_VALUE_PARAMETER.getFqName())) { - PsiLiteralExpression nameExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD); + if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_VALUE_PARAMETER.getFqName())) { + PsiLiteralExpression nameExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD); if (nameExpression != null) { name = (String) nameExpression.getValue(); } - PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD); + PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD); if (nullableExpression != null) { nullable = (Boolean) nullableExpression.getValue(); } else { @@ -628,19 +639,24 @@ public class JavaDescriptorResolver { changeNullable = true; } - PsiLiteralExpression signatureExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_TYPE_FIELD); + PsiLiteralExpression signatureExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_TYPE_FIELD); if (signatureExpression != null) { typeFromAnnotation = (String) signatureExpression.getValue(); } - PsiLiteralExpression receiverExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_RECEIVER_FIELD); + PsiLiteralExpression receiverExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_RECEIVER_FIELD); if (receiverExpression != null) { - receiver = true; + receiver = (Boolean) receiverExpression.getValue(); + } + + PsiLiteralExpression hasDefaultValueExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_HAS_DEFAULT_VALUE_FIELD); + if (hasDefaultValueExpression != null) { + hasDefaultValue = (Boolean) hasDefaultValueExpression.getValue(); } - } else if (annotation.getQualifiedName().equals(StdlibNames.JET_TYPE_PARAMETER.getFqName())) { + } else if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_TYPE_PARAMETER.getFqName())) { return JvmMethodParameterMeaning.typeInfo(new Object()); } } @@ -661,7 +677,7 @@ public class JavaDescriptorResolver { name, null, // TODO : review changeNullable ? TypeUtils.makeNullableAsSpecified(outType, nullable) : outType, - false, + hasDefaultValue, varargElementType )); } @@ -748,6 +764,9 @@ public class JavaDescriptorResolver { return functionDescriptor; } DeclarationDescriptor classDescriptor = method.hasModifierProperty(PsiModifier.STATIC) ? resolveNamespace(method.getContainingClass()) : resolveClass(method.getContainingClass()); + if (classDescriptor == null) { + return null; + } PsiParameter[] parameters = method.getParameterList().getParameters(); FunctionDescriptorImpl functionDescriptorImpl = new FunctionDescriptorImpl( owner, @@ -776,8 +795,8 @@ public class JavaDescriptorResolver { private List resolveMethodTypeParameters(PsiMethod method, FunctionDescriptorImpl functionDescriptorImpl) { for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) { - if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD.getFqName())) { - PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD); + if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_METHOD.getFqName())) { + PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD); if (attributeValue != null) { String typeParametersString = (String) attributeValue.getValue(); if (typeParametersString != null) { @@ -822,8 +841,8 @@ public class JavaDescriptorResolver { String returnTypeFromAnnotation = null; for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) { - if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD.getFqName())) { - PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD); + if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_METHOD.getFqName())) { + PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD); if (nullableExpression != null) { nullable = (Boolean) nullableExpression.getValue(); } else { @@ -832,7 +851,7 @@ public class JavaDescriptorResolver { changeNullable = true; } - PsiLiteralExpression returnTypeExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_RETURN_TYPE_FIELD); + PsiLiteralExpression returnTypeExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_METHOD_RETURN_TYPE_FIELD); if (returnTypeExpression != null) { returnTypeFromAnnotation = (String) returnTypeExpression.getValue(); } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaPackageScope.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaPackageScope.java index 098b8ec6bdf..45613dcb978 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaPackageScope.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaPackageScope.java @@ -94,7 +94,10 @@ public class JavaPackageScope extends JetScopeImpl { } if (psiClass.hasModifierProperty(PsiModifier.PUBLIC)) { - allDescriptors.add(descriptorResolver.resolveClass(psiClass)); + ClassDescriptor classDescriptor = descriptorResolver.resolveClass(psiClass); + if (classDescriptor != null) { + allDescriptors.add(classDescriptor); + } } } } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaTypeTransformer.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaTypeTransformer.java index 4aed6ee493d..fde7a02232c 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaTypeTransformer.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaTypeTransformer.java @@ -94,6 +94,9 @@ public class JavaTypeTransformer { } ClassDescriptor descriptor = resolver.resolveClass(psiClass); + if (descriptor == null) { + return ErrorUtils.createErrorType("Unresolve java class: " + classType.getPresentableText()); + } List arguments = Lists.newArrayList(); if (classType.isRaw()) { diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JetTypeJetSignatureReader.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JetTypeJetSignatureReader.java index 64bf4d30633..2984dc9e057 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JetTypeJetSignatureReader.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JetTypeJetSignatureReader.java @@ -1,17 +1,18 @@ package org.jetbrains.jet.lang.resolve.java; -import org.jetbrains.jet.rt.signature.JetSignatureExceptionsAdapter; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; -import org.jetbrains.jet.rt.signature.JetSignatureVisitor; import org.jetbrains.jet.lang.types.ErrorUtils; import org.jetbrains.jet.lang.types.JetStandardClasses; import org.jetbrains.jet.lang.types.JetStandardLibrary; import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.JetTypeImpl; import org.jetbrains.jet.lang.types.TypeProjection; +import org.jetbrains.jet.lang.types.TypeUtils; import org.jetbrains.jet.lang.types.Variance; +import org.jetbrains.jet.rt.signature.JetSignatureExceptionsAdapter; +import org.jetbrains.jet.rt.signature.JetSignatureVisitor; import java.util.ArrayList; import java.util.Collections; @@ -119,6 +120,17 @@ public abstract class JetTypeJetSignatureReader extends JetSignatureExceptionsAd }; } + @Override + public JetSignatureVisitor visitArrayType(final boolean nullable) { + return new JetTypeJetSignatureReader(javaDescriptorResolver, jetStandardLibrary) { + @Override + protected void done(@NotNull JetType jetType) { + JetType arrayType = TypeUtils.makeNullableAsSpecified(jetStandardLibrary.getArrayType(jetType), nullable); + JetTypeJetSignatureReader.this.done(arrayType); + } + }; + } + @Override public void visitEnd() { JetType jetType = new JetTypeImpl( diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmAbi.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmAbi.java new file mode 100644 index 00000000000..0cb5f676a08 --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmAbi.java @@ -0,0 +1,9 @@ +package org.jetbrains.jet.lang.resolve.java; + +/** + * @author Stepan Koltsov + */ +public class JvmAbi { + public static final String TRAIT_IMPL_SUFFIX = "$$TImpl"; + public static final String DEFAULT_PARAMS_IMPL_SUFFIX = "$default"; +} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/StdlibNames.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java similarity index 95% rename from compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/StdlibNames.java rename to compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java index 285ffe54b3c..f94405a8214 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/StdlibNames.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java @@ -5,7 +5,7 @@ import org.objectweb.asm.Type; /** * @author Stepan Koltsov */ -public class StdlibNames { +public class JvmStdlibNames { public static final JvmClassName JET_VALUE_PARAMETER = new JvmClassName("jet.typeinfo.JetValueParameter"); @@ -36,6 +36,6 @@ public class StdlibNames { public static final JvmClassName JET_OBJECT = new JvmClassName("jet.JetObject"); - private StdlibNames() { + private JvmStdlibNames() { } } diff --git a/compiler/frontend/src/jet/Library.jet b/compiler/frontend/src/jet/Library.jet index c54b0d2c49e..d9a849e0017 100644 --- a/compiler/frontend/src/jet/Library.jet +++ b/compiler/frontend/src/jet/Library.jet @@ -34,7 +34,7 @@ namespace io { fun readLine() : String? } -fun Any.synchronized(block : fun() : R) : R +fun Any.synchronized(block : () -> R) : R fun Any?.identityEquals(other : Any?) : Boolean // = this === other @@ -139,7 +139,7 @@ trait CharIterable : Iterable { fun Array(val size : Int) : Array -class Array(val size : Int, init : fun(Int) : T) { +class Array(val size : Int, init : (Int) -> T) { fun get(index : Int) : T fun set(index : Int, value : T) : Unit diff --git a/compiler/frontend/src/org/jetbrains/jet/JetCoreEnvironment.java b/compiler/frontend/src/org/jetbrains/jet/JetCoreEnvironment.java index 65218c54fcf..1b2e2c12e66 100644 --- a/compiler/frontend/src/org/jetbrains/jet/JetCoreEnvironment.java +++ b/compiler/frontend/src/org/jetbrains/jet/JetCoreEnvironment.java @@ -2,6 +2,7 @@ package org.jetbrains.jet; import com.intellij.core.JavaCoreEnvironment; import com.intellij.lang.java.JavaParserDefinition; +import com.intellij.mock.MockApplication; import com.intellij.openapi.Disposable; import org.jetbrains.jet.lang.parsing.JetParserDefinition; import org.jetbrains.jet.plugin.JetFileType; @@ -19,4 +20,8 @@ public class JetCoreEnvironment extends JavaCoreEnvironment { registerParserDefinition(new JavaParserDefinition()); registerParserDefinition(new JetParserDefinition()); } + + public MockApplication getApplication() { + return myApplication; + } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java index 8844d181e69..0c55185fe81 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java @@ -18,7 +18,7 @@ import static org.jetbrains.jet.lexer.JetTokens.*; */ public class JetExpressionParsing extends AbstractJetParsing { private static final TokenSet WHEN_CONDITION_RECOVERY_SET = TokenSet.create(RBRACE, IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS, ELSE_KEYWORD); - private static final TokenSet WHEN_CONDITION_RECOVERY_SET_WITH_DOUBLE_ARROW = TokenSet.create(RBRACE, IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS, ELSE_KEYWORD, DOUBLE_ARROW, DOT); + private static final TokenSet WHEN_CONDITION_RECOVERY_SET_WITH_ARROW = TokenSet.create(RBRACE, IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS, ELSE_KEYWORD, ARROW, DOT); private static final ImmutableMap KEYWORD_TEXTS = tokenSetToMap(KEYWORDS); @@ -38,8 +38,8 @@ public class JetExpressionParsing extends AbstractJetParsing { CONTINUE_KEYWORD, OBJECT_KEYWORD, IF_KEYWORD, TRY_KEYWORD, ELSE_KEYWORD, WHILE_KEYWORD, DO_KEYWORD, WHEN_KEYWORD, RBRACKET, RBRACE, RPAR, PLUSPLUS, MINUSMINUS, MUL, PLUS, MINUS, EXCL, DIV, PERC, LTEQ, // TODO GTEQ, foo=x - EQEQEQ, ARROW, DOUBLE_ARROW, EXCLEQEQEQ, EQEQ, EXCLEQ, ANDAND, OROR, SAFE_ACCESS, ELVIS, - SEMICOLON, RANGE, EQ, MULTEQ, DIVEQ, PERCEQ, PLUSEQ, MINUSEQ, NOT_IN, NOT_IS, HASH, + EQEQEQ, ARROW, ARROW, EXCLEQEQEQ, EQEQ, EXCLEQ, ANDAND, OROR, SAFE_ACCESS, ELVIS, + SEMICOLON, RANGE, EQ, MULTEQ, DIVEQ, PERCEQ, PLUSEQ, MINUSEQ, NOT_IN, NOT_IS, //HASH, COLON ); @@ -49,6 +49,7 @@ public class JetExpressionParsing extends AbstractJetParsing { // Atomic LPAR, // parenthesized + HASH, // Tuple // literal constant TRUE_KEYWORD, FALSE_KEYWORD, @@ -100,13 +101,14 @@ public class JetExpressionParsing extends AbstractJetParsing { ); /*package*/ static final TokenSet EXPRESSION_FOLLOW = TokenSet.create( - SEMICOLON, DOUBLE_ARROW, COMMA, RBRACE, RPAR, RBRACKET + SEMICOLON, ARROW, COMMA, RBRACE, RPAR, RBRACKET ); @SuppressWarnings({"UnusedDeclaration"}) private enum Precedence { POSTFIX(PLUSPLUS, MINUSMINUS, - HASH, DOT, SAFE_ACCESS, QUEST), // typeArguments? valueArguments : typeArguments : arrayAccess +// HASH, + DOT, SAFE_ACCESS, QUEST), // typeArguments? valueArguments : typeArguments : arrayAccess PREFIX(MINUS, PLUS, MINUSMINUS, PLUSPLUS, EXCL, LABEL_IDENTIFIER, AT, ATAT) { // attributes @@ -150,7 +152,7 @@ public class JetExpressionParsing extends AbstractJetParsing { EQUALITY(EQEQ, EXCLEQ, EQEQEQ, EXCLEQEQEQ), CONJUNCTION(ANDAND), DISJUNCTION(OROR), - ARROW(JetTokens.ARROW), +// ARROW(JetTokens.ARROW), ASSIGNMENT(EQ, PLUSEQ, MINUSEQ, MULTEQ, DIVEQ, PERCEQ), ; @@ -374,13 +376,13 @@ public class JetExpressionParsing extends AbstractJetParsing { expression.done(PREDICATE_EXPRESSION); } - else if (at(HASH)) { - advance(); // HASH - - expect(IDENTIFIER, "Expecting property or function name"); - - expression.done(HASH_QUALIFIED_EXPRESSION); - } +// else if (at(HASH)) { +// advance(); // HASH +// +// expect(IDENTIFIER, "Expecting property or function name"); +// +// expression.done(HASH_QUALIFIED_EXPRESSION); +// } else if (atSet(Precedence.POSTFIX.getOperations())) { parseOperationReference(); expression.done(POSTFIX_EXPRESSION); @@ -502,7 +504,10 @@ public class JetExpressionParsing extends AbstractJetParsing { // System.out.println("atom at " + myBuilder.getTokenText()); if (at(LPAR)) { - parseParenthesizedExpressionOrTuple(); + parseParenthesizedExpression(); + } + else if (at(HASH)) { + parseTupleExpression(); } else if (at(NAMESPACE_KEYWORD)) { parseOneTokenExpression(ROOT_NAMESPACE); @@ -756,13 +761,13 @@ public class JetExpressionParsing extends AbstractJetParsing { if (at(ELSE_KEYWORD)) { advance(); // ELSE_KEYWORD - if (!at(DOUBLE_ARROW)) { - errorUntil("Expecting '=>'", TokenSet.create(DOUBLE_ARROW, + if (!at(ARROW)) { + errorUntil("Expecting '=>'", TokenSet.create(ARROW, RBRACE, EOL_OR_SEMICOLON)); } - if (at(DOUBLE_ARROW)) { - advance(); // DOUBLE_ARROW + if (at(ARROW)) { + advance(); // ARROW if (atSet(WHEN_CONDITION_RECOVERY_SET)) { error("Expecting an element"); @@ -790,7 +795,7 @@ public class JetExpressionParsing extends AbstractJetParsing { if (!at(COMMA)) break; advance(); // COMMA } - expect(DOUBLE_ARROW, "Expecting '=>' or 'when'", WHEN_CONDITION_RECOVERY_SET); + expect(ARROW, "Expecting '->' or 'when'", WHEN_CONDITION_RECOVERY_SET); if (atSet(WHEN_CONDITION_RECOVERY_SET)) { error("Expecting an element"); } else { @@ -815,7 +820,7 @@ public class JetExpressionParsing extends AbstractJetParsing { mark.done(OPERATION_REFERENCE); - if (atSet(WHEN_CONDITION_RECOVERY_SET_WITH_DOUBLE_ARROW)) { + if (atSet(WHEN_CONDITION_RECOVERY_SET_WITH_ARROW)) { error("Expecting an element"); } else { parseExpression(); @@ -824,7 +829,7 @@ public class JetExpressionParsing extends AbstractJetParsing { } else if (at(IS_KEYWORD) || at(NOT_IS)) { advance(); // IS_KEYWORD or NOT_IS - if (atSet(WHEN_CONDITION_RECOVERY_SET_WITH_DOUBLE_ARROW)) { + if (atSet(WHEN_CONDITION_RECOVERY_SET_WITH_ARROW)) { error("Expecting a type or a decomposer pattern"); } else { parsePattern(); @@ -832,7 +837,7 @@ public class JetExpressionParsing extends AbstractJetParsing { condition.done(WHEN_CONDITION_IS_PATTERN); } else { PsiBuilder.Marker expressionPattern = mark(); - if (atSet(WHEN_CONDITION_RECOVERY_SET_WITH_DOUBLE_ARROW)) { + if (atSet(WHEN_CONDITION_RECOVERY_SET_WITH_ARROW)) { error("Expecting an expression, is-condition or in-condition"); } else { parseExpression(); @@ -863,9 +868,8 @@ public class JetExpressionParsing extends AbstractJetParsing { if (at(NAMESPACE_KEYWORD) || at(IDENTIFIER) || at(FUN_KEYWORD) || at(THIS_KEYWORD)) { PsiBuilder.Marker rollbackMarker = mark(); parseBinaryExpression(Precedence.ELVIS); - if (at(AT)) { + if (at(HASH)) { rollbackMarker.drop(); - advance(); // AT PsiBuilder.Marker list = mark(); parseTuplePattern(DECOMPOSER_ARGUMENT); list.done(DECOMPOSER_ARGUMENT_LIST); @@ -877,9 +881,9 @@ public class JetExpressionParsing extends AbstractJetParsing { rollbackMarker = mark(); myJetParsing.parseTypeRef(); - if (at(AT)) { - errorAndAdvance("'@' is allowed only after a decomposer element, not after a type"); - } +// if (at(AT)) { +// errorAndAdvance("'@' is allowed only after a decomposer element, not after a type"); +// } if (myBuilder.getCurrentOffset() < expressionEndOffset) { rollbackMarker.rollbackTo(); parseBinaryExpression(Precedence.ELVIS); @@ -889,7 +893,7 @@ public class JetExpressionParsing extends AbstractJetParsing { pattern.done(TYPE_PATTERN); } } - } else if (at(LPAR)) { + } else if (at(HASH)) { parseTuplePattern(TUPLE_PATTERN_ENTRY); pattern.done(TUPLE_PATTERN); } @@ -905,20 +909,21 @@ public class JetExpressionParsing extends AbstractJetParsing { } else if (parseLiteralConstant()) { pattern.done(EXPRESSION_PATTERN); } else { - errorUntil("Pattern expected", TokenSet.create(RBRACE, DOUBLE_ARROW)); + errorUntil("Pattern expected", TokenSet.create(RBRACE, ARROW)); pattern.drop(); } } /* * tuplePattern - * : "(" ((SimpleName "=")? pattern){","}? ")" + * : "#" "(" ((SimpleName "=")? pattern){","}? ")" * ; */ private void parseTuplePattern(JetNodeType entryType) { myBuilder.disableNewlines(); - expect(LPAR, "Expecting '('", getDecomposerExpressionFollow()); + expect(HASH, "Expecting a tuple pattern of the form '#(...)'", getDecomposerExpressionFollow()); + expect(LPAR, "Expecting a tuple pattern of the form '#(...)'", getDecomposerExpressionFollow()); if (!at(RPAR)) { while (true) { @@ -1059,8 +1064,8 @@ public class JetExpressionParsing extends AbstractJetParsing { /* * functionLiteral // one can use "it" as a parameter name * : "{" expressions "}" - * : "{" (modifiers SimpleName){","} "=>" statements "}" - * : "{" (type ".")? "(" (modifiers SimpleName (":" type)?){","} ")" (":" type)? "=>" expressions "}" + * : "{" (modifiers SimpleName){","} "->" statements "}" + * : "{" (type ".")? "(" (modifiers SimpleName (":" type)?){","} ")" (":" type)? "->" expressions "}" * ; */ private void parseFunctionLiteral() { @@ -1077,83 +1082,112 @@ public class JetExpressionParsing extends AbstractJetParsing { myBuilder.enableNewlines(); advance(); // LBRACE - int doubleArrowPos = matchTokenStreamPredicate(new FirstBefore(new At(DOUBLE_ARROW), new At(RBRACE)) { - @Override - public boolean isTopLevel(int openAngleBrackets, int openBrackets, int openBraces, int openParentheses) { - return openBraces == 0; + boolean paramsFound = false; + + if (at(ARROW)) { + // { -> ...} + advance(); // ARROW + mark().done(VALUE_PARAMETER_LIST); + paramsFound = true; + } + else if (at(LPAR)) { + // Look for ARROW after matching RPAR + // {(a, b) -> ...} + + { + PsiBuilder.Marker rollbackMarker = mark(); + + parseFunctionLiteralParametersAndType(); + + paramsFound = rollbackOrDropAt(rollbackMarker, ARROW); } - }); - boolean doubleArrowPresent = doubleArrowPos >= 0; - if (doubleArrowPresent) { - boolean dontExpectParameters = false; - - int lastDot = matchTokenStreamPredicate(new LastBefore(new At(DOT), new AtOffset(doubleArrowPos))); - if (lastDot >= 0) { // There is a receiver type - createTruncatedBuilder(lastDot).parseTypeRef(); - - expect(DOT, "Expecting '.'"); - - if (!at(LPAR)) { - int firstLParPos = matchTokenStreamPredicate(new FirstBefore(new At(LPAR), new AtOffset(doubleArrowPos))); - - if (firstLParPos >= 0) { - errorUntilOffset("Expecting '('", firstLParPos); - } else { - errorUntilOffset("To specify a receiver type, use the full notation: {ReceiverType.(parameters) [: ReturnType] => ...}", - doubleArrowPos); - dontExpectParameters = true; + if (!paramsFound) { + // If not found, try a typeRef DOT and then LPAR .. RPAR ARROW + // {((A) -> B).(x) -> ... } + PsiBuilder.Marker rollbackMarker = mark(); + int lastDot = matchTokenStreamPredicate(new LastBefore(new At(DOT), new AtSet(ARROW, RPAR))); + if (lastDot >= 0) { + createTruncatedBuilder(lastDot).parseTypeRef(); + if (at(DOT)) { + advance(); // DOT + parseFunctionLiteralParametersAndType(); } } + paramsFound = rollbackOrDropAt(rollbackMarker, ARROW); } - - if (at(LPAR)) { - parseFunctionLiteralParameterList(); - - if (at(COLON)) { - advance(); // COLON - if (at(DOUBLE_ARROW)) { - error("Expecting a type"); - } - else { - myJetParsing.parseTypeRef(); - } - } - } - else if (!dontExpectParameters) { - PsiBuilder.Marker parameterList = mark(); - - while (!eof()) { - PsiBuilder.Marker parameter = mark(); - - int parameterNamePos = matchTokenStreamPredicate(new LastBefore(new At(IDENTIFIER), new AtOffset(doubleArrowPos))); - createTruncatedBuilder(parameterNamePos).parseModifierList(MODIFIER_LIST, false); - - expect(IDENTIFIER, "Expecting parameter name", TokenSet.create(DOUBLE_ARROW)); - - parameter.done(VALUE_PARAMETER); - - if (at(COLON)) { - errorUntilOffset("To specify a type of a parameter or a return type, use the full notation: {(parameter : Type) : ReturnType => ...}", doubleArrowPos); - } - else if (at(DOUBLE_ARROW)) { - break; - } - else if (!at(COMMA)) { - errorUntilOffset("Expecting '=>' or ','", doubleArrowPos); - } - else { - advance(); // COMMA - } - } - - parameterList.done(VALUE_PARAMETER_LIST); - } - - expectNoAdvance(DOUBLE_ARROW, "Expecting '=>'"); } else { + if (at(IDENTIFIER)) { + // Try to parse a simple name list followed by an ARROW + // {a -> ...} + // {a, b -> ...} + PsiBuilder.Marker rollbackMarker = mark(); + parseFunctionLiteralShorthandParameterList(); + parseOptionalFunctionLiteralType(); + paramsFound = rollbackOrDropAt(rollbackMarker, ARROW); + } + if (!paramsFound && atSet(JetParsing.TYPE_REF_FIRST)) { + // Try to parse a type DOT valueParameterList ARROW + // {A.(b) -> ...} + PsiBuilder.Marker rollbackMarker = mark(); + int lastDot = matchTokenStreamPredicate(new LastBefore(new At(DOT), new AtSet(ARROW, RBRACE))); + if (lastDot >= 0) { // There is a receiver type + createTruncatedBuilder(lastDot).parseTypeRef(); + } + + if (at(DOT)) { + advance(); // DOT + parseFunctionLiteralParametersAndType(); + paramsFound = rollbackOrDropAt(rollbackMarker, ARROW); + } + else { + rollbackMarker.rollbackTo(); + } + } +// int doubleArrowPos = matchTokenStreamPredicate(new FirstBefore(new At(ARROW), new At(RBRACE)) { +// @Override +// public boolean isTopLevel(int openAngleBrackets, int openBrackets, int openBraces, int openParentheses) { +// return openBraces == 0; +// } +// }); +// +// boolean doubleArrowPresent = doubleArrowPos >= 0; +// if (doubleArrowPresent) { +// boolean dontExpectParameters = false; +// +// int lastDot = matchTokenStreamPredicate(new LastBefore(new At(DOT), new AtOffset(doubleArrowPos))); +// if (lastDot >= 0) { // There is a receiver type +// createTruncatedBuilder(lastDot).parseTypeRef(); +// +// expect(DOT, "Expecting '.'"); +// +// if (!at(LPAR)) { +// int firstLParPos = matchTokenStreamPredicate(new FirstBefore(new At(LPAR), new AtOffset(doubleArrowPos))); +// +// if (firstLParPos >= 0) { +// errorUntilOffset("Expecting '('", firstLParPos); +// } else { +// errorUntilOffset("To specify a receiver type, use the full notation: {ReceiverType.(parameters) [: ReturnType] => ...}", +// doubleArrowPos); +// dontExpectParameters = true; +// } +// } +// +// } +// +// if (at(LPAR)) { +// parseFunctionLiteralParametersAndType(); +// } +// else if (!dontExpectParameters) { +// parseFunctionLiteralShorthandParameterList(); +// } +// +// expectNoAdvance(ARROW, "Expecting '=>'"); +// } + } + if (!paramsFound) { if (preferBlock) { literal.drop(); parseStatements(); @@ -1175,12 +1209,80 @@ public class JetExpressionParsing extends AbstractJetParsing { literalExpression.done(FUNCTION_LITERAL_EXPRESSION); } + private boolean rollbackOrDropAt(PsiBuilder.Marker rollbackMarker, IElementType dropAt) { + if (at(dropAt)) { + advance(); // dropAt + rollbackMarker.drop(); + return true; + } + rollbackMarker.rollbackTo(); + return false; + } + + /* + * SimpleName{,} + */ + private void parseFunctionLiteralShorthandParameterList() { + PsiBuilder.Marker parameterList = mark(); + + while (!eof()) { + PsiBuilder.Marker parameter = mark(); + +// int parameterNamePos = matchTokenStreamPredicate(new LastBefore(new At(IDENTIFIER), new AtOffset(doubleArrowPos))); +// createTruncatedBuilder(parameterNamePos).parseModifierList(MODIFIER_LIST, false); + + expect(IDENTIFIER, "Expecting parameter name", TokenSet.create(ARROW)); + + parameter.done(VALUE_PARAMETER); + + if (at(COLON)) { + PsiBuilder.Marker errorMarker = mark(); + advance(); // COLON + myJetParsing.parseTypeRef(); + errorMarker.error("To specify a type of a parameter or a return type, use the full notation: {(parameter : Type) : ReturnType => ...}"); + } + else if (at(ARROW)) { + break; + } + else if (at(COMMA)) { + advance(); // COMMA + } + else { + error("Expecting '->' or ','"); + break; + } + } + + parameterList.done(VALUE_PARAMETER_LIST); + } + + private void parseFunctionLiteralParametersAndType() { + parseFunctionLiteralParameterList(); + + parseOptionalFunctionLiteralType(); + } + + /* + * (":" type)? + */ + private void parseOptionalFunctionLiteralType() { + if (at(COLON)) { + advance(); // COLON + if (at(ARROW)) { + error("Expecting a type"); + } + else { + myJetParsing.parseTypeRef(); + } + } + } + /* * "(" (modifiers SimpleName (":" type)?){","} ")" */ private void parseFunctionLiteralParameterList() { PsiBuilder.Marker list = mark(); - expect(LPAR, "Expecting a parameter list in parentheses (...)", TokenSet.create(DOUBLE_ARROW, COLON)); + expect(LPAR, "Expecting a parameter list in parentheses (...)", TokenSet.create(ARROW, COLON)); myBuilder.disableNewlines(); @@ -1189,7 +1291,7 @@ public class JetExpressionParsing extends AbstractJetParsing { if (at(COMMA)) errorAndAdvance("Expecting a parameter declaration"); PsiBuilder.Marker parameter = mark(); - int parameterNamePos = matchTokenStreamPredicate(new LastBefore(new At(IDENTIFIER), new AtSet(COMMA, RPAR, COLON, DOUBLE_ARROW))); + int parameterNamePos = matchTokenStreamPredicate(new LastBefore(new At(IDENTIFIER), new AtSet(COMMA, RPAR, COLON, ARROW))); createTruncatedBuilder(parameterNamePos).parseModifierList(MODIFIER_LIST, false); expect(IDENTIFIER, "Expecting parameter declaration"); @@ -1211,7 +1313,7 @@ public class JetExpressionParsing extends AbstractJetParsing { myBuilder.restoreNewlinesState(); - expect(RPAR, "Expecting ')", TokenSet.create(DOUBLE_ARROW, COLON)); + expect(RPAR, "Expecting ')", TokenSet.create(ARROW, COLON)); list.done(VALUE_PARAMETER_LIST); } @@ -1567,29 +1669,43 @@ public class JetExpressionParsing extends AbstractJetParsing { } /* - * tupleLiteral // Ambiguity when after a SimpleName (infix call). In this case (e) is treated as an element in parentheses - * // to put a tuple, write write ((e)) - * : "(" ((SimpleName "=")? element){","} ")" - * ; - * - * element - * : "(" element ")" - * ; - * - * TODO: duplication with valueArguments (but for the error messages) + * "(" expression ")" */ - private void parseParenthesizedExpressionOrTuple() { + private void parseParenthesizedExpression() { assert _at(LPAR); PsiBuilder.Marker mark = mark(); myBuilder.disableNewlines(); advance(); // LPAR - boolean tuple = false; + if (at(RPAR)) { + error("Expecting an expression"); + } + else { + parseExpression(); + } + + expect(RPAR, "Expecting ')'"); + myBuilder.restoreNewlinesState(); + + mark.done(PARENTHESIZED); + } + + /* + * tupleLiteral + * : "#" "(" (((SimpleName "=")? expression){","})? ")" + * ; + */ + private void parseTupleExpression() { + assert _at(HASH); + PsiBuilder.Marker mark = mark(); + + advance(); // HASH + advance(); // LPAR + myBuilder.disableNewlines(); if (!at(RPAR)) { while (true) { while (at(COMMA)) { - tuple = true; errorAndAdvance("Expecting a tuple entry (element)"); } @@ -1597,7 +1713,6 @@ public class JetExpressionParsing extends AbstractJetParsing { PsiBuilder.Marker entry = mark(); advance(); // IDENTIFIER advance(); // EQ - tuple = true; parseExpression(); entry.done(LABELED_TUPLE_ENTRY); } else { @@ -1606,21 +1721,18 @@ public class JetExpressionParsing extends AbstractJetParsing { if (!at(COMMA)) break; advance(); // COMMA - tuple = true; if (at(RPAR)) { error("Expecting a tuple entry (element)"); break; } } - } else { - tuple = true; - } + } expect(RPAR, "Expecting ')'"); myBuilder.restoreNewlinesState(); - mark.done(tuple ? TUPLE : PARENTHESIZED); + mark.done(TUPLE); } /* diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java index 479849c88c7..2566b9b5291 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -37,7 +37,7 @@ public class JetParsing extends AbstractJetParsing { private static final TokenSet TYPE_PARAMETER_GT_RECOVERY_SET = TokenSet.create(WHERE_KEYWORD, LPAR, COLON, LBRACE, GT); private static final TokenSet PARAMETER_NAME_RECOVERY_SET = TokenSet.create(COLON, EQ, COMMA, RPAR); private static final TokenSet NAMESPACE_NAME_RECOVERY_SET = TokenSet.create(DOT, EOL_OR_SEMICOLON); - /*package*/ static final TokenSet TYPE_REF_FIRST = TokenSet.create(LBRACKET, IDENTIFIER, FUN_KEYWORD, LPAR, CAPITALIZED_THIS_KEYWORD); + /*package*/ static final TokenSet TYPE_REF_FIRST = TokenSet.create(LBRACKET, IDENTIFIER, FUN_KEYWORD, LPAR, CAPITALIZED_THIS_KEYWORD, HASH); private static final TokenSet RECEIVER_TYPE_TERMINATORS = TokenSet.create(DOT, SAFE_ACCESS); public static JetParsing createForTopLevel(SemanticWhitespaceAwarePsiBuilder builder) { @@ -847,7 +847,7 @@ public class JetParsing extends AbstractJetParsing { parseReceiverType("property", propertyNameFollow, lastDot); - myBuilder.enableJoiningComplexTokens(); + myBuilder.restoreJoiningComplexTokensState(); if (at(COLON)) { advance(); // COLON @@ -985,7 +985,7 @@ public class JetParsing extends AbstractJetParsing { myBuilder.disableJoiningComplexTokens(); int lastDot = findLastBefore(RECEIVER_TYPE_TERMINATORS, TokenSet.create(LPAR), true); parseReceiverType("function", TokenSet.create(LT, LPAR, COLON, EQ), lastDot); - myBuilder.enableJoiningComplexTokens(); + myBuilder.restoreJoiningComplexTokensState(); TokenSet valueParametersFollow = TokenSet.create(COLON, EQ, LBRACE, SEMICOLON, RPAR); @@ -1281,17 +1281,54 @@ public class JetParsing extends AbstractJetParsing { * : typeDescriptor "?" */ public void parseTypeRef() { + PsiBuilder.Marker typeRefMarker = parseTypeRefContents(); + typeRefMarker.done(TYPE_REFERENCE); + } + + private PsiBuilder.Marker parseTypeRefContents() { + // Disabling token merge is required for cases like + // Int?.(Foo) -> Bar + // we don't support this case now +// myBuilder.disableJoiningComplexTokens(); PsiBuilder.Marker typeRefMarker = mark(); parseAnnotations(false); if (at(IDENTIFIER) || at(NAMESPACE_KEYWORD)) { parseUserType(); } - else if (at(FUN_KEYWORD)) { - parseFunctionType(); + else if (at(HASH)) { + parseTupleType(); } else if (at(LPAR)) { - parseTupleType(); + PsiBuilder.Marker functionOrParenthesizedType = mark(); + + // This may be a function parameter list or just a prenthesized type + advance(); // LPAR + parseTypeRefContents().drop(); // parenthesized types, no reference element around it is needed + + if (at(RPAR)) { + advance(); // RPAR + if (at(ARROW)) { + // It's a function type with one parameter specified + // (A) -> B + functionOrParenthesizedType.rollbackTo(); + parseFunctionType(); + } + else { + // It's a parenthesized type + // (A) + functionOrParenthesizedType.drop(); + } + } + else { + // This must be a function type + // (A, B) -> C + // or + // (a : A) -> C + functionOrParenthesizedType.rollbackTo(); + parseFunctionType(); + } + } else if (at(CAPITALIZED_THIS_KEYWORD)) { parseSelfType(); @@ -1299,7 +1336,7 @@ public class JetParsing extends AbstractJetParsing { else { errorWithRecovery("Type expected", TokenSet.orSet(TOPLEVEL_OBJECT_FIRST, - TokenSet.create(EQ, COMMA, GT, RBRACKET, DOT, RPAR, RBRACE, LBRACE, SEMICOLON))); + TokenSet.create(EQ, COMMA, GT, RBRACKET, DOT, RPAR, RBRACE, LBRACE, SEMICOLON))); } while (at(QUEST)) { @@ -1310,20 +1347,29 @@ public class JetParsing extends AbstractJetParsing { typeRefMarker = precede; } - typeRefMarker.done(TYPE_REFERENCE); - } - /* - * selfType - * : "This" - * ; - */ - private void parseSelfType() { - assert _at(CAPITALIZED_THIS_KEYWORD); + if (at(DOT)) { + // This is a receiver for a function type + // A.(B) -> C + // ^ - PsiBuilder.Marker type = mark(); - advance(); // CAPITALIZED_THIS_KEYWORD - type.done(SELF_TYPE); + PsiBuilder.Marker precede = typeRefMarker.precede(); + typeRefMarker.done(TYPE_REFERENCE); + + advance(); // DOT + + if (at(LPAR)) { + parseFunctionTypeContents().drop(); + } + else { + error("Expecting function type"); + } + typeRefMarker = precede.precede(); + + precede.done(FUNCTION_TYPE); + } +// myBuilder.restoreJoiningComplexTokensState(); + return typeRefMarker; } /* @@ -1341,13 +1387,18 @@ public class JetParsing extends AbstractJetParsing { PsiBuilder.Marker reference = mark(); while (true) { - expect(IDENTIFIER, "Type name expected", TokenSet.orSet(JetExpressionParsing.EXPRESSION_FIRST, JetExpressionParsing.EXPRESSION_FOLLOW)); + expect(IDENTIFIER, "Expecting type name", TokenSet.orSet(JetExpressionParsing.EXPRESSION_FIRST, JetExpressionParsing.EXPRESSION_FOLLOW)); reference.done(REFERENCE_EXPRESSION); parseTypeArgumentList(-1); if (!at(DOT)) { break; } + if (lookahead(1) == LPAR) { + // This may be a receiver for a function type + // Int.(Int) -> Int + break; + } PsiBuilder.Marker precede = userType.precede(); userType.done(USER_TYPE); @@ -1360,6 +1411,19 @@ public class JetParsing extends AbstractJetParsing { userType.done(USER_TYPE); } + /* + * selfType + * : "This" + * ; + */ + private void parseSelfType() { + assert _at(CAPITALIZED_THIS_KEYWORD); + + PsiBuilder.Marker type = mark(); + advance(); // CAPITALIZED_THIS_KEYWORD + type.done(SELF_TYPE); + } + /* * (optionalProjection type){","} */ @@ -1410,18 +1474,18 @@ public class JetParsing extends AbstractJetParsing { /* * tupleType - * : "(" type{","}? ")" - * : "(" parameter{","} ")" // tuple with named entries, the names do not affect assignment compatibility + * : "#" "(" type{","}? ")" + * : "#" "(" parameter{","} ")" // tuple with named entries, the names do not affect assignment compatibility * ; */ private void parseTupleType() { - // TODO : prohibit (a) - assert _at(LPAR); + assert _at(HASH); PsiBuilder.Marker tuple = mark(); myBuilder.disableNewlines(); - advance(); // LPAR + advance(); // HASH + expect(LPAR, "Expecting a tuple type in the form of '#(...)"); if (!at(RPAR)) { while (true) { @@ -1456,32 +1520,38 @@ public class JetParsing extends AbstractJetParsing { /* * functionType - * : "fun" (type ".")? "(" (parameter | modifiers type){","} ")" (":" type)? // Unit by default + * : (type ".")? "(" (parameter | modifiers type){","} ")" "->" type? * ; */ private void parseFunctionType() { - assert _at(FUN_KEYWORD); + parseFunctionTypeContents().done(FUNCTION_TYPE); + } + private PsiBuilder.Marker parseFunctionTypeContents() { +// assert _at(LPAR) : tt(); + if (!_at(LPAR)) + System.out.println(myBuilder.getTokenText()); PsiBuilder.Marker functionType = mark(); - advance(); // FUN_KEYWORD - - int lastLPar = findLastBefore(TokenSet.create(LPAR), TokenSet.create(COLON), false); - if (lastLPar >= 0 && lastLPar > myBuilder.getCurrentOffset()) { - // TODO : -1 is a hack? - createTruncatedBuilder(lastLPar - 1).parseTypeRef(); - advance(); // DOT - } +// advance(); // LPAR +// +// int lastLPar = findLastBefore(TokenSet.create(LPAR), TokenSet.create(COLON), false); +// if (lastLPar >= 0 && lastLPar > myBuilder.getCurrentOffset()) { +// TODO : -1 is a hack? +// createTruncatedBuilder(lastLPar - 1).parseTypeRef(); +// advance(); // DOT +// } parseValueParameterList(true, TokenSet.EMPTY); - if (at(COLON)) { - advance(); // COLON // expect(COLON, "Expecting ':' followed by a return type", TYPE_REF_FIRST); +// if (at(COLON)) { +// advance(); // COLON // expect(COLON, "Expecting ':' followed by a return type", TYPE_REF_FIRST); - parseTypeRef(); - } + expect(ARROW, "Expecting '->' to specify return type of a function type", TYPE_REF_FIRST); + parseTypeRef(); +// } - functionType.done(FUNCTION_TYPE); + return functionType;//.done(FUNCTION_TYPE); } /* diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilder.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilder.java index 9c836948b2a..378350b3707 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilder.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilder.java @@ -13,6 +13,7 @@ public interface SemanticWhitespaceAwarePsiBuilder extends PsiBuilder { void enableNewlines(); void restoreNewlinesState(); + void restoreJoiningComplexTokensState(); void enableJoiningComplexTokens(); void disableJoiningComplexTokens(); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilderAdapter.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilderAdapter.java index bdec327ec20..7215fcb90f1 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilderAdapter.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilderAdapter.java @@ -35,6 +35,11 @@ public class SemanticWhitespaceAwarePsiBuilderAdapter extends PsiBuilderAdapter myBuilder.restoreNewlinesState(); } + @Override + public void restoreJoiningComplexTokensState() { + myBuilder.restoreJoiningComplexTokensState(); + } + @Override public void enableJoiningComplexTokens() { myBuilder.enableJoiningComplexTokens(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilderImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilderImpl.java index 68ecfaafd88..39388d9db3c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilderImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/SemanticWhitespaceAwarePsiBuilderImpl.java @@ -16,11 +16,15 @@ import static org.jetbrains.jet.lexer.JetTokens.*; * @author abreslav */ public class SemanticWhitespaceAwarePsiBuilderImpl extends PsiBuilderAdapter implements SemanticWhitespaceAwarePsiBuilder { + private final TokenSet complexTokens = TokenSet.create(SAFE_ACCESS, ELVIS); + private final Stack joinComplexTokens = new Stack(); + private final Stack newlinesEnabled = new Stack(); public SemanticWhitespaceAwarePsiBuilderImpl(final PsiBuilder delegate) { super(delegate); newlinesEnabled.push(true); + joinComplexTokens.push(true); } @Override @@ -75,22 +79,28 @@ public class SemanticWhitespaceAwarePsiBuilderImpl extends PsiBuilderAdapter imp newlinesEnabled.pop(); } - private final TokenSet complexTokens = TokenSet.create(SAFE_ACCESS, ELVIS); - private boolean joinComplexTokens = true; + private boolean joinComplexTokens() { + return joinComplexTokens.peek(); + } + + @Override + public void restoreJoiningComplexTokensState() { + joinComplexTokens.pop(); + } @Override public void enableJoiningComplexTokens() { - joinComplexTokens = true; + joinComplexTokens.push(true); } @Override public void disableJoiningComplexTokens() { - joinComplexTokens = false; + joinComplexTokens.push(false); } @Override public IElementType getTokenType() { - if (!joinComplexTokens) return super.getTokenType(); + if (!joinComplexTokens()) return super.getTokenType(); return getJoinedTokenType(super.getTokenType(), 1); } @@ -105,7 +115,7 @@ public class SemanticWhitespaceAwarePsiBuilderImpl extends PsiBuilderAdapter imp @Override public void advanceLexer() { - if (!joinComplexTokens) { + if (!joinComplexTokens()) { super.advanceLexer(); return; } @@ -123,7 +133,7 @@ public class SemanticWhitespaceAwarePsiBuilderImpl extends PsiBuilderAdapter imp @Override public String getTokenText() { - if (!joinComplexTokens) return super.getTokenText(); + if (!joinComplexTokens()) return super.getTokenText(); IElementType tokenType = getTokenType(); if (complexTokens.contains(tokenType)) { if (tokenType == ELVIS) return "?:"; @@ -134,7 +144,7 @@ public class SemanticWhitespaceAwarePsiBuilderImpl extends PsiBuilderAdapter imp @Override public IElementType lookAhead(int steps) { - if (!joinComplexTokens) return super.lookAhead(steps); + if (!joinComplexTokens()) return super.lookAhead(steps); if (complexTokens.contains(getTokenType())) { return super.lookAhead(steps + 1); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionLiteral.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionLiteral.java index 6f20e9a1478..c39e7fe49c1 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionLiteral.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionLiteral.java @@ -30,7 +30,7 @@ public class JetFunctionLiteral extends JetFunction { } public boolean hasParameterSpecification() { - return findChildByType(JetTokens.DOUBLE_ARROW) != null; + return findChildByType(JetTokens.ARROW) != null; } @Override @@ -51,6 +51,6 @@ public class JetFunctionLiteral extends JetFunction { @Nullable public ASTNode getArrowNode() { - return getNode().findChildByType(JetTokens.DOUBLE_ARROW); + return getNode().findChildByType(JetTokens.ARROW); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionType.java index aaeffa8262b..d7f7cd4146f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionType.java @@ -7,6 +7,7 @@ import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.JetNodeTypes; +import org.jetbrains.jet.lexer.JetToken; import org.jetbrains.jet.lexer.JetTokens; import java.util.ArrayList; @@ -17,6 +18,9 @@ import java.util.List; * @author max */ public class JetFunctionType extends JetTypeElement { + + public static final JetToken RETURN_TYPE_SEPARATOR = JetTokens.ARROW; + public JetFunctionType(@NotNull ASTNode node) { super(node); } @@ -65,7 +69,7 @@ public class JetFunctionType extends JetTypeElement { PsiElement child = getFirstChild(); while (child != null) { IElementType tt = child.getNode().getElementType(); - if (tt == JetTokens.LPAR || tt == JetTokens.COLON) break; + if (tt == JetTokens.LPAR || tt == RETURN_TYPE_SEPARATOR) break; if (child instanceof JetTypeReference) { return (JetTypeReference) child; } @@ -81,7 +85,7 @@ public class JetFunctionType extends JetTypeElement { PsiElement child = getFirstChild(); while (child != null) { IElementType tt = child.getNode().getElementType(); - if (tt == JetTokens.COLON) { + if (tt == RETURN_TYPE_SEPARATOR) { colonPassed = true; } if (colonPassed && child instanceof JetTypeReference) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeResolver.java index 8896830d305..35cd9d738a7 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeResolver.java @@ -19,6 +19,7 @@ import java.util.Collections; import java.util.List; import static org.jetbrains.jet.lang.diagnostics.Errors.UNRESOLVED_REFERENCE; +import static org.jetbrains.jet.lang.diagnostics.Errors.UNSUPPORTED; import static org.jetbrains.jet.lang.diagnostics.Errors.WRONG_NUMBER_OF_TYPE_ARGUMENTS; import static org.jetbrains.jet.lang.resolve.BindingContext.REFERENCE_TARGET; @@ -173,13 +174,17 @@ public class TypeResolver { @Override public void visitJetElement(JetElement element) { - throw new IllegalArgumentException("Unsupported type: " + element); + trace.report(UNSUPPORTED.on(element, "Self-types are not supported yet")); +// throw new IllegalArgumentException("Unsupported type: " + element); } }); } if (result[0] == null) { return ErrorUtils.createErrorType(typeElement == null ? "No type element" : typeElement.getText()); } + if (nullable) { + return TypeUtils.makeNullable(result[0]); + } return result[0]; } diff --git a/compiler/frontend/src/org/jetbrains/jet/lexer/Jet.flex b/compiler/frontend/src/org/jetbrains/jet/lexer/Jet.flex index a6136493b42..30760e5968c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lexer/Jet.flex +++ b/compiler/frontend/src/org/jetbrains/jet/lexer/Jet.flex @@ -163,6 +163,7 @@ LONG_TEMPLATE_ENTRY_END=\} "namespace" { return JetTokens.NAMESPACE_KEYWORD ;} "continue" { return JetTokens.CONTINUE_KEYWORD ;} +"package" { return JetTokens.NAMESPACE_KEYWORD ;} "return" { return JetTokens.RETURN_KEYWORD ;} "object" { return JetTokens.OBJECT_KEYWORD ;} "while" { return JetTokens.WHILE_KEYWORD ;} diff --git a/compiler/frontend/src/org/jetbrains/jet/lexer/JetTokens.java b/compiler/frontend/src/org/jetbrains/jet/lexer/JetTokens.java index c66e06e3a60..e2cd5e0282f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lexer/JetTokens.java +++ b/compiler/frontend/src/org/jetbrains/jet/lexer/JetTokens.java @@ -170,12 +170,14 @@ public interface JetTokens { TokenSet STRINGS = TokenSet.create(CHARACTER_LITERAL, REGULAR_STRING_PART, RAW_STRING_LITERAL); TokenSet OPERATIONS = TokenSet.create(AS_KEYWORD, AS_SAFE, IS_KEYWORD, IN_KEYWORD, DOT, PLUSPLUS, MINUSMINUS, MUL, PLUS, - MINUS, EXCL, DIV, PERC, LT, GT, LTEQ, GTEQ, EQEQEQ, ARROW, EXCLEQEQEQ, EQEQ, EXCLEQ, ANDAND, OROR, + MINUS, EXCL, DIV, PERC, LT, GT, LTEQ, GTEQ, EQEQEQ, EXCLEQEQEQ, EQEQ, EXCLEQ, ANDAND, OROR, SAFE_ACCESS, ELVIS, // MAP, FILTER, QUEST, COLON, RANGE, EQ, MULTEQ, DIVEQ, PERCEQ, PLUSEQ, MINUSEQ, - NOT_IN, NOT_IS, HASH, IDENTIFIER, LABEL_IDENTIFIER, ATAT, AT); + NOT_IN, NOT_IS, +// HASH, + IDENTIFIER, LABEL_IDENTIFIER, ATAT, AT); TokenSet AUGMENTED_ASSIGNMENTS = TokenSet.create(PLUSEQ, MINUSEQ, MULTEQ, PERCEQ, DIVEQ); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lexer/_JetLexer.java b/compiler/frontend/src/org/jetbrains/jet/lexer/_JetLexer.java index 444c9e4fbdf..4ed815b1fd0 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lexer/_JetLexer.java +++ b/compiler/frontend/src/org/jetbrains/jet/lexer/_JetLexer.java @@ -1,19 +1,18 @@ -/* The following code was generated by JFlex 1.4.3 on 12/15/11 8:19 PM */ +/* The following code was generated by JFlex 1.4.3 on 12/16/11 12:34 PM */ package org.jetbrains.jet.lexer; -import java.util.*; -import com.intellij.lexer.*; -import com.intellij.psi.*; +import com.intellij.lexer.FlexLexer; +import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; -import org.jetbrains.jet.lexer.JetTokens; +import java.util.Stack; /** * This class is a scanner generated by * JFlex 1.4.3 - * on 12/15/11 8:19 PM from the specification file + * on 12/16/11 12:34 PM from the specification file * /Users/abreslav/work/jet-clean/compiler/frontend/src/org/jetbrains/jet/lexer/Jet.flex */ class _JetLexer implements FlexLexer { @@ -40,14 +39,14 @@ class _JetLexer implements FlexLexer { * Translates characters to character classes */ private static final String ZZ_CMAP_PACKED = - "\11\0\1\3\1\7\1\0\1\3\23\0\1\3\1\57\1\25\1\77"+ - "\1\10\1\67\1\65\1\23\1\72\1\73\1\13\1\62\1\76\1\21"+ - "\1\17\1\12\1\14\11\1\1\74\1\75\1\63\1\60\1\64\1\61"+ - "\1\11\1\2\1\16\2\2\1\20\1\2\11\4\1\22\3\4\1\54"+ - "\3\4\1\15\2\4\1\70\1\24\1\71\1\0\1\4\1\6\1\36"+ - "\1\45\1\42\1\56\1\40\1\52\1\4\1\32\1\33\1\46\1\51"+ - "\1\50\1\37\1\35\1\43\1\41\1\4\1\44\1\34\1\31\1\26"+ - "\1\55\1\47\1\15\1\53\1\4\1\27\1\66\1\30\54\0\1\4"+ + "\11\0\1\3\1\7\1\0\1\3\23\0\1\3\1\60\1\25\1\100"+ + "\1\10\1\70\1\66\1\23\1\73\1\74\1\13\1\63\1\77\1\21"+ + "\1\17\1\12\1\14\11\1\1\75\1\76\1\64\1\61\1\65\1\62"+ + "\1\11\1\2\1\16\2\2\1\20\1\2\11\4\1\22\3\4\1\55"+ + "\3\4\1\15\2\4\1\71\1\24\1\72\1\0\1\4\1\6\1\36"+ + "\1\47\1\42\1\57\1\40\1\53\1\45\1\32\1\33\1\50\1\44"+ + "\1\52\1\37\1\35\1\43\1\41\1\4\1\46\1\34\1\31\1\26"+ + "\1\56\1\51\1\15\1\54\1\4\1\27\1\67\1\30\54\0\1\4"+ "\12\0\1\4\4\0\1\4\5\0\27\4\1\0\37\4\1\0\u013f\4"+ "\31\0\162\4\4\0\14\4\16\0\5\4\11\0\1\4\213\0\1\4"+ "\13\0\1\4\1\0\3\4\1\0\1\4\1\0\24\4\1\0\54\4"+ @@ -121,27 +120,27 @@ class _JetLexer implements FlexLexer { private static final String ZZ_ACTION_PACKED_0 = "\4\0\1\1\1\2\1\3\1\4\2\1\1\5\1\6"+ "\1\7\1\2\1\10\1\11\1\12\1\13\1\14\1\15"+ - "\17\3\1\16\1\17\1\20\1\21\1\22\1\23\2\1"+ + "\20\3\1\16\1\17\1\20\1\21\1\22\1\23\2\1"+ "\1\24\1\25\1\26\1\27\1\30\1\31\1\32\1\33"+ "\1\34\1\35\1\36\1\35\1\0\1\37\1\40\1\0"+ "\1\40\1\41\1\42\1\0\1\43\1\0\1\44\1\0"+ "\1\45\1\0\1\46\1\47\1\50\1\51\1\52\1\43"+ "\2\2\1\43\1\53\1\54\1\55\1\56\2\12\1\0"+ - "\3\3\1\57\1\60\1\61\3\3\1\62\14\3\1\63"+ + "\3\3\1\57\1\60\1\61\3\3\1\62\15\3\1\63"+ "\1\0\1\64\1\65\1\66\1\67\1\70\1\71\1\72"+ "\1\73\1\74\1\75\1\76\1\0\1\77\2\100\1\0"+ "\1\40\1\101\1\43\1\3\2\0\1\50\1\102\4\0"+ - "\1\103\4\3\1\104\4\3\1\105\10\3\1\106\1\3"+ + "\1\103\4\3\1\104\4\3\1\105\11\3\1\106\1\3"+ "\1\107\1\3\1\110\1\111\1\112\1\113\1\114\1\115"+ "\2\0\2\40\1\44\1\45\1\0\2\102\1\43\2\0"+ "\1\116\1\3\1\117\1\3\1\120\1\3\1\121\1\3"+ - "\1\122\6\3\1\123\1\3\1\124\1\125\1\76\1\0"+ - "\1\126\1\50\2\0\1\127\1\130\1\131\2\3\1\132"+ - "\2\3\1\133\1\134\1\135\1\0\1\103\2\3\1\136"+ - "\1\137\3\3\1\140\1\141"; + "\1\122\7\3\1\123\1\3\1\124\1\125\1\76\1\0"+ + "\1\126\1\50\2\0\1\127\1\130\1\131\3\3\1\132"+ + "\2\3\1\133\1\134\1\135\1\0\1\103\3\3\1\136"+ + "\1\137\1\3\1\140\1\3\1\141"; private static int [] zzUnpackAction() { - int [] result = new int[225]; + int [] result = new int[230]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -166,38 +165,38 @@ class _JetLexer implements FlexLexer { private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); private static final String ZZ_ROWMAP_PACKED_0 = - "\0\0\0\100\0\200\0\300\0\u0100\0\u0140\0\u0180\0\u01c0"+ - "\0\u0200\0\u0240\0\u0280\0\u02c0\0\u0300\0\u0340\0\u0380\0\u03c0"+ - "\0\u0400\0\u0440\0\u0100\0\u0100\0\u0480\0\u04c0\0\u0500\0\u0540"+ - "\0\u0580\0\u05c0\0\u0600\0\u0640\0\u0680\0\u06c0\0\u0700\0\u0740"+ - "\0\u0780\0\u07c0\0\u0800\0\u0840\0\u0880\0\u0100\0\u08c0\0\u0900"+ - "\0\u0940\0\u0980\0\u09c0\0\u0a00\0\u0100\0\u0100\0\u0100\0\u0100"+ - "\0\u0100\0\u0100\0\u0100\0\u0100\0\u0a40\0\u0100\0\u0a80\0\u0ac0"+ - "\0\u0100\0\u0b00\0\u0b40\0\u0b80\0\u0100\0\u0100\0\u0bc0\0\u0c00"+ - "\0\u0c40\0\u0c80\0\u0cc0\0\u0d00\0\u0d40\0\u0100\0\u0d80\0\u0dc0"+ - "\0\u0100\0\u0100\0\u0e00\0\u0e40\0\u0e80\0\u0ec0\0\u0100\0\u0100"+ - "\0\u0100\0\u0100\0\u0100\0\u0f00\0\u0f40\0\u0f80\0\u0fc0\0\u1000"+ - "\0\u0180\0\u0180\0\u0180\0\u1040\0\u1080\0\u10c0\0\u1100\0\u1140"+ - "\0\u1180\0\u11c0\0\u1200\0\u1240\0\u1280\0\u12c0\0\u1300\0\u1340"+ - "\0\u1380\0\u13c0\0\u1400\0\u0180\0\u1440\0\u1480\0\u14c0\0\u0100"+ - "\0\u0100\0\u0100\0\u0100\0\u0100\0\u0100\0\u0100\0\u0100\0\u1500"+ - "\0\u1540\0\u0100\0\u0100\0\u1580\0\u15c0\0\u1600\0\u0100\0\u1640"+ - "\0\u0100\0\u1680\0\u16c0\0\u1700\0\u1740\0\u1780\0\u17c0\0\u1800"+ - "\0\u1840\0\u1880\0\u18c0\0\u1900\0\u1940\0\u1980\0\u0180\0\u19c0"+ - "\0\u1a00\0\u1a40\0\u1a80\0\u0100\0\u1ac0\0\u1b00\0\u1b40\0\u1b80"+ - "\0\u1bc0\0\u1c00\0\u1c40\0\u1c80\0\u0180\0\u1cc0\0\u0180\0\u1d00"+ - "\0\u0180\0\u0180\0\u1d40\0\u1d40\0\u0100\0\u0100\0\u1d80\0\u1dc0"+ - "\0\u0100\0\u1e00\0\u0100\0\u0100\0\u1e40\0\u1e80\0\u0100\0\u1ec0"+ - "\0\u1640\0\u1f00\0\u0180\0\u1f40\0\u0180\0\u1f80\0\u0180\0\u1fc0"+ - "\0\u0180\0\u2000\0\u0180\0\u2040\0\u2080\0\u20c0\0\u2100\0\u2140"+ - "\0\u2180\0\u0180\0\u21c0\0\u0180\0\u0100\0\u0100\0\u2200\0\u0b00"+ - "\0\u0100\0\u2240\0\u2280\0\u0180\0\u0180\0\u0180\0\u22c0\0\u2300"+ - "\0\u0180\0\u2340\0\u2380\0\u0180\0\u0180\0\u0180\0\u23c0\0\u0100"+ - "\0\u2400\0\u2440\0\u0180\0\u0180\0\u2480\0\u24c0\0\u2500\0\u0180"+ - "\0\u0180"; + "\0\0\0\101\0\202\0\303\0\u0104\0\u0145\0\u0186\0\u01c7"+ + "\0\u0208\0\u0249\0\u028a\0\u02cb\0\u030c\0\u034d\0\u038e\0\u03cf"+ + "\0\u0410\0\u0451\0\u0104\0\u0104\0\u0492\0\u04d3\0\u0514\0\u0555"+ + "\0\u0596\0\u05d7\0\u0618\0\u0659\0\u069a\0\u06db\0\u071c\0\u075d"+ + "\0\u079e\0\u07df\0\u0820\0\u0861\0\u08a2\0\u08e3\0\u0104\0\u0924"+ + "\0\u0965\0\u09a6\0\u09e7\0\u0a28\0\u0a69\0\u0104\0\u0104\0\u0104"+ + "\0\u0104\0\u0104\0\u0104\0\u0104\0\u0104\0\u0aaa\0\u0104\0\u0aeb"+ + "\0\u0b2c\0\u0104\0\u0b6d\0\u0bae\0\u0bef\0\u0104\0\u0104\0\u0c30"+ + "\0\u0c71\0\u0cb2\0\u0cf3\0\u0d34\0\u0d75\0\u0db6\0\u0104\0\u0df7"+ + "\0\u0e38\0\u0104\0\u0104\0\u0e79\0\u0eba\0\u0efb\0\u0f3c\0\u0104"+ + "\0\u0104\0\u0104\0\u0104\0\u0104\0\u0f7d\0\u0fbe\0\u0fff\0\u1040"+ + "\0\u1081\0\u0186\0\u0186\0\u0186\0\u10c2\0\u1103\0\u1144\0\u1185"+ + "\0\u11c6\0\u1207\0\u1248\0\u1289\0\u12ca\0\u130b\0\u134c\0\u138d"+ + "\0\u13ce\0\u140f\0\u1450\0\u1491\0\u14d2\0\u0186\0\u1513\0\u1554"+ + "\0\u1595\0\u0104\0\u0104\0\u0104\0\u0104\0\u0104\0\u0104\0\u0104"+ + "\0\u0104\0\u15d6\0\u1617\0\u0104\0\u0104\0\u1658\0\u1699\0\u16da"+ + "\0\u0104\0\u171b\0\u0104\0\u175c\0\u179d\0\u17de\0\u181f\0\u1860"+ + "\0\u18a1\0\u18e2\0\u1923\0\u1964\0\u19a5\0\u19e6\0\u1a27\0\u1a68"+ + "\0\u0186\0\u1aa9\0\u1aea\0\u1b2b\0\u1b6c\0\u0104\0\u1bad\0\u1bee"+ + "\0\u1c2f\0\u1c70\0\u1cb1\0\u1cf2\0\u1d33\0\u1d74\0\u1db5\0\u0186"+ + "\0\u1df6\0\u0186\0\u1e37\0\u0186\0\u0186\0\u1e78\0\u1e78\0\u0104"+ + "\0\u0104\0\u1eb9\0\u1efa\0\u0104\0\u1f3b\0\u0104\0\u0104\0\u1f7c"+ + "\0\u1fbd\0\u0104\0\u1ffe\0\u171b\0\u203f\0\u0186\0\u2080\0\u0186"+ + "\0\u20c1\0\u0186\0\u2102\0\u0186\0\u2143\0\u0186\0\u2184\0\u21c5"+ + "\0\u2206\0\u2247\0\u2288\0\u22c9\0\u230a\0\u0186\0\u234b\0\u0186"+ + "\0\u0104\0\u0104\0\u238c\0\u0b6d\0\u0104\0\u23cd\0\u240e\0\u0186"+ + "\0\u0186\0\u0186\0\u244f\0\u2490\0\u24d1\0\u0186\0\u2512\0\u2553"+ + "\0\u0186\0\u0186\0\u0186\0\u2594\0\u0104\0\u25d5\0\u2616\0\u2657"+ + "\0\u0186\0\u0186\0\u2698\0\u0186\0\u26d9\0\u0186"; private static int [] zzUnpackRowMap() { - int [] result = new int[225]; + int [] result = new int[230]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -224,240 +223,250 @@ class _JetLexer implements FlexLexer { "\1\12\1\13\1\14\1\15\1\16\2\7\1\17\1\7"+ "\1\20\1\7\1\21\1\5\1\22\1\7\1\23\1\24"+ "\1\25\1\7\1\26\1\27\1\30\1\31\1\7\1\32"+ - "\1\7\1\33\1\34\1\35\1\36\1\7\1\37\2\7"+ - "\1\40\1\7\1\41\1\42\1\43\1\44\1\45\1\46"+ + "\1\33\1\34\1\35\2\7\1\36\1\37\1\7\1\40"+ + "\1\7\1\41\1\7\1\42\1\43\1\44\1\45\1\46"+ "\1\47\1\50\1\51\1\52\1\53\1\54\1\55\1\56"+ - "\1\57\1\60\1\61\1\62\1\63\1\64\7\65\1\66"+ - "\1\67\13\65\1\70\1\71\52\65\2\0\1\72\1\0"+ - "\1\72\1\0\1\73\6\0\2\72\1\0\1\72\1\0"+ - "\1\72\3\0\1\72\2\0\1\74\25\72\21\0\1\5"+ - "\1\6\1\7\1\10\1\7\1\5\1\11\1\10\1\12"+ - "\1\13\1\14\1\15\1\16\2\7\1\17\1\7\1\20"+ - "\1\7\1\21\1\5\1\22\1\7\1\75\1\76\1\25"+ - "\1\7\1\26\1\27\1\30\1\31\1\7\1\32\1\7"+ - "\1\33\1\34\1\35\1\36\1\7\1\37\2\7\1\40"+ - "\1\7\1\41\1\42\1\43\1\44\1\45\1\46\1\47"+ - "\1\50\1\51\1\52\1\53\1\54\1\55\1\56\1\57"+ - "\1\60\1\61\1\62\1\63\1\64\101\0\1\6\12\0"+ - "\1\6\2\0\1\77\1\100\17\0\1\100\40\0\2\7"+ - "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ - "\3\0\1\7\2\0\26\7\24\0\1\10\3\0\1\10"+ - "\70\0\6\101\2\0\70\101\2\0\1\102\1\0\1\102"+ - "\1\0\1\103\6\0\2\102\1\0\1\102\1\0\1\102"+ - "\3\0\1\102\2\0\26\102\23\0\1\104\1\0\1\104"+ - "\1\0\1\105\2\0\1\106\3\0\2\104\1\0\1\104"+ - "\1\0\1\104\3\0\1\104\2\0\26\104\33\0\1\107"+ - "\1\110\44\0\1\111\77\0\1\112\20\0\1\113\12\0"+ - "\1\113\1\114\1\115\1\77\1\100\17\0\1\100\4\0"+ - "\1\115\33\0\1\116\12\0\1\116\2\0\1\117\101\0"+ - "\1\120\36\0\1\121\3\0\1\122\13\0\7\21\1\0"+ - "\13\21\1\123\1\124\53\21\25\0\1\125\53\0\2\7"+ - "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ - "\3\0\1\7\2\0\1\7\1\126\11\7\1\127\6\7"+ - "\1\130\3\7\22\0\2\7\1\0\2\7\6\0\3\7"+ - "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\3\7"+ - "\1\131\1\132\14\7\1\133\4\7\22\0\2\7\1\0"+ + "\1\57\1\60\1\61\1\62\1\63\1\64\1\65\7\66"+ + "\1\67\1\70\13\66\1\71\1\72\53\66\2\0\1\73"+ + "\1\0\1\73\1\0\1\74\6\0\2\73\1\0\1\73"+ + "\1\0\1\73\3\0\1\73\2\0\1\75\26\73\21\0"+ + "\1\5\1\6\1\7\1\10\1\7\1\5\1\11\1\10"+ + "\1\12\1\13\1\14\1\15\1\16\2\7\1\17\1\7"+ + "\1\20\1\7\1\21\1\5\1\22\1\7\1\76\1\77"+ + "\1\25\1\7\1\26\1\27\1\30\1\31\1\7\1\32"+ + "\1\33\1\34\1\35\2\7\1\36\1\37\1\7\1\40"+ + "\1\7\1\41\1\7\1\42\1\43\1\44\1\45\1\46"+ + "\1\47\1\50\1\51\1\52\1\53\1\54\1\55\1\56"+ + "\1\57\1\60\1\61\1\62\1\63\1\64\1\65\102\0"+ + "\1\6\12\0\1\6\2\0\1\100\1\101\17\0\1\101"+ + "\41\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\3\0\1\7\2\0\27\7\24\0\1\10"+ + "\3\0\1\10\71\0\6\102\2\0\71\102\2\0\1\103"+ + "\1\0\1\103\1\0\1\104\6\0\2\103\1\0\1\103"+ + "\1\0\1\103\3\0\1\103\2\0\27\103\23\0\1\105"+ + "\1\0\1\105\1\0\1\106\2\0\1\107\3\0\2\105"+ + "\1\0\1\105\1\0\1\105\3\0\1\105\2\0\27\105"+ + "\33\0\1\110\1\111\45\0\1\112\100\0\1\113\20\0"+ + "\1\114\12\0\1\114\1\115\1\116\1\100\1\101\17\0"+ + "\1\101\6\0\1\116\32\0\1\117\12\0\1\117\2\0"+ + "\1\120\102\0\1\121\37\0\1\122\3\0\1\123\13\0"+ + "\7\21\1\0\13\21\1\124\1\125\54\21\25\0\1\126"+ + "\54\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\3\0\1\7\2\0\1\7\1\127\13\7"+ + "\1\130\5\7\1\131\3\7\22\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ + "\2\0\3\7\1\132\1\133\15\7\1\134\4\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\3\0\1\135\2\0\27\7\22\0\2\7\1\0"+ "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ - "\1\134\2\0\26\7\22\0\2\7\1\0\2\7\6\0"+ - "\3\7\1\0\1\7\1\0\1\7\3\0\1\135\2\0"+ - "\5\7\1\136\20\7\22\0\2\7\1\0\2\7\6\0"+ - "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ - "\3\7\1\137\22\7\22\0\2\7\1\0\2\7\6\0"+ - "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ - "\17\7\1\140\6\7\22\0\2\7\1\0\2\7\6\0"+ - "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ - "\12\7\1\141\4\7\1\142\6\7\22\0\2\7\1\0"+ + "\1\136\2\0\5\7\1\137\21\7\22\0\2\7\1\0"+ "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ - "\1\7\2\0\14\7\1\143\11\7\22\0\2\7\1\0"+ + "\1\7\2\0\3\7\1\140\23\7\22\0\2\7\1\0"+ "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ - "\1\7\2\0\7\7\1\144\16\7\22\0\2\7\1\0"+ + "\1\7\2\0\21\7\1\141\5\7\22\0\2\7\1\0"+ "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ - "\1\7\2\0\13\7\1\145\12\7\22\0\2\7\1\0"+ + "\1\7\2\0\5\7\1\142\21\7\22\0\2\7\1\0"+ "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ - "\1\7\2\0\1\7\1\146\24\7\22\0\2\7\1\0"+ - "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ - "\1\147\2\0\5\7\1\150\4\7\1\151\13\7\22\0"+ + "\1\7\2\0\12\7\1\143\6\7\1\144\5\7\22\0"+ "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\1\7\1\152\24\7\22\0"+ + "\1\7\3\0\1\7\2\0\16\7\1\145\10\7\22\0"+ "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\5\7\1\153\20\7\22\0"+ + "\1\7\3\0\1\7\2\0\7\7\1\146\17\7\22\0"+ "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\12\7\1\154\13\7\54\0"+ - "\1\155\24\0\1\156\77\0\1\157\3\0\1\160\73\0"+ - "\1\161\1\0\1\162\75\0\1\163\77\0\1\164\104\0"+ - "\1\165\100\0\1\166\71\0\1\167\17\0\7\65\2\0"+ - "\13\65\2\0\52\65\2\0\1\170\1\0\1\170\1\0"+ - "\1\171\6\0\2\170\1\0\1\170\1\0\1\170\3\0"+ - "\1\170\1\172\1\0\26\170\21\0\7\173\1\0\16\173"+ - "\1\174\51\173\1\0\2\72\1\0\2\72\6\0\3\72"+ - "\1\0\1\72\1\0\1\72\3\0\1\72\2\0\26\72"+ - "\21\0\6\175\2\0\70\175\1\0\2\72\1\0\2\72"+ - "\6\0\3\72\1\0\1\72\1\0\1\72\3\0\1\72"+ - "\2\0\1\72\1\176\24\72\22\0\1\116\12\0\1\116"+ - "\2\0\1\177\61\0\1\200\12\0\1\200\4\0\1\200"+ - "\40\0\1\200\15\0\6\101\1\201\1\0\70\101\1\0"+ - "\2\102\1\0\2\102\6\0\3\102\1\0\1\102\1\0"+ - "\1\102\3\0\1\102\2\0\26\102\21\0\6\202\2\0"+ - "\70\202\1\0\2\104\1\0\2\104\6\0\3\104\1\0"+ - "\1\104\1\0\1\104\3\0\1\104\2\0\26\104\21\0"+ - "\6\203\2\0\70\203\7\107\1\0\70\107\13\204\1\205"+ - "\64\204\1\0\1\113\12\0\1\113\2\0\1\206\1\100"+ - "\17\0\1\100\40\0\2\114\11\0\1\114\1\0\1\114"+ - "\1\207\1\114\1\0\1\210\13\0\1\114\1\0\1\114"+ - "\1\210\1\114\2\0\1\114\4\0\1\114\3\0\1\114"+ - "\22\0\1\115\12\0\1\115\2\0\1\211\61\0\1\116"+ - "\12\0\1\116\3\0\1\100\17\0\1\100\37\0\7\21"+ - "\1\0\70\21\25\0\1\212\53\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\2\7\1\213\10\7\1\214\12\7\22\0\2\7"+ - "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ - "\3\0\1\215\2\0\5\7\1\216\14\7\1\217\3\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\10\7\1\220\15\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\10\7\1\221\15\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\17\7\1\222\6\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\6\7\1\223\17\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\26\7\2\0\1\224"+ - "\17\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\3\7\1\225\22\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\4\7\1\226\21\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\5\7\1\227\20\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\15\7\1\230\10\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\1\231\25\7\22\0"+ + "\1\7\3\0\1\7\2\0\15\7\1\147\11\7\22\0"+ "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\7\7\1\232\16\7\22\0"+ + "\1\7\3\0\1\7\2\0\1\7\1\150\25\7\22\0"+ "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\2\7\1\233\4\7\1\234"+ - "\16\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ - "\1\7\1\0\1\7\3\0\1\7\2\0\4\7\1\235"+ - "\21\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ - "\1\7\1\0\1\7\3\0\1\7\2\0\17\7\1\236"+ - "\6\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ - "\1\7\1\0\1\7\3\0\1\7\2\0\13\7\1\237"+ - "\12\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ - "\1\7\1\0\1\7\3\0\1\7\2\0\2\7\1\240"+ - "\23\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ - "\1\7\1\0\1\7\3\0\1\7\2\0\13\7\1\241"+ - "\3\7\1\242\6\7\55\0\1\243\1\244\122\0\1\245"+ - "\77\0\1\246\20\0\2\170\1\0\2\170\6\0\3\170"+ - "\1\0\1\170\1\0\1\170\3\0\1\170\2\0\26\170"+ - "\21\0\6\247\2\0\70\247\1\0\2\250\11\0\1\250"+ - "\1\0\1\250\1\0\1\250\15\0\1\250\1\0\1\250"+ - "\1\0\1\250\2\0\1\250\4\0\1\250\3\0\1\250"+ - "\21\0\6\175\1\251\1\0\70\175\1\0\2\72\1\0"+ - "\2\72\6\0\3\72\1\0\1\72\1\0\1\72\3\0"+ - "\1\72\2\0\2\72\1\252\23\72\22\0\1\200\12\0"+ - "\1\200\63\0\6\202\1\253\1\0\70\202\6\203\1\254"+ - "\1\0\70\203\13\204\1\255\64\204\12\256\1\257\1\205"+ - "\64\256\1\0\1\116\12\0\1\116\64\0\2\260\11\0"+ - "\1\260\1\0\1\260\1\177\1\260\15\0\1\260\1\0"+ - "\1\260\1\0\1\260\2\0\1\260\4\0\1\260\3\0"+ - "\1\260\22\0\1\200\12\0\1\200\4\0\1\261\40\0"+ - "\1\261\34\0\1\177\60\0\25\212\1\262\52\212\1\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\3\7\1\263\22\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\12\7\1\264\13\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\7\7\1\265\16\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\2\7\1\266\23\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\7\7\1\267\16\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\7\7\1\270\16\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\17\7\1\271\6\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\7\7\1\272\16\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\7\7\1\273\16\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\1\274\25\7\22\0\2\7"+ - "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ - "\3\0\1\7\2\0\3\7\1\275\22\7\22\0\2\7"+ - "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ - "\3\0\1\7\2\0\7\7\1\276\16\7\22\0\2\7"+ - "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ - "\3\0\1\277\2\0\26\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\5\7\1\300\20\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\17\7\1\301\6\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\4\7\1\302\21\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\3\7\1\303\22\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\3\7\1\304\22\7\22\0\2\305\1\0\2\305"+ - "\6\0\3\305\1\0\1\305\1\0\1\305\3\0\1\305"+ - "\2\0\26\305\21\0\6\247\1\306\1\0\70\247\1\0"+ - "\2\307\11\0\1\307\1\0\1\307\1\0\1\307\15\0"+ - "\1\307\1\0\1\307\1\0\1\307\2\0\1\307\4\0"+ - "\1\307\3\0\1\307\22\0\2\72\1\0\2\72\6\0"+ - "\3\72\1\0\1\72\1\0\1\72\3\0\1\72\2\0"+ - "\3\72\1\310\22\72\21\0\12\204\1\311\1\255\64\204"+ - "\13\256\1\312\64\256\1\0\2\260\11\0\1\260\1\0"+ - "\1\260\1\0\1\260\1\0\1\210\13\0\1\260\1\0"+ - "\1\260\1\210\1\260\2\0\1\260\4\0\1\260\3\0"+ - "\1\260\21\0\25\212\1\313\52\212\1\0\2\7\1\0"+ - "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ - "\1\7\2\0\16\7\1\314\7\7\22\0\2\7\1\0"+ - "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ - "\1\7\2\0\1\315\25\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\13\7\1\316\12\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\3\7\1\317\22\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\2\7\1\320\23\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\3\7\1\321\22\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\11\7\1\322\14\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\13\7\1\323\12\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\20\7\1\324\5\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\7\7\1\325\16\7\22\0\2\7\1\0\2\7"+ - "\6\0\3\7\1\0\1\7\1\0\1\7\3\0\1\7"+ - "\2\0\7\7\1\326\16\7\22\0\2\327\11\0\1\327"+ - "\1\0\1\327\1\0\1\327\15\0\1\327\1\0\1\327"+ - "\1\0\1\327\2\0\1\327\4\0\1\327\3\0\1\327"+ - "\21\0\12\256\1\257\1\312\64\256\25\212\1\330\52\212"+ - "\1\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\10\7\1\331\15\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\4\7\1\332\21\7"+ - "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ - "\1\0\1\7\3\0\1\7\2\0\1\333\25\7\22\0"+ - "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ - "\1\7\3\0\1\7\2\0\4\7\1\334\21\7\22\0"+ - "\2\173\11\0\1\173\1\0\1\173\1\0\1\173\15\0"+ - "\1\173\1\0\1\173\1\0\1\173\2\0\1\173\4\0"+ - "\1\173\3\0\1\173\22\0\2\7\1\0\2\7\6\0"+ - "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ - "\5\7\1\335\20\7\22\0\2\7\1\0\2\7\6\0"+ - "\3\7\1\0\1\7\1\0\1\7\3\0\1\336\2\0"+ - "\26\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ - "\1\7\1\0\1\7\3\0\1\7\2\0\11\7\1\337"+ + "\1\7\3\0\1\151\2\0\5\7\1\152\4\7\1\153"+ "\14\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ - "\1\7\1\0\1\7\3\0\1\7\2\0\7\7\1\340"+ - "\16\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ - "\1\7\1\0\1\7\3\0\1\7\2\0\7\7\1\341"+ - "\16\7\21\0"; + "\1\7\1\0\1\7\3\0\1\7\2\0\1\7\1\154"+ + "\25\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\5\7\1\155"+ + "\21\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\12\7\1\156"+ + "\14\7\54\0\1\157\25\0\1\160\100\0\1\161\3\0"+ + "\1\162\74\0\1\163\1\0\1\164\76\0\1\165\100\0"+ + "\1\166\105\0\1\167\101\0\1\170\72\0\1\171\17\0"+ + "\7\66\2\0\13\66\2\0\53\66\2\0\1\172\1\0"+ + "\1\172\1\0\1\173\6\0\2\172\1\0\1\172\1\0"+ + "\1\172\3\0\1\172\1\174\1\0\27\172\21\0\7\175"+ + "\1\0\16\175\1\176\52\175\1\0\2\73\1\0\2\73"+ + "\6\0\3\73\1\0\1\73\1\0\1\73\3\0\1\73"+ + "\2\0\27\73\21\0\6\177\2\0\71\177\1\0\2\73"+ + "\1\0\2\73\6\0\3\73\1\0\1\73\1\0\1\73"+ + "\3\0\1\73\2\0\1\73\1\200\25\73\22\0\1\117"+ + "\12\0\1\117\2\0\1\201\62\0\1\202\12\0\1\202"+ + "\4\0\1\202\41\0\1\202\15\0\6\102\1\203\1\0"+ + "\71\102\1\0\2\103\1\0\2\103\6\0\3\103\1\0"+ + "\1\103\1\0\1\103\3\0\1\103\2\0\27\103\21\0"+ + "\6\204\2\0\71\204\1\0\2\105\1\0\2\105\6\0"+ + "\3\105\1\0\1\105\1\0\1\105\3\0\1\105\2\0"+ + "\27\105\21\0\6\205\2\0\71\205\7\110\1\0\71\110"+ + "\13\206\1\207\65\206\1\0\1\114\12\0\1\114\2\0"+ + "\1\210\1\101\17\0\1\101\41\0\2\115\11\0\1\115"+ + "\1\0\1\115\1\211\1\115\1\0\1\212\13\0\1\115"+ + "\1\0\1\115\1\212\1\115\4\0\1\115\3\0\1\115"+ + "\3\0\1\115\22\0\1\116\12\0\1\116\2\0\1\213"+ + "\62\0\1\117\12\0\1\117\3\0\1\101\17\0\1\101"+ + "\40\0\7\21\1\0\71\21\25\0\1\214\54\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\2\7\1\215\12\7\1\216\11\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\3\0\1\217\2\0\5\7\1\220\15\7"+ + "\1\221\3\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\10\7"+ + "\1\222\16\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\10\7"+ + "\1\223\16\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\21\7"+ + "\1\224\5\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\6\7"+ + "\1\225\20\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\27\7"+ + "\2\0\1\226\17\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\3\7"+ + "\1\227\23\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\11\7"+ + "\1\230\15\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\4\7"+ + "\1\231\22\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\5\7"+ + "\1\232\21\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\17\7"+ + "\1\233\7\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\1\234"+ + "\26\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\7\7\1\235"+ + "\17\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\2\7\1\236"+ + "\4\7\1\237\17\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ + "\4\7\1\240\22\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ + "\21\7\1\241\5\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ + "\15\7\1\242\11\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ + "\2\7\1\243\24\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ + "\15\7\1\244\3\7\1\245\5\7\55\0\1\246\1\247"+ + "\124\0\1\250\100\0\1\251\20\0\2\172\1\0\2\172"+ + "\6\0\3\172\1\0\1\172\1\0\1\172\3\0\1\172"+ + "\2\0\27\172\21\0\6\252\2\0\71\252\1\0\2\253"+ + "\11\0\1\253\1\0\1\253\1\0\1\253\15\0\1\253"+ + "\1\0\1\253\1\0\1\253\4\0\1\253\3\0\1\253"+ + "\3\0\1\253\21\0\6\177\1\254\1\0\71\177\1\0"+ + "\2\73\1\0\2\73\6\0\3\73\1\0\1\73\1\0"+ + "\1\73\3\0\1\73\2\0\2\73\1\255\24\73\22\0"+ + "\1\202\12\0\1\202\64\0\6\204\1\256\1\0\71\204"+ + "\6\205\1\257\1\0\71\205\13\206\1\260\65\206\12\261"+ + "\1\262\1\207\65\261\1\0\1\117\12\0\1\117\65\0"+ + "\2\263\11\0\1\263\1\0\1\263\1\201\1\263\15\0"+ + "\1\263\1\0\1\263\1\0\1\263\4\0\1\263\3\0"+ + "\1\263\3\0\1\263\22\0\1\202\12\0\1\202\4\0"+ + "\1\264\41\0\1\264\34\0\1\201\61\0\25\214\1\265"+ + "\53\214\1\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\3\7\1\266"+ + "\23\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\12\7\1\267"+ + "\14\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\7\7\1\270"+ + "\17\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\2\7\1\271"+ + "\24\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\7\7\1\272"+ + "\17\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\7\7\1\273"+ + "\17\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\21\7\1\274"+ + "\5\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\7\7\1\275"+ + "\17\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\7\7\1\276"+ + "\17\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\13\7\1\277"+ + "\13\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\1\300\26\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\3\0\1\7\2\0\3\7\1\301\23\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\3\0\1\7\2\0\7\7\1\302\17\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\3\0\1\303\2\0\27\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\5\7\1\304\21\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\21\7\1\305\5\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\4\7\1\306\22\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\3\7\1\307\23\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\3\7\1\310\23\7\22\0\2\311"+ + "\1\0\2\311\6\0\3\311\1\0\1\311\1\0\1\311"+ + "\3\0\1\311\2\0\27\311\21\0\6\252\1\312\1\0"+ + "\71\252\1\0\2\313\11\0\1\313\1\0\1\313\1\0"+ + "\1\313\15\0\1\313\1\0\1\313\1\0\1\313\4\0"+ + "\1\313\3\0\1\313\3\0\1\313\22\0\2\73\1\0"+ + "\2\73\6\0\3\73\1\0\1\73\1\0\1\73\3\0"+ + "\1\73\2\0\3\73\1\314\23\73\21\0\12\206\1\315"+ + "\1\260\65\206\13\261\1\316\65\261\1\0\2\263\11\0"+ + "\1\263\1\0\1\263\1\0\1\263\1\0\1\212\13\0"+ + "\1\263\1\0\1\263\1\212\1\263\4\0\1\263\3\0"+ + "\1\263\3\0\1\263\21\0\25\214\1\317\53\214\1\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\3\0\1\7\2\0\20\7\1\320\6\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\3\0\1\7\2\0\1\321\26\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\15\7\1\322\11\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\3\7\1\323\23\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\5\7\1\324\21\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\2\7\1\325\24\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\3\7\1\326\23\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\11\7\1\327\15\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\15\7\1\330\11\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\13\7\1\331\13\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\7\7\1\332\17\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\3\0\1\7\2\0\7\7\1\333\17\7\22\0\2\334"+ + "\11\0\1\334\1\0\1\334\1\0\1\334\15\0\1\334"+ + "\1\0\1\334\1\0\1\334\4\0\1\334\3\0\1\334"+ + "\3\0\1\334\21\0\12\261\1\262\1\316\65\261\25\214"+ + "\1\335\53\214\1\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\10\7"+ + "\1\336\16\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\14\7"+ + "\1\337\12\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\4\7"+ + "\1\340\22\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\3\0\1\7\2\0\1\341"+ + "\26\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\3\0\1\7\2\0\4\7\1\342"+ + "\22\7\22\0\2\175\11\0\1\175\1\0\1\175\1\0"+ + "\1\175\15\0\1\175\1\0\1\175\1\0\1\175\4\0"+ + "\1\175\3\0\1\175\3\0\1\175\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ + "\1\7\2\0\5\7\1\343\21\7\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ + "\1\7\2\0\7\7\1\344\17\7\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\3\0"+ + "\1\345\2\0\27\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ + "\11\7\1\337\15\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\3\0\1\7\2\0"+ + "\7\7\1\346\17\7\21\0"; private static int [] zzUnpackTrans() { - int [] result = new int[9536]; + int [] result = new int[10010]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -498,18 +507,18 @@ class _JetLexer implements FlexLexer { private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\4\0\1\11\15\1\2\11\21\1\1\11\6\1\10\11"+ + "\4\0\1\11\15\1\2\11\22\1\1\11\6\1\10\11"+ "\1\1\1\11\1\1\1\0\1\11\1\1\1\0\1\1"+ "\2\11\1\0\1\1\1\0\1\1\1\0\1\1\1\0"+ - "\1\11\2\1\2\11\4\1\5\11\1\1\1\0\27\1"+ + "\1\11\2\1\2\11\4\1\5\11\1\1\1\0\30\1"+ "\1\0\2\1\10\11\1\1\1\0\2\11\1\1\1\0"+ "\1\1\1\11\1\1\1\11\2\0\2\1\4\0\12\1"+ - "\1\11\20\1\2\11\2\0\1\11\1\1\2\11\1\0"+ - "\1\1\1\11\1\1\2\0\22\1\2\11\1\0\1\1"+ - "\1\11\2\0\13\1\1\0\1\11\11\1"; + "\1\11\21\1\2\11\2\0\1\11\1\1\2\11\1\0"+ + "\1\1\1\11\1\1\2\0\23\1\2\11\1\0\1\1"+ + "\1\11\2\0\14\1\1\0\1\11\11\1"; private static int [] zzUnpackAttribute() { - int [] result = new int[225]; + int [] result = new int[230]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -1025,7 +1034,7 @@ class _JetLexer implements FlexLexer { { return JetTokens.MINUSMINUS; } case 142: break; - case 96: + case 97: { return JetTokens.CONTINUE_KEYWORD ; } case 143: break; @@ -1077,7 +1086,7 @@ class _JetLexer implements FlexLexer { { return TokenType.BAD_CHARACTER; } case 155: break; - case 97: + case 96: { return JetTokens.NAMESPACE_KEYWORD ; } case 156: break; diff --git a/compiler/testData/cfg/Basic.instructions b/compiler/testData/cfg/Basic.instructions index 970f555349b..fb9dddf0e69 100644 --- a/compiler/testData/cfg/Basic.instructions +++ b/compiler/testData/cfg/Basic.instructions @@ -121,17 +121,17 @@ sink: NEXT:[] PREV:[] ===================== == flfun == -fun flfun(f : fun () : Any) : Unit {} +fun flfun(f : () -> Any) : Unit {} --------------------- l0: - NEXT:[v(f : fun () : Any)] PREV:[] - v(f : fun () : Any) NEXT:[w(f)] PREV:[] - w(f) NEXT:[read (Unit)] PREV:[v(f : fun () : Any)] - read (Unit) NEXT:[] PREV:[w(f)] + NEXT:[v(f : () -> Any)] PREV:[] + v(f : () -> Any) NEXT:[w(f)] PREV:[] + w(f) NEXT:[read (Unit)] PREV:[v(f : () -> Any)] + read (Unit) NEXT:[] PREV:[w(f)] l1: - NEXT:[] PREV:[read (Unit)] + NEXT:[] PREV:[read (Unit)] error: - NEXT:[] PREV:[] + NEXT:[] PREV:[] sink: - NEXT:[] PREV:[] + NEXT:[] PREV:[] ===================== diff --git a/compiler/testData/cfg/Basic.jet b/compiler/testData/cfg/Basic.jet index 870c40513a0..f71bf2fd807 100644 --- a/compiler/testData/cfg/Basic.jet +++ b/compiler/testData/cfg/Basic.jet @@ -20,4 +20,4 @@ fun foo(a : Boolean, b : Int) : Unit {} fun genfun() : Unit {} -fun flfun(f : fun () : Any) : Unit {} \ No newline at end of file +fun flfun(f : () -> Any) : Unit {} \ No newline at end of file diff --git a/compiler/testData/codegen/PSVM.jet b/compiler/testData/codegen/PSVM.jet index dcef3d78bf1..a53f9b5a26f 100644 --- a/compiler/testData/codegen/PSVM.jet +++ b/compiler/testData/codegen/PSVM.jet @@ -1,4 +1,4 @@ -namespace foo; +package foo; fun main(args : Array) { diff --git a/compiler/testData/codegen/classes/closureWithParameter.jet b/compiler/testData/codegen/classes/closureWithParameter.jet index 0c556d628c1..e0b5d616951 100644 --- a/compiler/testData/codegen/classes/closureWithParameter.jet +++ b/compiler/testData/codegen/classes/closureWithParameter.jet @@ -1,7 +1,7 @@ fun box() : String { - return apply( "OK", {(arg: String) => arg } ) + return apply( "OK", {(arg: String) -> arg } ) } -fun apply(arg : String, f : fun (p:String) : String) : String { +fun apply(arg : String, f : (p:String) -> String) : String { return f(arg) } diff --git a/compiler/testData/codegen/classes/closureWithParameterAndBoxing.jet b/compiler/testData/codegen/classes/closureWithParameterAndBoxing.jet index 6d0a4ffa658..2b64a547d29 100644 --- a/compiler/testData/codegen/classes/closureWithParameterAndBoxing.jet +++ b/compiler/testData/codegen/classes/closureWithParameterAndBoxing.jet @@ -1,7 +1,7 @@ fun box() : String { - return if (apply( 5, {(arg: Int) => arg + 13 } ) == 18) "OK" else "fail" + return if (apply( 5, {(arg: Int) -> arg + 13 } ) == 18) "OK" else "fail" } -fun apply(arg : Int, f : fun (p:Int) : Int) : Int { +fun apply(arg : Int, f : (p:Int) -> Int) : Int { return f(arg) } diff --git a/compiler/testData/codegen/classes/doubleEnclosedLocalVariable.jet b/compiler/testData/codegen/classes/doubleEnclosedLocalVariable.jet index d8e5ea789f2..96ac7f2ef19 100644 --- a/compiler/testData/codegen/classes/doubleEnclosedLocalVariable.jet +++ b/compiler/testData/codegen/classes/doubleEnclosedLocalVariable.jet @@ -3,6 +3,6 @@ fun box() : String { return if (sum(200, { val ff = {cl}; ff() }) == 239) "OK" else "FAIL" } -fun sum(arg:Int, f : fun () : Int) : Int { +fun sum(arg:Int, f : () -> Int) : Int { return arg + f() } diff --git a/compiler/testData/codegen/classes/enclosingLocalVariable.jet b/compiler/testData/codegen/classes/enclosingLocalVariable.jet index d2dbe243469..01e1a103ff2 100644 --- a/compiler/testData/codegen/classes/enclosingLocalVariable.jet +++ b/compiler/testData/codegen/classes/enclosingLocalVariable.jet @@ -3,6 +3,6 @@ fun box() : String { return if (sum(200, { val m = { val r = { cl }; r() }; m() }) == 239) "OK" else "FAIL" } -fun sum(arg:Int, f : fun () : Int) : Int { +fun sum(arg:Int, f : () -> Int) : Int { return arg + f() } diff --git a/compiler/testData/codegen/classes/enclosingThis.jet b/compiler/testData/codegen/classes/enclosingThis.jet index 93ae48c580f..d227b3a2cc9 100644 --- a/compiler/testData/codegen/classes/enclosingThis.jet +++ b/compiler/testData/codegen/classes/enclosingThis.jet @@ -1,10 +1,10 @@ class Point(val x:Int, val y:Int) { - fun mul() : fun (scalar:Int):Point { - return { (scalar:Int):Point => Point(x * scalar, y * scalar) } + fun mul() : (scalar:Int)->Point { + return { (scalar:Int):Point -> Point(x * scalar, y * scalar) } } } -val m = Point(2, 3).mul() : fun (scalar:Int):Point +val m = Point(2, 3).mul() : (scalar:Int)->Point fun box() : String { val answer = m(5) diff --git a/compiler/testData/codegen/classes/extensionClosure.jet b/compiler/testData/codegen/classes/extensionClosure.jet index 11fd11b3816..21307ea42ab 100644 --- a/compiler/testData/codegen/classes/extensionClosure.jet +++ b/compiler/testData/codegen/classes/extensionClosure.jet @@ -1,13 +1,13 @@ class Point(val x : Int, val y : Int) fun box() : String { - val answer = apply(Point(3, 5), { Point.(scalar : Int) : Point => + val answer = apply(Point(3, 5), { Point.(scalar : Int) : Point -> Point(x * scalar, y * scalar) }) return if (answer.x == 6 && answer.y == 10) "OK" else "FAIL" } -fun apply(arg:Point, f : fun Point.(scalar : Int) : Point) : Point { +fun apply(arg:Point, f : Point.(scalar : Int) -> Point) : Point { return arg.f(2) } diff --git a/compiler/testData/codegen/classes/simplestClosure.jet b/compiler/testData/codegen/classes/simplestClosure.jet index c851416e4f1..7a9f3b439cf 100644 --- a/compiler/testData/codegen/classes/simplestClosure.jet +++ b/compiler/testData/codegen/classes/simplestClosure.jet @@ -2,6 +2,6 @@ fun box() : String { return invoker( {"OK"} ) } -fun invoker(gen : fun () : String) : String { +fun invoker(gen : () -> String) : String { return gen() } diff --git a/compiler/testData/codegen/classes/simplestClosureAndBoxing.jet b/compiler/testData/codegen/classes/simplestClosureAndBoxing.jet index 8e3bedb2f37..50f22fbeb8d 100644 --- a/compiler/testData/codegen/classes/simplestClosureAndBoxing.jet +++ b/compiler/testData/codegen/classes/simplestClosureAndBoxing.jet @@ -2,6 +2,6 @@ fun box() : String { return if (int_invoker( { 7 } ) == 7) "OK" else "fail" } -fun int_invoker(gen : fun () : Int) : Int { +fun int_invoker(gen : () -> Int) : Int { return gen() } diff --git a/compiler/testData/codegen/controlStructures/sync.jet b/compiler/testData/codegen/controlStructures/sync.jet index 408db40ca36..6af5e9af150 100644 --- a/compiler/testData/codegen/controlStructures/sync.jet +++ b/compiler/testData/codegen/controlStructures/sync.jet @@ -1,7 +1,7 @@ import java.util.concurrent.* import java.util.concurrent.atomic.* -fun thread(block: fun():Unit ) { +fun thread(block: ()->Unit ) { val thread = object: Thread() { override fun run() { block() diff --git a/compiler/testData/codegen/extensionFunctions/generic.jet b/compiler/testData/codegen/extensionFunctions/generic.jet index fdc73cc4e0e..5b27d7fb271 100644 --- a/compiler/testData/codegen/extensionFunctions/generic.jet +++ b/compiler/testData/codegen/extensionFunctions/generic.jet @@ -1,6 +1,6 @@ import java.util.* -fun ArrayList.findAll(predicate: fun (T) : Boolean): ArrayList { +fun ArrayList.findAll(predicate: (T) -> Boolean): ArrayList { val result = ArrayList() for(val t in this) { if (predicate(t)) result.add(t) @@ -16,6 +16,6 @@ fun box(): String { list.add("Moscow") list.add("Munich") - val m: ArrayList = list.findAll({(name: String) => name.startsWith("M")}) + val m: ArrayList = list.findAll({(name: String) -> name.startsWith("M")}) return if (m.size() == 2) "OK" else "fail" } diff --git a/compiler/testData/codegen/extensionFunctions/shared.kt b/compiler/testData/codegen/extensionFunctions/shared.kt index 216ba549ba3..977376ca391 100644 --- a/compiler/testData/codegen/extensionFunctions/shared.kt +++ b/compiler/testData/codegen/extensionFunctions/shared.kt @@ -2,7 +2,7 @@ fun T.mustBe(t : T) { assert("$this must be $t") {this == t} } -inline fun assert(message : String, condition : fun() : Boolean) { +inline fun assert(message : String, condition : () -> Boolean) { if (!condition()) throw AssertionError(message) } diff --git a/compiler/testData/codegen/extensionFunctions/virtual.jet b/compiler/testData/codegen/extensionFunctions/virtual.jet index 18a774867ac..cc8a6a72f1a 100644 --- a/compiler/testData/codegen/extensionFunctions/virtual.jet +++ b/compiler/testData/codegen/extensionFunctions/virtual.jet @@ -3,7 +3,7 @@ class Request(val path: String) { } class Handler() { - fun Int.times(op: fun(): Unit) { + fun Int.times(op: ()-> Unit) { for(i in 0..this) op() } diff --git a/compiler/testData/codegen/extensionFunctions/whenFail.jet b/compiler/testData/codegen/extensionFunctions/whenFail.jet index 94f1e1492e4..bc38886f110 100644 --- a/compiler/testData/codegen/extensionFunctions/whenFail.jet +++ b/compiler/testData/codegen/extensionFunctions/whenFail.jet @@ -8,7 +8,7 @@ fun StringBuilder.takeFirst(): Char { fun foo(expr: StringBuilder): Int { val c = expr.takeFirst() when(c) { - 0.chr => throw Exception("zero") - else => throw Exception("nonzero" + c) + 0.chr -> throw Exception("zero") + else -> throw Exception("nonzero" + c) } } diff --git a/compiler/testData/codegen/functions/defaultargs.jet b/compiler/testData/codegen/functions/defaultargs.jet index 137e1b3be9e..4278ca81773 100644 --- a/compiler/testData/codegen/functions/defaultargs.jet +++ b/compiler/testData/codegen/functions/defaultargs.jet @@ -5,7 +5,7 @@ fun reformat( divideByCamelHumps : Boolean = true, wordSeparator : String = " " ) = - (normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator) + #(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator) trait A { fun bar2(arg: Int = 239) : Int @@ -38,7 +38,7 @@ class C() : B() { fun T.toPrefixedString(prefix: String = "", suffix: String="") = prefix + (this as java.lang.Object).toString() + suffix fun box() : String { - val expected = (true, true, true, " ") + val expected = #(true, true, true, " ") if("mama".toPrefixedString(suffix="321", prefix="papa") != "papamama321") return "fail" if("mama".toPrefixedString(prefix="papa") != "papamama") return "fail" diff --git a/compiler/testData/codegen/functions/functionExpression.jet b/compiler/testData/codegen/functions/functionExpression.jet index 6e9611f2441..aaeadaf0c56 100644 --- a/compiler/testData/codegen/functions/functionExpression.jet +++ b/compiler/testData/codegen/functions/functionExpression.jet @@ -1,24 +1,24 @@ -fun Any.foo1() : fun(): String { +fun Any.foo1() : ()-> String { return { "239" + this } } -fun Int.foo2() : fun(i : Int) : Int { - return { x => x + this } +fun Int.foo2() : (i : Int) -> Int { + return { x -> x + this } } fun fooT1(t : T) = { t.toString() } -fun fooT2(t: T) = { (x:T) => t.toString() + x.toString() } +fun fooT2(t: T) = { (x:T) -> t.toString() + x.toString() } fun box() : String { if( (10.foo1())() != "23910") return "foo1 fail" if( (10.foo2())(1) != 11 ) return "foo2 fail" - if(1.{Int.() => this + 1}() != 2) return "test 3 failed"; + if(1.{Int.() -> this + 1}() != 2) return "test 3 failed"; if( {1}() != 1) return "test 4 failed"; - if( {(x : Int) => x}(1) != 1) return "test 5 failed"; - if( 1.{Int.(x : Int) => x + this}(1) != 2) return "test 6 failed"; - if( 1.({Int.() => this})() != 1) return "test 7 failed"; + if( {(x : Int) -> x}(1) != 1) return "test 5 failed"; + if( 1.{Int.(x : Int) -> x + this}(1) != 2) return "test 6 failed"; + if( 1.({Int.() -> this})() != 1) return "test 7 failed"; if( (fooT1("mama"))() != "mama") return "test 8 failed"; if( (fooT2("mama"))("papa") != "mamapapa") return "test 9 failed"; return "OK" diff --git a/compiler/testData/codegen/functions/nothisnoclosure.jet b/compiler/testData/codegen/functions/nothisnoclosure.jet index a53afefb72e..3c7b59679f2 100644 --- a/compiler/testData/codegen/functions/nothisnoclosure.jet +++ b/compiler/testData/codegen/functions/nothisnoclosure.jet @@ -1,6 +1,6 @@ fun loop(var times : Int) { while(times > 0) { - val u : fun(value : Int) : Unit = { + val u : (value : Int) -> Unit = { System.out?.println(it) } u(times--) diff --git a/compiler/testData/codegen/functions/withtypeparams.jet b/compiler/testData/codegen/functions/withtypeparams.jet index 291ebe1c04b..b88aad83cfb 100644 --- a/compiler/testData/codegen/functions/withtypeparams.jet +++ b/compiler/testData/codegen/functions/withtypeparams.jet @@ -1,5 +1,5 @@ class X () { - fun getTypeChecker() = { (a : Any) => a is T } + fun getTypeChecker() = { (a : Any) -> a is T } } fun box() : String { diff --git a/compiler/testData/codegen/namespaceQualifiedMethod.jet b/compiler/testData/codegen/namespaceQualifiedMethod.jet index b532836e3e2..0a8dd2c6f87 100644 --- a/compiler/testData/codegen/namespaceQualifiedMethod.jet +++ b/compiler/testData/codegen/namespaceQualifiedMethod.jet @@ -1,4 +1,4 @@ -namespace Foo { +package Foo { fun bar() = 610 } diff --git a/compiler/testData/codegen/patternMatching/constant.jet b/compiler/testData/codegen/patternMatching/constant.jet index a6af8ca9236..e74aa2568a2 100644 --- a/compiler/testData/codegen/patternMatching/constant.jet +++ b/compiler/testData/codegen/patternMatching/constant.jet @@ -1,4 +1,4 @@ fun isZero(x: Int) = when(x) { - 0 => true - else => false + 0 -> true + else -> false } diff --git a/compiler/testData/codegen/patternMatching/exceptionOnNoMatch.jet b/compiler/testData/codegen/patternMatching/exceptionOnNoMatch.jet index b8d62ebe77e..f5e668b9faf 100644 --- a/compiler/testData/codegen/patternMatching/exceptionOnNoMatch.jet +++ b/compiler/testData/codegen/patternMatching/exceptionOnNoMatch.jet @@ -1,3 +1,3 @@ fun isZero(x: Int) = when(x) { - 0 => true + 0 -> true } diff --git a/compiler/testData/codegen/patternMatching/is.jet b/compiler/testData/codegen/patternMatching/is.jet index 9fac50c586b..4c8a88fce5c 100644 --- a/compiler/testData/codegen/patternMatching/is.jet +++ b/compiler/testData/codegen/patternMatching/is.jet @@ -1,7 +1,7 @@ fun typeName(a: Any?) : String { return when(a) { - is java.util.ArrayList<*> => "array list" - else => "no idea" + is java.util.ArrayList<*> -> "array list" + else -> "no idea" } } diff --git a/compiler/testData/codegen/patternMatching/pattern.jet b/compiler/testData/codegen/patternMatching/pattern.jet index 25f8167886a..e87965a0fc8 100644 --- a/compiler/testData/codegen/patternMatching/pattern.jet +++ b/compiler/testData/codegen/patternMatching/pattern.jet @@ -1,4 +1,4 @@ fun isString(x: Any) = when(x) { - is String => "string" - else => "something" + is String -> "string" + else -> "something" } diff --git a/compiler/testData/codegen/patternMatching/range.jet b/compiler/testData/codegen/patternMatching/range.jet index 5010f350b68..f1200c681e0 100644 --- a/compiler/testData/codegen/patternMatching/range.jet +++ b/compiler/testData/codegen/patternMatching/range.jet @@ -3,9 +3,9 @@ fun isDigit(a: Int) : String { aa.add(239) return when(a) { - in aa => "array list" - in 0..9 => "digit" - !in 0..100 => "not small" - else => "something" + in aa -> "array list" + in 0..9 -> "digit" + !in 0..100 -> "not small" + else -> "something" } } diff --git a/compiler/testData/codegen/patternMatching/rangeChar.jet b/compiler/testData/codegen/patternMatching/rangeChar.jet index 744855a20eb..7ab6b77512f 100644 --- a/compiler/testData/codegen/patternMatching/rangeChar.jet +++ b/compiler/testData/codegen/patternMatching/rangeChar.jet @@ -1,4 +1,4 @@ fun isDigit(a: Char) = when(a) { - in '0'..'9' => "digit" - else => "something" + in '0'..'9' -> "digit" + else -> "something" } diff --git a/compiler/testData/codegen/regressions/kt237.jet b/compiler/testData/codegen/regressions/kt237.jet index aaa60b5904f..c82ae4277a9 100644 --- a/compiler/testData/codegen/regressions/kt237.jet +++ b/compiler/testData/codegen/regressions/kt237.jet @@ -1,11 +1,11 @@ fun main(args: Array?) { - val y: Unit = () //do not compile + val y: Unit = #() //do not compile A() //do not compile - C(()) //do not compile + C(#()) //do not compile //do not compile - System.out?.println(fff(())) //do not compile + System.out?.println(fff(#())) //do not compile System.out?.println(id(y)) //do not compile - System.out?.println(fff(id(y)) == id(foreach(Array(0,{0}),{(e : Int) : Unit => }))) //do not compile + System.out?.println(fff(id(y)) == id(foreach(Array(0,{0}),{(e : Int) : Unit -> }))) //do not compile } class A() @@ -17,13 +17,13 @@ fun fff(x: T) : T { return x } fun id(value: T): T = value -fun foreach(array: Array?, action: fun(Int): Unit) { +fun foreach(array: Array?, action: (Int)-> Unit) { for (el in array) { action(el) //exception through compilation (see below) } } -fun almostFilter(array: Array, action: fun(Int): Int) { +fun almostFilter(array: Array, action: (Int)-> Int) { for (el in array) { action(el) } @@ -34,8 +34,8 @@ fun box() : String { a[0] = 0 a[1] = 1 a[2] = 2 - foreach(a, { (el : Int) : Unit => System.out?.println(el) }) - almostFilter(a, { (el : Int) : Int => el }) + foreach(a, { (el : Int) : Unit -> System.out?.println(el) }) + almostFilter(a, { (el : Int) : Int -> el }) main(null) return "OK" } \ No newline at end of file diff --git a/compiler/testData/codegen/regressions/kt249.jet b/compiler/testData/codegen/regressions/kt249.jet index bf15ae39c99..e4906c74b27 100644 --- a/compiler/testData/codegen/regressions/kt249.jet +++ b/compiler/testData/codegen/regressions/kt249.jet @@ -1,4 +1,4 @@ -namespace x +package x class Outer() { class object { diff --git a/compiler/testData/codegen/regressions/kt326.jet b/compiler/testData/codegen/regressions/kt326.jet index 3d9b4ad8e54..09ab793d03c 100644 --- a/compiler/testData/codegen/regressions/kt326.jet +++ b/compiler/testData/codegen/regressions/kt326.jet @@ -1,4 +1,4 @@ -namespace test +package test class List(len: Int) { val a : Array = Array(len) diff --git a/compiler/testData/codegen/regressions/kt343.jet b/compiler/testData/codegen/regressions/kt343.jet index 49a8dc9c487..1820bbe0ffb 100644 --- a/compiler/testData/codegen/regressions/kt343.jet +++ b/compiler/testData/codegen/regressions/kt343.jet @@ -1,12 +1,12 @@ import java.util.ArrayList -fun launch(f : fun() : Unit) { +fun launch(f : () -> Unit) { f() } fun box(): String { val list = ArrayList() - val foo : fun() : Unit = { + val foo : () -> Unit = { list.add(2) //first exception } foo() diff --git a/compiler/testData/codegen/regressions/kt344.jet b/compiler/testData/codegen/regressions/kt344.jet index 39a8f550b74..c48a17af8e2 100644 --- a/compiler/testData/codegen/regressions/kt344.jet +++ b/compiler/testData/codegen/regressions/kt344.jet @@ -27,7 +27,7 @@ fun t1() : Boolean { x = x + "45" + y x = x.substring(3) x += "aaa" - () + #() } foo() @@ -43,7 +43,7 @@ fun t2() : Boolean { x = x + 5 + y x += 5 x++ - () + #() } foo() x -= 55 @@ -55,7 +55,7 @@ fun t3() : Boolean { var x = true val foo = { x = false - () + #() } foo() return !x @@ -67,7 +67,7 @@ fun t4() : Boolean { val foo = { x = x + 200.flt + y x += 18 - () + #() } foo() System.out?.println(x) @@ -80,7 +80,7 @@ fun t5() : Boolean { val foo = { x = x + 200.dbl + y x -= 22 - () + #() } foo() System.out?.println(x) @@ -94,7 +94,7 @@ fun t6() : Boolean { x = (x + 20.byt + y).byt x += 2 x-- - () + #() } foo() System.out?.println(x) @@ -105,7 +105,7 @@ fun t7() : Boolean { var x : Char = 'a' val foo = { x = 'b' - () + #() } foo() System.out?.println(x) @@ -117,10 +117,10 @@ fun t8() : Boolean { val foo = { val bar = { x = 30.sht - () + #() } bar() - () + #() } foo() return x == 30.sht diff --git a/compiler/testData/codegen/regressions/kt395.jet b/compiler/testData/codegen/regressions/kt395.jet index 1febc10ffc5..11f1deb9334 100644 --- a/compiler/testData/codegen/regressions/kt395.jet +++ b/compiler/testData/codegen/regressions/kt395.jet @@ -1,6 +1,6 @@ -fun Any.with(operation : fun Any.() : Any) = operation().toString() +fun Any.with(operation : Any.() -> Any) = operation().toString() -val f = { (a : Int) :Unit => } +val f = { (a : Int) :Unit -> } fun box () : String { return if(20.with { diff --git a/compiler/testData/codegen/regressions/kt508.jet b/compiler/testData/codegen/regressions/kt508.jet index 088bd1fd6bd..134aa72670b 100644 --- a/compiler/testData/codegen/regressions/kt508.jet +++ b/compiler/testData/codegen/regressions/kt508.jet @@ -1,4 +1,4 @@ -namespace mult_constructors_3_bug +package mult_constructors_3_bug public open class Identifier() { private var myNullable : Boolean = true diff --git a/compiler/testData/codegen/regressions/kt511.jet b/compiler/testData/codegen/regressions/kt511.jet index a9bc915346c..0fe6d87cc32 100644 --- a/compiler/testData/codegen/regressions/kt511.jet +++ b/compiler/testData/codegen/regressions/kt511.jet @@ -1,4 +1,4 @@ -namespace one_extends_base +package one_extends_base open class Base(name : T?) { var myName : T? diff --git a/compiler/testData/codegen/regressions/kt528.kt b/compiler/testData/codegen/regressions/kt528.kt index 8cfe1707aee..d656fb2f6f7 100644 --- a/compiler/testData/codegen/regressions/kt528.kt +++ b/compiler/testData/codegen/regressions/kt528.kt @@ -1,4 +1,4 @@ -namespace mask +package mask import std.io.* import java.io.* @@ -52,7 +52,7 @@ class Luhny() { fun check() { if (digits.size() < 14) return print("check") - val sum = digits.sum { i, d => + val sum = digits.sum { i, d -> // println("$i -> $d") if (i % 2 == digits.size()) { val f = d * 2 / 10 @@ -94,12 +94,12 @@ class Luhny() { } } -fun T.pr(f : fun(T) : Unit) : T { +fun T.pr(f : (T) -> Unit) : T { f(this) return this } -fun LinkedList.sum(f : fun(Int, Int ): Int): Int { +fun LinkedList.sum(f : (Int, Int )-> Int): Int { var sum = 0 for (i in 1..size()) { val j = size() - i @@ -120,7 +120,7 @@ fun LinkedList.sum(f : fun(Int, Int ): Int): Int { fun Char.isDigit() = Character.isDigit(this) -fun Reader.forEachChar(body : fun(Char) : Unit) { +fun Reader.forEachChar(body : (Char) -> Unit) { do { var i = read(); if (i == -1) break diff --git a/compiler/testData/codegen/regressions/kt529.kt b/compiler/testData/codegen/regressions/kt529.kt index 84a6d3edc52..546a345b1c7 100644 --- a/compiler/testData/codegen/regressions/kt529.kt +++ b/compiler/testData/codegen/regressions/kt529.kt @@ -1,4 +1,4 @@ -namespace mask +package mask import std.io.* import java.io.* @@ -46,7 +46,7 @@ class Luhny() { private fun check() { val size = digits.size() if (size < 14) return - val sum = digits.sum {i, d => + val sum = digits.sum {i, d -> if (i % 2 == size % 2) double(d) else d } // var sum = 0 @@ -89,7 +89,7 @@ class Luhny() { fun Char.isDigit() = Character.isDigit(this) -fun java.lang.Iterable.sum(f : fun(index : Int, value : Int) : Int) : Int { +fun java.lang.Iterable.sum(f : (index : Int, value : Int) -> Int) : Int { var sum = 0 var i = 0 for (d in this) { @@ -99,7 +99,7 @@ fun java.lang.Iterable.sum(f : fun(index : Int, value : Int) : Int) : Int { return sum } -fun Reader.forEachChar(body : fun(Char) : Unit) { +fun Reader.forEachChar(body : (Char) -> Unit) { do { var i = read(); if (i == -1) break diff --git a/compiler/testData/codegen/regressions/kt533.kt b/compiler/testData/codegen/regressions/kt533.kt index 7e7ef961ffd..3ad813a6e0b 100644 --- a/compiler/testData/codegen/regressions/kt533.kt +++ b/compiler/testData/codegen/regressions/kt533.kt @@ -1,4 +1,4 @@ -namespace mask +package mask import std.io.* import java.io.* @@ -50,7 +50,7 @@ class Luhny() { fun check() { if (digits.size() < 14) return - val sum = digits.sum { i, d => + val sum = digits.sum { i, d -> if (i % 2 != 0) d * 2 / 10 + d * 2 % 10 else d @@ -85,7 +85,7 @@ class Luhny() { } } -fun LinkedList.sum(f : fun(Int, Int) : Int) : Int { +fun LinkedList.sum(f : (Int, Int) -> Int) : Int { var sum = 0 var i = 0 for (d in backwards()) { @@ -136,7 +136,7 @@ fun Char.isDigit() = Character.isDigit(this) // fun clear() {} //} -fun Reader.forEachChar(body : fun(Char) : Unit) { +fun Reader.forEachChar(body : (Char) -> Unit) { do { var i = read(); if (i == -1) break diff --git a/compiler/testData/codegen/regressions/kt560.jet b/compiler/testData/codegen/regressions/kt560.jet index 630cf37d654..cb3944e1f27 100644 --- a/compiler/testData/codegen/regressions/kt560.jet +++ b/compiler/testData/codegen/regressions/kt560.jet @@ -1,4 +1,4 @@ -namespace while_bug_1 +package while_bug_1 import java.io.* diff --git a/compiler/testData/codegen/regressions/kt581.jet b/compiler/testData/codegen/regressions/kt581.jet index 0f8d7162122..4480994e57e 100644 --- a/compiler/testData/codegen/regressions/kt581.jet +++ b/compiler/testData/codegen/regressions/kt581.jet @@ -1,4 +1,4 @@ -namespace whats.the.difference +package whats.the.difference import java.util.HashSet diff --git a/compiler/testData/codegen/regressions/kt594.jet b/compiler/testData/codegen/regressions/kt594.jet index 70d94715100..93c5580e600 100644 --- a/compiler/testData/codegen/regressions/kt594.jet +++ b/compiler/testData/codegen/regressions/kt594.jet @@ -1,4 +1,4 @@ -namespace array_test +package array_test fun box() : String { var array : IntArray? = IntArray(10) diff --git a/compiler/testData/codegen/regressions/kt613.jet b/compiler/testData/codegen/regressions/kt613.jet index 463b77aa909..b35b35959a4 100644 --- a/compiler/testData/codegen/regressions/kt613.jet +++ b/compiler/testData/codegen/regressions/kt613.jet @@ -1,4 +1,4 @@ -namespace name +package name class Test() { var i = 5 diff --git a/compiler/testData/codegen/regressions/kt640.jet b/compiler/testData/codegen/regressions/kt640.jet index 705fc1f338c..4171c7419c5 100644 --- a/compiler/testData/codegen/regressions/kt640.jet +++ b/compiler/testData/codegen/regressions/kt640.jet @@ -1,4 +1,4 @@ -namespace demo +package demo public open class Identifier(myName : T?, myHasDollar : Boolean) { { diff --git a/compiler/testData/codegen/regressions/kt684.jet b/compiler/testData/codegen/regressions/kt684.jet index 41048cec7c5..21fb4860c63 100644 --- a/compiler/testData/codegen/regressions/kt684.jet +++ b/compiler/testData/codegen/regressions/kt684.jet @@ -1,8 +1,8 @@ fun escapeChar(c : Char) : String? = when (c) { - '\\' => "\\\\" - '\n' => "\\n" - '"' => "\\\"" - else => String.valueOf(c) + '\\' -> "\\\\" + '\n' -> "\\n" + '"' -> "\\\"" + else -> String.valueOf(c) } fun String.escape(i : Int = 0, result : String = "") : String = diff --git a/compiler/testData/codegen/regressions/kt694.jet b/compiler/testData/codegen/regressions/kt694.jet index 698558d3642..f45c6815711 100644 --- a/compiler/testData/codegen/regressions/kt694.jet +++ b/compiler/testData/codegen/regressions/kt694.jet @@ -1,4 +1,4 @@ -namespace org2 +package org2 enum class Test { A diff --git a/compiler/testData/codegen/regressions/kt707.jet b/compiler/testData/codegen/regressions/kt707.jet index 47d245455aa..a12afa2b3cd 100644 --- a/compiler/testData/codegen/regressions/kt707.jet +++ b/compiler/testData/codegen/regressions/kt707.jet @@ -1,6 +1,6 @@ class List(val head: T, val tail: List? = null) -fun List.mapHead(f: fun(T): T): List = List(f(head), null) +fun List.mapHead(f: (T)-> T): List = List(f(head), null) fun box() : String { val a: Int = List(1).mapHead{it * 2}.head diff --git a/compiler/testData/codegen/regressions/kt752.jet b/compiler/testData/codegen/regressions/kt752.jet index 20132c9f6a8..2f6ab3d7d69 100644 --- a/compiler/testData/codegen/regressions/kt752.jet +++ b/compiler/testData/codegen/regressions/kt752.jet @@ -1,4 +1,4 @@ -namespace demo_range +package demo_range fun Int?.rangeTo(other : Int?) : IntRange = this.sure().rangeTo(other.sure()) diff --git a/compiler/testData/codegen/regressions/kt753.jet b/compiler/testData/codegen/regressions/kt753.jet index a1b81de8138..75a54b5ca33 100644 --- a/compiler/testData/codegen/regressions/kt753.jet +++ b/compiler/testData/codegen/regressions/kt753.jet @@ -1,4 +1,4 @@ -namespace bitwise_demo +package bitwise_demo fun Long?.shl(bits : Int?) : Long = this.sure().shl(bits.sure()) diff --git a/compiler/testData/codegen/regressions/kt756.jet b/compiler/testData/codegen/regressions/kt756.jet index 4cff1aecd11..e47c2612f1f 100644 --- a/compiler/testData/codegen/regressions/kt756.jet +++ b/compiler/testData/codegen/regressions/kt756.jet @@ -1,4 +1,4 @@ -namespace demo_range +package demo_range fun Int?.plus() : Int = this.sure().plus() fun Int?.dec() : Int = this.sure().dec() diff --git a/compiler/testData/codegen/regressions/kt757.jet b/compiler/testData/codegen/regressions/kt757.jet index 8ddfb3d879a..925391944fb 100644 --- a/compiler/testData/codegen/regressions/kt757.jet +++ b/compiler/testData/codegen/regressions/kt757.jet @@ -1,4 +1,4 @@ -namespace demo_long +package demo_long fun Long?.inv() : Long = this.sure().inv() diff --git a/compiler/testData/codegen/regressions/kt769.jet b/compiler/testData/codegen/regressions/kt769.jet index 266af79d867..0bfe012e7be 100644 --- a/compiler/testData/codegen/regressions/kt769.jet +++ b/compiler/testData/codegen/regressions/kt769.jet @@ -1,10 +1,10 @@ -namespace w_range +package w_range fun box() : String { var i = 0 when (i) { - 1 => i-- - else => { i = 2 } + 1 -> i-- + else -> { i = 2 } } System.out?.println(i) return "OK" diff --git a/compiler/testData/codegen/regressions/kt772.jet b/compiler/testData/codegen/regressions/kt772.jet index 6cad8d6ae03..bb45a0c94d1 100644 --- a/compiler/testData/codegen/regressions/kt772.jet +++ b/compiler/testData/codegen/regressions/kt772.jet @@ -1,18 +1,18 @@ -namespace demo2 +package demo2 fun print(o : Any?) {} fun test(i : Int) { var monthString : String? = "" when (i) { - 1 => { + 1 -> { print(1) print(2) print(3) print(4) print(5) } - else => { + else -> { monthString = "Invalid month" } } diff --git a/compiler/testData/codegen/regressions/kt773.jet b/compiler/testData/codegen/regressions/kt773.jet index 6cad8d6ae03..bb45a0c94d1 100644 --- a/compiler/testData/codegen/regressions/kt773.jet +++ b/compiler/testData/codegen/regressions/kt773.jet @@ -1,18 +1,18 @@ -namespace demo2 +package demo2 fun print(o : Any?) {} fun test(i : Int) { var monthString : String? = "" when (i) { - 1 => { + 1 -> { print(1) print(2) print(3) print(4) print(5) } - else => { + else -> { monthString = "Invalid month" } } diff --git a/compiler/testData/codegen/regressions/kt785.jet b/compiler/testData/codegen/regressions/kt785.jet index 1b10c8c73d7..add8bb72789 100644 --- a/compiler/testData/codegen/regressions/kt785.jet +++ b/compiler/testData/codegen/regressions/kt785.jet @@ -1,7 +1,7 @@ class A() { var x : Int = 0 - var z = { () => + var z = { () -> x++ } } diff --git a/compiler/testData/codegen/regressions/kt789.jet b/compiler/testData/codegen/regressions/kt789.jet index e071cfdf507..79014973767 100644 --- a/compiler/testData/codegen/regressions/kt789.jet +++ b/compiler/testData/codegen/regressions/kt789.jet @@ -1,4 +1,4 @@ -namespace foo +package foo import java.util.*; diff --git a/compiler/testData/codegen/regressions/kt828.kt b/compiler/testData/codegen/regressions/kt828.kt index 34801b54b8d..06e63bec23c 100644 --- a/compiler/testData/codegen/regressions/kt828.kt +++ b/compiler/testData/codegen/regressions/kt828.kt @@ -1,4 +1,4 @@ -namespace demo +package demo fun box() : String { var res : Boolean = true diff --git a/compiler/testData/codegen/regressions/kt857.jet b/compiler/testData/codegen/regressions/kt857.jet new file mode 100644 index 00000000000..1b8598b8a5b --- /dev/null +++ b/compiler/testData/codegen/regressions/kt857.jet @@ -0,0 +1,7 @@ +namespace container_test + +class Container(var t : T) { + fun getT() : T = t +} + +fun box() = Container("OK").getT() diff --git a/compiler/testData/codegen/traits/stdlib.jet b/compiler/testData/codegen/traits/stdlib.jet index af0db549b40..235263a95eb 100644 --- a/compiler/testData/codegen/traits/stdlib.jet +++ b/compiler/testData/codegen/traits/stdlib.jet @@ -36,7 +36,7 @@ trait WriteOnlyArray : ISized { } } -class MutableArray(length: Int, init : fun(Int) : T) : ReadOnlyArray, WriteOnlyArray { +class MutableArray(length: Int, init : (Int) -> T) : ReadOnlyArray, WriteOnlyArray { private val array = Array(length, init) override fun get(index : Int) : T = array[index] diff --git a/compiler/testData/diagnostics/checkerTestUtil/test.jet b/compiler/testData/diagnostics/checkerTestUtil/test.jet index e78606b8885..699dfbd5ce5 100644 --- a/compiler/testData/diagnostics/checkerTestUtil/test.jet +++ b/compiler/testData/diagnostics/checkerTestUtil/test.jet @@ -2,7 +2,7 @@ fun foo(u : Unit) : Int = 1 fun test() : Int { foo(1) - val a : fun() : Unit = { + val a : () -> Unit = { foo(1) } return 1 - "1" diff --git a/compiler/testData/diagnostics/tests/Abstract.jet b/compiler/testData/diagnostics/tests/Abstract.jet index d36e7769f63..30cb42c416d 100644 --- a/compiler/testData/diagnostics/tests/Abstract.jet +++ b/compiler/testData/diagnostics/tests/Abstract.jet @@ -1,6 +1,6 @@ // +JDK -namespace abstract +package abstract class MyClass() { //properties @@ -180,7 +180,7 @@ enum class MyEnum() { abstract enum class MyAbstractEnum() {} -namespace MyNamespace { +package MyNamespace { //properties val a: Int val a1: Int = 1 diff --git a/compiler/testData/diagnostics/tests/AutoCreatedIt.jet b/compiler/testData/diagnostics/tests/AutoCreatedIt.jet index b9aa7b90c6b..c89b3d01850 100644 --- a/compiler/testData/diagnostics/tests/AutoCreatedIt.jet +++ b/compiler/testData/diagnostics/tests/AutoCreatedIt.jet @@ -1,10 +1,10 @@ fun text() { "direct:a" to "mock:a" "direct:a" on {it.body == ""} to "mock:a" - "direct:a" on {it => it.body == ""} to "mock:a" + "direct:a" on {it -> it.body == ""} to "mock:a" bar {1} bar {it + 1} - bar {it, it1 => it} + bar {it, it1 -> it} bar1 {1} bar1 {it + 1} @@ -12,18 +12,18 @@ fun text() { bar2 {} bar2 {1} bar2 {it} - bar2 {it => it} + bar2 {it -> it} } -fun bar(f : fun (Int, Int) : Int) {} -fun bar1(f : fun (Int) : Int) {} -fun bar2(f : fun () : Int) {} +fun bar(f : (Int, Int) -> Int) {} +fun bar1(f : (Int) -> Int) {} +fun bar2(f : () -> Int) {} fun String.to(dest : String) { } -fun String.on(predicate : fun (s : URI) : Boolean) : URI { +fun String.on(predicate : (s : URI) -> Boolean) : URI { return URI(this) } diff --git a/compiler/testData/diagnostics/tests/AutocastsForStableIdentifiers.jet b/compiler/testData/diagnostics/tests/AutocastsForStableIdentifiers.jet index f6ccdfc8a0a..82805cf8bfb 100644 --- a/compiler/testData/diagnostics/tests/AutocastsForStableIdentifiers.jet +++ b/compiler/testData/diagnostics/tests/AutocastsForStableIdentifiers.jet @@ -1,6 +1,6 @@ -namespace example; +package example; -namespace ns { +package ns { val y : Any? = 2 } diff --git a/compiler/testData/diagnostics/tests/Basic.jet b/compiler/testData/diagnostics/tests/Basic.jet index 4dc3161b26a..0a0673ca5eb 100644 --- a/compiler/testData/diagnostics/tests/Basic.jet +++ b/compiler/testData/diagnostics/tests/Basic.jet @@ -2,7 +2,7 @@ fun foo(u : Unit) : Int = 1 fun test() : Int { foo(1) - val a : fun() : Unit = { + val a : () -> Unit = { foo(1) } return 1 - "1" diff --git a/compiler/testData/diagnostics/tests/Bounds.jet b/compiler/testData/diagnostics/tests/Bounds.jet index 37066cb74ab..e2b7cf1ce86 100644 --- a/compiler/testData/diagnostics/tests/Bounds.jet +++ b/compiler/testData/diagnostics/tests/Bounds.jet @@ -1,4 +1,4 @@ -namespace boundsWithSubstitutors { +package boundsWithSubstitutors { open class A class B>() @@ -18,10 +18,10 @@ namespace boundsWithSubstitutors { open class A {} open class B() - abstract class CInt>, X : fun (B<Char>) : (B<Any>, B)>() : B<Any>() { // 2 errors + abstract class CInt>, X : (B<Char>) -> #(B<Any>, B)>() : B<Any>() { // 2 errors val a = B<Char>() // error - abstract val x : fun (B<Char>) : B<Any> + abstract val x : (B<Char>) -> B<Any> } diff --git a/compiler/testData/diagnostics/tests/Builders.jet b/compiler/testData/diagnostics/tests/Builders.jet index 10791f68875..497950f941f 100644 --- a/compiler/testData/diagnostics/tests/Builders.jet +++ b/compiler/testData/diagnostics/tests/Builders.jet @@ -2,7 +2,7 @@ import java.util.* -namespace html { +package html { abstract class Factory { abstract fun create() : T @@ -16,7 +16,7 @@ namespace html { val children = ArrayList() val attributes = HashMap() - protected fun initTag(init : fun T.() : Unit) : T + protected fun initTag(init : T.() -> Unit) : T where class object T : Factory{ val tag = T.create() tag.init() @@ -36,9 +36,9 @@ namespace html { override fun create() = HTML() } - fun head(init : fun Head.() : Unit) = initTag(init) + fun head(init : Head.() -> Unit) = initTag(init) - fun body(init : fun Body.() : Unit) = initTag(init) + fun body(init : Body.() -> Unit) = initTag(init) } class Head() : TagWithText("head") { @@ -46,7 +46,7 @@ namespace html { override fun create() = Head() } - fun title(init : fun Title.() : Unit) = initTag(init) + fun title(init : Title.() -> Unit) = initTag<Title>(init) } class Title() : TagWithText("title") @@ -59,10 +59,10 @@ namespace html { override fun create() = Body() } - fun b(init : fun B.() : Unit) = initTag<B>(init) - fun p(init : fun P.() : Unit) = initTag<P>(init) - fun h1(init : fun H1.() : Unit) = initTag<H1>(init) - fun a(href : String, init : fun A.() : Unit) { + fun b(init : B.() -> Unit) = initTag<B>(init) + fun p(init : P.() -> Unit) = initTag<P>(init) + fun h1(init : H1.() -> Unit) = initTag<H1>(init) + fun a(href : String, init : A.() -> Unit) { val a = initTag<A>(init) a.href = href } @@ -79,7 +79,7 @@ namespace html { fun Map<String, String>.set(key : String, value : String) = this.put(key, value) - fun html(init : fun HTML.() : Unit) : HTML { + fun html(init : HTML.() -> Unit) : HTML { val html = HTML() html.init() return html @@ -87,7 +87,7 @@ namespace html { } -namespace foo { +package foo { import html.* diff --git a/compiler/testData/diagnostics/tests/Casts.jet b/compiler/testData/diagnostics/tests/Casts.jet index 163619fd4d0..b63af35a916 100644 --- a/compiler/testData/diagnostics/tests/Casts.jet +++ b/compiler/testData/diagnostics/tests/Casts.jet @@ -12,5 +12,5 @@ fun test() : Unit { y <!USELESS_CAST!>as?<!> Int : Int? x <!USELESS_CAST!>as?<!> Int? : Int? y <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as?<!> Int? : Int? - () + #() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/ClassObjects.jet b/compiler/testData/diagnostics/tests/ClassObjects.jet index f933004a4d5..019fc084e6f 100644 --- a/compiler/testData/diagnostics/tests/ClassObjects.jet +++ b/compiler/testData/diagnostics/tests/ClassObjects.jet @@ -1,6 +1,6 @@ // +JDK -namespace Jet86 +package Jet86 class A { class object { diff --git a/compiler/testData/diagnostics/tests/ConflictingOverloads.jet b/compiler/testData/diagnostics/tests/ConflictingOverloads.jet index 6f13050d3ae..bb5554d2d32 100644 --- a/compiler/testData/diagnostics/tests/ConflictingOverloads.jet +++ b/compiler/testData/diagnostics/tests/ConflictingOverloads.jet @@ -13,7 +13,7 @@ class A { } } -namespace deepSpace { +package deepSpace { <!CONFLICTING_OVERLOADS!>fun c(<!UNUSED_PARAMETER!>s<!>: String)<!> { } @@ -32,23 +32,23 @@ namespace deepSpace { // check no error in overload in different namespaces -namespace ns1 { +package ns1 { fun e() = 1 } -namespace ns2 { +package ns2 { fun e() = 1 } -namespace ns3 { - namespace ns1 { +package ns3 { + package ns1 { fun e() = 1 } } // check same rules apply for ext functions -namespace extensionFunctions { +package extensionFunctions { <!CONFLICTING_OVERLOADS!>fun Int.qwe(<!UNUSED_PARAMETER!>a<!>: Float)<!> = 1 <!CONFLICTING_OVERLOADS!>fun Int.qwe(<!UNUSED_PARAMETER!>a<!>: Float)<!> = 2 @@ -60,7 +60,7 @@ namespace extensionFunctions { // check no error when regular function and extension function have same name -namespace extensionAndRegular { +package extensionAndRegular { fun who() = 1 fun Int.who() = 1 @@ -68,7 +68,7 @@ namespace extensionAndRegular { // constructor vs. fun overload -namespace constructorVsFun { +package constructorVsFun { class <!CONFLICTING_OVERLOADS!>a()<!> { } <!CONFLICTING_OVERLOADS!>fun a()<!> = 1 diff --git a/compiler/testData/diagnostics/tests/Dollar.jet b/compiler/testData/diagnostics/tests/Dollar.jet index 7966eb21ab9..1adf1bd99ea 100644 --- a/compiler/testData/diagnostics/tests/Dollar.jet +++ b/compiler/testData/diagnostics/tests/Dollar.jet @@ -1,4 +1,4 @@ -namespace dollar +package dollar open class `$$$$$`() { } diff --git a/compiler/testData/diagnostics/tests/ExtensionFunctions.jet b/compiler/testData/diagnostics/tests/ExtensionFunctions.jet index e7e3c1cebf4..0e963b6a6d6 100644 --- a/compiler/testData/diagnostics/tests/ExtensionFunctions.jet +++ b/compiler/testData/diagnostics/tests/ExtensionFunctions.jet @@ -1,7 +1,7 @@ // +JDK fun Int?.optint() : Unit {} -val Int?.optval : Unit = () +val Int?.optval : Unit = #() fun <T, E> T.foo(<!UNUSED_PARAMETER!>x<!> : E, y : A) : T { y.plus(1) @@ -39,7 +39,7 @@ val <T> T.<!MUST_BE_INITIALIZED!>foo<!> : T fun Int.foo() = this -namespace null_safety { +package null_safety { fun parse(<!UNUSED_PARAMETER!>cmd<!>: String): Command? { return null } class Command() { diff --git a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.jet b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.jet index 852e49c45fe..32fc8be4b84 100644 --- a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.jet +++ b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.jet @@ -1,22 +1,22 @@ -namespace foo +package foo -fun Any.foo() : fun() : Unit { +fun Any.foo() : () -> Unit { return {} } -fun Any.foo1() : fun(i : Int) : Unit { +fun Any.foo1() : (i : Int) -> Unit { return {} } -fun foo2() : fun(i : fun()) : Unit { +fun foo2() : (i : () -> Unit) -> Unit { return {} } -fun fooT1<T>(t : T) : fun() : T { +fun fooT1<T>(t : T) : () -> T { return {t} } -fun fooT2<T>() : fun(t : T) : T { +fun fooT2<T>() : (t : T) -> T { return {it} } @@ -34,8 +34,8 @@ fun main(args : Array<String>) { foo2()({}) foo2()<!TOO_MANY_ARGUMENTS!>{}<!> (foo2()){} - (foo2())<!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>x<!> => }<!> - foo2()(<!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>x<!> => }<!>) + (foo2())<!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> }<!> + foo2()(<!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> }<!>) val a = fooT1(1)() a : Int @@ -49,19 +49,19 @@ fun main(args : Array<String>) { <!CALLEE_NOT_A_FUNCTION!>1<!>(){} } -fun f() : fun Int.() : Unit = {} +fun f() : Int.() -> Unit = {} fun main1() { - 1.{Int.() => 1}(); + 1.{Int.() -> 1}(); {1}() - {(x : Int) => x}(1) - 1.{Int.(x : Int) => x}(1) + {(x : Int) -> x}(1) + 1.{Int.(x : Int) -> x}(1) @l{1}() - 1.({Int.() => 1})() + 1.({Int.() -> 1})() 1.(f())() 1.if(true){f()}else{f()}() - 1.if(true){Int.() => 1}else{f()}() - 1.if(true){Int.() => 1}else{Int.() => 1}() + 1.if(true){Int.() -> 1}else{f()}() + 1.if(true){Int.() -> 1}else{Int.() -> 1}() 1.<!CALLEE_NOT_A_FUNCTION!>"sdf"<!>() @@ -71,12 +71,12 @@ fun main1() { } fun test() { - {(x : Int) => 1}<!NO_VALUE_FOR_PARAMETER!>()<!> - <!MISSING_RECEIVER!>{Int.() => 1}<!>() - <!TYPE_MISMATCH!>"sd"<!>.{Int.() => 1}() + {(x : Int) -> 1}<!NO_VALUE_FOR_PARAMETER!>()<!> + <!MISSING_RECEIVER!>{Int.() -> 1}<!>() + <!TYPE_MISMATCH!>"sd"<!>.{Int.() -> 1}() val i : Int? = null - i<!UNSAFE_CALL!>.<!>{Int.() => 1}() + i<!UNSAFE_CALL!>.<!>{Int.() -> 1}() {}<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>() - 1<!UNNECESSARY_SAFE_CALL!>?.<!>{Int.() => 1}() + 1<!UNNECESSARY_SAFE_CALL!>?.<!>{Int.() -> 1}() 1.<!NO_RECEIVER_ADMITTED!>{}<!>() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/FunctionReturnTypes.jet b/compiler/testData/diagnostics/tests/FunctionReturnTypes.jet index 0bab0cf8335..11d8bcde513 100644 --- a/compiler/testData/diagnostics/tests/FunctionReturnTypes.jet +++ b/compiler/testData/diagnostics/tests/FunctionReturnTypes.jet @@ -6,11 +6,11 @@ fun unitEmptyInfer() {} fun unitEmpty() : Unit {} fun unitEmptyReturn() : Unit {return} fun unitIntReturn() : Unit {return <!TYPE_MISMATCH!>1<!>} -fun unitUnitReturn() : Unit {return ()} +fun unitUnitReturn() : Unit {return #()} fun test1() : Any = {<!RETURN_TYPE_MISMATCH, RETURN_NOT_ALLOWED!>return<!>} fun test2() : Any = @a {return@a 1} fun test3() : Any { <!RETURN_TYPE_MISMATCH!>return<!> } -fun test4(): fun(): Unit = { <!RETURN_TYPE_MISMATCH, RETURN_NOT_ALLOWED!>return@test4<!> } +fun test4(): ()-> Unit = { <!RETURN_TYPE_MISMATCH, RETURN_NOT_ALLOWED!>return@test4<!> } fun test5(): Any = @{ return@ } fun test6(): Any = {<!RETURN_NOT_ALLOWED!>return 1<!>} @@ -21,13 +21,13 @@ fun bbb() { fun foo(<!UNUSED_PARAMETER!>expr<!>: StringBuilder): Int { val c = 'a' when(c) { - 0.chr => throw Exception("zero") - else => throw Exception("nonzero" + c) + 0.chr -> throw Exception("zero") + else -> throw Exception("nonzero" + c) } } -fun unitShort() : Unit = () +fun unitShort() : Unit = #() fun unitShortConv() : Unit = <!TYPE_MISMATCH!>1<!> fun unitShortNull() : Unit = <!TYPE_MISMATCH!>null<!> @@ -44,7 +44,7 @@ fun intFunctionLiteral(): Int = <!TYPE_MISMATCH!>{ 10 }<!> fun blockReturnUnitMismatch() : Int {<!RETURN_TYPE_MISMATCH!>return<!>} fun blockReturnValueTypeMismatch() : Int {return <!ERROR_COMPILE_TIME_VALUE!>3.4<!>} fun blockReturnValueTypeMatch() : Int {return 1} -fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>()<!>} +fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>#()<!>} fun blockAndAndMismatch() : Int { <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>true && false<!> @@ -176,37 +176,37 @@ class B() { } fun testFunctionLiterals() { - val <!UNUSED_VARIABLE!>endsWithVarDeclaration<!> : fun() : Boolean = { + val <!UNUSED_VARIABLE!>endsWithVarDeclaration<!> : () -> Boolean = { <!EXPECTED_TYPE_MISMATCH!>val x = 2<!> } - val <!UNUSED_VARIABLE!>endsWithAssignment<!> = { () : Int => + val <!UNUSED_VARIABLE!>endsWithAssignment<!> = { () : Int -> var x = 1 <!EXPECTED_TYPE_MISMATCH!>x = 333<!> } - val <!UNUSED_VARIABLE!>endsWithReAssignment<!> = { () : Int => + val <!UNUSED_VARIABLE!>endsWithReAssignment<!> = { () : Int -> var x = 1 <!ASSIGNMENT_TYPE_MISMATCH!>x += 333<!> } - val <!UNUSED_VARIABLE!>endsWithFunDeclaration<!> : fun() : String = { + val <!UNUSED_VARIABLE!>endsWithFunDeclaration<!> : () -> String = { var x = 1 x = 333 <!EXPECTED_TYPE_MISMATCH!>fun meow() : Unit {}<!> } - val <!UNUSED_VARIABLE!>endsWithObjectDeclaration<!> : fun() : Int = { + val <!UNUSED_VARIABLE!>endsWithObjectDeclaration<!> : () -> Int = { var x = 1 x = 333 <!EXPECTED_TYPE_MISMATCH!>object A {}<!> } - val <!UNUSED_VARIABLE!>expectedUnitReturnType1<!> = { () : Unit => + val <!UNUSED_VARIABLE!>expectedUnitReturnType1<!> = { () : Unit -> val x = 1 } - val <!UNUSED_VARIABLE!>expectedUnitReturnType2<!> = { () : Unit => + val <!UNUSED_VARIABLE!>expectedUnitReturnType2<!> = { () : Unit -> fun meow() : Unit {} object A {} } diff --git a/compiler/testData/diagnostics/tests/GenericArgumentConsistency.jet b/compiler/testData/diagnostics/tests/GenericArgumentConsistency.jet index fafd2cf98c8..b9ab728653d 100644 --- a/compiler/testData/diagnostics/tests/GenericArgumentConsistency.jet +++ b/compiler/testData/diagnostics/tests/GenericArgumentConsistency.jet @@ -13,28 +13,28 @@ trait BB1 : BA1<Int> {} trait BB2 : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>BA1<Any>, BB1<!> {} -namespace x { +package x { trait AA1<out T> {} trait AB1 : AA1<Int> {} trait AB3 : AA1<Comparable<Int>> {} trait AB2 : AA1<Number>, AB1, AB3 {} } -namespace x2 { +package x2 { trait AA1<out T> {} trait AB1 : AA1<Any> {} trait AB3 : AA1<Comparable<Int>> {} trait AB2 : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>AA1<Number>, AB1, AB3<!> {} } -namespace x3 { +package x3 { trait AA1<in T> {} trait AB1 : AA1<Any> {} trait AB3 : AA1<Comparable<Int>> {} trait AB2 : AA1<Number>, AB1, AB3 {} } -namespace sx2 { +package sx2 { trait AA1<in T> {} trait AB1 : AA1<Int> {} trait AB3 : AA1<Comparable<Int>> {} diff --git a/compiler/testData/diagnostics/tests/IllegalModifiers.jet b/compiler/testData/diagnostics/tests/IllegalModifiers.jet index a3585e341de..94e23907adf 100644 --- a/compiler/testData/diagnostics/tests/IllegalModifiers.jet +++ b/compiler/testData/diagnostics/tests/IllegalModifiers.jet @@ -1,4 +1,4 @@ -namespace illegal_modifiers +package illegal_modifiers abstract class A() { <!INCOMPATIBLE_MODIFIERS!>abstract<!> <!INCOMPATIBLE_MODIFIERS!>final<!> fun f() diff --git a/compiler/testData/diagnostics/tests/ImportResolutionOrder.jet b/compiler/testData/diagnostics/tests/ImportResolutionOrder.jet index acaeadc053c..7e0ecfe19e0 100644 --- a/compiler/testData/diagnostics/tests/ImportResolutionOrder.jet +++ b/compiler/testData/diagnostics/tests/ImportResolutionOrder.jet @@ -1,22 +1,22 @@ // KT-355 Resolve imports after all symbols are built -namespace a { +package a { import b.* val x : X = X() } -namespace b { +package b { class X() { } } -namespace c { +package c { import d.X val x : X = X() } -namespace d { +package d { class X() { } diff --git a/compiler/testData/diagnostics/tests/LValueAssignment.jet b/compiler/testData/diagnostics/tests/LValueAssignment.jet index e9551afa2fd..7752029c1db 100644 --- a/compiler/testData/diagnostics/tests/LValueAssignment.jet +++ b/compiler/testData/diagnostics/tests/LValueAssignment.jet @@ -1,4 +1,4 @@ -namespace lvalue_assignment +package lvalue_assignment open class B() { var b: Int = 2 @@ -38,7 +38,7 @@ class D() { fun cannotBe(var <!UNUSED_PARAMETER!>i<!>: Int) { <!UNRESOLVED_REFERENCE!>z<!> = 30; - <!VARIABLE_EXPECTED!>()<!> = (); + <!VARIABLE_EXPECTED!>#()<!> = #(); (<!VARIABLE_EXPECTED!>i <!USELESS_CAST!>as<!> Int<!>) = 34 (<!VARIABLE_EXPECTED!>i is Int<!>) = false diff --git a/compiler/testData/diagnostics/tests/MergePackagesWithJava.jet b/compiler/testData/diagnostics/tests/MergePackagesWithJava.jet index 9da16a7c82d..727852d39df 100644 --- a/compiler/testData/diagnostics/tests/MergePackagesWithJava.jet +++ b/compiler/testData/diagnostics/tests/MergePackagesWithJava.jet @@ -2,7 +2,7 @@ // KT-689 Allow to put Java and Kotlin files in the same packages // This is a stub test. One should not extend Java packages that come from libraries. -namespace java +package java val c : lang.Class<*>? = null diff --git a/compiler/testData/diagnostics/tests/MultipleBounds.jet b/compiler/testData/diagnostics/tests/MultipleBounds.jet index 773ebaea33f..49c333a7b87 100644 --- a/compiler/testData/diagnostics/tests/MultipleBounds.jet +++ b/compiler/testData/diagnostics/tests/MultipleBounds.jet @@ -1,4 +1,4 @@ -namespace Jet87 +package Jet87 open class A() { fun foo() : Int = 1 diff --git a/compiler/testData/diagnostics/tests/NamespaceAsExpression.jet b/compiler/testData/diagnostics/tests/NamespaceAsExpression.jet index de5e97fe5b8..8248d2972ae 100644 --- a/compiler/testData/diagnostics/tests/NamespaceAsExpression.jet +++ b/compiler/testData/diagnostics/tests/NamespaceAsExpression.jet @@ -1,6 +1,6 @@ -namespace root +package root -namespace a { +package a { } diff --git a/compiler/testData/diagnostics/tests/NamespaceInExpressionPosition.jet b/compiler/testData/diagnostics/tests/NamespaceInExpressionPosition.jet index f8520b087f1..9a6d9805a2a 100644 --- a/compiler/testData/diagnostics/tests/NamespaceInExpressionPosition.jet +++ b/compiler/testData/diagnostics/tests/NamespaceInExpressionPosition.jet @@ -1,6 +1,6 @@ // +JDK -namespace foo +package foo class X {} diff --git a/compiler/testData/diagnostics/tests/NamespaceQualified.jet b/compiler/testData/diagnostics/tests/NamespaceQualified.jet index 194c1047e24..f57a483de32 100644 --- a/compiler/testData/diagnostics/tests/NamespaceQualified.jet +++ b/compiler/testData/diagnostics/tests/NamespaceQualified.jet @@ -1,8 +1,8 @@ // +JDK -namespace foobar +package foobar -namespace a { +package a { import java.* val a : util.List<Int>? = null @@ -14,7 +14,7 @@ abstract class Foo<T>() { abstract val x : T<Int> } -namespace a { +package a { import java.util.* val b : List<Int>? = a diff --git a/compiler/testData/diagnostics/tests/Nullability.jet b/compiler/testData/diagnostics/tests/Nullability.jet index 95e8ebb3700..14ba1b28652 100644 --- a/compiler/testData/diagnostics/tests/Nullability.jet +++ b/compiler/testData/diagnostics/tests/Nullability.jet @@ -40,28 +40,28 @@ fun test() { out.println(); } - if (out == null || out.println(0) == ()) { + if (out == null || out.println(0) == #()) { out?.println(1) } else { out.println(2) } - if (out != null && out.println() == ()) { + if (out != null && out.println() == #()) { out.println(); } else { out?.println(); } - if (out == null || out != null && out.println() == ()) { + if (out == null || out != null && out.println() == #()) { out?.println(); } else { out.println(); } - if (1 == 2 || out != null && out.println(1) == ()) { + if (1 == 2 || out != null && out.println(1) == #()) { out?.println(2); } else { @@ -96,28 +96,28 @@ fun test() { out.println(); } - if (out == null || out.println(0) == ()) { + if (out == null || out.println(0) == #()) { out?.println(1) } else { out.println(2) } - if (out != null && out.println() == ()) { + if (out != null && out.println() == #()) { out.println(); } else { out?.println(); } - if (out == null || out != null && out.println() == ()) { + if (out == null || out != null && out.println() == #()) { out?.println(); } else { out.println(); } - if (1 == 2 || out != null && out.println(1) == ()) { + if (1 == 2 || out != null && out.println(1) == #()) { out?.println(2); } else { diff --git a/compiler/testData/diagnostics/tests/Objects.jet b/compiler/testData/diagnostics/tests/Objects.jet index 79ed4e42644..14ce45145bd 100644 --- a/compiler/testData/diagnostics/tests/Objects.jet +++ b/compiler/testData/diagnostics/tests/Objects.jet @@ -1,4 +1,4 @@ -namespace toplevelObjectDeclarations { +package toplevelObjectDeclarations { open class Foo(y : Int) { open fun foo() : Int = 1 } @@ -28,7 +28,7 @@ namespace toplevelObjectDeclarations { val z = y.foo() } -namespace nestedObejcts { +package nestedObejcts { object A { val b = B val d = A.B.A @@ -58,7 +58,7 @@ namespace nestedObejcts { val e = B.<!UNRESOLVED_REFERENCE!>A<!>.B } -namespace localObjects { +package localObjects { object A { val x : Int = 0 } diff --git a/compiler/testData/diagnostics/tests/Override.jet b/compiler/testData/diagnostics/tests/Override.jet index ce46dadac07..6884e82eb42 100644 --- a/compiler/testData/diagnostics/tests/Override.jet +++ b/compiler/testData/diagnostics/tests/Override.jet @@ -1,6 +1,6 @@ -namespace override +package override -namespace normal { +package normal { trait MyTrait { fun foo() val pr : Unit @@ -16,8 +16,8 @@ namespace normal { override fun foo() {} override fun bar() {} - override val pr : Unit = () - override val prr : Unit = () + override val pr : Unit = #() + override val prr : Unit = #() } class MyChildClass() : MyClass() {} @@ -26,14 +26,14 @@ namespace normal { class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass2<!>() : MyTrait, MyAbstractClass { override fun foo() {} - override val pr : Unit = () - override val prr : Unit = () + override val pr : Unit = #() + override val prr : Unit = #() } class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass3<!>() : MyTrait, MyAbstractClass { override fun bar() {} - override val pr : Unit = () - override val prr : Unit = () + override val pr : Unit = #() + override val prr : Unit = #() } class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass4<!>() : MyTrait, MyAbstractClass { @@ -45,13 +45,13 @@ namespace normal { class MyChildClass1() : MyClass() { fun <!VIRTUAL_MEMBER_HIDDEN!>foo<!>() {} - val <!VIRTUAL_MEMBER_HIDDEN!>pr<!> : Unit = () + val <!VIRTUAL_MEMBER_HIDDEN!>pr<!> : Unit = #() override fun bar() {} - override val prr : Unit = () + override val prr : Unit = #() } } -namespace generics { +package generics { trait MyTrait<T> { fun foo(t: T) : T } diff --git a/compiler/testData/diagnostics/tests/QualifiedExpressions.jet b/compiler/testData/diagnostics/tests/QualifiedExpressions.jet index 187c745ef63..135fbc2e89a 100644 --- a/compiler/testData/diagnostics/tests/QualifiedExpressions.jet +++ b/compiler/testData/diagnostics/tests/QualifiedExpressions.jet @@ -1,4 +1,4 @@ -namespace qualified_expressions +package qualified_expressions fun test(s: String?) { val <!UNUSED_VARIABLE!>a<!>: Int = <!TYPE_MISMATCH!>s?.length<!> diff --git a/compiler/testData/diagnostics/tests/QualifiedThis.jet b/compiler/testData/diagnostics/tests/QualifiedThis.jet index 7fab8479b4b..82d44c804ce 100644 --- a/compiler/testData/diagnostics/tests/QualifiedThis.jet +++ b/compiler/testData/diagnostics/tests/QualifiedThis.jet @@ -21,7 +21,7 @@ fun foo1() : Unit { this<!UNRESOLVED_REFERENCE!>@a<!> } -namespace closures { +package closures { class A(val a:Int) { class B() { @@ -31,10 +31,10 @@ namespace closures { val Int.xx = this : Int fun Char.xx() : Any { this : Char - val <!UNUSED_VARIABLE!>a<!> = {Double.() => this : Double + this@xx : Char} - val <!UNUSED_VARIABLE!>b<!> = @a{Double.() => this@a : Double + this@xx : Char} - val <!UNUSED_VARIABLE!>c<!> = @a{() => <!NO_THIS!>this@a<!> + this@xx : Char} - return (@a{Double.() => this@a : Double + this@xx : Char}) + val <!UNUSED_VARIABLE!>a<!> = {Double.() -> this : Double + this@xx : Char} + val <!UNUSED_VARIABLE!>b<!> = @a{Double.() -> this@a : Double + this@xx : Char} + val <!UNUSED_VARIABLE!>c<!> = @a{() -> <!NO_THIS!>this@a<!> + this@xx : Char} + return (@a{Double.() -> this@a : Double + this@xx : Char}) } } } diff --git a/compiler/testData/diagnostics/tests/RecursiveTypeInference.jet b/compiler/testData/diagnostics/tests/RecursiveTypeInference.jet index 46e2f2ae7c7..47e0d6aeb58 100644 --- a/compiler/testData/diagnostics/tests/RecursiveTypeInference.jet +++ b/compiler/testData/diagnostics/tests/RecursiveTypeInference.jet @@ -1,16 +1,16 @@ -namespace a { +package a { val foo = bar() fun bar() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>foo<!> } -namespace b { +package b { fun foo() = bar() fun bar() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>foo()<!> } -namespace c { +package c { fun bazz() = bar() fun foo() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>bazz()<!> @@ -18,21 +18,21 @@ namespace c { fun bar() = foo() } -namespace ok { +package ok { - namespace a { + package a { val foo = bar() fun bar() : Int = foo } - namespace b { + package b { fun foo() : Int = bar() fun bar() = foo() } - namespace c { + package c { fun bazz() = bar() fun foo() : Int = bazz() diff --git a/compiler/testData/diagnostics/tests/Redeclarations.jet b/compiler/testData/diagnostics/tests/Redeclarations.jet index 3068a16b54d..18756b8ba9a 100644 --- a/compiler/testData/diagnostics/tests/Redeclarations.jet +++ b/compiler/testData/diagnostics/tests/Redeclarations.jet @@ -1,11 +1,11 @@ -namespace redeclarations { +package redeclarations { object <!REDECLARATION, REDECLARATION!>A<!> { val x : Int = 0 val A = 1 } - namespace <!REDECLARATION!>A<!> { + package <!REDECLARATION!>A<!> { class A {} } diff --git a/compiler/testData/diagnostics/tests/ResolveToJava.jet b/compiler/testData/diagnostics/tests/ResolveToJava.jet index 28d49d5ee3f..8275b2c842c 100644 --- a/compiler/testData/diagnostics/tests/ResolveToJava.jet +++ b/compiler/testData/diagnostics/tests/ResolveToJava.jet @@ -49,6 +49,6 @@ fun test(<!UNUSED_PARAMETER!>l<!> : java.util.List<Int>) { } -namespace xxx { +package xxx { import java.lang.Class; } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/Return.jet b/compiler/testData/diagnostics/tests/Return.jet index 2426ecb933c..146783a46fd 100644 --- a/compiler/testData/diagnostics/tests/Return.jet +++ b/compiler/testData/diagnostics/tests/Return.jet @@ -1,4 +1,4 @@ -namespace <!SYNTAX!>return<!> +package <!SYNTAX!>return<!> class A { fun outer() { diff --git a/compiler/testData/diagnostics/tests/ShiftFunctionTypes.jet b/compiler/testData/diagnostics/tests/ShiftFunctionTypes.jet new file mode 100644 index 00000000000..1259ccc7fd4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/ShiftFunctionTypes.jet @@ -0,0 +1,51 @@ +class A { +} + +namespace n { + class B +} +abstract class XXX() { + abstract val a : Int + abstract val a1 : namespace.<!UNRESOLVED_REFERENCE!>Int<!> + abstract val a2 : n.B + abstract val a3 : (A) + abstract val a31 : (n.B) + abstract val a4 : A? + abstract val a5 : (A)? + abstract val a6 : (A?) + abstract val a7 : (A) -> n.B + abstract val a8 : (A, n.B) -> n.B + +//val a9 : (A, B) +//val a10 : (B)? -> B + + val a11 : ((Int) -> Int)? = null + val a12 : ((Int) -> (Int))? = null + abstract val a13 : Int.(Int) -> Int + abstract val a14 : n.B.(Int) -> Int + abstract val a15 : Int? .(Int) -> Int + abstract val a152 : (Int?).(Int) -> Int +// abstract val a151 : Int?.(Int) -> Int + abstract val a16 : (Int) -> (Int) -> Int + abstract val a17 : ((Int) -> Int).(Int) -> Int + abstract val a18 : (Int) -> ((Int) -> Int) + abstract val a19 : ((Int) -> Int) -> Int +} + +abstract class YYY() { + abstract val a7 : (a : A) -> n.B + abstract val a8 : (a : A, b : n.B) -> n.B +//val a9 : (A, B) +//val a10 : (B)? -> B + val a11 : ((a : Int) -> Int)? = null + val a12 : ((a : Int) -> (Int))? = null + abstract val a13 : Int.(a : Int) -> Int + abstract val a14 : n.B.(a : Int) -> Int + abstract val a15 : Int? .(a : Int) -> Int + abstract val a152 : (Int?).(a : Int) -> Int +//abstract val a151 : Int?.(a : Int) -> Int + abstract val a16 : (a : Int) -> (a : Int) -> Int + abstract val a17 : ((a : Int) -> Int).(a : Int) -> Int + abstract val a18 : (a : Int) -> ((a : Int) -> Int) + abstract val a19 : (b : (a : Int) -> Int) -> Int +} diff --git a/compiler/testData/diagnostics/tests/StringTemplates.jet b/compiler/testData/diagnostics/tests/StringTemplates.jet index 79b4e562f17..976a06e3a02 100644 --- a/compiler/testData/diagnostics/tests/StringTemplates.jet +++ b/compiler/testData/diagnostics/tests/StringTemplates.jet @@ -3,8 +3,8 @@ fun demo() { val a = "" val asd = 1 val bar = 5 - fun map(f : fun () : Any?) : Int = 1 - fun buzz(f : fun () : Any?) : Int = 1 + fun map(f : () -> Any?) : Int = 1 + fun buzz(f : () -> Any?) : Int = 1 val sdf = 1 val foo = 3; "$abc" diff --git a/compiler/testData/diagnostics/tests/Super.jet b/compiler/testData/diagnostics/tests/Super.jet index 749b17c322f..1f41daa88ce 100644 --- a/compiler/testData/diagnostics/tests/Super.jet +++ b/compiler/testData/diagnostics/tests/Super.jet @@ -1,4 +1,4 @@ -namespace example; +package example; fun any(<!UNUSED_PARAMETER!>a<!> : Any) {} @@ -7,7 +7,7 @@ fun notAnExpression() { if (<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>) {} else {} // not an expression val <!UNUSED_VARIABLE!>x<!> = <!SUPER_IS_NOT_AN_EXPRESSION!>super<!> // not an expression when (1) { - <!SUPER_IS_NOT_AN_EXPRESSION!>super<!> => 1 // not an expression + <!SUPER_IS_NOT_AN_EXPRESSION!>super<!> -> 1 // not an expression } } @@ -33,8 +33,8 @@ class A<E>() : C(), T { super<<!NOT_A_SUPERTYPE!>E<!>>@A.bar() super<<!NOT_A_SUPERTYPE!>Int<!>>.foo() super<<!SYNTAX!><!>>.foo() - super<<!NOT_A_SUPERTYPE!>fun() : Unit<!>>.foo() - super<<!NOT_A_SUPERTYPE!>()<!>>.foo() + super<<!NOT_A_SUPERTYPE!>() -> Unit<!>>.foo() + super<<!NOT_A_SUPERTYPE!>#()<!>>.foo() super<T><!UNRESOLVED_REFERENCE!>@B<!>.foo() super<C><!UNRESOLVED_REFERENCE!>@B<!>.bar() } diff --git a/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.jet b/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.jet index 22cfde8fdaa..964b8dfbb54 100644 --- a/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.jet +++ b/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.jet @@ -1,4 +1,4 @@ -namespace uninitialized_reassigned_variables +package uninitialized_reassigned_variables fun doSmth(<!UNUSED_PARAMETER!>s<!>: String) {} fun doSmth(<!UNUSED_PARAMETER!>i<!>: Int) {} diff --git a/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.jet b/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.jet index 9a14ad7a471..9848e76942e 100644 --- a/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.jet +++ b/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.jet @@ -1,3 +1,3 @@ -fun foo(f : fun()) { +fun foo(f : () -> Unit) { val <!UNUSED_VARIABLE!>x<!> : Unit = f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/Unresolved.jet b/compiler/testData/diagnostics/tests/Unresolved.jet index b5b6018377d..0ec39c5fcbe 100644 --- a/compiler/testData/diagnostics/tests/Unresolved.jet +++ b/compiler/testData/diagnostics/tests/Unresolved.jet @@ -1,8 +1,8 @@ -namespace unresolved +package unresolved fun testGenericArgumentsCount() { - val <!UNUSED_VARIABLE!>p1<!>: Tuple2<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!> = (2, 2) - val <!UNUSED_VARIABLE!>p2<!>: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Tuple2<!> = (2, 2) + val <!UNUSED_VARIABLE!>p1<!>: Tuple2<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!> = #(2, 2) + val <!UNUSED_VARIABLE!>p2<!>: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Tuple2<!> = #(2, 2) } fun testUnresolved() { @@ -16,8 +16,8 @@ fun testUnresolved() { s.<!UNRESOLVED_REFERENCE!>foo<!>() when(<!UNRESOLVED_REFERENCE!>a<!>) { - is Int => <!UNRESOLVED_REFERENCE!>a<!> - is String => <!UNRESOLVED_REFERENCE!>a<!> + is Int -> <!UNRESOLVED_REFERENCE!>a<!> + is String -> <!UNRESOLVED_REFERENCE!>a<!> } //TODO diff --git a/compiler/testData/diagnostics/tests/UnusedVariables.jet b/compiler/testData/diagnostics/tests/UnusedVariables.jet index b41e4ab4002..a623c336836 100644 --- a/compiler/testData/diagnostics/tests/UnusedVariables.jet +++ b/compiler/testData/diagnostics/tests/UnusedVariables.jet @@ -1,4 +1,4 @@ -namespace unused_variables +package unused_variables fun testSimpleCases() { var i = <!VARIABLE_WITH_REDUNDANT_INITIALIZER!>2<!> @@ -103,11 +103,11 @@ fun testInnerFunctions() { fun testFunctionLiterals() { var x = 1 - var <!UNUSED_VARIABLE!>fl<!> = { (): Int => + var <!UNUSED_VARIABLE!>fl<!> = { (): Int -> x } var y = 2 - var <!UNUSED_VARIABLE!>fl1<!> = { (): Unit => + var <!UNUSED_VARIABLE!>fl1<!> = { (): Unit -> doSmth(y) } } diff --git a/compiler/testData/diagnostics/tests/Varargs.jet b/compiler/testData/diagnostics/tests/Varargs.jet index 5986ce0982d..e9a33960df3 100644 --- a/compiler/testData/diagnostics/tests/Varargs.jet +++ b/compiler/testData/diagnostics/tests/Varargs.jet @@ -1,5 +1,5 @@ fun v(<!UNUSED_PARAMETER!>x<!> : Int, <!UNUSED_PARAMETER!>y<!> : String, vararg <!UNUSED_PARAMETER!>f<!> : Long) {} -fun v1(vararg <!UNUSED_PARAMETER!>f<!> : fun (Int) : Unit) {} +fun v1(vararg <!UNUSED_PARAMETER!>f<!> : (Int) -> Unit) {} fun test() { v(1, "") diff --git a/compiler/testData/diagnostics/tests/Variance.jet b/compiler/testData/diagnostics/tests/Variance.jet index 8785dfd87cb..da27ecfa5ba 100644 --- a/compiler/testData/diagnostics/tests/Variance.jet +++ b/compiler/testData/diagnostics/tests/Variance.jet @@ -1,4 +1,4 @@ -namespace variance +package variance abstract class Consumer<in T> {} diff --git a/compiler/testData/diagnostics/tests/When.jet b/compiler/testData/diagnostics/tests/When.jet index bff65aac380..0943aa7cdb6 100644 --- a/compiler/testData/diagnostics/tests/When.jet +++ b/compiler/testData/diagnostics/tests/When.jet @@ -4,19 +4,19 @@ fun foo() : Int { val s = "" val x = 1 when (x) { - is * => 1 - is <!INCOMPATIBLE_TYPES!>String<!> => 1 - !is Int => 1 - is Any? => 1 - <!INCOMPATIBLE_TYPES!>s<!> => 1 - 1 => 1 - 1 + <!UNRESOLVED_REFERENCE!>a<!> => 1 - in 1..<!UNRESOLVED_REFERENCE!>a<!> => 1 - !in 1..<!UNRESOLVED_REFERENCE!>a<!> => 1 + is * -> 1 + is <!INCOMPATIBLE_TYPES!>String<!> -> 1 + !is Int -> 1 + is Any? -> 1 + <!INCOMPATIBLE_TYPES!>s<!> -> 1 + 1 -> 1 + 1 + <!UNRESOLVED_REFERENCE!>a<!> -> 1 + in 1..<!UNRESOLVED_REFERENCE!>a<!> -> 1 + !in 1..<!UNRESOLVED_REFERENCE!>a<!> -> 1 // Commented for KT-621 .<!!UNRESOLVED_REFERENCE!>a<!!> => 1 // Commented for KT-621 .equals(1).<!!UNRESOLVED_REFERENCE!>a<!!> => 1 // Commented for KT-621 <!UNNECESSARY_SAFE_CALL!!>?.<!!>equals(1) => 1 - else => 1 + else -> 1 } // Commented for KT-621 @@ -35,33 +35,33 @@ fun test() { val s = ""; when (x) { - <!INCOMPATIBLE_TYPES!>s<!> => 1 - is <!INCOMPATIBLE_TYPES!>""<!> => 1 - x => 1 - is 1 => 1 - is <!TYPE_MISMATCH_IN_TUPLE_PATTERN!>(1, 1)<!> => 1 + <!INCOMPATIBLE_TYPES!>s<!> -> 1 + is <!INCOMPATIBLE_TYPES!>""<!> -> 1 + x -> 1 + is 1 -> 1 + is <!TYPE_MISMATCH_IN_TUPLE_PATTERN!>#(1, 1)<!> -> 1 } - val z = (1, 1) + val z = #(1, 1) when (z) { - is (*, *) => 1 - is (*, 1) => 1 - is (1, 1) => 1 - is (1, <!INCOMPATIBLE_TYPES!>"1"<!>) => 1 - is <!TYPE_MISMATCH_IN_TUPLE_PATTERN!>(1, "1", *)<!> => 1 - is boo @ (1, <!INCOMPATIBLE_TYPES!>"a"<!>, *) => 1 - is boo @ <!TYPE_MISMATCH_IN_TUPLE_PATTERN!>(1, *)<!> => 1 + is #(*, *) -> 1 + is #(*, 1) -> 1 + is #(1, 1) -> 1 + is #(1, <!INCOMPATIBLE_TYPES!>"1"<!>) -> 1 + is <!TYPE_MISMATCH_IN_TUPLE_PATTERN!>#(1, "1", *)<!> -> 1 + is boo #(1, <!INCOMPATIBLE_TYPES!>"a"<!>, *) -> 1 + is boo <!TYPE_MISMATCH_IN_TUPLE_PATTERN!>#(1, *)<!> -> 1 } when (z) { - <!ELSE_MISPLACED_IN_WHEN!>else => 1<!> - (1, 1) => 2 + <!ELSE_MISPLACED_IN_WHEN!>else -> 1<!> + #(1, 1) -> 2 } when (z) { - else => 1 + else -> 1 } } -val (Int, Int).boo : (Int, Int, Int) = (1, 1, 1) +val #(Int, Int).boo : #(Int, Int, Int) = #(1, 1, 1) diff --git a/compiler/testData/diagnostics/tests/backingField/CustomGetValGlobal.jet b/compiler/testData/diagnostics/tests/backingField/CustomGetValGlobal.jet index 6962636adec..0a26ab8d578 100644 --- a/compiler/testData/diagnostics/tests/backingField/CustomGetValGlobal.jet +++ b/compiler/testData/diagnostics/tests/backingField/CustomGetValGlobal.jet @@ -1,4 +1,4 @@ -namespace customGetValGlobal { +package customGetValGlobal { val zz = 1 get() = $zz * 2 diff --git a/compiler/testData/diagnostics/tests/backingField/kt462BackingFieldsResolve.jet b/compiler/testData/diagnostics/tests/backingField/kt462BackingFieldsResolve.jet index af0ec07ea8d..3520c94aa5e 100644 --- a/compiler/testData/diagnostics/tests/backingField/kt462BackingFieldsResolve.jet +++ b/compiler/testData/diagnostics/tests/backingField/kt462BackingFieldsResolve.jet @@ -1,7 +1,7 @@ //KT-462 Consider allowing initializing properties via property names when it is safe //KT-598 Allow to use backing fields after this expression -namespace kt462 +package kt462 abstract class TestInitializationWithoutBackingField() { val valWithBackingField : Int diff --git a/compiler/testData/diagnostics/tests/backingField/kt782namespaceLevel.jet b/compiler/testData/diagnostics/tests/backingField/kt782namespaceLevel.jet index 70e44773cdf..0d12bc57aa8 100644 --- a/compiler/testData/diagnostics/tests/backingField/kt782namespaceLevel.jet +++ b/compiler/testData/diagnostics/tests/backingField/kt782namespaceLevel.jet @@ -1,6 +1,6 @@ // KT-782 Allow backing field usage for accessors of variables on namespace level -namespace kt782 +package kt782 val z : Int = 34 diff --git a/compiler/testData/diagnostics/tests/cast/WhenErasedDisallowFromAny.jet b/compiler/testData/diagnostics/tests/cast/WhenErasedDisallowFromAny.jet index 2f424e3b9ad..d4ad8b264b0 100644 --- a/compiler/testData/diagnostics/tests/cast/WhenErasedDisallowFromAny.jet +++ b/compiler/testData/diagnostics/tests/cast/WhenErasedDisallowFromAny.jet @@ -3,6 +3,6 @@ import java.util.List; fun ff(l: Any) = when(l) { - is <!CANNOT_CHECK_FOR_ERASED!>List<String><!> => 1 + is <!CANNOT_CHECK_FOR_ERASED!>List<String><!> -> 1 else <!SYNTAX!>2<!> } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt510.jet b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt510.jet index 41feb040f2a..15407891604 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt510.jet +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt510.jet @@ -1,6 +1,6 @@ //KT-510 `this.` allows initialization without backing field -namespace kt510 +package kt510 public open class Identifier1() { var field : Boolean diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt607.jet b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt607.jet index 238661318d1..06ff50dd689 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt607.jet +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt607.jet @@ -1,6 +1,6 @@ //KT-607 Val reassignment is not marked as an error -namespace kt607 +package kt607 fun foo(a: A) { val o = object { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.jet b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.jet index 56f75e247e2..8ea0f2ef92b 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.jet +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.jet @@ -1,6 +1,6 @@ //KT-609 Analyze not only local variables, but function parameters as well in 'unused values' analysis -namespace kt609 +package kt609 fun test(var a: Int) { a = <!UNUSED_VALUE!>324<!> //should be an 'unused value' warning here diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt610.jet b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt610.jet index 916704e6c03..93838a62884 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt610.jet +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt610.jet @@ -1,6 +1,6 @@ //KT-610 Distinguish errors 'unused variable' and 'variable is assigned but never accessed' -namespace kt610 +package kt610 fun foo() { var <!UNUSED_VARIABLE!>j<!> = 9 //'unused variable' error diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt843.jet b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt843.jet index 3e276fe45d3..eeefb8d96f2 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt843.jet +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt843.jet @@ -1,6 +1,6 @@ //KT-843 Don't highlight incomplete variables as unused -namespace kt843 +package kt843 fun main(args : Array<String>) { // Integer type diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.jet b/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.jet index f9d9a50e4f4..878cce20769 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.jet +++ b/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.jet @@ -1,4 +1,4 @@ -namespace kt770_351_735 +package kt770_351_735 //+JDK @@ -6,9 +6,9 @@ namespace kt770_351_735 fun main(args : Array<String>) { var i = 0 when (i) { - 1 => i-- - 2 => i = 2 // i is surrounded by a black border - else => <!UNRESOLVED_REFERENCE!>j<!> = 2 + 1 -> i-- + 2 -> i = 2 // i is surrounded by a black border + else -> <!UNRESOLVED_REFERENCE!>j<!> = 2 } System.out?.println(i) } @@ -26,8 +26,8 @@ fun foo() { z = <!UNUSED_VALUE!>34<!> } } - val <!UNUSED_VARIABLE!>f<!>: fun(): Int = <!TYPE_MISMATCH!>r<!> - val <!UNUSED_VARIABLE!>g<!>: fun(): Any = r + val <!UNUSED_VARIABLE!>f<!>: ()-> Int = <!TYPE_MISMATCH!>r<!> + val <!UNUSED_VARIABLE!>g<!>: ()-> Any = r } //KT-735 Statements without braces are prohibited on the right side of when entries. @@ -35,8 +35,8 @@ fun box() : Int { val d = 2 var z = 0 when(d) { - is 5, is 3 => z++ - else => z = -1000 + is 5, is 3 -> z++ + else -> z = -1000 } return z } @@ -47,10 +47,10 @@ fun test1() = while(true) {} fun test2(): Unit = while(true) {} fun testCoercionToUnit() { - val <!UNUSED_VARIABLE!>simple<!>: fun(): Unit = { + val <!UNUSED_VARIABLE!>simple<!>: ()-> Unit = { 41 } - val <!UNUSED_VARIABLE!>withIf<!>: fun(): Unit = { + val <!UNUSED_VARIABLE!>withIf<!>: ()-> Unit = { if (true) { 3 } else { @@ -58,16 +58,16 @@ fun testCoercionToUnit() { } } val i = 34 - val <!UNUSED_VARIABLE!>withWhen<!> : fun() : Unit = { + val <!UNUSED_VARIABLE!>withWhen<!> : () -> Unit = { when(i) { - is 1 => { + is 1 -> { val d = 34 "1" doSmth(d) } - is 2 => '4' - else => true + is 2 -> '4' + else -> true } } @@ -79,7 +79,7 @@ fun testCoercionToUnit() { 45 } } - val <!UNUSED_VARIABLE!>f<!> : fun() : String = <!TYPE_MISMATCH!>checkType<!> + val <!UNUSED_VARIABLE!>f<!> : () -> String = <!TYPE_MISMATCH!>checkType<!> } fun doSmth(<!UNUSED_PARAMETER!>i<!>: Int) {} @@ -88,16 +88,16 @@ fun testImplicitCoercion() { val d = 21 var z = 0 var <!UNUSED_VARIABLE!>i<!> = <!IMPLICIT_CAST_TO_UNIT_OR_ANY!>when(d) { - is 3 => null - is 4 => { val <!NAME_SHADOWING, UNUSED_VARIABLE!>z<!> = 23 } - else => z = 20 + is 3 -> null + is 4 -> { val <!NAME_SHADOWING, UNUSED_VARIABLE!>z<!> = 23 } + else -> z = 20 }<!> var <!UNUSED_VARIABLE!>u<!> = <!IMPLICIT_CAST_TO_UNIT_OR_ANY!>when(d) { - is 3 => { + is 3 -> { z = <!UNUSED_VALUE!>34<!> } - else => <!UNUSED_CHANGED_VALUE!>z--<!> + else -> <!UNUSED_CHANGED_VALUE!>z--<!> }<!> var <!UNUSED_VARIABLE!>iff<!> = <!IMPLICIT_CAST_TO_UNIT_OR_ANY!>if (true) { diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt786.jet b/compiler/testData/diagnostics/tests/controlStructures/kt786.jet index 665af148d31..e82c47aa5fc 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt786.jet +++ b/compiler/testData/diagnostics/tests/controlStructures/kt786.jet @@ -1,13 +1,13 @@ -namespace kt786 +package kt786 //KT-786 Exception on incomplete code with 'when' fun foo() : Int { val d = 2 var z = 0 when(d) { - is 5, is 3 => <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY, UNUSED_CHANGED_VALUE!>z++<!> - <!ELSE_MISPLACED_IN_WHEN!>else => { <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>z = <!UNUSED_VALUE!>-1000<!><!> }<!> - return z => <!UNREACHABLE_CODE!>34<!> + is 5, is 3 -> <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY, UNUSED_CHANGED_VALUE!>z++<!> + <!ELSE_MISPLACED_IN_WHEN!>else -> { <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>z = <!UNUSED_VALUE!>-1000<!><!> }<!> + return z -> <!UNREACHABLE_CODE!>34<!> } } @@ -15,10 +15,10 @@ fun foo() : Int { fun fff(): Int { var d = 3 when(d) { - is 4 => 21 - return 2 => <!UNREACHABLE_CODE!>return 47<!> - <!UNREACHABLE_CODE!>bar()<!> => <!UNREACHABLE_CODE!>45<!> - <!UNREACHABLE_CODE!>444<!> => <!UNREACHABLE_CODE!>true<!> + is 4 -> 21 + return 2 -> <!UNREACHABLE_CODE!>return 47<!> + <!UNREACHABLE_CODE!>bar()<!> -> <!UNREACHABLE_CODE!>45<!> + <!UNREACHABLE_CODE!>444<!> -> <!UNREACHABLE_CODE!>true<!> } return 34 } diff --git a/compiler/testData/diagnostics/tests/infos/Autocasts.jet b/compiler/testData/diagnostics/tests/infos/Autocasts.jet index 38a9005de0b..a869d644ed6 100644 --- a/compiler/testData/diagnostics/tests/infos/Autocasts.jet +++ b/compiler/testData/diagnostics/tests/infos/Autocasts.jet @@ -20,7 +20,7 @@ fun f9(init : A?) { a?.<!UNRESOLVED_REFERENCE!>bar<!>() a?.foo() } - if (!(a is B) || a.bar() == ()) { + if (!(a is B) || a.bar() == #()) { a?.<!UNRESOLVED_REFERENCE!>bar<!>() } if (!(a is B)) { @@ -54,24 +54,24 @@ fun f101(a : A?) { fun f11(a : A?) { when (a) { - is B => a.bar() - is A => a.foo() - is Any => a.foo() - is Any? => a.<!UNRESOLVED_REFERENCE!>bar<!>() - else => a?.foo() + is B -> a.bar() + is A -> a.foo() + is Any -> a.foo() + is Any? -> a.<!UNRESOLVED_REFERENCE!>bar<!>() + else -> a?.foo() } } fun f12(a : A?) { when (a) { - is B => a.bar() - is A => a.foo() - is Any => a.foo(); - is Any? => a.<!UNRESOLVED_REFERENCE!>bar<!>() - is val c : <!TYPE_MISMATCH_IN_BINDING_PATTERN!>B<!> => c.foo() - is val c is C => c.bar() - is val c is C => a.bar() - else => a?.foo() + is B -> a.bar() + is A -> a.foo() + is Any -> a.foo(); + is Any? -> a.<!UNRESOLVED_REFERENCE!>bar<!>() + is val c : <!TYPE_MISMATCH_IN_BINDING_PATTERN!>B<!> -> c.foo() + is val c is C -> c.bar() + is val c is C -> a.bar() + else -> a?.foo() } if (a is val b) { @@ -106,7 +106,7 @@ fun f13(a : A?) { } a?.foo() - if (a is val c is B && a.foo() == () && c.bar() == ()) { + if (a is val c is B && a.foo() == #() && c.bar() == #()) { c.foo() c.bar() } @@ -154,18 +154,18 @@ fun getStringLength(obj : Any) : Char? { fun toInt(i: Int?): Int = if (i != null) i else 0 fun illegalWhenBody(a: Any): Int = when(a) { - is Int => a - is String => <!TYPE_MISMATCH!>a<!> + is Int -> a + is String -> <!TYPE_MISMATCH!>a<!> } fun illegalWhenBlock(a: Any): Int { when(a) { - is Int => return a - is String => return <!TYPE_MISMATCH!>a<!> + is Int -> return a + is String -> return <!TYPE_MISMATCH!>a<!> } } fun declarations(a: Any?) { if (a is String) { - val <!UNUSED_VARIABLE!>p4<!>: (Int, String) = (2, a) + val <!UNUSED_VARIABLE!>p4<!>: #(Int, String) = #(2, a) } if (a is String?) { if (a != null) { @@ -186,21 +186,21 @@ fun vars(a: Any?) { } fun tuples(a: Any?) { if (a != null) { - val <!UNUSED_VARIABLE!>s<!>: (Any, String) = (a, <!TYPE_MISMATCH!>a<!>) + val <!UNUSED_VARIABLE!>s<!>: #(Any, String) = #(a, <!TYPE_MISMATCH!>a<!>) } if (a is String) { - val <!UNUSED_VARIABLE!>s<!>: (Any, String) = (a, a) + val <!UNUSED_VARIABLE!>s<!>: #(Any, String) = #(a, a) } - fun illegalTupleReturnType(): (Any, String) = (<!TYPE_MISMATCH!>a<!>, <!TYPE_MISMATCH!>a<!>) + fun illegalTupleReturnType(): #(Any, String) = #(<!TYPE_MISMATCH!>a<!>, <!TYPE_MISMATCH!>a<!>) if (a is String) { - fun legalTupleReturnType(): (Any, String) = (a, a) + fun legalTupleReturnType(): #(Any, String) = #(a, a) } val <!UNUSED_VARIABLE!>illegalFunctionLiteral<!>: Function0<Int> = <!TYPE_MISMATCH!>{ <!TYPE_MISMATCH!>a<!> }<!> - val <!UNUSED_VARIABLE!>illegalReturnValueInFunctionLiteral<!>: Function0<Int> = { (): Int => <!TYPE_MISMATCH!>a<!> } + val <!UNUSED_VARIABLE!>illegalReturnValueInFunctionLiteral<!>: Function0<Int> = { (): Int -> <!TYPE_MISMATCH!>a<!> } if (a is Int) { val <!UNUSED_VARIABLE!>legalFunctionLiteral<!>: Function0<Int> = { a } - val <!UNUSED_VARIABLE!>alsoLegalFunctionLiteral<!>: Function0<Int> = { (): Int => a } + val <!UNUSED_VARIABLE!>alsoLegalFunctionLiteral<!>: Function0<Int> = { (): Int -> a } } } fun returnFunctionLiteralBlock(a: Any?): Function0<Int> { @@ -208,12 +208,12 @@ fun returnFunctionLiteralBlock(a: Any?): Function0<Int> { else return { 1 } } fun returnFunctionLiteral(a: Any?): Function0<Int> = - if (a is Int) { (): Int => a } - else { () => 1 } + if (a is Int) { (): Int -> a } + else { () -> 1 } -fun illegalTupleReturnType(a: Any): (Any, String) = (a, <!TYPE_MISMATCH!>a<!>) +fun illegalTupleReturnType(a: Any): #(Any, String) = #(a, <!TYPE_MISMATCH!>a<!>) -fun declarationInsidePattern(x: (Any, Any)): String = when(x) { is (val a is String, *) => a; else => "something" } +fun declarationInsidePattern(x: #(Any, Any)): String = when(x) { is #(val a is String, *) -> a; else -> "something" } fun mergeAutocasts(a: Any?) { if (a is String || a is Int) { @@ -224,7 +224,7 @@ fun mergeAutocasts(a: Any?) { a.<!UNRESOLVED_REFERENCE!>compareTo<!>("") } when (a) { - is String, is Any => a.<!UNRESOLVED_REFERENCE!>compareTo<!>("") + is String, is Any -> a.<!UNRESOLVED_REFERENCE!>compareTo<!>("") } if (a is String && a is Any) { val <!UNUSED_VARIABLE!>i<!>: Int = a.compareTo("") diff --git a/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt244.jet b/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt244.jet index 3fdb3fc0a75..3e19f906169 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt244.jet +++ b/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt244.jet @@ -1,4 +1,4 @@ -namespace kt244 +package kt244 //+JDK diff --git a/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt362.jet b/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt362.jet index 5fd5f72bfb1..a934b77d046 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt362.jet +++ b/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt362.jet @@ -1,7 +1,7 @@ // KT-362 Don't allow autocasts on vals that are not internal -namespace example; +package example; -namespace test { +package test { public class Public() { public val public : Int? = 1; protected val protected : Int? = 1; diff --git a/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.jet b/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.jet index cdced141c6a..0f387418f9d 100644 --- a/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.jet +++ b/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.jet @@ -1,7 +1,7 @@ // One of the two passes is making a scope and turning vals into functions // See KT-76 -namespace x +package x val b : Foo = Foo() val a1 = b.compareTo(2) diff --git a/compiler/testData/diagnostics/tests/regressions/CoercionToUnit.jet b/compiler/testData/diagnostics/tests/regressions/CoercionToUnit.jet index 765036145b7..3fbbafe7fa4 100644 --- a/compiler/testData/diagnostics/tests/regressions/CoercionToUnit.jet +++ b/compiler/testData/diagnostics/tests/regressions/CoercionToUnit.jet @@ -2,7 +2,7 @@ fun foo(<!UNUSED_PARAMETER!>u<!> : Unit) : Int = 1 fun test() : Int { foo(<!TYPE_MISMATCH!>1<!>) - val <!UNUSED_VARIABLE!>a<!> : fun() : Unit = { + val <!UNUSED_VARIABLE!>a<!> : () -> Unit = { foo(<!TYPE_MISMATCH!>1<!>) } return 1 diff --git a/compiler/testData/diagnostics/tests/regressions/Jet121.jet b/compiler/testData/diagnostics/tests/regressions/Jet121.jet index fc29dfe5293..4dda2b95c51 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet121.jet +++ b/compiler/testData/diagnostics/tests/regressions/Jet121.jet @@ -1,6 +1,6 @@ -namespace jet121 { +package jet121 { fun box() : String { - val answer = apply("OK") { String.() : Int => + val answer = apply("OK") { String.() : Int -> get(0) length } @@ -8,7 +8,7 @@ namespace jet121 { return if (answer == 2) "OK" else "FAIL" } - fun apply(arg:String, f : fun String.() : Int) : Int { + fun apply(arg:String, f : String.() -> Int) : Int { return arg.f() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/Jet124.jet b/compiler/testData/diagnostics/tests/regressions/Jet124.jet index 317b1438f41..5e8088b3e08 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet124.jet +++ b/compiler/testData/diagnostics/tests/regressions/Jet124.jet @@ -1,8 +1,8 @@ -fun foo1() : fun (Int) : Int = { (x: Int) => x } +fun foo1() : (Int) -> Int = { (x: Int) -> x } fun foo() { - val h : fun (Int) : Int = foo1(); + val h : (Int) -> Int = foo1(); h(1) - val m : fun (Int) : Int = {(a : Int) => 1}//foo1() + val m : (Int) -> Int = {(a : Int) -> 1}//foo1() m(1) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/Jet169.jet b/compiler/testData/diagnostics/tests/regressions/Jet169.jet index c0196a2543d..8c28c04b4c3 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet169.jet +++ b/compiler/testData/diagnostics/tests/regressions/Jet169.jet @@ -1,8 +1,8 @@ fun set(<!UNUSED_PARAMETER!>key<!> : String, <!UNUSED_PARAMETER!>value<!> : String) { val a : String? = "" when (a) { - "" => a<!UNSAFE_CALL!>.<!>get(0) - is String, is Any => a.compareTo("") - else => a.toString() + "" -> a<!UNSAFE_CALL!>.<!>get(0) + is String, is Any -> a.compareTo("") + else -> a.toString() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/UnavaliableQualifiedThis.jet b/compiler/testData/diagnostics/tests/regressions/UnavaliableQualifiedThis.jet index 301ded436a1..06f60005347 100644 --- a/compiler/testData/diagnostics/tests/regressions/UnavaliableQualifiedThis.jet +++ b/compiler/testData/diagnostics/tests/regressions/UnavaliableQualifiedThis.jet @@ -2,7 +2,7 @@ trait Iterator<out T> { fun next() : T val hasNext : Boolean - fun <R> map(transform: fun(element: T) : R) : Iterator<R> = + fun <R> map(transform: (element: T) -> R) : Iterator<R> = object : Iterator<R> { override fun next() : R = transform(<!NO_THIS!>this@map<!>.next()) diff --git a/compiler/testData/diagnostics/tests/regressions/kt128.jet b/compiler/testData/diagnostics/tests/regressions/kt128.jet index ca9b223cd02..f136de1a55a 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt128.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt128.jet @@ -1,6 +1,6 @@ // KT-128 Support passing only the last closure if all the other parameters have default values -fun div(<!UNUSED_PARAMETER!>c<!> : String = "", <!UNUSED_PARAMETER!>f<!> : fun()) {} +fun div(<!UNUSED_PARAMETER!>c<!> : String = "", <!UNUSED_PARAMETER!>f<!> : () -> Unit) {} fun f() { div { // Nothing passed, but could have been... // ... diff --git a/compiler/testData/diagnostics/tests/regressions/kt235.jet b/compiler/testData/diagnostics/tests/regressions/kt235.jet index 0f0c33183a5..0fd87b03479 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt235.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt235.jet @@ -1,36 +1,36 @@ //KT-235 Illegal assignment return type // +JDK -namespace kt235 +package kt235 fun main(args: Array<String>) { val array = MyArray() - val <!UNUSED_VARIABLE!>f<!> = { (): String => + val <!UNUSED_VARIABLE!>f<!> = { (): String -> <!EXPECTED_TYPE_MISMATCH!>array[2] = 23<!> //error: Type mismatch: inferred type is Int (!!!) but String was expected } - val <!UNUSED_VARIABLE!>g<!> = {(): String => + val <!UNUSED_VARIABLE!>g<!> = {(): String -> var x = 1 <!EXPECTED_TYPE_MISMATCH!>x += 2<!> //no error, but it should be here } - val <!UNUSED_VARIABLE!>h<!> = {(): String => + val <!UNUSED_VARIABLE!>h<!> = {(): String -> var x = 1 <!EXPECTED_TYPE_MISMATCH!>x = 2<!> //the same } val array1 = MyArray1() - val <!UNUSED_VARIABLE!>i<!> = { (): String => + val <!UNUSED_VARIABLE!>i<!> = { (): String -> <!EXPECTED_TYPE_MISMATCH!>array1[2] = 23<!> } - val <!UNUSED_VARIABLE!>fi<!> = { (): Int => + val <!UNUSED_VARIABLE!>fi<!> = { (): Int -> <!ASSIGNMENT_TYPE_MISMATCH!>array[2] = 23<!> } - val <!UNUSED_VARIABLE!>gi<!> = {(): Int => + val <!UNUSED_VARIABLE!>gi<!> = {(): Int -> var x = 1 <!ASSIGNMENT_TYPE_MISMATCH!>x += 21<!> } var m: MyNumber = MyNumber() - val <!UNUSED_VARIABLE!>a<!> = { (): MyNumber => + val <!UNUSED_VARIABLE!>a<!> = { (): MyNumber -> <!UNUSED_CHANGED_VALUE!>m++<!> } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt26-1.jet b/compiler/testData/diagnostics/tests/regressions/kt26-1.jet index ff27f3515f3..d749ca77a99 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt26-1.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt26-1.jet @@ -1,7 +1,7 @@ // KT-26 Import namespaces defined in this file -namespace foo { +package foo { import bar.* // Must not be an error } -namespace bar {} \ No newline at end of file +package bar {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt26.jet b/compiler/testData/diagnostics/tests/regressions/kt26.jet index f79b7a901f8..816545f24b4 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt26.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt26.jet @@ -2,7 +2,7 @@ import html.* // Must not be an error -namespace html { +package html { abstract class Factory<T> { fun create() : T? = null diff --git a/compiler/testData/diagnostics/tests/regressions/kt302.jet b/compiler/testData/diagnostics/tests/regressions/kt302.jet index df3d68e0d55..25fe84153e2 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt302.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt302.jet @@ -1,6 +1,6 @@ // KT-302 Report an error when inheriting many implementations of the same member -namespace kt302 +package kt302 trait A { open fun foo() {} diff --git a/compiler/testData/diagnostics/tests/regressions/kt306.jet b/compiler/testData/diagnostics/tests/regressions/kt306.jet index 4356fe5e10c..b78f2902f9d 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt306.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt306.jet @@ -1,14 +1,14 @@ // KT-306 Ambiguity when different this's have same-looking functions fun test() { - {Foo.() => + {Foo.() -> bar() - {Barr.() => + {Barr.() -> this.bar() bar() } } - {Barr.() => + {Barr.() -> bar() } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt328.jet b/compiler/testData/diagnostics/tests/regressions/kt328.jet index 79ac13f9e0d..f396b3f67e1 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt328.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt328.jet @@ -21,7 +21,7 @@ val x = { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>x<!> } val z = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>z<!> //KT-329 Assertion failure on local function -fun block(f : fun() : Unit) = f() +fun block(f : () -> Unit) = f() fun bar3() = block{ <!UNRESOLVED_REFERENCE!>foo3<!>() // <-- missing closing curly bracket fun foo3() = block{ <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>bar3()<!> }<!SYNTAX!><!> diff --git a/compiler/testData/diagnostics/tests/regressions/kt352.jet b/compiler/testData/diagnostics/tests/regressions/kt352.jet index 74f9ddecdb0..52eb5122d37 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt352.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt352.jet @@ -1,26 +1,26 @@ //KT-352 Function variable declaration type isn't checked inside a function body -namespace kt352 +package kt352 -val f : fun(Any) : Unit = <!TYPE_MISMATCH!>{ () : Unit => }<!> //type mismatch +val f : (Any) -> Unit = <!TYPE_MISMATCH!>{ () : Unit -> }<!> //type mismatch fun foo() { - val <!UNUSED_VARIABLE!>f<!> : fun(Any) : Unit = <!TYPE_MISMATCH!>{ () : Unit => }<!> //!!! no error + val <!UNUSED_VARIABLE!>f<!> : (Any) -> Unit = <!TYPE_MISMATCH!>{ () : Unit -> }<!> //!!! no error } class A() { - val f : fun(Any) : Unit = <!TYPE_MISMATCH!>{ () : Unit => }<!> //type mismatch + val f : (Any) -> Unit = <!TYPE_MISMATCH!>{ () : Unit -> }<!> //type mismatch } //more tests -val g : fun() : Unit = <!TYPE_MISMATCH!>{ (): Int => 42 }<!> +val g : () -> Unit = <!TYPE_MISMATCH!>{ (): Int -> 42 }<!> -val h : fun() : Unit = { doSmth() } +val h : () -> Unit = { doSmth() } fun doSmth(): Int = 42 fun doSmth(<!UNUSED_PARAMETER!>a<!>: String) {} -val testIt : fun(Any) : Unit = { +val testIt : (Any) -> Unit = { if (it is String) { doSmth(it) } diff --git a/compiler/testData/diagnostics/tests/regressions/kt353.jet b/compiler/testData/diagnostics/tests/regressions/kt353.jet index bc2a4f6df2f..5194b492db7 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt353.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt353.jet @@ -5,7 +5,7 @@ trait A { } fun foo(a: A) { - val <!UNUSED_VARIABLE!>g<!> : fun() : Unit = { + val <!UNUSED_VARIABLE!>g<!> : () -> Unit = { a.gen() //it works: Unit is derived } @@ -15,16 +15,16 @@ fun foo(a: A) { a.<!TYPE_INFERENCE_FAILED!>gen()<!> // Shouldn't work: no info for inference } - val <!UNUSED_VARIABLE!>b<!> : fun() : Unit = { + val <!UNUSED_VARIABLE!>b<!> : () -> Unit = { if (true) { a.gen() // unit can be inferred } else { - () + #() } } - val <!UNUSED_VARIABLE!>f<!> : fun() : Int = { () : Int => + val <!UNUSED_VARIABLE!>f<!> : () -> Int = { () : Int -> a.gen() //type mismatch, but Int can be derived } diff --git a/compiler/testData/diagnostics/tests/regressions/kt385.109.441.jet b/compiler/testData/diagnostics/tests/regressions/kt385.109.441.jet index 9dcac990807..d87d244f290 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt385.109.441.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt385.109.441.jet @@ -5,29 +5,29 @@ import java.util.* -fun <T> Iterator<T>.foreach(operation: fun(element: T) : Unit) : Unit = while(hasNext) operation(next()) +fun <T> Iterator<T>.foreach(operation: (element: T) -> Unit) : Unit = while(hasNext) operation(next()) -fun <T> Iterator<T>.foreach(operation: fun(index: Int, element: T) : Unit) : Unit { +fun <T> Iterator<T>.foreach(operation: (index: Int, element: T) -> Unit) : Unit { var k = 0 while(hasNext) operation(k++, next()) } -fun <T> Iterable<T>.foreach(operation: fun(element: T) : Unit) : Unit = iterator() foreach operation +fun <T> Iterable<T>.foreach(operation: (element: T) -> Unit) : Unit = iterator() foreach operation -fun <T> Iterable<T>.foreach(operation: fun(index: Int, element: T) : Unit) : Unit = iterator() foreach operation +fun <T> Iterable<T>.foreach(operation: (index: Int, element: T) -> Unit) : Unit = iterator() foreach operation fun box() : String { - return generic_invoker( { () : String => "OK"} ) + return generic_invoker( { () : String -> "OK"} ) } -fun <T> generic_invoker(gen : fun () : T) : T { +fun <T> generic_invoker(gen : () -> T) : T { return gen() } fun println(message : Int) { System.out?.println(message) } fun println(message : Long) { System.out?.println(message) } -inline fun run<T>(body : fun() : T) : T = body() +inline fun run<T>(body : () -> T) : T = body() fun main(args : Array<String>) { diff --git a/compiler/testData/diagnostics/tests/regressions/kt398.jet b/compiler/testData/diagnostics/tests/regressions/kt398.jet index 1babedaf8f4..7607d58dece 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt398.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt398.jet @@ -1,7 +1,7 @@ // KT-398 Internal error when property initializes with function class X<T>() { - val check = { (a : Any) => a is T } + val check = { (a : Any) -> a is T } } fun box() : String { diff --git a/compiler/testData/diagnostics/tests/regressions/kt399.jet b/compiler/testData/diagnostics/tests/regressions/kt399.jet index 3c52df4cc6e..ce92c6e50b4 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt399.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt399.jet @@ -1,7 +1,7 @@ // KT-399 Type argument inference not implemented for CALL_EXPRESSION fun <T> getSameTypeChecker(<!UNUSED_PARAMETER!>obj<!>: T) : Function1<Any,Boolean> { - return { (a : Any) => a is T } + return { (a : Any) -> a is T } } fun box() : String { diff --git a/compiler/testData/diagnostics/tests/regressions/kt402.jet b/compiler/testData/diagnostics/tests/regressions/kt402.jet index 7df59b2aa2f..a1e70b417f2 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt402.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt402.jet @@ -1,8 +1,8 @@ -namespace kt402 +package kt402 -fun getTypeChecker() : fun(Any):Boolean { - <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>{ (a : Any) => a is <!UNRESOLVED_REFERENCE!>T<!> }<!> // reports unsupported +fun getTypeChecker() : (Any)->Boolean { + <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>{ (a : Any) -> a is <!UNRESOLVED_REFERENCE!>T<!> }<!> // reports unsupported } -fun f() : fun(Any) : Boolean { - return { (a : Any) => a is String } +fun f() : (Any) -> Boolean { + return { (a : Any) -> a is String } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt41.jet b/compiler/testData/diagnostics/tests/regressions/kt41.jet index 84ec9616fae..91e93881f06 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt41.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt41.jet @@ -1,6 +1,6 @@ // KT-41 Make functions with errors in returning statement return ERROR type and not Nothing -namespace kt41 +package kt41 fun aaa() = 6 <!UNRESOLVED_REFERENCE!>foo<!> 1 diff --git a/compiler/testData/diagnostics/tests/regressions/kt411.jet b/compiler/testData/diagnostics/tests/regressions/kt411.jet index 0828b9a4efd..1397f9092f2 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt411.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt411.jet @@ -1,6 +1,6 @@ //kt-411 Wrong type expected when returning from a function literal -namespace kt411 +package kt411 fun f() { invoker( @@ -9,17 +9,17 @@ fun f() { } ) } -fun invoker(<!UNUSED_PARAMETER!>gen<!> : fun() : Int) : Int = 0 +fun invoker(<!UNUSED_PARAMETER!>gen<!> : () -> Int) : Int = 0 //more tests fun t1() { - val <!UNUSED_VARIABLE!>v<!> = @{ () : Int => + val <!UNUSED_VARIABLE!>v<!> = @{ () : Int -> return@ 111 } } fun t2() : String { - val <!UNUSED_VARIABLE!>g<!> : fun(): Int = @{ + val <!UNUSED_VARIABLE!>g<!> : ()-> Int = @{ if (true) { return@ 1 } @@ -41,7 +41,7 @@ fun t3() : String { } ) invoker( - @{ (): Int => + @{ (): Int -> return@ 1 } ) @@ -54,10 +54,10 @@ fun t3() : String { } fun t4() : Int { - val <!UNUSED_VARIABLE!>h<!> : fun (): String = @l{ + val <!UNUSED_VARIABLE!>h<!> : ()-> String = @l{ return@l "a" } - val <!UNUSED_VARIABLE!>g<!> : fun (): String = @{ () : String => + val <!UNUSED_VARIABLE!>g<!> : ()-> String = @{ () : String -> return@ "a" } diff --git a/compiler/testData/diagnostics/tests/regressions/kt439.jet b/compiler/testData/diagnostics/tests/regressions/kt439.jet index 176e3280e18..49fd6e28082 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt439.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt439.jet @@ -1,6 +1,6 @@ // KT-439 Support labeled function literals in call arguments -inline fun run1<T>(body : fun() : T) : T = body() +inline fun run1<T>(body : () -> T) : T = body() fun main1(<!UNUSED_PARAMETER!>args<!> : Array<String>) { run1 @l{ 1 } // should not be an error diff --git a/compiler/testData/diagnostics/tests/regressions/kt442.jet b/compiler/testData/diagnostics/tests/regressions/kt442.jet index 0618918b14a..9b4e1c745d2 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt442.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt442.jet @@ -1,12 +1,12 @@ // KT-442 Type inference fails on with() -fun <T> funny(f : fun() : T) : T = f() +fun <T> funny(f : () -> T) : T = f() fun testFunny() { val <!UNUSED_VARIABLE!>a<!> : Int = funny {1} } -fun <T> funny2(<!UNUSED_PARAMETER!>f<!> : fun(t : T) : T) : T <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>{}<!> +fun <T> funny2(<!UNUSED_PARAMETER!>f<!> : (t : T) -> T) : T <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>{}<!> fun testFunny2() { val <!UNUSED_VARIABLE!>a<!> : Int = funny2 {it} @@ -16,11 +16,11 @@ fun box() : String { return generic_invoker { it } } -fun <T> generic_invoker(gen : fun (String) : T) : T { +fun <T> generic_invoker(gen : (String) -> T) : T { return gen("") } -fun <T> T.with(f : fun T.()) { +fun <T> T.with(f : T.() -> Unit) { f() } diff --git a/compiler/testData/diagnostics/tests/regressions/kt455.jet b/compiler/testData/diagnostics/tests/regressions/kt455.jet index 0db1c1c4ae9..a30e73c4bff 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt455.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt455.jet @@ -1,6 +1,6 @@ //KT-455 Do not repeat errors in definite assignment checks -namespace kt455 +package kt455 fun foo() { val a: Int diff --git a/compiler/testData/diagnostics/tests/regressions/kt456.jet b/compiler/testData/diagnostics/tests/regressions/kt456.jet index d27eb2d3faa..8d67585ff38 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt456.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt456.jet @@ -1,6 +1,6 @@ //KT-456 No check for obligatory return in getters -namespace kt456 +package kt456 class A() { val i: Int diff --git a/compiler/testData/diagnostics/tests/regressions/kt469.jet b/compiler/testData/diagnostics/tests/regressions/kt469.jet index a9ff4c1d291..ee21f757324 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt469.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt469.jet @@ -1,6 +1,6 @@ // +JDK -namespace kt469 +package kt469 //KT-512 plusAssign() : Unit does not work properly import java.util.* diff --git a/compiler/testData/diagnostics/tests/regressions/kt524.jet b/compiler/testData/diagnostics/tests/regressions/kt524.jet index 9ffcd1f564a..f4da82809a4 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt524.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt524.jet @@ -1,7 +1,7 @@ // KT-524 sure() returns T // +JDK -namespace StringBuilder +package StringBuilder import java.lang.StringBuilder diff --git a/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.jet b/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.jet index b258404a6f6..65a0bccdbf4 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.jet @@ -1,7 +1,7 @@ // http://youtrack.jetbrains.net/issue/KT-526 // KT-526 Unresolved reference for inner static class -namespace demo +package demo class Foo { class object { diff --git a/compiler/testData/diagnostics/tests/regressions/kt549.jet b/compiler/testData/diagnostics/tests/regressions/kt549.jet index 5fc17be122b..2b3f087420f 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt549.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt549.jet @@ -1,9 +1,9 @@ //KT-549 type inference failed // +JDK -namespace demo +package demo - fun filter<T>(list : Array<T>, filter : fun (T) : Boolean) : java.util.List<T> { + fun filter<T>(list : Array<T>, filter : (T) -> Boolean) : java.util.List<T> { val answer = java.util.ArrayList<T>(); for (l in list) { if (filter(l)) answer.add(l) diff --git a/compiler/testData/diagnostics/tests/regressions/kt571.jet b/compiler/testData/diagnostics/tests/regressions/kt571.jet index 2333eb78644..9a6cfce30a6 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt571.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt571.jet @@ -1,3 +1,3 @@ //KT-571 Type inference failed -fun <T, R> let(t : T, body : fun(T) : R) = body(t) +fun <T, R> let(t : T, body : (T) -> R) = body(t) private fun double(d : Int) : Int = let(d * 2) {it / 10 + it * 2 % 10} diff --git a/compiler/testData/diagnostics/tests/regressions/kt575.jet b/compiler/testData/diagnostics/tests/regressions/kt575.jet index aaa84ac3c9f..6f796301ad7 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt575.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt575.jet @@ -1,6 +1,6 @@ // KT-575 Cannot ++ a class object member -namespace kt575 +package kt575 class Creature() { class object { diff --git a/compiler/testData/diagnostics/tests/regressions/kt58.jet b/compiler/testData/diagnostics/tests/regressions/kt58.jet index d6a0e64456f..7b7a7526755 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt58.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt58.jet @@ -1,11 +1,11 @@ //KT-58 Allow finally around definite returns // +JDK -namespace kt58 +package kt58 import java.util.concurrent.locks.Lock -fun lock<T>(lock : Lock, body : fun () : T) : T { +fun lock<T>(lock : Lock, body : () -> T) : T { lock.lock() try { return body() diff --git a/compiler/testData/diagnostics/tests/regressions/kt580.jet b/compiler/testData/diagnostics/tests/regressions/kt580.jet index c2d12ec6e93..8816e416104 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt580.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt580.jet @@ -1,7 +1,7 @@ //KT-580 Type inference failed // +JDK -namespace whats.the.difference +package whats.the.difference import java.util.* diff --git a/compiler/testData/diagnostics/tests/regressions/kt604.jet b/compiler/testData/diagnostics/tests/regressions/kt604.jet index 02f079e6900..de0926b0208 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt604.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt604.jet @@ -11,7 +11,7 @@ trait ChannelPipelineFactory{ fun getPipeline() : ChannelPipeline } -class StandardPipelineFactory(val config: fun ChannelPipeline.():Unit) : ChannelPipelineFactory { +class StandardPipelineFactory(val config: ChannelPipeline.()->Unit) : ChannelPipelineFactory { override fun getPipeline() : ChannelPipeline { val pipeline = DefaultChannelPipeline() pipeline.config () diff --git a/compiler/testData/diagnostics/tests/regressions/kt618.jet b/compiler/testData/diagnostics/tests/regressions/kt618.jet index f70f921730e..2ef9ef9d760 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt618.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt618.jet @@ -1,4 +1,4 @@ -namespace lol +package lol class B() { fun plusAssign(<!UNUSED_PARAMETER!>other<!> : B) : String { diff --git a/compiler/testData/diagnostics/tests/regressions/kt629.jet b/compiler/testData/diagnostics/tests/regressions/kt629.jet index f0c8780ad9a..8dd6bc71d81 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt629.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt629.jet @@ -1,6 +1,6 @@ //KT-629 Assignments are parsed as expressions. -namespace kt629 +package kt629 class A() { var p = "yeah" diff --git a/compiler/testData/diagnostics/tests/regressions/kt688.jet b/compiler/testData/diagnostics/tests/regressions/kt688.jet index 045dddc7d8f..7ff7a78081b 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt688.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt688.jet @@ -6,7 +6,7 @@ open class B() : A() { class C() { - fun a<T>(x: fun(T):T, y: T): T { + fun a<T>(x: (T)->T, y: T): T { return x(x(y)) } diff --git a/compiler/testData/diagnostics/tests/regressions/kt691.jet b/compiler/testData/diagnostics/tests/regressions/kt691.jet index e7194b099c9..649df9d3c90 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt691.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt691.jet @@ -1,2 +1,2 @@ // KT-691 Allow to create nested namespaces with dot delimiter -namespace foo.bar.buz \ No newline at end of file +package foo.bar.buz \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt743.jet b/compiler/testData/diagnostics/tests/regressions/kt743.jet index faecff09851..2988a573a65 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt743.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt743.jet @@ -2,5 +2,5 @@ // +JDK class List<T>(val head: T, val tail: List<T>? = null) -fun <T, Q> List<T>.map(f: fun(T): Q): List<T>? = tail.sure<List<T>>().map(f) +fun <T, Q> List<T>.map(f: (T)-> Q): List<T>? = tail.sure<List<T>>().map(f) fun foo<T>(t : T) : T = foo(t) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt860.jet b/compiler/testData/diagnostics/tests/regressions/kt860.jet index d8acf4fad50..4f01757e730 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt860.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt860.jet @@ -1,7 +1,7 @@ // KT-860 ConcurrentModificationException in frontend // +JDK -namespace std.util +package std.util import java.util.* diff --git a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.jet b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.jet index 1b0a3c71177..a7c98104ac7 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.jet +++ b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.jet @@ -1,6 +1,6 @@ // +JDK -namespace kt_250_617_10 +package kt_250_617_10 import java.util.ArrayList import java.util.HashMap diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowPropertyInClosure.jet b/compiler/testData/diagnostics/tests/shadowing/ShadowPropertyInClosure.jet index c785e3f5fc7..00c0d038398 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowPropertyInClosure.jet +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowPropertyInClosure.jet @@ -1,3 +1,3 @@ val i = 17 -val f = { (): Int => var i = 17; i } +val f = { (): Int -> var i = 17; i } diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.jet b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.jet index d9dd9110893..e448f74f8c9 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.jet +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.jet @@ -1,5 +1,5 @@ fun f(): Int { var i = 17 - { (): Unit => var <!NAME_SHADOWING!>i<!> = 18 } + { (): Unit -> var <!NAME_SHADOWING!>i<!> = 18 } return i } diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.jet b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.jet index 6ba5fd4c919..d926e4bca41 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.jet +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.jet @@ -1,5 +1,5 @@ fun ff(): Int { var i = 1 - { (i: Int) => i } + { (i: Int) -> i } return i } diff --git a/compiler/testData/psi/Attributes.jet b/compiler/testData/psi/Attributes.jet index 321691b72dc..2cf3b445414 100644 --- a/compiler/testData/psi/Attributes.jet +++ b/compiler/testData/psi/Attributes.jet @@ -1,4 +1,4 @@ -namespace foo.bar.goo +package foo.bar.goo abstract open diff --git a/compiler/testData/psi/Attributes.txt b/compiler/testData/psi/Attributes.txt index 6cb067b94eb..8119149e1b8 100644 --- a/compiler/testData/psi/Attributes.txt +++ b/compiler/testData/psi/Attributes.txt @@ -1,7 +1,7 @@ JetFile: Attributes.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') diff --git a/compiler/testData/psi/AttributesOnPatterns.jet b/compiler/testData/psi/AttributesOnPatterns.jet index ec9ead0312a..c485e7ca69a 100644 --- a/compiler/testData/psi/AttributesOnPatterns.jet +++ b/compiler/testData/psi/AttributesOnPatterns.jet @@ -1,11 +1,11 @@ fun foo() { when (e) { - is [a] val a => d - is [a] val a is foo => d - is [a] * => d - is [a] 2 => d - is [a] T => d - is [a] T @ () => d + is [a] val a -> d + is [a] val a is foo -> d + is [a] * -> d + is [a] 2 -> d + is [a] T -> d + is [a] T #() -> d } } diff --git a/compiler/testData/psi/AttributesOnPatterns.txt b/compiler/testData/psi/AttributesOnPatterns.txt index 545e0b1f3b1..c2b2d07c73c 100644 --- a/compiler/testData/psi/AttributesOnPatterns.txt +++ b/compiler/testData/psi/AttributesOnPatterns.txt @@ -43,7 +43,7 @@ JetFile: AttributesOnPatterns.jet PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('a') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') @@ -77,7 +77,7 @@ JetFile: AttributesOnPatterns.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') @@ -99,7 +99,7 @@ JetFile: AttributesOnPatterns.jet PsiWhiteSpace(' ') PsiElement(MUL)('*') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') @@ -122,7 +122,7 @@ JetFile: AttributesOnPatterns.jet INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('2') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') @@ -147,7 +147,7 @@ JetFile: AttributesOnPatterns.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') @@ -169,14 +169,13 @@ JetFile: AttributesOnPatterns.jet PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') diff --git a/compiler/testData/psi/Attributes_ERR.jet b/compiler/testData/psi/Attributes_ERR.jet index 03e73f7b999..7bc5aaa1e14 100644 --- a/compiler/testData/psi/Attributes_ERR.jet +++ b/compiler/testData/psi/Attributes_ERR.jet @@ -1,4 +1,4 @@ -namespace foo.bar.goo +package foo.bar.goo abstract open diff --git a/compiler/testData/psi/Attributes_ERR.txt b/compiler/testData/psi/Attributes_ERR.txt index 0f8116df665..9a1cb87e2ca 100644 --- a/compiler/testData/psi/Attributes_ERR.txt +++ b/compiler/testData/psi/Attributes_ERR.txt @@ -1,7 +1,7 @@ JetFile: Attributes_ERR.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') diff --git a/compiler/testData/psi/BabySteps.jet b/compiler/testData/psi/BabySteps.jet index a96fa43ff48..cf99c2a5705 100644 --- a/compiler/testData/psi/BabySteps.jet +++ b/compiler/testData/psi/BabySteps.jet @@ -1,4 +1,4 @@ -namespace foo +package foo class Runnable<a,a>(a : doo = 0) : foo(d=0), bar by x, bar { diff --git a/compiler/testData/psi/BabySteps.txt b/compiler/testData/psi/BabySteps.txt index fbdf8deeafb..237827701cd 100644 --- a/compiler/testData/psi/BabySteps.txt +++ b/compiler/testData/psi/BabySteps.txt @@ -1,7 +1,7 @@ JetFile: BabySteps.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') PsiWhiteSpace('\n\n') diff --git a/compiler/testData/psi/BabySteps_ERR.jet b/compiler/testData/psi/BabySteps_ERR.jet index 97653321e3c..5648633c7f0 100644 --- a/compiler/testData/psi/BabySteps_ERR.jet +++ b/compiler/testData/psi/BabySteps_ERR.jet @@ -1,4 +1,4 @@ -namespace foo +package foo class Runnable<a,a>(a : doo = 0) : foo(d=0), ,bar by x, bar { diff --git a/compiler/testData/psi/BabySteps_ERR.txt b/compiler/testData/psi/BabySteps_ERR.txt index 9f0a5ea788b..4838223fe42 100644 --- a/compiler/testData/psi/BabySteps_ERR.txt +++ b/compiler/testData/psi/BabySteps_ERR.txt @@ -1,7 +1,7 @@ JetFile: BabySteps_ERR.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') PsiWhiteSpace('\n\n') diff --git a/compiler/testData/psi/CallsInWhen.jet b/compiler/testData/psi/CallsInWhen.jet index 2675ba89523..4cacfb5fff4 100644 --- a/compiler/testData/psi/CallsInWhen.jet +++ b/compiler/testData/psi/CallsInWhen.jet @@ -1,14 +1,14 @@ fun foo() { when (a) { - a.foo => a - a.foo() => a - a.foo<T> => a - a.foo<T>(a) => a - a.foo<T>(a, d) => a - a.{bar} => a - a.{!bar} => a - a.{() => !bar} => a - else => a + a.foo -> a + a.foo() -> a + a.foo<T> -> a + a.foo<T>(a) -> a + a.foo<T>(a, d) -> a + a.{bar} -> a + a.{!bar} -> a + a.{() -> !bar} -> a + else -> a } } diff --git a/compiler/testData/psi/CallsInWhen.txt b/compiler/testData/psi/CallsInWhen.txt index 4bde9526e87..d67bce4cd23 100644 --- a/compiler/testData/psi/CallsInWhen.txt +++ b/compiler/testData/psi/CallsInWhen.txt @@ -33,7 +33,7 @@ JetFile: CallsInWhen.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -52,7 +52,7 @@ JetFile: CallsInWhen.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -76,7 +76,7 @@ JetFile: CallsInWhen.jet PsiElement(IDENTIFIER)('T') PsiElement(GT)('>') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -106,7 +106,7 @@ JetFile: CallsInWhen.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -141,7 +141,7 @@ JetFile: CallsInWhen.jet PsiElement(IDENTIFIER)('d') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -161,7 +161,7 @@ JetFile: CallsInWhen.jet PsiElement(IDENTIFIER)('bar') PsiElement(RBRACE)('}') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -184,7 +184,7 @@ JetFile: CallsInWhen.jet PsiElement(IDENTIFIER)('bar') PsiElement(RBRACE)('}') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -203,7 +203,7 @@ JetFile: CallsInWhen.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK PREFIX_EXPRESSION @@ -213,7 +213,7 @@ JetFile: CallsInWhen.jet PsiElement(IDENTIFIER)('bar') PsiElement(RBRACE)('}') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -221,7 +221,7 @@ JetFile: CallsInWhen.jet WHEN_ENTRY PsiElement(else)('else') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') diff --git a/compiler/testData/psi/FileStart_ERR.jet b/compiler/testData/psi/FileStart_ERR.jet index dafb2f44095..cbfc8a0477c 100644 --- a/compiler/testData/psi/FileStart_ERR.jet +++ b/compiler/testData/psi/FileStart_ERR.jet @@ -1,2 +1,2 @@ -/namespace foo.bar +/package foo.bar import foo \ No newline at end of file diff --git a/compiler/testData/psi/FileStart_ERR.txt b/compiler/testData/psi/FileStart_ERR.txt index 87894ee76dd..1f3f4e6a14a 100644 --- a/compiler/testData/psi/FileStart_ERR.txt +++ b/compiler/testData/psi/FileStart_ERR.txt @@ -6,7 +6,7 @@ JetFile: FileStart_ERR.jet PsiElement(DIV)('/') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') diff --git a/compiler/testData/psi/FunctionLiterals.jet b/compiler/testData/psi/FunctionLiterals.jet index 6fb663e9924..4c27813eefb 100644 --- a/compiler/testData/psi/FunctionLiterals.jet +++ b/compiler/testData/psi/FunctionLiterals.jet @@ -3,28 +3,28 @@ fun foo() { {foo} - {a => a} + {a -> a} - {(a) => a} - {(a : A) => a} - {(a : A) : T => a} - {(a) : T => a} + {(a) -> a} + {(a : A) -> a} + {(a : A) : T -> a} + {(a) : T -> a} - {(a, a) => a} - {(a : A, a : B) => a} - {(a : A, a) : T => a} - {(a, a : B) : T => a} + {(a, a) -> a} + {(a : A, a : B) -> a} + {(a : A, a) : T -> a} + {(a, a : B) : T -> a} - {() => a} - {() => a} - {() : T => a} - {() : T => a} + {() -> a} + {() -> a} + {() : T -> a} + {() : T -> a} - {T.(a) => a} - {T.(a : A) => a} - {T.(a : A) : T => a} - {T.(a) : T => a} + {T.(a) -> a} + {T.(a : A) -> a} + {T.(a : A) : T -> a} + {T.(a) : T -> a} - {x, y => 1} - {[a] x, [b] y, [c] z => 1} + {x, y -> 1} + {[a] x, [b] y, [c] z -> 1} } diff --git a/compiler/testData/psi/FunctionLiterals.txt b/compiler/testData/psi/FunctionLiterals.txt index 7bf48210b76..13fc16a5f1d 100644 --- a/compiler/testData/psi/FunctionLiterals.txt +++ b/compiler/testData/psi/FunctionLiterals.txt @@ -35,7 +35,7 @@ JetFile: FunctionLiterals.jet VALUE_PARAMETER PsiElement(IDENTIFIER)('a') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -51,7 +51,7 @@ JetFile: FunctionLiterals.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -74,7 +74,7 @@ JetFile: FunctionLiterals.jet PsiElement(IDENTIFIER)('A') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -104,7 +104,7 @@ JetFile: FunctionLiterals.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -127,7 +127,7 @@ JetFile: FunctionLiterals.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -147,7 +147,7 @@ JetFile: FunctionLiterals.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -181,7 +181,7 @@ JetFile: FunctionLiterals.jet PsiElement(IDENTIFIER)('B') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -215,7 +215,7 @@ JetFile: FunctionLiterals.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -249,7 +249,7 @@ JetFile: FunctionLiterals.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -263,7 +263,7 @@ JetFile: FunctionLiterals.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -277,7 +277,7 @@ JetFile: FunctionLiterals.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -298,7 +298,7 @@ JetFile: FunctionLiterals.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -319,7 +319,7 @@ JetFile: FunctionLiterals.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -340,7 +340,7 @@ JetFile: FunctionLiterals.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -368,7 +368,7 @@ JetFile: FunctionLiterals.jet PsiElement(IDENTIFIER)('A') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -403,7 +403,7 @@ JetFile: FunctionLiterals.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -431,7 +431,7 @@ JetFile: FunctionLiterals.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -449,7 +449,7 @@ JetFile: FunctionLiterals.jet VALUE_PARAMETER PsiElement(IDENTIFIER)('y') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK INTEGER_CONSTANT @@ -459,56 +459,41 @@ JetFile: FunctionLiterals.jet FUNCTION_LITERAL_EXPRESSION FUNCTION_LITERAL PsiElement(LBRACE)('{') - VALUE_PARAMETER_LIST - VALUE_PARAMETER - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') + BLOCK + ANNOTATED_EXPRESSION + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('x') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_PARAMETER - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(RBRACKET)(']') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('x') + PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line) + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiElement(LBRACKET)('[') + PsiElement(IDENTIFIER)('b') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('y') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_PARAMETER - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiElement(RBRACKET)(']') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiElement(LBRACKET)('[') + PsiElement(IDENTIFIER)('c') + PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('z') - PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') - PsiWhiteSpace(' ') - BLOCK - INTEGER_CONSTANT + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') PsiElement(INTEGER_LITERAL)('1') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') PsiElement(RBRACE)('}') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') \ No newline at end of file + PsiErrorElement:Expecting '} + <empty list> \ No newline at end of file diff --git a/compiler/testData/psi/FunctionLiterals_ERR.jet b/compiler/testData/psi/FunctionLiterals_ERR.jet index e0fb54a1dc0..d275d6711a6 100644 --- a/compiler/testData/psi/FunctionLiterals_ERR.jet +++ b/compiler/testData/psi/FunctionLiterals_ERR.jet @@ -1,18 +1,18 @@ fun foo() { - { => a} + { -> a} - {(a => a} - {(a : ) => a} - {(a : A) : => a} - {(a) : T => } + {(a -> a} + {(a : ) -> a} + {(a : A) : -> a} + {(a) : T -> } - {(a, ) => a} - {(a : A, , a : B) => a} - {(a : A, , , a) : T => a} + {(a, ) -> a} + {(a : A, , a : B) -> a} + {(a : A, , , a) : T -> a} - {T.t(a) => a} - {T.t -(a : A) => a} + {T.t(a) -> a} + {T.t -(a : A) -> a} - {a : b => f} - {T.a : b => f} + {a : b -> f} + {T.a : b -> f} } \ No newline at end of file diff --git a/compiler/testData/psi/FunctionLiterals_ERR.txt b/compiler/testData/psi/FunctionLiterals_ERR.txt index 36f5a5db19b..922c8670737 100644 --- a/compiler/testData/psi/FunctionLiterals_ERR.txt +++ b/compiler/testData/psi/FunctionLiterals_ERR.txt @@ -17,12 +17,10 @@ JetFile: FunctionLiterals_ERR.jet FUNCTION_LITERAL PsiElement(LBRACE)('{') PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - VALUE_PARAMETER - PsiErrorElement:Expecting parameter name - <empty list> - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') + VALUE_PARAMETER_LIST + <empty list> BLOCK REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -38,7 +36,7 @@ JetFile: FunctionLiterals_ERR.jet PsiErrorElement:Expecting ') <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -60,7 +58,7 @@ JetFile: FunctionLiterals_ERR.jet <empty list> PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -87,7 +85,7 @@ JetFile: FunctionLiterals_ERR.jet PsiErrorElement:Expecting a type <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -110,7 +108,7 @@ JetFile: FunctionLiterals_ERR.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK <empty list> @@ -129,7 +127,7 @@ JetFile: FunctionLiterals_ERR.jet PsiWhiteSpace(' ') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -166,7 +164,7 @@ JetFile: FunctionLiterals_ERR.jet PsiElement(IDENTIFIER)('B') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -208,7 +206,7 @@ JetFile: FunctionLiterals_ERR.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK REFERENCE_EXPRESSION @@ -218,100 +216,118 @@ JetFile: FunctionLiterals_ERR.jet FUNCTION_LITERAL_EXPRESSION FUNCTION_LITERAL PsiElement(LBRACE)('{') - TYPE_REFERENCE - USER_TYPE + BLOCK + DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - PsiErrorElement:Expecting '(' - PsiElement(IDENTIFIER)('t') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') - PsiWhiteSpace(' ') - BLOCK - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - PsiErrorElement:Expecting '(' - PsiElement(IDENTIFIER)('t') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('t') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(MINUS)('-') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') + PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line) + PsiElement(ARROW)('->') PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') - PsiWhiteSpace(' ') - BLOCK - REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n ') - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - VALUE_PARAMETER_LIST - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiErrorElement:To specify a type of a parameter or a return type, use the full notation: {(parameter : Type) : ReturnType => ...} - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('b') - PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiErrorElement:Expecting parameter name - <empty list> - PsiElement(DOUBLE_ARROW)('=>') - PsiWhiteSpace(' ') - BLOCK - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('f') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - PsiErrorElement:To specify a receiver type, use the full notation: {ReceiverType.(parameters) [: ReturnType] => ...} - PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('b') - PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') - PsiWhiteSpace(' ') - BLOCK - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('f') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') \ No newline at end of file + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + FUNCTION_LITERAL_EXPRESSION + FUNCTION_LITERAL + PsiElement(LBRACE)('{') + BLOCK + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('t') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(MINUS)('-') + PARENTHESIZED + PsiElement(LPAR)('(') + BINARY_WITH_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line) + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + FUNCTION_LITERAL_EXPRESSION + FUNCTION_LITERAL + PsiElement(LBRACE)('{') + VALUE_PARAMETER_LIST + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiErrorElement:To specify a type of a parameter or a return type, use the full notation: {(parameter : Type) : ReturnType => ...} + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiErrorElement:Expecting parameter name + <empty list> + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + BLOCK + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('f') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + FUNCTION_LITERAL_EXPRESSION + FUNCTION_LITERAL + PsiElement(LBRACE)('{') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiErrorElement:Expecting a parameter list in parentheses (...) + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + VALUE_PARAMETER + PsiErrorElement:Expecting parameter declaration + <empty list> + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiErrorElement:Expecting ') + <empty list> + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + BLOCK + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('f') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') + PsiErrorElement:Expecting '}' + <empty list> \ No newline at end of file diff --git a/compiler/testData/psi/FunctionTypes.jet b/compiler/testData/psi/FunctionTypes.jet index 4187222c8e0..0e94be440f8 100644 --- a/compiler/testData/psi/FunctionTypes.jet +++ b/compiler/testData/psi/FunctionTypes.jet @@ -1,24 +1,24 @@ -type f = fun ([a] a) : b -type f = fun (a) : b -type f = fun () : [x] b -type f = fun () : () +type f = ([a] a) -> b +type f = (a) -> b +type f = () -> [x] b +type f = () -> #() -type f = fun (a : [a] a) : b -type f = fun (a : a) : b -type f = fun () : b -type f = fun () : () +type f = (a : [a] a) -> b +type f = (a : a) -> b +type f = () -> b +type f = () -> #() -type f = fun (a : [a] a, foo, x : bar) : b -type f = fun (foo, a : a) : b -type f = fun (foo, a : fun (a) : b) : b -type f = fun (foo, a : fun (a) : b) : fun () : () +type f = (a : [a] a, foo, x : bar) -> b +type f = (foo, a : a) -> b +type f = (foo, a : (a) -> b) -> b +type f = (foo, a : (a) -> b) -> () -> #() -type f = fun (ref foo, ref a : fun (ref a) : b) : fun () : () +type f = (ref foo, ref a : (ref a) -> b) -> () -> #() -type f = fun T.() : () -type f = fun T.T.() : () -type f = fun T<A, B>.T<x>.() : () +type f = T.() -> #() +type f = T.T.() -> #() +type f = T<A, B>.T<x>.() -> #() -type f = [a] fun T.() : () -type f = [a] fun T.T.() : () -type f = [a] fun T<A, B>.T<x>.() : () +type f = [a] T.() -> #() +type f = [a] T.T.() -> #() +type f = [a] T<A, B>.T<x>.() -> #() diff --git a/compiler/testData/psi/FunctionTypes.txt b/compiler/testData/psi/FunctionTypes.txt index 47e8aa32ae6..3442c373210 100644 --- a/compiler/testData/psi/FunctionTypes.txt +++ b/compiler/testData/psi/FunctionTypes.txt @@ -10,11 +10,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -35,7 +33,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -50,11 +48,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -64,7 +60,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -79,16 +75,14 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE ANNOTATION @@ -113,19 +107,18 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') @@ -137,11 +130,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -165,7 +156,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -180,11 +171,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -198,7 +187,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -213,16 +202,14 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -237,19 +224,18 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') @@ -261,11 +247,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -307,7 +291,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('bar') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -322,11 +306,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -347,7 +329,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -362,11 +344,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -380,11 +360,9 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -394,7 +372,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -402,7 +380,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -417,11 +395,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -435,11 +411,9 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -449,7 +423,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -457,20 +431,19 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') @@ -482,11 +455,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -506,11 +477,9 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -523,7 +492,7 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -531,20 +500,19 @@ JetFile: FunctionTypes.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') @@ -556,11 +524,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION @@ -570,10 +536,11 @@ JetFile: FunctionTypes.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n') @@ -585,11 +552,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE USER_TYPE @@ -603,10 +568,11 @@ JetFile: FunctionTypes.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n') @@ -618,11 +584,9 @@ JetFile: FunctionTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE USER_TYPE @@ -659,10 +623,11 @@ JetFile: FunctionTypes.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') @@ -676,20 +641,18 @@ JetFile: FunctionTypes.jet PsiElement(EQ)('=') PsiWhiteSpace(' ') TYPE_REFERENCE - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') @@ -698,10 +661,11 @@ JetFile: FunctionTypes.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n') @@ -715,20 +679,18 @@ JetFile: FunctionTypes.jet PsiElement(EQ)('=') PsiWhiteSpace(' ') TYPE_REFERENCE - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') USER_TYPE USER_TYPE REFERENCE_EXPRESSION @@ -741,10 +703,11 @@ JetFile: FunctionTypes.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n') @@ -758,20 +721,18 @@ JetFile: FunctionTypes.jet PsiElement(EQ)('=') PsiWhiteSpace(' ') TYPE_REFERENCE - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') USER_TYPE USER_TYPE REFERENCE_EXPRESSION @@ -807,9 +768,10 @@ JetFile: FunctionTypes.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/FunctionTypes_ERR.jet b/compiler/testData/psi/FunctionTypes_ERR.jet index 204ee20a422..f948522e84e 100644 --- a/compiler/testData/psi/FunctionTypes_ERR.jet +++ b/compiler/testData/psi/FunctionTypes_ERR.jet @@ -1 +1 @@ -type f = fun (a, ) : b +type f = (a, ) -> b diff --git a/compiler/testData/psi/FunctionTypes_ERR.txt b/compiler/testData/psi/FunctionTypes_ERR.txt index 80d5db63e38..d3201689668 100644 --- a/compiler/testData/psi/FunctionTypes_ERR.txt +++ b/compiler/testData/psi/FunctionTypes_ERR.txt @@ -10,11 +10,9 @@ JetFile: FunctionTypes_ERR.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -28,7 +26,7 @@ JetFile: FunctionTypes_ERR.jet PsiWhiteSpace(' ') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/Functions.jet b/compiler/testData/psi/Functions.jet index bc7ed706c1d..86bb4dbce06 100644 --- a/compiler/testData/psi/Functions.jet +++ b/compiler/testData/psi/Functions.jet @@ -2,21 +2,21 @@ fun foo() fun [a] foo() fun [a] T.foo() fun [a] T.foo(a : foo) : bar -fun [a()] T.foo<T : fun (a) : b>(a : foo) : bar +fun [a()] T.foo<T : (a) -> b>(a : foo) : bar fun foo(); fun [a] foo(); fun [a] T.foo(); fun [a] T.foo(a : foo) : bar; -fun [a()] T.foo<T : fun (a) : b>(a : foo) : bar; +fun [a()] T.foo<T : (a) -> b>(a : foo) : bar; fun foo() {} fun [a] foo() {} fun [a] T.foo() {} fun [a] T.foo(a : foo) : bar {} -fun [a()] T.foo<T : fun (a) : b>(a : foo) : bar {} +fun [a()] T.foo<T : (a) -> b>(a : foo) : bar {} -fun [a()] T.foo<T : [a] fun (a) : b>(a : foo) : bar {} +fun [a()] T.foo<T : [a] (a) -> b>(a : foo) : bar {} fun A?.foo() : bar? fun A? .foo() : bar? \ No newline at end of file diff --git a/compiler/testData/psi/Functions.txt b/compiler/testData/psi/Functions.txt index 9626affdd1a..03ea683c1af 100644 --- a/compiler/testData/psi/Functions.txt +++ b/compiler/testData/psi/Functions.txt @@ -118,11 +118,9 @@ JetFile: Functions.jet PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -132,7 +130,7 @@ JetFile: Functions.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -279,11 +277,9 @@ JetFile: Functions.jet PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -293,7 +289,7 @@ JetFile: Functions.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -453,11 +449,9 @@ JetFile: Functions.jet PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -467,7 +461,7 @@ JetFile: Functions.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -537,10 +531,8 @@ JetFile: Functions.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -550,7 +542,7 @@ JetFile: Functions.jet PsiElement(IDENTIFIER)('a') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/Imports.jet b/compiler/testData/psi/Imports.jet index 6230669c2ae..c678ba5dd7f 100644 --- a/compiler/testData/psi/Imports.jet +++ b/compiler/testData/psi/Imports.jet @@ -1,4 +1,4 @@ -namespace foo.bar.goo +package foo.bar.goo import namespace.foo import foo diff --git a/compiler/testData/psi/Imports.txt b/compiler/testData/psi/Imports.txt index b80711ff1a2..2d274dd3bd7 100644 --- a/compiler/testData/psi/Imports.txt +++ b/compiler/testData/psi/Imports.txt @@ -1,7 +1,7 @@ JetFile: Imports.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') diff --git a/compiler/testData/psi/Imports_ERR.jet b/compiler/testData/psi/Imports_ERR.jet index 3d27c2cefdf..fc8120528c7 100644 --- a/compiler/testData/psi/Imports_ERR.jet +++ b/compiler/testData/psi/Imports_ERR.jet @@ -1,4 +1,4 @@ -namespace foo.bar.goo +package foo.bar.goo import namespace ; import namespace.* diff --git a/compiler/testData/psi/Imports_ERR.txt b/compiler/testData/psi/Imports_ERR.txt index 7e96a0f9b6a..71c49ec4414 100644 --- a/compiler/testData/psi/Imports_ERR.txt +++ b/compiler/testData/psi/Imports_ERR.txt @@ -1,7 +1,7 @@ JetFile: Imports_ERR.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -94,7 +94,7 @@ JetFile: Imports_ERR.jet PsiElement(DOT)('.') PsiWhiteSpace(' ') REFERENCE_EXPRESSION - PsiErrorElement:Type name expected + PsiErrorElement:Expecting type name PsiElement(as)('as') PsiWhiteSpace(' ') ANNOTATION_ENTRY @@ -124,7 +124,7 @@ JetFile: Imports_ERR.jet PsiElement(IDENTIFIER)('bar') PsiElement(DOT)('.') REFERENCE_EXPRESSION - PsiErrorElement:Type name expected + PsiErrorElement:Expecting type name PsiElement(MUL)('*') PsiWhiteSpace(' ') PsiErrorElement:Expecting namespace or top level declaration @@ -158,7 +158,7 @@ JetFile: Imports_ERR.jet PsiElement(IDENTIFIER)('bar') PsiElement(DOT)('.') REFERENCE_EXPRESSION - PsiErrorElement:Type name expected + PsiErrorElement:Expecting type name PsiElement(MUL)('*') PsiWhiteSpace(' ') PsiErrorElement:Expecting namespace or top level declaration diff --git a/compiler/testData/psi/LocalDeclarations.jet b/compiler/testData/psi/LocalDeclarations.jet index abe0308a864..4254634f0e5 100644 --- a/compiler/testData/psi/LocalDeclarations.jet +++ b/compiler/testData/psi/LocalDeclarations.jet @@ -6,6 +6,6 @@ fun foo() { out val foo = 5 [a] var foo = 4 - type f = fun T.() : () + type f = T.() -> #() } diff --git a/compiler/testData/psi/LocalDeclarations.txt b/compiler/testData/psi/LocalDeclarations.txt index d9a4c472683..4c9090fd03a 100644 --- a/compiler/testData/psi/LocalDeclarations.txt +++ b/compiler/testData/psi/LocalDeclarations.txt @@ -109,11 +109,9 @@ JetFile: LocalDeclarations.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION @@ -123,10 +121,11 @@ JetFile: LocalDeclarations.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') diff --git a/compiler/testData/psi/NamespaceBlock.jet b/compiler/testData/psi/NamespaceBlock.jet index 10b13428cd4..cf3ba05fd99 100644 --- a/compiler/testData/psi/NamespaceBlock.jet +++ b/compiler/testData/psi/NamespaceBlock.jet @@ -1,16 +1,16 @@ -namespace foo.bar.goo +package foo.bar.goo import foo as bar -namespace foof { +package foof { import foo.bar.*; class Foo {} - namespace bar { + package bar { class Bar {} - namespace ns { + package ns { class X class Y @@ -21,9 +21,9 @@ namespace foof { class Bar<T> {} -namespace foo {} +package foo {} -namespace bar { +package bar { import sdf } \ No newline at end of file diff --git a/compiler/testData/psi/NamespaceBlock.txt b/compiler/testData/psi/NamespaceBlock.txt index 1d32e0b59c6..33b0d00d72a 100644 --- a/compiler/testData/psi/NamespaceBlock.txt +++ b/compiler/testData/psi/NamespaceBlock.txt @@ -1,7 +1,7 @@ JetFile: NamespaceBlock.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -23,7 +23,7 @@ JetFile: NamespaceBlock.jet PsiWhiteSpace('\n\n') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foof') PsiWhiteSpace(' ') @@ -56,7 +56,7 @@ JetFile: NamespaceBlock.jet PsiWhiteSpace('\n\n ') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('bar') PsiWhiteSpace(' ') @@ -76,7 +76,7 @@ JetFile: NamespaceBlock.jet PsiWhiteSpace('\n\n ') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('ns') PsiWhiteSpace(' ') @@ -119,7 +119,7 @@ JetFile: NamespaceBlock.jet PsiWhiteSpace('\n\n') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') PsiWhiteSpace(' ') @@ -130,7 +130,7 @@ JetFile: NamespaceBlock.jet PsiWhiteSpace('\n\n') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('bar') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/NamespaceBlockFirst.jet b/compiler/testData/psi/NamespaceBlockFirst.jet index d3324536a1a..22ec2b0ed6b 100644 --- a/compiler/testData/psi/NamespaceBlockFirst.jet +++ b/compiler/testData/psi/NamespaceBlockFirst.jet @@ -1,4 +1,4 @@ -namespace foobar { +package foobar { val a = 1 val b = foobar.a } diff --git a/compiler/testData/psi/NamespaceBlockFirst.txt b/compiler/testData/psi/NamespaceBlockFirst.txt index daf5656d2ab..fcb33b0afae 100644 --- a/compiler/testData/psi/NamespaceBlockFirst.txt +++ b/compiler/testData/psi/NamespaceBlockFirst.txt @@ -4,7 +4,7 @@ JetFile: NamespaceBlockFirst.jet <empty list> NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foobar') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/NamespaceBlock_ERR.jet b/compiler/testData/psi/NamespaceBlock_ERR.jet index 66bf0b8d58f..a22d5edaa88 100644 --- a/compiler/testData/psi/NamespaceBlock_ERR.jet +++ b/compiler/testData/psi/NamespaceBlock_ERR.jet @@ -1,11 +1,11 @@ -namespace foo.bar.goo +package foo.bar.goo import foo as import foo. import foo.bar. import foo. as bar -namespace foof { +package foof { import foo.bar.* as bar import foo as ; import foo. ; @@ -14,13 +14,13 @@ namespace foof { import foo.bar.* as bar ; import foo.bar.* as ; - namespace foo + package foo class Foo {} - namespace { + package { class Bar {} - namespace ns { + package ns { class X class Y @@ -32,11 +32,11 @@ dsfgd class Bar<T> {} -namespace foo +package foo -namespace {} +package {} -namespace bar { +package bar { import sdf } \ No newline at end of file diff --git a/compiler/testData/psi/NamespaceBlock_ERR.txt b/compiler/testData/psi/NamespaceBlock_ERR.txt index 1675b5bb0bc..8d418eb0f6c 100644 --- a/compiler/testData/psi/NamespaceBlock_ERR.txt +++ b/compiler/testData/psi/NamespaceBlock_ERR.txt @@ -1,7 +1,7 @@ JetFile: NamespaceBlock_ERR.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -61,7 +61,7 @@ JetFile: NamespaceBlock_ERR.jet PsiElement(DOT)('.') PsiWhiteSpace(' ') REFERENCE_EXPRESSION - PsiErrorElement:Type name expected + PsiErrorElement:Expecting type name PsiElement(as)('as') PsiWhiteSpace(' ') ANNOTATION_ENTRY @@ -72,7 +72,7 @@ JetFile: NamespaceBlock_ERR.jet PsiElement(IDENTIFIER)('bar') PsiWhiteSpace('\n\n') NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foof') PsiWhiteSpace(' ') @@ -193,7 +193,7 @@ JetFile: NamespaceBlock_ERR.jet PsiWhiteSpace('\n\n ') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') PsiErrorElement:A namespace block in '{...}' expected @@ -212,7 +212,7 @@ JetFile: NamespaceBlock_ERR.jet PsiWhiteSpace('\n ') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiErrorElement:Expecting namespace name <empty list> PsiWhiteSpace(' ') @@ -232,7 +232,7 @@ JetFile: NamespaceBlock_ERR.jet PsiWhiteSpace('\n\n ') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('ns') PsiWhiteSpace(' ') @@ -283,7 +283,7 @@ JetFile: NamespaceBlock_ERR.jet PsiWhiteSpace('\n\n') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') PsiErrorElement:A namespace block in '{...}' expected @@ -291,7 +291,7 @@ JetFile: NamespaceBlock_ERR.jet PsiWhiteSpace('\n\n') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiErrorElement:Expecting namespace name <empty list> PsiWhiteSpace(' ') @@ -302,7 +302,7 @@ JetFile: NamespaceBlock_ERR.jet PsiWhiteSpace('\n\n') NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('bar') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/NamespaceModifiers.jet b/compiler/testData/psi/NamespaceModifiers.jet index c842220ebe8..de65a560b82 100644 --- a/compiler/testData/psi/NamespaceModifiers.jet +++ b/compiler/testData/psi/NamespaceModifiers.jet @@ -1,9 +1,9 @@ -public [a] namespace name; +public [a] package name; -[a] namespace a { +[a] package a { val foo - private namespace b { + private package b { } } \ No newline at end of file diff --git a/compiler/testData/psi/NamespaceModifiers.txt b/compiler/testData/psi/NamespaceModifiers.txt index 6dc1a3459f4..67db2bc7e0c 100644 --- a/compiler/testData/psi/NamespaceModifiers.txt +++ b/compiler/testData/psi/NamespaceModifiers.txt @@ -14,7 +14,7 @@ JetFile: NamespaceModifiers.jet PsiElement(IDENTIFIER)('a') PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('name') PsiElement(SEMICOLON)(';') @@ -32,7 +32,7 @@ JetFile: NamespaceModifiers.jet PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('a') PsiWhiteSpace(' ') @@ -49,7 +49,7 @@ JetFile: NamespaceModifiers.jet PsiElement(private)('private') PsiWhiteSpace(' ') NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('b') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/NewlinesInParentheses.jet b/compiler/testData/psi/NewlinesInParentheses.jet index 8feebf2ea52..277f48e644a 100644 --- a/compiler/testData/psi/NewlinesInParentheses.jet +++ b/compiler/testData/psi/NewlinesInParentheses.jet @@ -21,17 +21,17 @@ fun foo() { + d] when (e) { - is T @ - () => a + is T + #() -> a in f - () => a + () -> a !is T - @ () => a + #() -> a !in f - () => a + () -> a f - () => a + () -> a } val f = a is T - () + #() } \ No newline at end of file diff --git a/compiler/testData/psi/NewlinesInParentheses.txt b/compiler/testData/psi/NewlinesInParentheses.txt index 95f9c053518..10b4cde8cd4 100644 --- a/compiler/testData/psi/NewlinesInParentheses.txt +++ b/compiler/testData/psi/NewlinesInParentheses.txt @@ -244,14 +244,13 @@ JetFile: NewlinesInParentheses.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace('\n ') + PsiWhiteSpace(' \n ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -269,7 +268,7 @@ JetFile: NewlinesInParentheses.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -281,14 +280,13 @@ JetFile: NewlinesInParentheses.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') - PsiWhiteSpace('\n ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace('\n ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -306,7 +304,7 @@ JetFile: NewlinesInParentheses.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -322,7 +320,7 @@ JetFile: NewlinesInParentheses.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') @@ -343,14 +341,13 @@ JetFile: NewlinesInParentheses.jet OPERATION_REFERENCE PsiElement(is)('is') PsiWhiteSpace(' ') - TYPE_PATTERN - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiWhiteSpace('\n ') - TUPLE - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + DECOMPOSER_PATTERN + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiWhiteSpace('\n ') + DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/Precedence.jet b/compiler/testData/psi/Precedence.jet index 3970cea3476..70a5fcc23cf 100644 --- a/compiler/testData/psi/Precedence.jet +++ b/compiler/testData/psi/Precedence.jet @@ -37,19 +37,19 @@ fun foo() { t : Any? t as Any<T>? t as Any.Any<T>.Any<T> - t as fun () : T + t as () -> T t as? Any<T>? t as? Any.Any<T>.Any<T> - t as? fun () : T + t as? () -> T t : Any * 1 t : Any? * 1 t as Any<T>? * 1 t as Any.Any<T>.Any<T> * 1 - t as fun () : T * 1 + t as () -> T * 1 t as? Any<T>? * 1 t as? Any.Any<T>.Any<T> * 1 - t as? fun () : T * 1 + t as? () -> T * 1 ++t : Any + 1 a.b : Any + 1 diff --git a/compiler/testData/psi/Precedence.txt b/compiler/testData/psi/Precedence.txt index 5ba29479d36..0fee3e39d4e 100644 --- a/compiler/testData/psi/Precedence.txt +++ b/compiler/testData/psi/Precedence.txt @@ -671,15 +671,13 @@ JetFile: Precedence.jet OPERATION_REFERENCE PsiElement(EQ)('=') PsiWhiteSpace(' ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(ARROW)('->') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line) + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('c') PsiWhiteSpace('\n ') BINARY_EXPRESSION REFERENCE_EXPRESSION @@ -788,16 +786,14 @@ JetFile: Precedence.jet PsiWhiteSpace(' ') OPERATION_REFERENCE PsiElement(as)('as') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -868,16 +864,14 @@ JetFile: Precedence.jet PsiWhiteSpace(' ') OPERATION_REFERENCE PsiElement(AS_SAFE)('as?') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -1003,16 +997,14 @@ JetFile: Precedence.jet PsiWhiteSpace(' ') OPERATION_REFERENCE PsiElement(as)('as') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -1104,16 +1096,14 @@ JetFile: Precedence.jet PsiWhiteSpace(' ') OPERATION_REFERENCE PsiElement(AS_SAFE)('as?') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/RootNamespace.jet b/compiler/testData/psi/RootNamespace.jet index cc0a53278e2..153991eea55 100644 --- a/compiler/testData/psi/RootNamespace.jet +++ b/compiler/testData/psi/RootNamespace.jet @@ -1,13 +1,13 @@ -namespace foo.bar; +package foo.bar; class X -namespace foo.bar { +package foo.bar { fun foo() { namespace.foo.bar.X namespace.foo.bar.X() when (e) { - is namespace.foo.bar.X @ (x) => {} + is namespace.foo.bar.X #(x) -> {} } } } \ No newline at end of file diff --git a/compiler/testData/psi/RootNamespace.txt b/compiler/testData/psi/RootNamespace.txt index 33f37629a7f..c5af1609b1e 100644 --- a/compiler/testData/psi/RootNamespace.txt +++ b/compiler/testData/psi/RootNamespace.txt @@ -1,7 +1,7 @@ JetFile: RootNamespace.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -18,7 +18,7 @@ JetFile: RootNamespace.jet <empty list> NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -102,10 +102,9 @@ JetFile: RootNamespace.jet PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('X') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -115,7 +114,7 @@ JetFile: RootNamespace.jet PsiElement(IDENTIFIER)('x') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK PsiElement(LBRACE)('{') diff --git a/compiler/testData/psi/ShortAnnotations.jet b/compiler/testData/psi/ShortAnnotations.jet index b05a2c3863c..e6137d0a754 100644 --- a/compiler/testData/psi/ShortAnnotations.jet +++ b/compiler/testData/psi/ShortAnnotations.jet @@ -1,6 +1,6 @@ -foo bar(1) buzz<T>(1) zoo namespace aa +foo bar(1) buzz<T>(1) zoo package aa -foo bar(1) buzz<T>(1) zoo namespace a {} +foo bar(1) buzz<T>(1) zoo package a {} foo bar(1) buzz<T>(1) zoo class A foo bar(1) buzz<T>(1) zoo object B foo bar(1) buzz<T>(1) zoo fun a() {} @@ -24,6 +24,6 @@ class Foo { fun test() { when (foo bar(1) buzz<T>(1) zoo val a = 1) { - 1 => 1 + 1 -> 1 } } \ No newline at end of file diff --git a/compiler/testData/psi/ShortAnnotations.txt b/compiler/testData/psi/ShortAnnotations.txt index cc795b1920f..a559bce1ddd 100644 --- a/compiler/testData/psi/ShortAnnotations.txt +++ b/compiler/testData/psi/ShortAnnotations.txt @@ -50,7 +50,7 @@ JetFile: ShortAnnotations.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('zoo') PsiWhiteSpace(' ') - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('aa') PsiWhiteSpace('\n\n') @@ -105,7 +105,7 @@ JetFile: ShortAnnotations.jet PsiElement(IDENTIFIER)('zoo') PsiWhiteSpace(' ') NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('a') PsiWhiteSpace(' ') @@ -1134,7 +1134,7 @@ JetFile: ShortAnnotations.jet INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') diff --git a/compiler/testData/psi/SimpleExpressions.jet b/compiler/testData/psi/SimpleExpressions.jet index a3969d2b230..4e931bb6945 100644 --- a/compiler/testData/psi/SimpleExpressions.jet +++ b/compiler/testData/psi/SimpleExpressions.jet @@ -1,6 +1,6 @@ fun a( - a : foo = (), + a : foo = #(), a : foo = 10, a : foo = 0x10, a : foo = '1', @@ -17,7 +17,7 @@ fun a( a : foo = this, a : foo = super<sdf>, a : foo = (10), - a : foo = (10, "A", 0xf), + a : foo = #(10, "A", 0xf), a : foo = Foo(bar), a : foo = Foo<A>(bar), a : foo = Foo(), diff --git a/compiler/testData/psi/SimpleExpressions.txt b/compiler/testData/psi/SimpleExpressions.txt index 45ce1f23b2f..195e3389052 100644 --- a/compiler/testData/psi/SimpleExpressions.txt +++ b/compiler/testData/psi/SimpleExpressions.txt @@ -22,6 +22,7 @@ JetFile: SimpleExpressions.jet PsiElement(EQ)('=') PsiWhiteSpace(' ') TUPLE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiElement(COMMA)(',') @@ -325,6 +326,7 @@ JetFile: SimpleExpressions.jet PsiElement(EQ)('=') PsiWhiteSpace(' ') TUPLE + PsiElement(HASH)('#') PsiElement(LPAR)('(') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('10') diff --git a/compiler/testData/psi/SimpleModifiers.jet b/compiler/testData/psi/SimpleModifiers.jet index 407ad761e34..ac9d1dbc7b9 100644 --- a/compiler/testData/psi/SimpleModifiers.jet +++ b/compiler/testData/psi/SimpleModifiers.jet @@ -1,4 +1,4 @@ -namespace foo.bar.goo +package foo.bar.goo abstract open diff --git a/compiler/testData/psi/SimpleModifiers.txt b/compiler/testData/psi/SimpleModifiers.txt index 4df3f2f9c98..a4c58c3241e 100644 --- a/compiler/testData/psi/SimpleModifiers.txt +++ b/compiler/testData/psi/SimpleModifiers.txt @@ -1,7 +1,7 @@ JetFile: SimpleModifiers.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') diff --git a/compiler/testData/psi/SoftKeywords.jet b/compiler/testData/psi/SoftKeywords.jet index 829934a583a..b2ebd5d865e 100644 --- a/compiler/testData/psi/SoftKeywords.jet +++ b/compiler/testData/psi/SoftKeywords.jet @@ -1,4 +1,4 @@ -namespace foo.bar.goo +package foo.bar.goo import foo diff --git a/compiler/testData/psi/SoftKeywords.txt b/compiler/testData/psi/SoftKeywords.txt index 01fccd725d8..dcfafc412d1 100644 --- a/compiler/testData/psi/SoftKeywords.txt +++ b/compiler/testData/psi/SoftKeywords.txt @@ -1,7 +1,7 @@ JetFile: SoftKeywords.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') diff --git a/compiler/testData/psi/StringTemplates.jet b/compiler/testData/psi/StringTemplates.jet index 8bdec253be9..70723ad6f38 100644 --- a/compiler/testData/psi/StringTemplates.jet +++ b/compiler/testData/psi/StringTemplates.jet @@ -3,8 +3,8 @@ fun demo() { val a = "" val asd = 1 val bar = 5 - fun map(f : fun () : Any?) : Int = 1 - fun buzz(f : fun () : Any?) : Int = 1 + fun map(f : () -> Any?) : Int = 1 + fun buzz(f : () -> Any?) : Int = 1 val sdf = 1 val foo = 3; "$this must be$as$t" diff --git a/compiler/testData/psi/StringTemplates.txt b/compiler/testData/psi/StringTemplates.txt index 07ea659f400..f7aac5bf538 100644 --- a/compiler/testData/psi/StringTemplates.txt +++ b/compiler/testData/psi/StringTemplates.txt @@ -64,16 +64,14 @@ JetFile: StringTemplates.jet PsiElement(IDENTIFIER)('f') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE NULLABLE_TYPE @@ -105,16 +103,14 @@ JetFile: StringTemplates.jet PsiElement(IDENTIFIER)('f') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE NULLABLE_TYPE diff --git a/compiler/testData/psi/TupleTypes.jet b/compiler/testData/psi/TupleTypes.jet index 98047a6d660..930344a9c8f 100644 --- a/compiler/testData/psi/TupleTypes.jet +++ b/compiler/testData/psi/TupleTypes.jet @@ -1,10 +1,10 @@ class F( - a : (), - x : (X), - b : (A, B), - c : (x : Int, y : Int), - a : [x] (), - x : [x]([x] X), - b : [x] ([x] A, [x]B), - c : [x] (x : [x] Int, y : [x] Int) + a : #(), + x : #(X), + b : #(A, B), + c : #(x : Int, y : Int), + a : [x] #(), + x : [x]#([x] X), + b : [x] #([x] A, [x]B), + c : [x] #(x : [x] Int, y : [x] Int) ) \ No newline at end of file diff --git a/compiler/testData/psi/TupleTypes.txt b/compiler/testData/psi/TupleTypes.txt index cb44ded1528..d13da2370ce 100644 --- a/compiler/testData/psi/TupleTypes.txt +++ b/compiler/testData/psi/TupleTypes.txt @@ -18,6 +18,7 @@ JetFile: TupleTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiElement(COMMA)(',') @@ -29,6 +30,7 @@ JetFile: TupleTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE USER_TYPE @@ -44,6 +46,7 @@ JetFile: TupleTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE USER_TYPE @@ -65,6 +68,7 @@ JetFile: TupleTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') LABELED_TUPLE_TYPE_ENTRY PsiElement(IDENTIFIER)('x') @@ -106,6 +110,7 @@ JetFile: TupleTypes.jet PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiElement(COMMA)(',') @@ -126,6 +131,7 @@ JetFile: TupleTypes.jet PsiElement(IDENTIFIER)('x') PsiElement(RBRACKET)(']') TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE ANNOTATION @@ -161,6 +167,7 @@ JetFile: TupleTypes.jet PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE ANNOTATION @@ -211,6 +218,7 @@ JetFile: TupleTypes.jet PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') LABELED_TUPLE_TYPE_ENTRY PsiElement(IDENTIFIER)('x') diff --git a/compiler/testData/psi/TupleTypes_ERR.jet b/compiler/testData/psi/TupleTypes_ERR.jet index 75924194f84..c4e70baf21f 100644 --- a/compiler/testData/psi/TupleTypes_ERR.jet +++ b/compiler/testData/psi/TupleTypes_ERR.jet @@ -1,10 +1,10 @@ class F( - a : (), - x : (X), - b : (A, ), - c : (x : , : Int), - a : [x] (), - x : [x]([x X), - b : [x] ([x] A, [x]B), - c : [x] (x : [x] Int, y : [x] Int) + a : #(), + x : #(X), + b : #(A, ), + c : #(x : , : Int), + a : [x] #(), + x : [x]#([x X), + b : [x] #([x] A, [x]B), + c : [x] #(x : [x] Int, y : [x] Int) ) \ No newline at end of file diff --git a/compiler/testData/psi/TupleTypes_ERR.txt b/compiler/testData/psi/TupleTypes_ERR.txt index 5b984020566..3109fe1efef 100644 --- a/compiler/testData/psi/TupleTypes_ERR.txt +++ b/compiler/testData/psi/TupleTypes_ERR.txt @@ -18,6 +18,7 @@ JetFile: TupleTypes_ERR.jet PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiElement(COMMA)(',') @@ -29,6 +30,7 @@ JetFile: TupleTypes_ERR.jet PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE USER_TYPE @@ -44,6 +46,7 @@ JetFile: TupleTypes_ERR.jet PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE USER_TYPE @@ -63,6 +66,7 @@ JetFile: TupleTypes_ERR.jet PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') LABELED_TUPLE_TYPE_ENTRY PsiElement(IDENTIFIER)('x') @@ -101,6 +105,7 @@ JetFile: TupleTypes_ERR.jet PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiElement(COMMA)(',') @@ -121,6 +126,7 @@ JetFile: TupleTypes_ERR.jet PsiElement(IDENTIFIER)('x') PsiElement(RBRACKET)(']') TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE ANNOTATION @@ -160,6 +166,7 @@ JetFile: TupleTypes_ERR.jet PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE ANNOTATION @@ -210,6 +217,7 @@ JetFile: TupleTypes_ERR.jet PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') LABELED_TUPLE_TYPE_ENTRY PsiElement(IDENTIFIER)('x') diff --git a/compiler/testData/psi/TuplesWithLabeledEntries.jet b/compiler/testData/psi/TuplesWithLabeledEntries.jet index 8e1ee98d58a..c03fa82a256 100644 --- a/compiler/testData/psi/TuplesWithLabeledEntries.jet +++ b/compiler/testData/psi/TuplesWithLabeledEntries.jet @@ -1,2 +1,2 @@ -val foo = (a = 3) -val foo = (a = 3, a) \ No newline at end of file +val foo = #(a = 3) +val foo = #(a = 3, a) \ No newline at end of file diff --git a/compiler/testData/psi/TuplesWithLabeledEntries.txt b/compiler/testData/psi/TuplesWithLabeledEntries.txt index bb38c8417a9..0b775f17659 100644 --- a/compiler/testData/psi/TuplesWithLabeledEntries.txt +++ b/compiler/testData/psi/TuplesWithLabeledEntries.txt @@ -10,6 +10,7 @@ JetFile: TuplesWithLabeledEntries.jet PsiElement(EQ)('=') PsiWhiteSpace(' ') TUPLE + PsiElement(HASH)('#') PsiElement(LPAR)('(') LABELED_TUPLE_ENTRY PsiElement(IDENTIFIER)('a') @@ -28,6 +29,7 @@ JetFile: TuplesWithLabeledEntries.jet PsiElement(EQ)('=') PsiWhiteSpace(' ') TUPLE + PsiElement(HASH)('#') PsiElement(LPAR)('(') LABELED_TUPLE_ENTRY PsiElement(IDENTIFIER)('a') diff --git a/compiler/testData/psi/TypeDef.jet b/compiler/testData/psi/TypeDef.jet index 9aab7e0e4a7..12365eae7e7 100644 --- a/compiler/testData/psi/TypeDef.jet +++ b/compiler/testData/psi/TypeDef.jet @@ -1,4 +1,4 @@ -namespace foo.bar.goo +package foo.bar.goo type foo = bar type foo<T> = bar diff --git a/compiler/testData/psi/TypeDef.txt b/compiler/testData/psi/TypeDef.txt index f55ffb3a657..ac161f21cf6 100644 --- a/compiler/testData/psi/TypeDef.txt +++ b/compiler/testData/psi/TypeDef.txt @@ -1,7 +1,7 @@ JetFile: TypeDef.jet NAMESPACE NAMESPACE_HEADER - PsiElement(namespace)('namespace') + PsiElement(namespace)('package') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') diff --git a/compiler/testData/psi/TypeExpressionAmbiguities_ERR.jet b/compiler/testData/psi/TypeExpressionAmbiguities_ERR.jet index fb993207d65..5050788b08c 100644 --- a/compiler/testData/psi/TypeExpressionAmbiguities_ERR.jet +++ b/compiler/testData/psi/TypeExpressionAmbiguities_ERR.jet @@ -1,7 +1,7 @@ fun foo() { foo<Int?>() fooo<Double?addddd>() - dd<(Int, Int, Int)>(if (true) (1, 1, 1) else (2, 2, 2)) + dd<#(Int, Int, Int)>(if (true) #(1, 1, 1) else #(2, 2, 2)) foo(bar<a, b, c>(d)) foo(bar<a, b+1, c>(d)) foo(bar<a, f(), c>(d)) diff --git a/compiler/testData/psi/TypeExpressionAmbiguities_ERR.txt b/compiler/testData/psi/TypeExpressionAmbiguities_ERR.txt index b6eea49385d..d54cf771e6a 100644 --- a/compiler/testData/psi/TypeExpressionAmbiguities_ERR.txt +++ b/compiler/testData/psi/TypeExpressionAmbiguities_ERR.txt @@ -57,6 +57,7 @@ JetFile: TypeExpressionAmbiguities_ERR.jet TYPE_PROJECTION TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE USER_TYPE @@ -90,6 +91,7 @@ JetFile: TypeExpressionAmbiguities_ERR.jet PsiWhiteSpace(' ') THEN TUPLE + PsiElement(HASH)('#') PsiElement(LPAR)('(') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') @@ -107,6 +109,7 @@ JetFile: TypeExpressionAmbiguities_ERR.jet PsiWhiteSpace(' ') ELSE TUPLE + PsiElement(HASH)('#') PsiElement(LPAR)('(') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('2') diff --git a/compiler/testData/psi/When.jet b/compiler/testData/psi/When.jet index 48f1055329c..21b23b59ad1 100644 --- a/compiler/testData/psi/When.jet +++ b/compiler/testData/psi/When.jet @@ -1,7 +1,7 @@ fun foo() { return false - fun a() = {when(x) { is a => b }} + fun a() = {when(x) { is a -> b }} // foo fun b() {} @@ -13,20 +13,20 @@ fun foo() { } when (e) { - is a => foo + is a -> foo } when (e) { - is Tree @ (a, b) => foo - is null => foo - is 1 => foo - is A.b => foo - is 1.0 => foo - is 'c' => foo - is "sadfsa" => foo - is """ddd""" => foo - is * => foo - is val a is Foo => foo - is (val a is Foo, b) => foo + is Tree #(a, b) -> foo + is null -> foo + is 1 -> foo + is A.b -> foo + is 1.0 -> foo + is 'c' -> foo + is "sadfsa" -> foo + is """ddd""" -> foo + is * -> foo + is val a is Foo -> foo + is #(val a is Foo, b) -> foo } when (when(when (e) { @@ -39,45 +39,45 @@ fun foo() { fun foo() { when (val a = e) { - is Tree => c - is Tree @ (null, val r) => c - is a @ (a, b) => c - is a @ (a, b) => c - is a.a @ (a, b) => c - is a.a @ (foo = a, bar = b) => c - is namespace.a.a @ (a, b) => c - is a @ (val a is T, b) => c - is a @ (b, 1) => c - in 1..2 => dsf - !in 2 => sd - !is t => d - is fun (foo) : Bar => fgpp - is (1, val a is Foo, *, Foo, bar) => d - is (Foo, val a in 1..2, *, val _ !is Foo, val bar is foo.bar<a> @ (a)) => d - is (Int, Int) => 2 - is val a : Foo => 2 - else => foo + is Tree -> c + is Tree #(null, val r) -> c + is a #(a, b) -> c + is a #(a, b) -> c + is a.a #(a, b) -> c + is a.a #(foo = a, bar = b) -> c + is namespace.a.a #(a, b) -> c + is a #(val a is T, b) -> c + is a #(b, 1) -> c + in 1..2 -> dsf + !in 2 -> sd + !is t -> d + is (foo) -> Bar -> fgpp + is #(1, val a is Foo, *, Foo, bar) -> d + is #(Foo, val a in 1..2, *, val _ !is Foo, val bar is foo.bar<a> #(a)) -> d + is #(Int, Int) -> 2 + is val a : Foo -> 2 + else -> foo } } fun foo() { when (val a = e) { is Tree, - is Tree @ (null, val r), - is a @ (a, b) => c + is Tree #(null, val r), + is a #(a, b) -> c 1, foo(), bar, 2 + 3, - is a @ (a, b) => c - is a.a @ (val b, b) => c + is a #(a, b) -> c + is a.a #(val b, b) -> c } } fun whenWithoutCondition(i : Int) { val j = 12 when { - 3 => -1 - i == 3 => -1 - j < i, j == i => -1 - i is Int => 1 - else => 2 + 3 -> -1 + i == 3 -> -1 + j < i, j == i -> -1 + i is Int -> 1 + else -> 2 } } diff --git a/compiler/testData/psi/When.txt b/compiler/testData/psi/When.txt index c78e94c6686..941e79b71f5 100644 --- a/compiler/testData/psi/When.txt +++ b/compiler/testData/psi/When.txt @@ -52,7 +52,7 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('b') @@ -119,7 +119,7 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -143,10 +143,9 @@ JetFile: When.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Tree') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -164,7 +163,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -177,7 +176,7 @@ JetFile: When.jet NULL PsiElement(null)('null') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -190,7 +189,7 @@ JetFile: When.jet INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -209,7 +208,7 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('b') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -222,7 +221,7 @@ JetFile: When.jet FLOAT_CONSTANT PsiElement(FLOAT_CONSTANT)('1.0') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -235,7 +234,7 @@ JetFile: When.jet CHARACTER_CONSTANT PsiElement(CHARACTER_LITERAL)(''c'') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -251,7 +250,7 @@ JetFile: When.jet PsiElement(REGULAR_STRING_PART)('sadfsa') PsiElement(CLOSING_QUOTE)('"') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -264,7 +263,7 @@ JetFile: When.jet STRING_CONSTANT PsiElement(RAW_STRING_LITERAL)('"""ddd"""') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -276,7 +275,7 @@ JetFile: When.jet WILDCARD_PATTERN PsiElement(MUL)('*') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -300,7 +299,7 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Foo') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -310,6 +309,7 @@ JetFile: When.jet PsiElement(is)('is') PsiWhiteSpace(' ') TUPLE_PATTERN + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY BINDING_PATTERN @@ -336,7 +336,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -412,7 +412,7 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Tree') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -424,10 +424,9 @@ JetFile: When.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Tree') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY EXPRESSION_PATTERN @@ -443,7 +442,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('r') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -455,10 +454,9 @@ JetFile: When.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -476,7 +474,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -488,10 +486,9 @@ JetFile: When.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -509,7 +506,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -525,10 +522,9 @@ JetFile: When.jet PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -546,7 +542,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -562,10 +558,9 @@ JetFile: When.jet PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY PsiElement(IDENTIFIER)('foo') @@ -591,7 +586,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -611,10 +606,9 @@ JetFile: When.jet PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -632,7 +626,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -644,10 +638,9 @@ JetFile: When.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY BINDING_PATTERN @@ -674,7 +667,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -686,10 +679,9 @@ JetFile: When.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -705,7 +697,7 @@ JetFile: When.jet PsiElement(INTEGER_LITERAL)('1') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -723,7 +715,7 @@ JetFile: When.jet INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('2') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('dsf') @@ -736,7 +728,7 @@ JetFile: When.jet INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('2') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('sd') @@ -751,7 +743,7 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('t') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') @@ -759,29 +751,23 @@ JetFile: When.jet WHEN_ENTRY WHEN_CONDITION_IS_PATTERN PsiElement(is)('is') - PsiWhiteSpace(' ') - TYPE_PATTERN - TYPE_REFERENCE - FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Bar') + PsiWhiteSpace(' ') + PsiErrorElement:Pattern expected + PsiElement(LPAR)('(') + PsiElement(IDENTIFIER)('foo') + PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Bar') + PsiWhiteSpace(' ') + WHEN_ENTRY + WHEN_CONDITION_IS_PATTERN + EXPRESSION_PATTERN + PsiErrorElement:Expecting an expression, is-condition or in-condition + <empty list> + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('fgpp') @@ -791,6 +777,7 @@ JetFile: When.jet PsiElement(is)('is') PsiWhiteSpace(' ') TUPLE_PATTERN + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY EXPRESSION_PATTERN @@ -836,7 +823,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('bar') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') @@ -846,6 +833,7 @@ JetFile: When.jet PsiElement(is)('is') PsiWhiteSpace(' ') TUPLE_PATTERN + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -923,10 +911,9 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') PsiElement(GT)('>') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -937,7 +924,7 @@ JetFile: When.jet PsiElement(RPAR)(')') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') @@ -947,6 +934,7 @@ JetFile: When.jet PsiElement(is)('is') PsiWhiteSpace(' ') TUPLE_PATTERN + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -964,7 +952,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('Int') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('2') @@ -986,7 +974,7 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Foo') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('2') @@ -994,7 +982,7 @@ JetFile: When.jet WHEN_ENTRY PsiElement(else)('else') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -1048,10 +1036,9 @@ JetFile: When.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Tree') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY EXPRESSION_PATTERN @@ -1074,10 +1061,9 @@ JetFile: When.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -1095,7 +1081,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -1142,10 +1128,9 @@ JetFile: When.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -1163,7 +1148,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -1179,10 +1164,9 @@ JetFile: When.jet PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY BINDING_PATTERN @@ -1200,7 +1184,7 @@ JetFile: When.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('c') @@ -1250,7 +1234,7 @@ JetFile: When.jet INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('3') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') PREFIX_EXPRESSION OPERATION_REFERENCE @@ -1271,7 +1255,7 @@ JetFile: When.jet INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('3') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') PREFIX_EXPRESSION OPERATION_REFERENCE @@ -1305,7 +1289,7 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('i') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') PREFIX_EXPRESSION OPERATION_REFERENCE @@ -1329,7 +1313,7 @@ JetFile: When.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Int') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') @@ -1337,7 +1321,7 @@ JetFile: When.jet WHEN_ENTRY PsiElement(else)('else') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('2') diff --git a/compiler/testData/psi/When_ERR.jet b/compiler/testData/psi/When_ERR.jet index f41b6e1b613..e6c6159056f 100644 --- a/compiler/testData/psi/When_ERR.jet +++ b/compiler/testData/psi/When_ERR.jet @@ -2,25 +2,25 @@ fun foo() { when (e) { } when (e) { - is => foo - !is => foo - in => foo - !in => foo - => foo + is -> foo + !is -> foo + in -> foo + !in -> foo + -> foo else } when (e) { - is => - !is => - in => - !in => - !in => ; - => + is -> + !is -> + in -> + !in -> + !in -> ; + -> else - else => + else -> } when (e) { - is - => foo - is (, , 1, , ) => foo + is - -> foo + is #(, , 1, , ) -> foo } } \ No newline at end of file diff --git a/compiler/testData/psi/When_ERR.txt b/compiler/testData/psi/When_ERR.txt index 08dede49af4..425e8fb6d67 100644 --- a/compiler/testData/psi/When_ERR.txt +++ b/compiler/testData/psi/When_ERR.txt @@ -41,7 +41,7 @@ JetFile: When_ERR.jet PsiErrorElement:Expecting a type or a decomposer pattern <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -52,7 +52,7 @@ JetFile: When_ERR.jet PsiErrorElement:Expecting a type or a decomposer pattern <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -64,7 +64,7 @@ JetFile: When_ERR.jet PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -76,7 +76,7 @@ JetFile: When_ERR.jet PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -86,7 +86,7 @@ JetFile: When_ERR.jet EXPRESSION_PATTERN PsiErrorElement:Expecting an expression, is-condition or in-condition <empty list> - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -114,7 +114,7 @@ JetFile: When_ERR.jet PsiErrorElement:Expecting a type or a decomposer pattern <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace('\n ') @@ -124,7 +124,7 @@ JetFile: When_ERR.jet PsiErrorElement:Expecting a type or a decomposer pattern <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace('\n ') @@ -135,7 +135,7 @@ JetFile: When_ERR.jet PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace('\n ') @@ -146,7 +146,7 @@ JetFile: When_ERR.jet PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace('\n ') @@ -157,7 +157,7 @@ JetFile: When_ERR.jet PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiErrorElement:Expecting an expression <empty list> PsiWhiteSpace(' ') @@ -168,7 +168,7 @@ JetFile: When_ERR.jet EXPRESSION_PATTERN PsiErrorElement:Expecting an expression, is-condition or in-condition <empty list> - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace('\n ') @@ -180,7 +180,7 @@ JetFile: When_ERR.jet WHEN_ENTRY PsiElement(else)('else') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiErrorElement:Expecting an element <empty list> PsiWhiteSpace('\n ') @@ -203,7 +203,7 @@ JetFile: When_ERR.jet PsiErrorElement:Pattern expected PsiElement(MINUS)('-') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') @@ -213,6 +213,7 @@ JetFile: When_ERR.jet PsiElement(is)('is') PsiWhiteSpace(' ') TUPLE_PATTERN + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiErrorElement:Expecting a pattern PsiElement(COMMA)(',') @@ -233,7 +234,7 @@ JetFile: When_ERR.jet PsiWhiteSpace(' ') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') diff --git a/compiler/testData/psi/examples/BinaryTree.jet b/compiler/testData/psi/examples/BinaryTree.jet index 25a5bb1d230..7dc1edcde6e 100644 --- a/compiler/testData/psi/examples/BinaryTree.jet +++ b/compiler/testData/psi/examples/BinaryTree.jet @@ -28,9 +28,9 @@ class BinaryTree<T> : IMutableSet<T> { fun contains(node : TreeNode, item : T) : Boolean { if (node == null) return false when(compare(item, node.value)) { - EQ => true - LS => contains(node.left, item) - GT => contains(node.right, item) + EQ -> true + LS -> contains(node.left, item) + GT -> contains(node.right, item) } } } @@ -51,9 +51,9 @@ class BinaryTree<T> : IMutableSet<T> { return true } when (compare(item, node.value)) { - EQ => false - LS => add(ref node.left, node) - GT => add(ref node.right, node) + EQ -> false + LS -> add(ref node.left, node) + GT -> add(ref node.right, node) } } @@ -64,13 +64,13 @@ class BinaryTree<T> : IMutableSet<T> { return true } when (compare(item, node.value)) { - EQ => return false - LS => + EQ -> return false + LS -> if (node.left == null) { node.left = TreeNode(item, node) return true } else return add(node.left) - GT => + GT -> if (node.right == null) { node.right = TreeNode(item, node) return true @@ -90,19 +90,19 @@ class BinaryTree<T> : IMutableSet<T> { fun find(node : TreeNode) : TreeNode { if (node == null) return null when (compare(item, node.value)) { - EQ => node - LS => find(node.left) - GT => find(node.right) + EQ -> node + LS -> find(node.left) + GT -> find(node.right) } } } private fun remove(node : TreeNode) { when (node) { - is TreeNode @ (null, null) => replace(node, null) - is TreeNode @ (null, right) => replace(node, right) - is TreeNode @ (left, null) => replace(node, left) - is TreeNode @ (left, right) => { + is TreeNode #(null, null) -> replace(node, null) + is TreeNode #(null, right) -> replace(node, right) + is TreeNode #(left, null) -> replace(node, left) + is TreeNode #(left, right) -> { val min = min(node.right) node.value = min.value remove(min) diff --git a/compiler/testData/psi/examples/BinaryTree.txt b/compiler/testData/psi/examples/BinaryTree.txt index af51d25fcf8..358f3eff236 100644 --- a/compiler/testData/psi/examples/BinaryTree.txt +++ b/compiler/testData/psi/examples/BinaryTree.txt @@ -439,7 +439,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('EQ') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BOOLEAN_CONSTANT PsiElement(true)('true') @@ -450,7 +450,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('LS') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') CALL_EXPRESSION REFERENCE_EXPRESSION @@ -477,7 +477,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('GT') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') CALL_EXPRESSION REFERENCE_EXPRESSION @@ -714,7 +714,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('EQ') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BOOLEAN_CONSTANT PsiElement(false)('false') @@ -725,7 +725,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('LS') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') CALL_EXPRESSION REFERENCE_EXPRESSION @@ -754,7 +754,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('GT') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') CALL_EXPRESSION REFERENCE_EXPRESSION @@ -892,7 +892,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('EQ') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') RETURN PsiElement(return)('return') @@ -906,7 +906,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('LS') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace('\n ') IF PsiElement(if)('if') @@ -992,7 +992,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('GT') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace('\n ') IF PsiElement(if)('if') @@ -1263,7 +1263,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('EQ') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('node') @@ -1274,7 +1274,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('LS') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') CALL_EXPRESSION REFERENCE_EXPRESSION @@ -1296,7 +1296,7 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('GT') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') CALL_EXPRESSION REFERENCE_EXPRESSION @@ -1358,10 +1358,9 @@ JetFile: BinaryTree.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('TreeNode') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY EXPRESSION_PATTERN @@ -1375,7 +1374,7 @@ JetFile: BinaryTree.jet PsiElement(null)('null') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') CALL_EXPRESSION REFERENCE_EXPRESSION @@ -1399,10 +1398,9 @@ JetFile: BinaryTree.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('TreeNode') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY EXPRESSION_PATTERN @@ -1418,7 +1416,7 @@ JetFile: BinaryTree.jet PsiElement(IDENTIFIER)('right') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') CALL_EXPRESSION REFERENCE_EXPRESSION @@ -1442,10 +1440,9 @@ JetFile: BinaryTree.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('TreeNode') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -1461,7 +1458,7 @@ JetFile: BinaryTree.jet PsiElement(null)('null') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') CALL_EXPRESSION REFERENCE_EXPRESSION @@ -1485,10 +1482,9 @@ JetFile: BinaryTree.jet DECOMPOSER_PATTERN REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('TreeNode') - PsiWhiteSpace(' ') - PsiElement(AT)('@') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') DECOMPOSER_ARGUMENT_LIST + PsiElement(HASH)('#') PsiElement(LPAR)('(') TUPLE_PATTERN_ENTRY TYPE_PATTERN @@ -1506,7 +1502,7 @@ JetFile: BinaryTree.jet PsiElement(IDENTIFIER)('right') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK PsiElement(LBRACE)('{') diff --git a/compiler/testData/psi/examples/Builder.jet b/compiler/testData/psi/examples/Builder.jet index caf51c29d2c..6f7b80c32b8 100644 --- a/compiler/testData/psi/examples/Builder.jet +++ b/compiler/testData/psi/examples/Builder.jet @@ -31,7 +31,7 @@ class AntBuilder { fun classpath(entries : ClassPathEntry/*...*/) { /*...*/ } } - fun library(initializer : fun Library.() : Library) { + fun library(initializer : Library.() -> Library) { val lib = Library() lib.initializer() return lib diff --git a/compiler/testData/psi/examples/Builder.txt b/compiler/testData/psi/examples/Builder.txt index 2be62e21682..249ae918b3f 100644 --- a/compiler/testData/psi/examples/Builder.txt +++ b/compiler/testData/psi/examples/Builder.txt @@ -398,11 +398,9 @@ JetFile: Builder.jet PsiElement(IDENTIFIER)('initializer') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION @@ -412,7 +410,7 @@ JetFile: Builder.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/examples/FunctionsAndTypes.jet b/compiler/testData/psi/examples/FunctionsAndTypes.jet index 6644dd6b03c..c8d79fed6e8 100644 --- a/compiler/testData/psi/examples/FunctionsAndTypes.jet +++ b/compiler/testData/psi/examples/FunctionsAndTypes.jet @@ -1,34 +1,34 @@ -type f1 = fun (T) : X +type f1 = (T) -> X // type f1 = {(T) => X} -type f2 = fun (T, E) : X +type f2 = (T, E) -> X // type f2 = {(T, E) => X} -type f_tuple = fun ((T, E)) : X +type f_tuple = (#(T, E)) -> X //type f_tuple = {((T, E)) => X} -type hof = fun (X) : fun (T) : Y +type hof = (X) -> (T) -> Y //type hof = { (X) => {(T) => Y} } -type hof2 = fun (fun (X) : Y) : fun (Y) : Z +type hof2 = ( (X) -> Y) -> (Y) -> Z //type hof2 = { {(X) => Y} => {(Y) => Z} } -type Comparison<in T> = fun (a : T, b : T) : Int +type Comparison<in T> = (a : T, b : T) -> Int //type Comparison<in T> = {(a : T, b : T) => Int} -type Equality<in T> = fun (a : T, b : T) : Boolean +type Equality<in T> = (a : T, b : T) -> Boolean //type Equality<in T> = {(a : T, b : T) => Boolean} -type HashFunction<in T> = fun (obj : T) : Int +type HashFunction<in T> = (obj : T) -> Int //type HashFunction<in T> = {(obj : T) => Int} -type Runnable = fun () : () +type Runnable = () -> #() //type Runnable = {() => ()} -type Function1<in T, out R> = fun (input : T) : R +type Function1<in T, out R> = (input : T) -> R //type Function1<in T, out R> = {(input : T) => R} -val f1 = {(t : T) : X => something(t)} +val f1 = {(t : T) : X -> something(t)} fun f1(t : T) : X = something(t) -val f1 = {(t : T) => something(t)} -val f1 = {(T) : X => something(it)} -val f1 = {t => something(t)} +val f1 = {(t : T) -> something(t)} +val f1 = {(T) : X -> something(it)} +val f1 = {t -> something(t)} val f1 = {something(it)} -val f1 : fun (T) : X = {X()} +val f1 : (T) -> X = {X()} diff --git a/compiler/testData/psi/examples/FunctionsAndTypes.txt b/compiler/testData/psi/examples/FunctionsAndTypes.txt index ca829289aac..704881a598e 100644 --- a/compiler/testData/psi/examples/FunctionsAndTypes.txt +++ b/compiler/testData/psi/examples/FunctionsAndTypes.txt @@ -10,11 +10,9 @@ JetFile: FunctionsAndTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -24,7 +22,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -41,11 +39,9 @@ JetFile: FunctionsAndTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -62,7 +58,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('E') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -79,16 +75,15 @@ JetFile: FunctionsAndTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') TYPE_REFERENCE USER_TYPE @@ -103,7 +98,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(RPAR)(')') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -120,11 +115,9 @@ JetFile: FunctionsAndTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -134,12 +127,10 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('X') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -149,7 +140,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -166,18 +157,15 @@ JetFile: FunctionsAndTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') + PsiWhiteSpace(' ') VALUE_PARAMETER TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -187,7 +175,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('X') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -195,12 +183,10 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('Y') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -210,7 +196,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('Y') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -233,11 +219,9 @@ JetFile: FunctionsAndTypes.jet PsiElement(GT)('>') PsiWhiteSpace(' ') PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -262,7 +246,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -285,11 +269,9 @@ JetFile: FunctionsAndTypes.jet PsiElement(GT)('>') PsiWhiteSpace(' ') PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -314,7 +296,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -337,11 +319,9 @@ JetFile: FunctionsAndTypes.jet PsiElement(GT)('>') PsiWhiteSpace(' ') PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -355,7 +335,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -372,19 +352,18 @@ JetFile: FunctionsAndTypes.jet TYPE_PARAMETER_LIST <empty list> PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE TUPLE_TYPE + PsiElement(HASH)('#') PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n') @@ -411,11 +390,9 @@ JetFile: FunctionsAndTypes.jet PsiElement(GT)('>') PsiWhiteSpace(' ') PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -429,7 +406,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -468,7 +445,7 @@ JetFile: FunctionsAndTypes.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('X') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK CALL_EXPRESSION @@ -541,7 +518,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK CALL_EXPRESSION @@ -578,7 +555,7 @@ JetFile: FunctionsAndTypes.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('X') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK CALL_EXPRESSION @@ -606,7 +583,7 @@ JetFile: FunctionsAndTypes.jet VALUE_PARAMETER PsiElement(IDENTIFIER)('t') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK CALL_EXPRESSION @@ -648,11 +625,9 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('f1') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -662,7 +637,7 @@ JetFile: FunctionsAndTypes.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/examples/Graph.jet b/compiler/testData/psi/examples/Graph.jet index 7e373b1e9d6..6999b00c715 100644 --- a/compiler/testData/psi/examples/Graph.jet +++ b/compiler/testData/psi/examples/Graph.jet @@ -24,11 +24,11 @@ class Graph<V, E> { fun neighbours(v : Vertex<V>) = edges.filter{it.from == v}.map{it.to} // type is IIterable<Vertex<V>> - fun dfs(handler : fun (V) : Unit) { + fun dfs(handler : (V) -> Unit) { val visited = HashSet<Vertex<V>>() vertices.foreach{dfs(it, visited, handler)} - fun dfs(current : Vertex<V>, visited : ISet<Vertex<V>>, handler : fun (V) : Unit) { + fun dfs(current : Vertex<V>, visited : ISet<Vertex<V>>, handler : (V) -> Unit) { if (!visited.add(current)) return handler(current) @@ -36,7 +36,7 @@ class Graph<V, E> { } } - public fun traverse(pending : IPushPop<Vertex<V>>, visited : ISet<Vertex<V>>, handler : fun (V) : Unit) { + public fun traverse(pending : IPushPop<Vertex<V>>, visited : ISet<Vertex<V>>, handler : (V) -> Unit) { vertices.foreach { if (!visited.add(it)) continue @@ -44,7 +44,7 @@ class Graph<V, E> { while (!pending.isEmpty) { val current = pending.pop() handler(current); - neighbours(current).foreach { n => + neighbours(current).foreach { n -> if (visited.add(n)) { pending.push(n) } diff --git a/compiler/testData/psi/examples/Graph.txt b/compiler/testData/psi/examples/Graph.txt index 2cb4dd908c6..ecd6a20a6c0 100644 --- a/compiler/testData/psi/examples/Graph.txt +++ b/compiler/testData/psi/examples/Graph.txt @@ -469,11 +469,9 @@ JetFile: Graph.jet PsiElement(IDENTIFIER)('handler') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -483,7 +481,7 @@ JetFile: Graph.jet PsiElement(IDENTIFIER)('V') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -612,11 +610,9 @@ JetFile: Graph.jet PsiElement(IDENTIFIER)('handler') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -626,7 +622,7 @@ JetFile: Graph.jet PsiElement(IDENTIFIER)('V') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -784,11 +780,9 @@ JetFile: Graph.jet PsiElement(IDENTIFIER)('handler') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -798,7 +792,7 @@ JetFile: Graph.jet PsiElement(IDENTIFIER)('V') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -935,7 +929,7 @@ JetFile: Graph.jet VALUE_PARAMETER PsiElement(IDENTIFIER)('n') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace('\n ') BLOCK IF diff --git a/compiler/testData/psi/examples/LINQ.jet b/compiler/testData/psi/examples/LINQ.jet index e492a0c22d3..efffad662fd 100644 --- a/compiler/testData/psi/examples/LINQ.jet +++ b/compiler/testData/psi/examples/LINQ.jet @@ -1,3 +1,3 @@ fun foo() { - l filter {it.x} map {it.foo} aggregate {(a, b) => a + b} + l filter {it.x} map {it.foo} aggregate {(a, b) -> a + b} } \ No newline at end of file diff --git a/compiler/testData/psi/examples/LINQ.txt b/compiler/testData/psi/examples/LINQ.txt index 98e0b166b64..c8c78d1a8e9 100644 --- a/compiler/testData/psi/examples/LINQ.txt +++ b/compiler/testData/psi/examples/LINQ.txt @@ -65,7 +65,7 @@ JetFile: LINQ.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') BLOCK BINARY_EXPRESSION diff --git a/compiler/testData/psi/examples/PolymorphicClassObjects.jet b/compiler/testData/psi/examples/PolymorphicClassObjects.jet index fefa5d52ea4..12027ad1994 100644 --- a/compiler/testData/psi/examples/PolymorphicClassObjects.jet +++ b/compiler/testData/psi/examples/PolymorphicClassObjects.jet @@ -16,7 +16,7 @@ class List<T> { } -fun <E, T, R> Map<E, T>.map(f : fun (E) : R) : T<R> where +fun <E, T, R> Map<E, T>.map(f : (E) -> R) : T<R> where T : Iterable<E>, class object T : Buildable<E, T> = { val builder = T.newBuilder() diff --git a/compiler/testData/psi/examples/PolymorphicClassObjects.txt b/compiler/testData/psi/examples/PolymorphicClassObjects.txt index 9a59c5766da..0ba36037cd1 100644 --- a/compiler/testData/psi/examples/PolymorphicClassObjects.txt +++ b/compiler/testData/psi/examples/PolymorphicClassObjects.txt @@ -242,11 +242,9 @@ JetFile: PolymorphicClassObjects.jet PsiElement(IDENTIFIER)('f') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -256,7 +254,7 @@ JetFile: PolymorphicClassObjects.jet PsiElement(IDENTIFIER)('E') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/examples/With.jet b/compiler/testData/psi/examples/With.jet index 7303da79f0a..c6bf6fa33e2 100644 --- a/compiler/testData/psi/examples/With.jet +++ b/compiler/testData/psi/examples/With.jet @@ -1,4 +1,4 @@ -[inline] fun with<T>(receiver : T, body : fun T.() : Unit) = receiver.body() +[inline] fun with<T>(receiver : T, body : T.() -> Unit) = receiver.body() fun example() { diff --git a/compiler/testData/psi/examples/With.txt b/compiler/testData/psi/examples/With.txt index 468588f148e..fbe340bf2b1 100644 --- a/compiler/testData/psi/examples/With.txt +++ b/compiler/testData/psi/examples/With.txt @@ -39,11 +39,9 @@ JetFile: With.jet PsiElement(IDENTIFIER)('body') PsiWhiteSpace(' ') PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION @@ -53,7 +51,7 @@ JetFile: With.jet PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE diff --git a/compiler/testData/psi/examples/util/Comparison.jet b/compiler/testData/psi/examples/util/Comparison.jet index 00e8bc10327..ad53be8f67c 100644 --- a/compiler/testData/psi/examples/util/Comparison.jet +++ b/compiler/testData/psi/examples/util/Comparison.jet @@ -1,4 +1,4 @@ -type Comparison<in T> = fun (T, T) : Int +type Comparison<in T> = (T, T) -> Int fun naturalOrder<in T : Comparable<T>>(a : T, b : T) : Int = a.compareTo(b) @@ -8,9 +8,9 @@ enum class ComparisonResult { LS; EQ; GR } -type MatchableComparison<in T> = fun (T, T) : ComparisonResult +type MatchableComparison<in T> = (T, T) -> ComparisonResult -fun asMatchableComparison<T>(cmp : Comparison<T>) : MatchableComparison<T> = {(a, b) => +fun asMatchableComparison<T>(cmp : Comparison<T>) : MatchableComparison<T> = {(a, b) -> val res = cmp(a, b) if (res == 0) return ComparisonResult.EQ if (res < 0) return ComparisonResult.LS diff --git a/compiler/testData/psi/examples/util/Comparison.txt b/compiler/testData/psi/examples/util/Comparison.txt index 53e19e4cb0c..346fde02b9c 100644 --- a/compiler/testData/psi/examples/util/Comparison.txt +++ b/compiler/testData/psi/examples/util/Comparison.txt @@ -16,11 +16,9 @@ JetFile: Comparison.jet PsiElement(GT)('>') PsiWhiteSpace(' ') PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -37,7 +35,7 @@ JetFile: Comparison.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -255,11 +253,9 @@ JetFile: Comparison.jet PsiElement(GT)('>') PsiWhiteSpace(' ') PsiElement(EQ)('=') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - PsiElement(fun)('fun') - PsiWhiteSpace(' ') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER @@ -276,7 +272,7 @@ JetFile: Comparison.jet PsiElement(IDENTIFIER)('T') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(COLON)(':') + PsiElement(ARROW)('->') PsiWhiteSpace(' ') TYPE_REFERENCE USER_TYPE @@ -343,7 +339,7 @@ JetFile: Comparison.jet PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') + PsiElement(ARROW)('->') PsiWhiteSpace('\n ') BLOCK PROPERTY diff --git a/compiler/testData/psi/greatSyntacticShift/functionLiterals.jet b/compiler/testData/psi/greatSyntacticShift/functionLiterals.jet new file mode 100644 index 00000000000..345d07943ad --- /dev/null +++ b/compiler/testData/psi/greatSyntacticShift/functionLiterals.jet @@ -0,0 +1,43 @@ +class Foo +class Bar + +fun a(vararg a : Any) = a + +fun test() { +a(1 +, {} +, { -> 1} +, {1} +, {x} +, {-> 1} +, {x -> 1} +, {x, y -> 1} +, {(x, y) -> 1} +, {(x, y) : Int -> 1} +, {(x) -> 1} +, {(x) : Int -> 1} +, {(x)} +, {(x).(y)} +, {x.(y)} +, {Int.(x) -> 1} +, {A.B.(x) -> 1} +, {A.B.(x, y) -> 1} +, {Int.(x) : Int -> 1} +, {Int.(x, y) -> 1} +, {Int.(x, y) : Int -> 1} +, {(Int).(x, y) -> 1} +, {(Int).(x, y) : Int -> 1} +, {(Int).(x, y) : (Int) -> Int -> {1}} +, {Int? .(x, y) -> 1} +, {This.(x, y) -> 1} +, {#(A, B).(x, y) -> 1} +, {#(a, b).(y)} +, {#(a, b)} +, {Foo<Bar>.x} +, {Foo<Bar>.(x)} +, {Foo<Bar>.(x) -> x} +, {Foo.Bar.Baz.(x) -> x} +, {Foo<Bar>.(x) : Int -> x} +, {Foo.Bar.Baz.(x) : Int -> x} +) +} diff --git a/compiler/testData/psi/greatSyntacticShift/functionTypes.jet b/compiler/testData/psi/greatSyntacticShift/functionTypes.jet new file mode 100644 index 00000000000..4b51202a784 --- /dev/null +++ b/compiler/testData/psi/greatSyntacticShift/functionTypes.jet @@ -0,0 +1,51 @@ +class A { +} + +namespace n { + class B +} +abstract class XXX() { + abstract val a : Int + abstract val a1 : namespace.Int + abstract val a2 : n.B + abstract val a3 : (A) + abstract val a31 : (n.B) + abstract val a4 : A? + abstract val a5 : (A)? + abstract val a6 : (A?) + abstract val a7 : (A) -> n.B + abstract val a8 : (A, n.B) -> n.B + +//val a9 : (A, B) +//val a10 : (B)? -> B + + val a11 : ((Int) -> Int)? = null + val a12 : ((Int) -> (Int))? = null + abstract val a13 : Int.(Int) -> Int + abstract val a14 : n.B.(Int) -> Int + abstract val a15 : Int? .(Int) -> Int + abstract val a152 : (Int?).(Int) -> Int + abstract val a151 : Int?.(Int) -> Int + abstract val a16 : (Int) -> (Int) -> Int + abstract val a17 : ((Int) -> Int).(Int) -> Int + abstract val a18 : (Int) -> ((Int) -> Int) + abstract val a19 : ((Int) -> Int) -> Int +} + +abstract class YYY() { + abstract val a7 : (a : A) -> n.B + abstract val a8 : (a : A, b : n.B) -> n.B +//val a9 : (A, B) +//val a10 : (B)? -> B + val a11 : ((a : Int) -> Int)? = null + val a12 : ((a : Int) -> (Int))? = null + abstract val a13 : Int.(a : Int) -> Int + abstract val a14 : n.B.(a : Int) -> Int + abstract val a15 : Int? .(a : Int) -> Int + abstract val a152 : (Int?).(a : Int) -> Int +abstract val a151 : Int?.(a : Int) -> Int + abstract val a16 : (a : Int) -> (a : Int) -> Int + abstract val a17 : ((a : Int) -> Int).(a : Int) -> Int + abstract val a18 : (a : Int) -> ((a : Int) -> Int) + abstract val a19 : (b : (a : Int) -> Int) -> Int +} diff --git a/compiler/testData/readClass/fun/FunDefaultArg.kt b/compiler/testData/readClass/fun/FunDefaultArg.kt new file mode 100644 index 00000000000..e4cda07d87b --- /dev/null +++ b/compiler/testData/readClass/fun/FunDefaultArg.kt @@ -0,0 +1,3 @@ +namespace test + +fun funDefaultArg(p: Int, q: Int = 17, r: Int = 18) = 19 diff --git a/compiler/testData/readClass/fun/FunVarargCharSequence.kt b/compiler/testData/readClass/fun/FunVarargCharSequence.kt new file mode 100644 index 00000000000..4d1f154c1e7 --- /dev/null +++ b/compiler/testData/readClass/fun/FunVarargCharSequence.kt @@ -0,0 +1,3 @@ +namespace test + +fun varargCharSequence(a: Int, vararg b: java.lang.CharSequence) = 1 diff --git a/compiler/testData/readClass/fun/FunVarargInt.kt b/compiler/testData/readClass/fun/FunVarargInt.kt new file mode 100644 index 00000000000..5b51bb4cb3d --- /dev/null +++ b/compiler/testData/readClass/fun/FunVarargInt.kt @@ -0,0 +1,3 @@ +namespace test + +fun varargInt(a: Int, vararg b: Int) = 1 diff --git a/compiler/testData/readClass/fun/ModifierAbstract.kt b/compiler/testData/readClass/fun/ModifierAbstract.kt new file mode 100644 index 00000000000..3800def1fad --- /dev/null +++ b/compiler/testData/readClass/fun/ModifierAbstract.kt @@ -0,0 +1,5 @@ +namespace test + +abstract class ModifierAbstract { + abstract fun abs(): Int +} diff --git a/compiler/testData/readClass/fun/ModifierOpen.kt b/compiler/testData/readClass/fun/ModifierOpen.kt new file mode 100644 index 00000000000..e9f15a08e07 --- /dev/null +++ b/compiler/testData/readClass/fun/ModifierOpen.kt @@ -0,0 +1,5 @@ +namespace test + +open class ModifierOpen { + open fun abs() = 1 +} diff --git a/compiler/testData/resolve/Classifiers.jet b/compiler/testData/resolve/Classifiers.jet index 8e3a16988fb..e702a3c1021 100644 --- a/compiler/testData/resolve/Classifiers.jet +++ b/compiler/testData/resolve/Classifiers.jet @@ -8,7 +8,7 @@ namespace qualified_this { ~xx~val Int.xx = `xx`this : Int ~xx()~fun Int.xx() { `xx()`this : Int - val a = {Int.() => `xx()`this`xx()`@xx + this} + val a = {Int.() -> `xx()`this`xx()`@xx + this} } } diff --git a/compiler/testData/resolve/FunctionVariable.jet b/compiler/testData/resolve/FunctionVariable.jet index b7ea7a62f8a..5318d55d65c 100644 --- a/compiler/testData/resolve/FunctionVariable.jet +++ b/compiler/testData/resolve/FunctionVariable.jet @@ -1,3 +1,3 @@ -fun invoker(~gen~gen : fun () : Int) : Int { +fun invoker(~gen~gen : () -> Int) : Int { return `gen`gen() // Says it cannot resolve 'gen' here } diff --git a/compiler/tests/org/jetbrains/jet/ReadClassDataTest.java b/compiler/tests/org/jetbrains/jet/ReadClassDataTest.java index 04458738032..9714d54f0c3 100644 --- a/compiler/tests/org/jetbrains/jet/ReadClassDataTest.java +++ b/compiler/tests/org/jetbrains/jet/ReadClassDataTest.java @@ -22,6 +22,7 @@ import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingTraceContext; import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver; import org.jetbrains.jet.lang.resolve.java.JavaSemanticServices; +import org.jetbrains.jet.lang.resolve.java.JvmAbi; import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.resolve.scopes.receivers.ExtensionReceiver; import org.jetbrains.jet.lang.types.JetType; @@ -123,6 +124,8 @@ public class ReadClassDataTest extends UsefulTestCase { if (ad instanceof ClassifierDescriptor) { ClassifierDescriptor bd = nsb.getMemberScope().getClassifier(ad.getName()); compareClassifiers((ClassifierDescriptor) ad, bd); + + Assert.assertNull(nsb.getMemberScope().getClassifier(ad.getName() + JvmAbi.TRAIT_IMPL_SUFFIX)); } else if (ad instanceof FunctionDescriptor) { Set<FunctionDescriptor> functions = nsb.getMemberScope().getFunctions(ad.getName()); Assert.assertTrue(functions.size() >= 1); @@ -146,6 +149,10 @@ public class ReadClassDataTest extends UsefulTestCase { private String serializeContent(ClassDescriptor klass) { StringBuilder sb = new StringBuilder(); + + serialize(klass.getModality(), sb); + sb.append(" "); + serialize(klass.getKind(), sb); sb.append(" "); @@ -221,6 +228,9 @@ public class ReadClassDataTest extends UsefulTestCase { private void serialize(FunctionDescriptor fun, StringBuilder sb) { + serialize(fun.getModality(), sb); + sb.append(" "); + sb.append("fun "); if (!fun.getTypeParameters().isEmpty()) { sb.append("<"); @@ -256,11 +266,13 @@ public class ReadClassDataTest extends UsefulTestCase { } private void serialize(ValueParameterDescriptor valueParameter, StringBuilder sb) { + if (valueParameter.getVarargElementType() != null) { + sb.append("vararg "); + } sb.append(valueParameter.getName()); sb.append(": "); if (valueParameter.getVarargElementType() != null) { - sb.append("vararg "); - serialize(valueParameter.getVarargElementType()); + serialize(valueParameter.getVarargElementType(), sb); } else { serialize(valueParameter.getOutType(), sb); } @@ -276,7 +288,11 @@ public class ReadClassDataTest extends UsefulTestCase { sb.append(variance); sb.append(' '); } - } + } + + private void serialize(Modality modality, StringBuilder sb) { + sb.append(modality.name().toLowerCase()); + } private void serialize(JetType type, StringBuilder sb) { serialize(type.getConstructor().getDeclarationDescriptor(), sb); diff --git a/compiler/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java b/compiler/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java index f9e7eba1c9b..ceb54b29936 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java +++ b/compiler/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java @@ -54,7 +54,7 @@ public class CheckerTestUtilTest extends JetLiteFixture { } public void testBoth() throws Exception { - doTest(new TheTest("Unexpected TYPE_MISMATCH at 56 to 57", "Missing UNRESOLVED_REFERENCE at 166 to 168") { + doTest(new TheTest("Unexpected TYPE_MISMATCH at 56 to 57", "Missing UNRESOLVED_REFERENCE at 164 to 166") { @Override protected void makeTestData(List<Diagnostic> diagnostics, List<CheckerTestUtil.DiagnosedRange> diagnosedRanges) { diagnosedRanges.remove(1); @@ -64,7 +64,7 @@ public class CheckerTestUtilTest extends JetLiteFixture { } public void testMissingInTheMiddle() throws Exception { - doTest(new TheTest("Unexpected NONE_APPLICABLE at 122 to 123", "Missing TYPE_MISMATCH at 161 to 169") { + doTest(new TheTest("Unexpected NONE_APPLICABLE at 120 to 121", "Missing TYPE_MISMATCH at 159 to 167") { @Override protected void makeTestData(List<Diagnostic> diagnostics, List<CheckerTestUtil.DiagnosedRange> diagnosedRanges) { diagnosedRanges.remove(4); diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTest.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTest.java index 9cabe8bdd66..61116f1dfa9 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTest.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTest.java @@ -10,7 +10,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.JetLiteFixture; import org.jetbrains.jet.JetTestCaseBuilder; import org.jetbrains.jet.lang.Configuration; -import org.jetbrains.jet.lang.JetSemanticServices; import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory; import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils; import org.jetbrains.jet.lang.psi.JetDeclaration; diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java index 9312dadc793..89b4e450d8a 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java @@ -235,4 +235,8 @@ public class ClassGenTest extends CodegenTestCase { public void testKt707 () throws Exception { blackBoxFile("regressions/kt707.jet"); } + + public void testKt857 () throws Exception { +// blackBoxFile("regressions/kt857.jet"); + } } diff --git a/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java index 295781b1837..968a5647f20 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java @@ -485,7 +485,7 @@ public class NamespaceGenTest extends CodegenTestCase { } public void testTupleLiteral() throws Exception { - loadText("fun foo() = (1, \"foo\")"); + loadText("fun foo() = #(1, \"foo\")"); // System.out.println(generateToText()); final Method main = generateFunction("foo"); Tuple2 tuple2 = (Tuple2) main.invoke(null); @@ -494,7 +494,7 @@ public class NamespaceGenTest extends CodegenTestCase { } public void testParametrizedTupleLiteral() throws Exception { - loadText("fun <E,D> E.foo(extra: java.util.List<D>) = (1, \"foo\", this, extra)"); + loadText("fun <E,D> E.foo(extra: java.util.List<D>) = #(1, \"foo\", this, extra)"); // System.out.println(generateToText()); final Method main = generateFunction(); Tuple4 tuple4 = (Tuple4) main.invoke(null, "aaa", TypeInfo.STRING_TYPE_INFO, TypeInfo.INT_TYPE_INFO, Arrays.asList(10)); diff --git a/compiler/tests/org/jetbrains/jet/codegen/PatternMatchingTest.java b/compiler/tests/org/jetbrains/jet/codegen/PatternMatchingTest.java index a3fd95c3ab3..4643204921f 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/PatternMatchingTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/PatternMatchingTest.java @@ -74,19 +74,19 @@ public class PatternMatchingTest extends CodegenTestCase { } public void testWildcardPattern() throws Exception { - loadText("fun foo(x: String) = when(x) { is * => \"something\" }"); + loadText("fun foo(x: String) = when(x) { is * -> \"something\" }"); Method foo = generateFunction(); assertEquals("something", foo.invoke(null, "")); } public void testNoReturnType() throws Exception { - loadText("fun foo(x: String) = when(x) { is * => \"x\" }"); + loadText("fun foo(x: String) = when(x) { is * -> \"x\" }"); Method foo = generateFunction(); assertEquals("x", foo.invoke(null, "")); } public void testTuplePattern() throws Exception { - loadText("fun foo(x: (Any, Any)) = when(x) { is (1,2) => \"one,two\"; else => \"something\" }"); + loadText("fun foo(x: #(Any, Any)) = when(x) { is #(1,2) -> \"one,two\"; else -> \"something\" }"); Method foo = generateFunction(); final Object result; try { @@ -118,14 +118,14 @@ public class PatternMatchingTest extends CodegenTestCase { } public void testNames() throws Exception { - loadText("fun foo(x: (Any, Any)) = when(x) { is (val a is String, *) => a; else => \"something\" }"); + loadText("fun foo(x: #(Any, Any)) = when(x) { is #(val a is String, *) -> a; else -> \"something\" }"); Method foo = generateFunction(); assertEquals("JetBrains", foo.invoke(null, new Tuple2<String, String>(null, "JetBrains", "s.r.o."))); assertEquals("something", foo.invoke(null, new Tuple2<Integer, Integer>(null, 1, 2))); } public void testMultipleConditions() throws Exception { - loadText("fun foo(x: Any) = when(x) { is 0, 1 => \"bit\"; else => \"something\" }"); + loadText("fun foo(x: Any) = when(x) { is 0, 1 -> \"bit\"; else -> \"something\" }"); Method foo = generateFunction(); assertEquals("bit", foo.invoke(null, 0)); assertEquals("bit", foo.invoke(null, 1)); diff --git a/compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java b/compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java index d9071141007..2373b2a871d 100644 --- a/compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java +++ b/compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java @@ -78,15 +78,15 @@ public class JetTypeCheckerTest extends JetLiteFixture { assertType("\"d\"", library.getStringType()); assertType("\"\"\"d\"\"\"", library.getStringType()); - assertType("()", JetStandardClasses.getUnitType()); + assertType("#()", JetStandardClasses.getUnitType()); assertType("null", JetStandardClasses.getNullableNothingType()); } public void testTupleConstants() throws Exception { - assertType("()", JetStandardClasses.getUnitType()); + assertType("#()", JetStandardClasses.getUnitType()); - assertType("(1, 'a')", JetStandardClasses.getTupleType(library.getIntType(), library.getCharType())); + assertType("#(1, 'a')", JetStandardClasses.getTupleType(library.getIntType(), library.getCharType())); } public void testTypeInfo() throws Exception { @@ -117,11 +117,11 @@ public class JetTypeCheckerTest extends JetLiteFixture { } public void testWhen() throws Exception { - assertType("when (1) { is 1 => 2; } ", "Int"); - assertType("when (1) { is 1 => 2; is 1 => '2'} ", "Any"); - assertType("when (1) { is 1 => 2; is 1 => '2'; is 1 => null} ", "Any?"); - assertType("when (1) { is 1 => 2; is 1 => '2'; else => null} ", "Any?"); - assertType("when (1) { is 1 => 2; is 1 => '2'; is 1 => when(2) {is 1 => null}} ", "Any?"); + assertType("when (1) { is 1 -> 2; } ", "Int"); + assertType("when (1) { is 1 -> 2; is 1 -> '2'} ", "Any"); + assertType("when (1) { is 1 -> 2; is 1 -> '2'; is 1 -> null} ", "Any?"); + assertType("when (1) { is 1 -> 2; is 1 -> '2'; else -> null} ", "Any?"); + assertType("when (1) { is 1 -> 2; is 1 -> '2'; is 1 -> when(2) {is 1 -> null}} ", "Any?"); } public void testTry() throws Exception { @@ -213,38 +213,38 @@ public class JetTypeCheckerTest extends JetLiteFixture { } public void testTuples() throws Exception { - assertSubtype("Unit", "()"); - assertSubtype("()", "Unit"); - assertSubtype("()", "()"); + assertSubtype("Unit", "#()"); + assertSubtype("#()", "Unit"); + assertSubtype("#()", "#()"); - assertSubtype("(Boolean)", "(Boolean)"); - assertSubtype("(Byte)", "(Byte)"); - assertSubtype("(Char)", "(Char)"); - assertSubtype("(Short)", "(Short)"); - assertSubtype("(Int)", "(Int)"); - assertSubtype("(Long)", "(Long)"); - assertSubtype("(Float)", "(Float)"); - assertSubtype("(Double)", "(Double)"); - assertSubtype("(Unit)", "(Unit)"); - assertSubtype("(Unit, Unit)", "(Unit, Unit)"); + assertSubtype("#(Boolean)", "#(Boolean)"); + assertSubtype("#(Byte)", "#(Byte)"); + assertSubtype("#(Char)", "#(Char)"); + assertSubtype("#(Short)", "#(Short)"); + assertSubtype("#(Int)", "#(Int)"); + assertSubtype("#(Long)", "#(Long)"); + assertSubtype("#(Float)", "#(Float)"); + assertSubtype("#(Double)", "#(Double)"); + assertSubtype("#(Unit)", "#(Unit)"); + assertSubtype("#(Unit, Unit)", "#(Unit, Unit)"); - assertSubtype("(Boolean)", "(Boolean)"); - assertSubtype("(Byte)", "(Byte)"); - assertSubtype("(Char)", "(Char)"); - assertSubtype("(Short)", "(Short)"); - assertSubtype("(Int)", "(Int)"); - assertSubtype("(Long)", "(Long)"); - assertSubtype("(Float)", "(Float)"); - assertSubtype("(Double)", "(Double)"); - assertSubtype("(Unit)", "(Unit)"); - assertSubtype("(Unit, Unit)", "(Unit, Unit)"); + assertSubtype("#(Boolean)", "#(Boolean)"); + assertSubtype("#(Byte)", "#(Byte)"); + assertSubtype("#(Char)", "#(Char)"); + assertSubtype("#(Short)", "#(Short)"); + assertSubtype("#(Int)", "#(Int)"); + assertSubtype("#(Long)", "#(Long)"); + assertSubtype("#(Float)", "#(Float)"); + assertSubtype("#(Double)", "#(Double)"); + assertSubtype("#(Unit)", "#(Unit)"); + assertSubtype("#(Unit, Unit)", "#(Unit, Unit)"); - assertNotSubtype("(Unit)", "(Int)"); + assertNotSubtype("#(Unit)", "#(Int)"); - assertSubtype("(Unit)", "(Any)"); - assertSubtype("(Unit, Unit)", "(Any, Any)"); - assertSubtype("(Unit, Unit)", "(Any, Unit)"); - assertSubtype("(Unit, Unit)", "(Unit, Any)"); + assertSubtype("#(Unit)", "#(Any)"); + assertSubtype("#(Unit, Unit)", "#(Any, Any)"); + assertSubtype("#(Unit, Unit)", "#(Any, Unit)"); + assertSubtype("#(Unit, Unit)", "#(Unit, Any)"); } public void testProjections() throws Exception { @@ -326,38 +326,38 @@ public class JetTypeCheckerTest extends JetLiteFixture { } public void testLoops() throws Exception { - assertType("{ while (1) {1} }", "fun(): Unit"); - assertType("{ do {1} while(1) }", "fun(): Unit"); - assertType("{ for (i in 1) {1} }", "fun(): Unit"); + assertType("{ while (1) {1} }", "() -> Unit"); + assertType("{ do {1} while(1) }", "() -> Unit"); + assertType("{ for (i in 1) {1} }", "() -> Unit"); } public void testFunctionLiterals() throws Exception { - assertType("{() => }", "fun () : Unit"); - assertType("{() : Int => }", "fun () : Int"); - assertType("{() => 1}", "fun () : Int"); + assertType("{() -> }", "() -> Unit"); + assertType("{() : Int -> }", "() -> Int"); + assertType("{() -> 1}", "() -> Int"); - assertType("{(a : Int) => 1}", "fun (a : Int) : Int"); - assertType("{(a : Int, b : String) => 1}", "fun (a : Int, b : String) : Int"); + assertType("{(a : Int) -> 1}", "(a : Int) -> Int"); + assertType("{(a : Int, b : String) -> 1}", "(a : Int, b : String) -> Int"); - assertType("{(a : Int) => 1}", "fun (Int) : Int"); - assertType("{(a : Int, b : String) => 1}", "fun (Int, String) : Int"); + assertType("{(a : Int) -> 1}", "(Int) -> Int"); + assertType("{(a : Int, b : String) -> 1}", "(Int, String) -> Int"); - assertType("{Any.() => 1}", "fun Any.() : Int"); + assertType("{Any.() -> 1}", "Any.() -> Int"); - assertType("{Any.(a : Int) => 1}", "fun Any.(a : Int) : Int"); - assertType("{Any.(a : Int, b : String) => 1}", "fun Any.(a : Int, b : String) : Int"); + assertType("{Any.(a : Int) -> 1}", "Any.(a : Int) -> Int"); + assertType("{Any.(a : Int, b : String) -> 1}", "Any.(a : Int, b : String) -> Int"); - assertType("{Any.(a : Int) => 1}", "fun Any.(Int) : Int"); - assertType("{Any.(a : Int, b : String) => 1}", "fun Any.(Int, String) : Int"); + assertType("{Any.(a : Int) -> 1}", "Any.(Int) -> Int"); + assertType("{Any.(a : Int, b : String) -> 1}", "Any.(Int, String) -> Int"); - assertType("{Any.(a : Int, b : String) => b}", "fun Any.(Int, String) : String"); + assertType("{Any.(a : Int, b : String) -> b}", "Any.(Int, String) -> String"); } public void testBlocks() throws Exception { assertType("if (1) {val a = 1; a} else {null}", "Int?"); - assertType("if (1) {() => val a = 1; a} else {() => null}", "Function0<Int?>"); - assertType("if (1) {() => val a = 1; a; var b : Boolean; b} else null", "Function0<Boolean>?"); - assertType("if (1) {() => val a = 1; a; var b = a; b} else null", "Function0<Int>?"); + assertType("if (1) {() -> val a = 1; a} else {() -> null}", "Function0<Int?>"); + assertType("if (1) {() -> val a = 1; a; var b : Boolean; b} else null", "Function0<Boolean>?"); + assertType("if (1) {() -> val a = 1; a; var b = a; b} else null", "Function0<Int>?"); } public void testNew() throws Exception { @@ -376,7 +376,7 @@ public class JetTypeCheckerTest extends JetLiteFixture { public void testOverloads() throws Exception { assertType("Functions<String>().f()", "Unit"); assertType("Functions<String>().f(1)", "Int"); - assertType("Functions<Double>().f((1, 1))", "Double"); + assertType("Functions<Double>().f(#(1, 1))", "Double"); assertType("Functions<Double>().f(1.0)", "Any"); assertType("Functions<Byte>().f<String>(\"\")", "Byte"); @@ -577,7 +577,7 @@ public class JetTypeCheckerTest extends JetLiteFixture { "fun f() : Unit {} " + "fun f(a : Int) : Int {} " + "fun f(a : T) : Any {} " + - "fun f(a : (Int, Int)) : T {} " + + "fun f(a : #(Int, Int)) : T {} " + "fun f<E>(a : E) : T {} " + "}", "class WithPredicate() { " + diff --git a/grammar/src/expressions.grm b/grammar/src/expressions.grm index 28f3de35070..2491b7120fa 100644 --- a/grammar/src/expressions.grm +++ b/grammar/src/expressions.grm @@ -6,7 +6,7 @@ bq. See [Expressions] h3. Precedence ||*Precedence*||Title||Symbols|| -|Highest|Postfix|{{\+\+}}, {{\-\-}}, {{#}}, {{.}}, {{?.}}, {{?}}| +|Highest|Postfix|{{\+\+}}, {{\-\-}}, {{.}}, {{?.}}, {{?}}| | |Prefix|{{-}}, {{\+}}, {{\+\+}}, {{\-\-}}, {{!}}, [{{@label}}|#LabelName], {{@}}, {{@@}} | | |Type RHS|{{:}}, {{as}}, {{as?}} | | |Multiplicative|{{*}}, {{/}}, {{%}} | @@ -19,7 +19,6 @@ h3. Precedence | |Equality|{{==}}, {{\!==}}| | |Conjunction|{{&&}}| | |Disjunction|{{\|\|}}| -| |Arrow|{{\->}}| |Lowest|Assignment|{{=}}, {{+=}}, {{-=}}, {{*=}}, {{/=}}, {{%=}}| h3. Rules @@ -41,17 +40,12 @@ Decreasing precedence: equalityOperation "&&" "||" - "->" assignmentOperator */ expression - : arrowTupleExpression (assignmentOperator arrowTupleExpression)? - ; - -arrowTupleExpression - : disjunction ("->" disjunction)* + : disjunction (assignmentOperator disjunction)* ; disjunction @@ -109,7 +103,7 @@ postfixUnaryExpression // !!! When you add here, remember to update the FIRST set in the parser atomicExpression - : "(" expression ")" // see tupleLiteral + : "(" expression ")" : literalConstant : functionLiteral : tupleLiteral @@ -230,7 +224,7 @@ callSuffix ; memberAccessOperation - : "." : "?." : "#" : "?" + : "." : "?." : "?" ; typeArguments @@ -249,17 +243,15 @@ jump // yield ? ; -// Ambiguity when after a SimpleName (infix call). In this case (e) is treated as an expression in parentheses -// to put a tuple, write write ((e)) tupleLiteral - : "(" (((SimpleName "=")? expression){","})? ")" + : "#" "(" (((SimpleName "=")? expression){","})? ")" ; // one can use "it" as a parameter name functionLiteral : "{" statements "}" - : "{" (modifiers SimpleName){","} "=>" statements "}" - : "{" (type ".")? "(" (modifiers SimpleName (":" type)?){","} ")" (":" type)? "=>" statements "}" + : "{" (modifiers SimpleName){","} "->" statements "}" + : "{" (type ".")? "(" (modifiers SimpleName (":" type)?){","} ")" (":" type)? "->" statements "}" ; statements diff --git a/grammar/src/types.grm b/grammar/src/types.grm index b92457e67ce..d198da53afb 100644 --- a/grammar/src/types.grm +++ b/grammar/src/types.grm @@ -7,11 +7,11 @@ bq. See [Types] /* Foo<Bar<X>, T, Object> // user type -{(A, Object) : Foo} // function type -{ () : Foo} // function with no arguments -(A, B, C) // tuple type -(a : A, b : B) // tuple type with named entries -() // 0-ary tuple type (Unit) +(A, Object) -> Foo // function type +() -> Foo // function with no arguments +#(A, B, C) // tuple type +#(a : A, b : B) // tuple type with named entries +#() // 0-ary tuple type (Unit) */ @@ -20,6 +20,7 @@ type // IF YOU CHANGE THIS, please, update TYPE_FIRST in JetParsing typeDescriptor + : "(" typeDescriptor ")" : selfType : functionType : userType @@ -47,12 +48,12 @@ optionalProjection ; functionType - : "fun" (type ".")? "(" (parameter | modifiers /*lazy out ref*/ type){","} ")" (":" type)? // Unit by default + : (type ".")? "(" (parameter | modifiers /*lazy out ref*/ type){","} ")" "->" type? ; tupleType - : "(" type{","}? ")" - : "(" parameter{","} ")" // tuple with named entries, the names do not affect assignment compatibility + : "#" "(" type{","}? ")" + : "#" "(" parameter{","} ")" // tuple with named entries, the names do not affect assignment compatibility ; //////////////////////////////////////// \ No newline at end of file diff --git a/grammar/src/when.grm b/grammar/src/when.grm index 864f1602161..ca814d499a2 100644 --- a/grammar/src/when.grm +++ b/grammar/src/when.grm @@ -36,7 +36,7 @@ pattern decomposerPattern : type // TODO : typeArguments will be consumed by the expression - : elvisExpression typeArguments? "@" tuplePattern + : elvisExpression typeArguments? tuplePattern ; constantPattern diff --git a/idea/src/org/jetbrains/jet/plugin/java/JavaElementFinder.java b/idea/src/org/jetbrains/jet/plugin/java/JavaElementFinder.java index adf84a87b4c..fe2513823e0 100644 --- a/idea/src/org/jetbrains/jet/plugin/java/JavaElementFinder.java +++ b/idea/src/org/jetbrains/jet/plugin/java/JavaElementFinder.java @@ -9,7 +9,7 @@ import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.*; import com.intellij.psi.*; import com.intellij.psi.impl.file.PsiPackageImpl; import com.intellij.psi.search.GlobalSearchScope; @@ -18,18 +18,40 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.plugin.JetFileType; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; public class JavaElementFinder extends PsiElementFinder { private final Project project; private final PsiManager psiManager; + private WeakHashMap<GlobalSearchScope, List<JetFile>> jetFiles = new WeakHashMap<GlobalSearchScope, List<JetFile>>(); + public JavaElementFinder(Project project) { this.project = project; psiManager = PsiManager.getInstance(project); + + // Monitoring for files instead of collecting them each time + VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileAdapter() { + @Override + public void fileCreated(VirtualFileEvent event) { + invalidateJetFilesCache(); + } + + @Override + public void fileDeleted(VirtualFileEvent event) { + invalidateJetFilesCache(); + } + + @Override + public void fileMoved(VirtualFileMoveEvent event) { + invalidateJetFilesCache(); + } + + @Override + public void fileCopied(VirtualFileCopyEvent event) { + invalidateJetFilesCache(); + } + }); } @Override @@ -45,7 +67,7 @@ public class JavaElementFinder extends PsiElementFinder { if (qualifiedName.startsWith("java.")) return PsiClass.EMPTY_ARRAY; List<PsiClass> answer = new SmartList<PsiClass>(); - final List<JetFile> filesInScope = collectProjectFiles(project, scope); + final List<JetFile> filesInScope = collectProjectJetFiles(project, scope); for (JetFile file : filesInScope) { JetNamespace rootNamespace = file.getRootNamespace(); final String packageName = JetPsiUtil.getFQName(rootNamespace); @@ -71,7 +93,7 @@ public class JavaElementFinder extends PsiElementFinder { Set<String> answer = new HashSet<String>(); String packageFQN = psiPackage.getQualifiedName(); - for (JetFile psiFile : collectProjectFiles(project, GlobalSearchScope.allScope(project))) { + for (JetFile psiFile : collectProjectJetFiles(project, GlobalSearchScope.allScope(project))) { final JetNamespace rootNamespace = psiFile.getRootNamespace(); if (packageFQN.equals(JetPsiUtil.getFQName(rootNamespace))) { answer.add("namespace"); @@ -93,7 +115,7 @@ public class JavaElementFinder extends PsiElementFinder { @Override public PsiPackage findPackage(@NotNull String qualifiedName) { - final List<JetFile> psiFiles = collectProjectFiles(project, GlobalSearchScope.allScope(project)); + final List<JetFile> psiFiles = collectProjectJetFiles(project, GlobalSearchScope.allScope(project)); for (JetFile psiFile : psiFiles) { if (qualifiedName.equals(JetPsiUtil.getFQName(psiFile.getRootNamespace()))) { @@ -108,7 +130,7 @@ public class JavaElementFinder extends PsiElementFinder { @Override public PsiClass[] getClasses(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) { List<PsiClass> answer = new SmartList<PsiClass>(); - final List<JetFile> filesInScope = collectProjectFiles(project, scope); + final List<JetFile> filesInScope = collectProjectJetFiles(project, scope); String packageFQN = psiPackage.getQualifiedName(); for (JetFile file : filesInScope) { final JetNamespace rootNamespace = file.getRootNamespace(); @@ -125,31 +147,40 @@ public class JavaElementFinder extends PsiElementFinder { return answer.toArray(new PsiClass[answer.size()]); } + private synchronized void invalidateJetFilesCache() { + jetFiles.clear(); + } - private static List<JetFile> collectProjectFiles(final Project project, @NotNull final GlobalSearchScope scope) { - final List<JetFile> answer = new ArrayList<JetFile>(); + private synchronized List<JetFile> collectProjectJetFiles(final Project project, @NotNull final GlobalSearchScope scope) { + List<JetFile> cachedFiles = jetFiles.get(scope); + + if (cachedFiles == null) { + final List<JetFile> answer = new ArrayList<JetFile>(); + final FileTypeManager fileTypeManager = FileTypeManager.getInstance(); - final FileTypeManager fileTypeManager = FileTypeManager.getInstance(); - final PsiManager psiManager = PsiManager.getInstance(project); + VirtualFile[] contentRoots = ProjectRootManager.getInstance(project).getContentRoots(); - VirtualFile[] contentRoots = ProjectRootManager.getInstance(project).getContentRoots(); - CompilerPathsEx.visitFiles(contentRoots, new CompilerPathsEx.FileVisitor() { - @Override - protected void acceptFile(VirtualFile file, String fileRoot, String filePath) { - final FileType fileType = fileTypeManager.getFileTypeByFile(file); - if (fileType != JetFileType.INSTANCE) return; + CompilerPathsEx.visitFiles(contentRoots, new CompilerPathsEx.FileVisitor() { + @Override + protected void acceptFile(VirtualFile file, String fileRoot, String filePath) { + final FileType fileType = fileTypeManager.getFileTypeByFile(file); + if (fileType != JetFileType.INSTANCE) return; - if (scope.accept(file)) { - final PsiFile psiFile = psiManager.findFile(file); - if (psiFile instanceof JetFile) { - answer.add((JetFile) psiFile); + if (scope.accept(file)) { + final PsiFile psiFile = psiManager.findFile(file); + if (psiFile instanceof JetFile) { + answer.add((JetFile) psiFile); + } } } - } - }); + }); - return answer; + cachedFiles = answer; + jetFiles.put(scope, answer); + } + + return cachedFiles; } } diff --git a/idea/testData/checker/Bounds.jet b/idea/testData/checker/Bounds.jet index 8434607edf8..06371684203 100644 --- a/idea/testData/checker/Bounds.jet +++ b/idea/testData/checker/Bounds.jet @@ -18,9 +18,9 @@ namespace boundsWithSubstitutors { open class A {} open class B<T : A>() - abstract class C<T : B<<error>Int</error>>, X : fun (B<<error>Char</error>>) : (B<<error>Any</error>>, B<A>)>() : B<<error>Any</error>>() { // 2 errors + abstract class C<T : B<<error>Int</error>>, X : (B<<error>Char</error>>) -> #(B<<error>Any</error>>, B<A>)>() : B<<error>Any</error>>() { // 2 errors val a = B<<error>Char</error>>() // error - abstract val x : fun (B<<error>Char</error>>) : B<<error>Any</error>> + abstract val x : (B<<error>Char</error>>) -> B<<error>Any</error>> } diff --git a/idea/testData/checker/Builders.jet b/idea/testData/checker/Builders.jet index 1d26cbbc8b2..9913cd91bff 100644 --- a/idea/testData/checker/Builders.jet +++ b/idea/testData/checker/Builders.jet @@ -1,6 +1,6 @@ import java.util.* -namespace html { +package html { abstract class Factory<T> { abstract fun create() : T @@ -14,7 +14,7 @@ namespace html { val children = ArrayList<Element>() val attributes = HashMap<String, String>() - protected fun initTag<T : Element>(init : fun T.() : Unit) : T + protected fun initTag<T : Element>(init : T.() -> Unit) : T where class object T : Factory<T>{ val tag = T.create() tag.init() @@ -34,9 +34,9 @@ namespace html { override fun create() = HTML() } - fun head(init : fun Head.() : Unit) = initTag<Head>(init) + fun head(init : Head.() -> Unit) = initTag<Head>(init) - fun body(init : fun Body.() : Unit) = initTag<Body>(init) + fun body(init : Body.() -> Unit) = initTag<Body>(init) } class Head() : TagWithText("head") { @@ -44,7 +44,7 @@ namespace html { override fun create() = Head() } - fun title(init : fun Title.() : Unit) = initTag<Title>(init) + fun title(init : Title.() -> Unit) = initTag<Title>(init) } class Title() : TagWithText("title") @@ -57,10 +57,10 @@ namespace html { override fun create() = Body() } - fun b(init : fun B.() : Unit) = initTag<B>(init) - fun p(init : fun P.() : Unit) = initTag<P>(init) - fun h1(init : fun H1.() : Unit) = initTag<H1>(init) - fun a(href : String, init : fun A.() : Unit) { + fun b(init : B.() -> Unit) = initTag<B>(init) + fun p(init : P.() -> Unit) = initTag<P>(init) + fun h1(init : H1.() -> Unit) = initTag<H1>(init) + fun a(href : String, init : A.() -> Unit) { val a = initTag<A>(init) a.href = href } @@ -77,7 +77,7 @@ namespace html { fun Map<String, String>.set(key : String, value : String) = this.put(key, value) - fun html(init : fun HTML.() : Unit) : HTML { + fun html(init : HTML.() -> Unit) : HTML { val html = HTML() html.init() return html @@ -85,7 +85,7 @@ namespace html { } -namespace foo { +package foo { import html.* diff --git a/idea/testData/checker/Casts.jet b/idea/testData/checker/Casts.jet index 385b1338535..fbd29ea06b3 100644 --- a/idea/testData/checker/Casts.jet +++ b/idea/testData/checker/Casts.jet @@ -12,5 +12,5 @@ fun test() : Unit { y <warning>as?</warning> Int : Int? x <warning>as?</warning> Int? : Int? y <warning>as?</warning> Int? : Int? - () + #() } \ No newline at end of file diff --git a/idea/testData/checker/ExtensionFunctions.jet b/idea/testData/checker/ExtensionFunctions.jet index 4076cdfff62..df8a8ecd583 100644 --- a/idea/testData/checker/ExtensionFunctions.jet +++ b/idea/testData/checker/ExtensionFunctions.jet @@ -1,5 +1,5 @@ fun Int?.optint() : Unit {} -val Int?.optval : Unit = () +val Int?.optval : Unit = #() fun <T, E> T.foo(<warning>x</warning> : E, y : A) : T { y.plus(1) diff --git a/idea/testData/checker/FunctionReturnTypes.jet b/idea/testData/checker/FunctionReturnTypes.jet index 4b123df6245..85ee309f851 100644 --- a/idea/testData/checker/FunctionReturnTypes.jet +++ b/idea/testData/checker/FunctionReturnTypes.jet @@ -4,7 +4,7 @@ fun unitEmptyInfer() {} fun unitEmpty() : Unit {} fun unitEmptyReturn() : Unit {return} fun unitIntReturn() : Unit {return <error>1</error>} -fun unitUnitReturn() : Unit {return ()} +fun unitUnitReturn() : Unit {return #()} fun test1() : Any = { <error>return</error> } fun test2() : Any = @a {return@a 1} fun test3() : Any { <error>return</error> } @@ -16,13 +16,13 @@ fun bbb() { fun foo(<warning>expr</warning>: StringBuilder): Int { val c = 'a' when(c) { - 0.chr => throw Exception("zero") - else => throw Exception("nonzero" + c) + 0.chr -> throw Exception("zero") + else -> throw Exception("nonzero" + c) } } -fun unitShort() : Unit = () +fun unitShort() : Unit = #() fun unitShortConv() : Unit = <error>1</error> fun unitShortNull() : Unit = <error>null</error> @@ -39,7 +39,7 @@ fun intFunctionLiteral(): Int = <error>{ 10 }</error> fun blockReturnUnitMismatch() : Int {<error>return</error>} fun blockReturnValueTypeMismatch() : Int {return <error>3.4</error>} fun blockReturnValueTypeMatch() : Int {return 1} -fun blockReturnValueTypeMismatchUnit() : Int {return <error>()</error>} +fun blockReturnValueTypeMismatchUnit() : Int {return <error>#()</error>} fun blockAndAndMismatch() : Int { <error>true && false</error> diff --git a/idea/testData/checker/Nullability.jet b/idea/testData/checker/Nullability.jet index 8479b364cd8..8f2eaa9e6c7 100644 --- a/idea/testData/checker/Nullability.jet +++ b/idea/testData/checker/Nullability.jet @@ -38,28 +38,28 @@ fun test() { out.println(); } - if (out == null || out.println(0) == ()) { + if (out == null || out.println(0) == #()) { out?.println(1) } else { out.println(2) } - if (out != null && out.println() == ()) { + if (out != null && out.println() == #()) { out.println(); } else { out?.println(); } - if (out == null || out != null && out.println() == ()) { + if (out == null || out != null && out.println() == #()) { out?.println(); } else { out.println(); } - if (1 == 2 || out != null && out.println(1) == ()) { + if (1 == 2 || out != null && out.println(1) == #()) { out?.println(2); } else { @@ -94,28 +94,28 @@ fun test() { out.println(); } - if (out == null || out.println(0) == ()) { + if (out == null || out.println(0) == #()) { out?.println(1) } else { out.println(2) } - if (out != null && out.println() == ()) { + if (out != null && out.println() == #()) { out.println(); } else { out?.println(); } - if (out == null || out != null && out.println() == ()) { + if (out == null || out != null && out.println() == #()) { out?.println(); } else { out.println(); } - if (1 == 2 || out != null && out.println(1) == ()) { + if (1 == 2 || out != null && out.println(1) == #()) { out?.println(2); } else { diff --git a/idea/testData/checker/QualifiedThis.jet b/idea/testData/checker/QualifiedThis.jet index c0825aa37c1..b468488353b 100644 --- a/idea/testData/checker/QualifiedThis.jet +++ b/idea/testData/checker/QualifiedThis.jet @@ -31,10 +31,10 @@ namespace closures { val Int.xx = this : Int fun Char.xx() : Any { this : Char - val <warning>a</warning> = {Double.() => this : Double + this@xx : Char} - val <warning>b</warning> = @a{Double.() => this@a : Double + this@xx : Char} - val <warning>c</warning> = @a{() => <error>this@a</error> + this@xx : Char} - return (@a{Double.() => this@a : Double + this@xx : Char}) + val <warning>a</warning> = {Double.() -> this : Double + this@xx : Char} + val <warning>b</warning> = @a{Double.() -> this@a : Double + this@xx : Char} + val <warning>c</warning> = @a{() -> <error>this@a</error> + this@xx : Char} + return (@a{Double.() -> this@a : Double + this@xx : Char}) } } } diff --git a/idea/testData/checker/RecursiveTypeInference.jet b/idea/testData/checker/RecursiveTypeInference.jet index d1e8b6f6c62..cbbc837604e 100644 --- a/idea/testData/checker/RecursiveTypeInference.jet +++ b/idea/testData/checker/RecursiveTypeInference.jet @@ -1,16 +1,16 @@ -namespace a { +package a { val foo = bar() fun bar() = <error descr="[TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM] Type checking has run into a recursive problem">foo</error> } -namespace b { +package b { fun foo() = bar() fun bar() = <error descr="[TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM] Type checking has run into a recursive problem">foo()</error> } -namespace c { +package c { fun bazz() = bar() fun foo() = <error descr="[TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM] Type checking has run into a recursive problem">bazz()</error> @@ -18,21 +18,21 @@ namespace c { fun bar() = foo() } -namespace ok { +package ok { - namespace a { + package a { val foo = bar() fun bar() : Int = foo } - namespace b { + package b { fun foo() : Int = bar() fun bar() = foo() } - namespace c { + package c { fun bazz() = bar() fun foo() : Int = bazz() diff --git a/idea/testData/checker/StringTemplates.jet b/idea/testData/checker/StringTemplates.jet index 9c00360b365..ab2b794ceb6 100644 --- a/idea/testData/checker/StringTemplates.jet +++ b/idea/testData/checker/StringTemplates.jet @@ -3,8 +3,8 @@ fun demo() { val a = "" val asd = 1 val bar = 5 - fun map(f : fun () : Any?) : Int = 1 - fun buzz(f : fun () : Any?) : Int = 1 + fun map(f : () -> Any?) : Int = 1 + fun buzz(f : () -> Any?) : Int = 1 val sdf = 1 val foo = 3; "$abc" diff --git a/idea/testData/checker/Unresolved.jet b/idea/testData/checker/Unresolved.jet index a4b85b6b54a..b9407e489c4 100644 --- a/idea/testData/checker/Unresolved.jet +++ b/idea/testData/checker/Unresolved.jet @@ -1,8 +1,8 @@ -namespace unresolved +package unresolved fun testGenericArgumentsCount() { - val <warning>p1</warning>: Tuple2<error><Int></error> = (2, 2) - val <warning>p2</warning>: <error>Tuple2</error> = (2, 2) + val <warning>p1</warning>: Tuple2<error><Int></error> = #(2, 2) + val <warning>p2</warning>: <error>Tuple2</error> = #(2, 2) } fun testUnresolved() { @@ -16,8 +16,8 @@ fun testUnresolved() { s.<error>foo</error>() when(<error>a</error>) { - is Int => <error>a</error> - is String => <error>a</error> + is Int -> <error>a</error> + is String -> <error>a</error> } //TODO diff --git a/idea/testData/checker/When.jet b/idea/testData/checker/When.jet index c9e799dd41d..2362c95f494 100644 --- a/idea/testData/checker/When.jet +++ b/idea/testData/checker/When.jet @@ -4,25 +4,25 @@ fun foo() : Int { val s = "" val x = 1 when (x) { - is * => 1 - is <error>String</error> => 1 - !is Int => 1 - is Any? => 1 - <error>s</error> => 1 - 1 => 1 - 1 + <error>a</error> => 1 - in 1..<error>a</error> => 1 - !in 1..<error>a</error> => 1 - // Commented for KT-621 .<!error>a</!error> => 1 - // Commented for KT-621 .equals(1).<!error>a</!error> => 1 - // Commented for KT-621 <!warning>?.</!warning>equals(1) => 1 - else => 1 + is * -> 1 + is <error>String</error> -> 1 + !is Int -> 1 + is Any? -> 1 + <error>s</error> -> 1 + 1 -> 1 + 1 + <error>a</error> -> 1 + in 1..<error>a</error> -> 1 + !in 1..<error>a</error> -> 1 + // Commented for KT-621 .<!error>a</!error> -> 1 + // Commented for KT-621 .equals(1).<!error>a</!error> -> 1 + // Commented for KT-621 <!warning>?.</!warning>equals(1) -> 1 + else -> 1 } // Commented for KT-621 // return when (<!warning>x</!warning>?:null) { - // <!error>.</!error>foo() => 1 - // ?.equals(1).equals(2) => 1 + // <!error>.</!error>foo() -> 1 + // ?.equals(1).equals(2) -> 1 // } return 0 } @@ -34,33 +34,33 @@ fun test() { val s = ""; when (x) { - <error>s</error> => 1 - is <error>""</error> => 1 - x => 1 - is 1 => 1 - is <error>(1, 1)</error> => 1 + <error>s</error> -> 1 + is <error>""</error> -> 1 + x -> 1 + is 1 -> 1 + is <error>#(1, 1)</error> -> 1 } - val z = (1, 1) + val z = #(1, 1) when (z) { - is (*, *) => 1 - is (*, 1) => 1 - is (1, 1) => 1 - is (1, <error>"1"</error>) => 1 - is <error>(1, "1", *)</error> => 1 - is boo @ (1, <error>"a"</error>, *) => 1 - is boo @ <error>(1, *)</error> => 1 + is #(*, *) -> 1 + is #(*, 1) -> 1 + is #(1, 1) -> 1 + is #(1, <error>"1"</error>) -> 1 + is <error>#(1, "1", *)</error> -> 1 + is boo #(1, <error>"a"</error>, *) -> 1 + is boo <error>#(1, *)</error> -> 1 } when (z) { - <error>else => 1</error> - (1, 1) => 2 + <error>else -> 1</error> + #(1, 1) -> 2 } when (z) { - else => 1 + else -> 1 } } -val (Int, Int).boo : (Int, Int, Int) = (1, 1, 1) +val #(Int, Int).boo : #(Int, Int, Int) = #(1, 1, 1) diff --git a/idea/testData/checker/infos/Autocasts.jet b/idea/testData/checker/infos/Autocasts.jet index a5b716d9c05..fa45c29c3ad 100644 --- a/idea/testData/checker/infos/Autocasts.jet +++ b/idea/testData/checker/infos/Autocasts.jet @@ -19,7 +19,7 @@ fun f9(a : A?) { a?.<error descr="Unresolved reference: bar">bar</error>() a?.foo() } - if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == ()) { + if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == #()) { a?.<error descr="Unresolved reference: bar">bar</error>() } if (!(a is B)) { @@ -52,24 +52,24 @@ fun f101(a : A?) { fun f11(a : A?) { when (a) { - is B => <info descr="Automatically cast to B">a</info>.bar() - is A => <info descr="Automatically cast to A">a</info>.foo() - is Any => <info descr="Automatically cast to A">a</info>.foo() - is Any? => a.<error descr="Unresolved reference: bar">bar</error>() - else => a?.foo() + is B -> <info descr="Automatically cast to B">a</info>.bar() + is A -> <info descr="Automatically cast to A">a</info>.foo() + is Any -> <info descr="Automatically cast to A">a</info>.foo() + is Any? -> a.<error descr="Unresolved reference: bar">bar</error>() + else -> a?.foo() } } fun f12(a : A?) { when (a) { - is B => <info descr="Automatically cast to B">a</info>.bar() - is A => <info descr="Automatically cast to A">a</info>.foo() - is Any => <info descr="Automatically cast to A">a</info>.foo(); - is Any? => a.<error descr="Unresolved reference: bar">bar</error>() - is val c : <error descr="[TYPE_MISMATCH_IN_BINDING_PATTERN] B must be a supertype of A?. Use is to match against B">B</error> => c.foo() - is val c is C => <info descr="Automatically cast to C">c</info>.bar() - is val c is C => <info descr="Automatically cast to C">a</info>.bar() - else => a?.foo() + is B -> <info descr="Automatically cast to B">a</info>.bar() + is A -> <info descr="Automatically cast to A">a</info>.foo() + is Any -> <info descr="Automatically cast to A">a</info>.foo(); + is Any? -> a.<error descr="Unresolved reference: bar">bar</error>() + is val c : <error descr="[TYPE_MISMATCH_IN_BINDING_PATTERN] B must be a supertype of A?. Use is to match against B">B</error> -> c.foo() + is val c is C -> <info descr="Automatically cast to C">c</info>.bar() + is val c is C -> <info descr="Automatically cast to C">a</info>.bar() + else -> a?.foo() } if (a is val b) { @@ -104,7 +104,7 @@ fun f13(a : A?) { } a?.foo() - if (a is val c is B && <info descr="Automatically cast to A">a</info>.foo() == () && <info descr="Automatically cast to B">c</info>.bar() == ()) { + if (a is val c is B && <info descr="Automatically cast to A">a</info>.foo() == #() && <info descr="Automatically cast to B">c</info>.bar() == #()) { <info descr="Automatically cast to A">c</info>.foo() <info descr="Automatically cast to B">c</info>.bar() } @@ -152,18 +152,18 @@ fun getStringLength(obj : Any) : Char? { fun toInt(i: Int?): Int = if (i != null) <info descr="Automatically cast to Int">i</info> else 0 fun illegalWhenBody(a: Any): Int = when(a) { - is Int => <info descr="Automatically cast to Int">a</info> - is String => <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but Int was expected">a</error> + is Int -> <info descr="Automatically cast to Int">a</info> + is String -> <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but Int was expected">a</error> } fun illegalWhenBlock(a: Any): Int { when(a) { - is Int => return <info descr="Automatically cast to Int">a</info> - is String => return <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but Int was expected">a</error> + is Int -> return <info descr="Automatically cast to Int">a</info> + is String -> return <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but Int was expected">a</error> } } fun declarations(a: Any?) { if (a is String) { - val <warning>p4</warning>: (Int, String) = (2, <info descr="Automatically cast to String">a</info>) + val <warning>p4</warning>: #(Int, String) = #(2, <info descr="Automatically cast to String">a</info>) } if (a is String?) { if (a != null) { @@ -184,21 +184,21 @@ fun vars(a: Any?) { } fun tuples(a: Any?) { if (a != null) { - val <warning>s</warning>: (Any, String) = (<info descr="Automatically cast to Any">a</info>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>) + val <warning>s</warning>: #(Any, String) = #(<info descr="Automatically cast to Any">a</info>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>) } if (a is String) { - val <warning>s</warning>: (Any, String) = (<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>) + val <warning>s</warning>: #(Any, String) = #(<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>) } - fun illegalTupleReturnType(): (Any, String) = (<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Any was expected">a</error>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>) + fun illegalTupleReturnType(): #(Any, String) = #(<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Any was expected">a</error>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>) if (a is String) { - fun legalTupleReturnType(): (Any, String) = (<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>) + fun legalTupleReturnType(): #(Any, String) = #(<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>) } val <warning>illegalFunctionLiteral</warning>: Function0<Int> = <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Function0<Any?> but Function0<Int> was expected">{ <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> }</error> - val <warning>illegalReturnValueInFunctionLiteral</warning>: Function0<Int> = { (): Int => <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> } + val <warning>illegalReturnValueInFunctionLiteral</warning>: Function0<Int> = { (): Int -> <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> } if (a is Int) { val <warning>legalFunctionLiteral</warning>: Function0<Int> = { <info descr="Automatically cast to Int">a</info> } - val <warning>alsoLegalFunctionLiteral</warning>: Function0<Int> = { (): Int => <info descr="Automatically cast to Int">a</info> } + val <warning>alsoLegalFunctionLiteral</warning>: Function0<Int> = { (): Int -> <info descr="Automatically cast to Int">a</info> } } } fun returnFunctionLiteralBlock(a: Any?): Function0<Int> { @@ -206,12 +206,12 @@ fun returnFunctionLiteralBlock(a: Any?): Function0<Int> { else return { 1 } } fun returnFunctionLiteral(a: Any?): Function0<Int> = - if (a is Int) { (): Int => <info descr="Automatically cast to Int">a</info> } - else { () => 1 } + if (a is Int) { (): Int -> <info descr="Automatically cast to Int">a</info> } + else { () -> 1 } -fun illegalTupleReturnType(a: Any): (Any, String) = (a, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but String was expected">a</error>) +fun illegalTupleReturnType(a: Any): #(Any, String) = #(a, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but String was expected">a</error>) -fun declarationInsidePattern(x: (Any, Any)): String = when(x) { is (val a is String, *) => <info descr="Automatically cast to String">a</info>; else => "something" } +fun declarationInsidePattern(x: #(Any, Any)): String = when(x) { is #(val a is String, *) -> <info descr="Automatically cast to String">a</info>; else -> "something" } fun mergeAutocasts(a: Any?) { if (a is String || a is Int) { @@ -222,7 +222,7 @@ fun mergeAutocasts(a: Any?) { a.<error descr="Unresolved reference: compareTo">compareTo</error>("") } when (a) { - is String, is Any => a.<error descr="Unresolved reference: compareTo">compareTo</error>("") + is String, is Any -> a.<error descr="Unresolved reference: compareTo">compareTo</error>("") } if (a is String && a is Any) { val <warning>i</warning>: Int = <info descr="Automatically cast to String">a</info>.compareTo("") diff --git a/idea/testData/checker/regression/CoercionToUnit.jet b/idea/testData/checker/regression/CoercionToUnit.jet index f02143657f7..976db07f352 100644 --- a/idea/testData/checker/regression/CoercionToUnit.jet +++ b/idea/testData/checker/regression/CoercionToUnit.jet @@ -2,7 +2,7 @@ fun foo(<warning>u</warning> : Unit) : Int = 1 fun test() : Int { foo(<error>1</error>) - val <warning>a</warning> : fun() : Unit = { + val <warning>a</warning> : () -> Unit = { foo(<error>1</error>) } return 1 diff --git a/idea/testData/checker/regression/Jet121.jet b/idea/testData/checker/regression/Jet121.jet index fc29dfe5293..4dda2b95c51 100644 --- a/idea/testData/checker/regression/Jet121.jet +++ b/idea/testData/checker/regression/Jet121.jet @@ -1,6 +1,6 @@ -namespace jet121 { +package jet121 { fun box() : String { - val answer = apply("OK") { String.() : Int => + val answer = apply("OK") { String.() : Int -> get(0) length } @@ -8,7 +8,7 @@ namespace jet121 { return if (answer == 2) "OK" else "FAIL" } - fun apply(arg:String, f : fun String.() : Int) : Int { + fun apply(arg:String, f : String.() -> Int) : Int { return arg.f() } } \ No newline at end of file diff --git a/idea/testData/checker/regression/Jet124.jet b/idea/testData/checker/regression/Jet124.jet index 317b1438f41..5e8088b3e08 100644 --- a/idea/testData/checker/regression/Jet124.jet +++ b/idea/testData/checker/regression/Jet124.jet @@ -1,8 +1,8 @@ -fun foo1() : fun (Int) : Int = { (x: Int) => x } +fun foo1() : (Int) -> Int = { (x: Int) -> x } fun foo() { - val h : fun (Int) : Int = foo1(); + val h : (Int) -> Int = foo1(); h(1) - val m : fun (Int) : Int = {(a : Int) => 1}//foo1() + val m : (Int) -> Int = {(a : Int) -> 1}//foo1() m(1) } \ No newline at end of file diff --git a/idea/testData/checker/regression/Jet169.jet b/idea/testData/checker/regression/Jet169.jet index 0ba52f8e3cb..35ace683078 100644 --- a/idea/testData/checker/regression/Jet169.jet +++ b/idea/testData/checker/regression/Jet169.jet @@ -1,8 +1,8 @@ fun set(<warning>key</warning> : String, <warning>value</warning> : String) { val a : String? = "" when (a) { - "" => a<error>.</error>get(0) - is String, is Any => a.compareTo("") - else => a.toString() + "" -> a<error>.</error>get(0) + is String, is Any -> a.compareTo("") + else -> a.toString() } } diff --git a/shift/shift.iml b/shift/shift.iml new file mode 100644 index 00000000000..d4552b3374b --- /dev/null +++ b/shift/shift.iml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" /> + </content> + <orderEntry type="jdk" jdkName="IDEA 10.x" jdkType="IDEA JDK" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="frontend" /> + <orderEntry type="module" module-name="backend" /> + <orderEntry type="module" module-name="compiler-tests" /> + </component> +</module> + diff --git a/shift/src/org/jetbrains/jet/shift/NamespaceToPackage.java b/shift/src/org/jetbrains/jet/shift/NamespaceToPackage.java new file mode 100644 index 00000000000..a8cb46e5e83 --- /dev/null +++ b/shift/src/org/jetbrains/jet/shift/NamespaceToPackage.java @@ -0,0 +1,103 @@ +package org.jetbrains.jet.shift; + +import com.intellij.lang.ASTNode; +import com.intellij.openapi.Disposable; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.progress.impl.ProgressManagerImpl; +import com.intellij.pom.PomModel; +import com.intellij.pom.core.impl.PomModelImpl; +import org.jetbrains.jet.JetCoreEnvironment; +import org.jetbrains.jet.compiler.CompileEnvironment; +import org.jetbrains.jet.lang.psi.JetFile; +import org.jetbrains.jet.lang.psi.JetNamespace; +import org.jetbrains.jet.lang.psi.JetPsiFactory; +import org.jetbrains.jet.lang.psi.JetTreeVisitor; +import org.picocontainer.*; + +import javax.swing.*; +import java.lang.reflect.InvocationTargetException; + +import static org.jetbrains.jet.lexer.JetTokens.NAMESPACE_KEYWORD; + +/** + * @author abreslav + */ +public class NamespaceToPackage { + + public static void main(String[] args) throws InvocationTargetException, InterruptedException { + System.setProperty("java.awt.headless", "true"); + Disposable rootDisposable = new Disposable() { + @Override + public void dispose() { + } + }; + final JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable); + + MutablePicoContainer picoContainer = environment.getApplication().getPicoContainer(); + picoContainer.registerComponent(new ComponentAdapter() { + @Override + public Object getComponentKey() { + return "com.intellij.openapi.progress.ProgressManager"; + } + + @Override + public Class getComponentImplementation() { + return ProgressManagerImpl.class; + } + + @Override + public Object getComponentInstance(PicoContainer picoContainer) throws PicoInitializationException, PicoIntrospectionException { + return new ProgressManagerImpl(environment.getApplication()); + } + + @Override + public void verify(PicoContainer picoContainer) throws PicoIntrospectionException { + + } + + @Override + public void accept(PicoVisitor picoVisitor) { + + } + }); + + CompileEnvironment compileEnvironment = new CompileEnvironment(); + + compileEnvironment.setJavaRuntime(CompileEnvironment.findRtJar(true)); + if (!compileEnvironment.initializeKotlinRuntime()) { + System.out.println("foo"); + } +// environment.getApplication().registerService(ProgressManager.class, new ProgressManagerImpl(environment.getApplication())); + environment.getApplication().registerService(PomModel.class, new PomModelImpl(environment.getProject())); +// environment.getApplication().registerService(Project.class, environment.getProject()); + + final JetFile file = JetPsiFactory.createFile(environment.getProject(), "namespace foo\nclass A"); + final ASTNode packageKeyword = JetPsiFactory.createFile(environment.getProject(), "package foo").getRootNamespace().getHeader().getNode().findChildByType(NAMESPACE_KEYWORD); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + convert(file, packageKeyword); + } + }); + } + }); + + } + + private static void convert(JetFile file, final ASTNode packageKeyword) { + file.getRootNamespace().accept(new JetTreeVisitor<Void>() { + @Override + public Void visitNamespace(JetNamespace namespace, Void data) { + ASTNode namespaceNode = namespace.getHeader().getNode(); + ASTNode token = namespaceNode.findChildByType(NAMESPACE_KEYWORD); + namespaceNode.replaceChild(token, packageKeyword); + return super.visitNamespace(namespace, data); + } + }, null); + System.out.println("file = " + file.getText()); + } +} diff --git a/shift/tests/org/jetbrains/jet/shift/Shifter.java b/shift/tests/org/jetbrains/jet/shift/Shifter.java new file mode 100644 index 00000000000..d4bec90243d --- /dev/null +++ b/shift/tests/org/jetbrains/jet/shift/Shifter.java @@ -0,0 +1,157 @@ +package org.jetbrains.jet.shift; + +///** +// * @author abreslav +// */ +//public class Shifter extends LightDaemonAnalyzerTestCase { +// private String name; +// public static final Pattern FILE_PATTERN = Pattern.compile("//\\s*FILE:\\s*(.*)$", Pattern.MULTILINE); +// +// public Shifter(@NonNls String dataPath, String name) { +// super(dataPath); +// this.name = name; +// } +// +// @Override +// public String getName() { +// return "test" + name; +// } +// +// +//// private class TestFile { +//// private final List<CheckerTestUtil.DiagnosedRange> diagnosedRanges = Lists.newArrayList(); +//// private final String expectedText; +//// private final String clearText; +//// private final JetFile jetFile; +//// +//// public TestFile(String fileName, String textWithMarkers) { +//// expectedText = textWithMarkers; +//// clearText = CheckerTestUtil.parseDiagnosedRanges(expectedText, diagnosedRanges); +//// jetFile = createCheckAndReturnPsiFile(fileName, clearText); +//// } +//// +//// public void getActualText(BindingContext bindingContext, StringBuilder actualText) { +//// CheckerTestUtil.diagnosticsDiff(diagnosedRanges, CheckerTestUtil.getDiagnosticsIncludingSyntaxErrors(bindingContext, jetFile), new CheckerTestUtil.DiagnosticDiffCallbacks() { +//// @Override +//// public void missingDiagnostic(String type, int expectedStart, int expectedEnd) { +//// String message = "Missing " + type + DiagnosticUtils.atLocation(jetFile, new TextRange(expectedStart, expectedEnd)); +//// System.err.println(message); +//// } +//// +//// @Override +//// public void unexpectedDiagnostic(String type, int actualStart, int actualEnd) { +//// String message = "Unexpected " + type + DiagnosticUtils.atLocation(jetFile, new TextRange(actualStart, actualEnd)); +//// System.err.println(message); +//// } +//// }); +//// +//// actualText.append(CheckerTestUtil.addDiagnosticMarkersToText(jetFile, bindingContext, AnalyzingUtils.getSyntaxErrorRanges(jetFile))); +//// } +//// +//// } +// +// @Override +// public void runTest() throws Exception { +// String testFileName = name + ".jet"; +// +// String expectedText = loadFile(testFileName); +// +// final JetFile file = createCheckAndReturnPsiFile(testFileName, expectedText); +// +// +//// List<TestFile> testFileFiles = createTestFiles(testFileName, expectedText); +//// +//// boolean importJdk = expectedText.contains("+JDK"); +//// Configuration configuration = importJdk ? JavaBridgeConfiguration.createJavaBridgeConfiguration(getProject()) : Configuration.EMPTY; +//// +//// List<JetDeclaration> namespaces = Lists.newArrayList(); +//// for (TestFile testFileFile : testFileFiles) { +//// namespaces.add(testFileFile.jetFile.getRootNamespace()); +//// } +//// +//// BindingContext bindingContext; +//// if (importJdk) { +//// bindingContext = AnalyzerFacade.analyzeNamespacesWithJavaIntegration(getProject(), namespaces, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY); +//// } +//// else { +//// bindingContext = AnalyzingUtils.analyzeNamespaces(getProject(), Configuration.EMPTY, namespaces, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY, JetSemanticServices.createSemanticServices(getProject())); +//// } +//// +//// StringBuilder actualText = new StringBuilder(); +//// for (TestFile testFileFile : testFileFiles) { +//// testFileFile.getActualText(bindingContext, actualText); +//// } +//// +//// Assert.assertEquals(expectedText, actualText.toString()); +//// final JetFile file = JetPsiFactory.createFile(environment.getProject(), "namespace foo\nclass A"); +// ((MockApplication) ApplicationManager.getApplication()).registerService(PomModel.class, new PomModelImpl(getProject())); +// final ASTNode packageKeyword = JetPsiFactory.createFile(getProject(), "package foo").getRootNamespace().getHeader().getNode().findChildByType(NAMESPACE_KEYWORD); +// +//// SwingUtilities.invokeAndWait(new Runnable() { +//// @Override +//// public void run() { +// ApplicationManager.getApplication().runWriteAction(new Runnable() { +// @Override +// public void run() { +// convert(file, packageKeyword); +// } +// }); +//// } +//// }); +// +// } +// +// private static void convert(JetFile file, final ASTNode packageKeyword) { +// file.getRootNamespace().accept(new JetTreeVisitor<Void>() { +// @Override +// public Void visitNamespace(JetNamespace namespace, Void data) { +// ASTNode namespaceNode = namespace.getHeader().getNode(); +// ASTNode token = namespaceNode.findChildByType(NAMESPACE_KEYWORD); +// namespaceNode.replaceChild(token, packageKeyword); +// return super.visitNamespace(namespace, data); +// } +// }, null); +// System.out.println("file = " + file.getText()); +// } +// +// +// // private void convert(File src, File dest) throws IOException { +//// File[] files = src.listFiles(); +//// for (File file : files) { +//// try { +//// if (file.isDirectory()) { +//// File destDir = new File(dest, file.getName()); +//// destDir.mkdir(); +//// convert(file, destDir); +//// continue; +//// } +//// if (!file.getName().endsWith(".jet")) continue; +//// String text = doLoadFile(file.getParentFile().getAbsolutePath(), file.getName()); +//// Pattern pattern = Pattern.compile("</?(error|warning)>"); +//// String clearText = pattern.matcher(text).replaceAll(""); +//// createAndCheckPsiFile(name, clearText); +//// +//// BindingContext bindingContext = AnalyzingUtils.getInstance(ImportingStrategy.NONE).analyzeFileWithCache((JetFile) myFile); +//// String expectedText = CheckerTestUtil.addDiagnosticMarkersToText(myFile, bindingContext).toString(); +//// +//// File destFile = new File(dest, file.getName()); +//// FileWriter fileWriter = new FileWriter(destFile); +//// fileWriter.write(expectedText); +//// fileWriter.close(); +//// } +//// catch (RuntimeException e) { +//// e.printStackTrace(); +//// } +//// } +//// } +// +// public static Test suite() { +// return JetTestCaseBuilder.suiteForDirectory(JetTestCaseBuilder.getTestDataPathBase(), "/diagnostics/tests/shift", true, new JetTestCaseBuilder.NamedTestFactory() { +// @NotNull +// @Override +// public Test createTest(@NotNull String dataPath, @NotNull String name, @NotNull File file) { +// return new Shifter(dataPath, name); +// } +// }); +// } +//} diff --git a/stdlib/ktSrc/Arrays.kt b/stdlib/ktSrc/Arrays.kt index 68f2234c716..48e1c8fc595 100644 --- a/stdlib/ktSrc/Arrays.kt +++ b/stdlib/ktSrc/Arrays.kt @@ -1,4 +1,4 @@ -namespace std +package std import java.io.ByteArrayInputStream diff --git a/stdlib/ktSrc/Filter.kt b/stdlib/ktSrc/Filter.kt index 1fa5cb45317..45439740e42 100644 --- a/stdlib/ktSrc/Filter.kt +++ b/stdlib/ktSrc/Filter.kt @@ -1,4 +1,4 @@ -namespace std +package std import java.util.* import java.lang.Iterable @@ -6,7 +6,7 @@ import java.lang.Iterable /* Filters given iterator */ -inline fun <T> java.util.Iterator<T>.filter(f: fun(T): Boolean) : java.util.Iterator<T> = FilterIterator<T>(this, f) +inline fun <T> java.util.Iterator<T>.filter(f: (T)-> Boolean) : java.util.Iterator<T> = FilterIterator<T>(this, f) /* Adds filtered elements in to given container @@ -28,15 +28,15 @@ Create iterator filtering given java.lang.Iterable inline fun <T> java.lang.Iterable<T>.filter(f: fun(T): Boolean) : java.util.Iterator<T> = (iterator() as java.util.Iterator<T>).filter(f) */ -private class FilterIterator<T>(val original: java.util.Iterator<T>, val filter: fun(T): Boolean) : java.util.Iterator<T> { +private class FilterIterator<T>(val original: java.util.Iterator<T>, val filter: (T)-> Boolean) : java.util.Iterator<T> { var state = 0 var nextElement: T? = null override fun hasNext(): Boolean = when(state) { - 1 => true // checked and next present - 2 => false // checked and next not present - else => { + 1 -> true // checked and next present + 2 -> false // checked and next not present + else -> { while(original.hasNext()) { val candidate = original.next() if((filter)(candidate)) { diff --git a/stdlib/ktSrc/Iterators.kt b/stdlib/ktSrc/Iterators.kt index 8a9b592ab26..7b3087e952e 100644 --- a/stdlib/ktSrc/Iterators.kt +++ b/stdlib/ktSrc/Iterators.kt @@ -1,4 +1,4 @@ -namespace std.util +package std.util import java.util.* import java.util.Iterator diff --git a/stdlib/ktSrc/JavaIo.kt b/stdlib/ktSrc/JavaIo.kt index a710dff0c94..f38eef39582 100644 --- a/stdlib/ktSrc/JavaIo.kt +++ b/stdlib/ktSrc/JavaIo.kt @@ -1,6 +1,6 @@ -namespace std +package std -namespace io { +package io { import java.io.* import java.nio.charset.* diff --git a/stdlib/ktSrc/JavaUtil.kt b/stdlib/ktSrc/JavaUtil.kt index b71427a49e0..0c967f25554 100644 --- a/stdlib/ktSrc/JavaUtil.kt +++ b/stdlib/ktSrc/JavaUtil.kt @@ -1,4 +1,4 @@ -namespace std.util +package std.util import java.util.* @@ -20,7 +20,7 @@ inline fun linkedList<T>(vararg values: T) : LinkedList<T> = values.to(LinkedLi inline fun hashSet<T>(vararg values: T) : HashSet<T> = values.to(HashSet<T>(values.size)) /** Returns true if any elements in the collection match the given predicate */ -inline fun <T> java.lang.Iterable<T>.any(predicate: fun(T): Boolean) : Boolean { +inline fun <T> java.lang.Iterable<T>.any(predicate: (T)-> Boolean) : Boolean { for (elem in this) { if (predicate(elem)) { return true @@ -30,7 +30,7 @@ inline fun <T> java.lang.Iterable<T>.any(predicate: fun(T): Boolean) : Boolean { } /** Returns true if all elements in the collection match the given predicate */ -inline fun <T> java.lang.Iterable<T>.all(predicate: fun(T): Boolean) : Boolean { +inline fun <T> java.lang.Iterable<T>.all(predicate: (T)-> Boolean) : Boolean { for (elem in this) { if (!predicate(elem)) { return false @@ -40,7 +40,7 @@ inline fun <T> java.lang.Iterable<T>.all(predicate: fun(T): Boolean) : Boolean { } /** Returns the first item in the collection which matches the given predicate or null if none matched */ -inline fun <T> java.lang.Iterable<T>.find(predicate: fun(T): Boolean) : T? { +inline fun <T> java.lang.Iterable<T>.find(predicate: (T)-> Boolean) : T? { for (elem in this) { if (predicate(elem)) return elem @@ -49,7 +49,7 @@ inline fun <T> java.lang.Iterable<T>.find(predicate: fun(T): Boolean) : T? { } /** Returns a new collection containing all elements in this collection which match the given predicate */ -inline fun <T> java.lang.Iterable<T>.filter(result: Collection<T> = ArrayList<T>(), predicate: fun(T): Boolean) : Collection<T> { +inline fun <T> java.lang.Iterable<T>.filter(result: Collection<T> = ArrayList<T>(), predicate: (T)-> Boolean) : Collection<T> { for (elem in this) { if (predicate(elem)) result.add(elem) @@ -61,7 +61,7 @@ inline fun <T> java.lang.Iterable<T>.filter(result: Collection<T> = ArrayList<T> * Returns the result of transforming each item in the collection to a one or more values which * are concatenated together into a single collection */ -inline fun <T, out R> java.lang.Iterable<T>.flatMap(result: Collection<R> = ArrayList<R>(), transform: fun(T): Collection<R>) : Collection<R> { +inline fun <T, out R> java.lang.Iterable<T>.flatMap(result: Collection<R> = ArrayList<R>(), transform: (T)-> Collection<R>) : Collection<R> { for (elem in this) { val coll = transform(elem) if (coll != null) { @@ -74,7 +74,7 @@ inline fun <T, out R> java.lang.Iterable<T>.flatMap(result: Collection<R> = Arra } /** Performs the given operation on each element inside the collection */ -inline fun <T> java.lang.Iterable<T>.foreach(operation: fun(element: T) : Unit) { +inline fun <T> java.lang.Iterable<T>.foreach(operation: (element: T) -> Unit) { for (elem in this) operation(elem) } @@ -95,14 +95,14 @@ inline fun <T> java.lang.Iterable<T>.join(separator: String, prefix: String = "" } /** Returns a new collection containing the results of applying the given function to each element in this collection */ -inline fun <T, R> java.lang.Iterable<T>.map(result: Collection<R> = ArrayList<R>(), transform : fun(T) : R) : Collection<R> { +inline fun <T, R> java.lang.Iterable<T>.map(result: Collection<R> = ArrayList<R>(), transform : (T) -> R) : Collection<R> { for (item in this) result.add(transform(item)) return result } /** Returns a new collection containing the results of applying the given function to each element in this collection */ -inline fun <T, R> java.util.Collection<T>.map(result: Collection<R> = ArrayList<R>(this.size), transform : fun(T) : R) : Collection<R> { +inline fun <T, R> java.util.Collection<T>.map(result: Collection<R> = ArrayList<R>(this.size), transform : (T) -> R) : Collection<R> { for (item in this) result.add(transform(item)) return result @@ -211,7 +211,7 @@ val Map<*,*>.empty : Boolean */ /** Returns the value for the given key or returns the result of the defaultValue function if there was no entry for the given key */ -inline fun <K,V> java.util.Map<K,V>.getOrElse(key: K, defaultValue: fun(): V) : V { +inline fun <K,V> java.util.Map<K,V>.getOrElse(key: K, defaultValue: ()-> V) : V { val current = this.get(key) if (current != null) { return current @@ -221,7 +221,7 @@ inline fun <K,V> java.util.Map<K,V>.getOrElse(key: K, defaultValue: fun(): V) : } /** Returns the value for the given key or the result of the defaultValue function is put into the map for the given value and returned */ -inline fun <K,V> java.util.Map<K,V>.getOrElseUpdate(key: K, defaultValue: fun(): V) : V { +inline fun <K,V> java.util.Map<K,V>.getOrElseUpdate(key: K, defaultValue: ()-> V) : V { val current = this.get(key) if (current != null) { return current diff --git a/stdlib/ktSrc/ModuleBuilder.kt b/stdlib/ktSrc/ModuleBuilder.kt index ca94ba92ea1..cf1ffcdd896 100644 --- a/stdlib/ktSrc/ModuleBuilder.kt +++ b/stdlib/ktSrc/ModuleBuilder.kt @@ -1,6 +1,6 @@ -namespace kotlin +package kotlin -namespace modules { +package modules { import java.util.* import jet.modules.* @@ -8,7 +8,7 @@ import jet.modules.* class ModuleSetBuilder(): IModuleSetBuilder { val modules: ArrayList<IModuleBuilder?> = ArrayList<IModuleBuilder?>() - fun module(name: String, callback: fun ModuleBuilder.()) { + fun module(name: String, callback: ModuleBuilder.() -> Unit) { val builder = ModuleBuilder(name) builder.callback() modules.add(builder) diff --git a/stdlib/ktSrc/String.kt b/stdlib/ktSrc/String.kt index 4df7c099d29..ad9ec3f66a9 100644 --- a/stdlib/ktSrc/String.kt +++ b/stdlib/ktSrc/String.kt @@ -1,4 +1,4 @@ -namespace std +package std import java.io.StringReader diff --git a/stdlib/ktSrc/System.kt b/stdlib/ktSrc/System.kt index 1b5545f0266..3d7b443991d 100644 --- a/stdlib/ktSrc/System.kt +++ b/stdlib/ktSrc/System.kt @@ -1,9 +1,9 @@ -namespace std.util +package std.util /** Executes current block and returns elapsed time in milliseconds */ -fun measureTimeMillis(block: fun() : Unit) : Long { +fun measureTimeMillis(block: () -> Unit) : Long { val start = System.currentTimeMillis() block() return System.currentTimeMillis() - start @@ -12,7 +12,7 @@ fun measureTimeMillis(block: fun() : Unit) : Long { /** Executes current block and returns elapsed time in milliseconds */ -fun measureTimeNano(block: fun() : Unit) : Long { +fun measureTimeNano(block: () -> Unit) : Long { val start = System.nanoTime() block() return System.nanoTime() - start diff --git a/stdlib/ktSrc/Thread.kt b/stdlib/ktSrc/Thread.kt index 637418ea902..e55b77e3a86 100644 --- a/stdlib/ktSrc/Thread.kt +++ b/stdlib/ktSrc/Thread.kt @@ -1,4 +1,4 @@ -namespace std.concurrent +package std.concurrent import java.lang.* @@ -21,7 +21,7 @@ inline var Thread.contextClassLoader : ClassLoader? get() = getContextClassLoader() set(loader: ClassLoader?) { setContextClassLoader(loader) } -fun thread(start: Boolean = true, daemon: Boolean = false, contextClassLoader: ClassLoader? = null, name: String? = null, priority: Int = -1, block: fun():Unit) : Thread { +fun thread(start: Boolean = true, daemon: Boolean = false, contextClassLoader: ClassLoader? = null, name: String? = null, priority: Int = -1, block: ()->Unit) : Thread { val thread = object: Thread() { override fun run() { block()