From bf503e9a4b28fefd82f2fbbce32c110d8b2aee4d Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Thu, 19 Jul 2012 19:52:56 +0400 Subject: [PATCH] KT-2363 Drop secondary constructors #KT-2363 Fixed --- .../codegen/ImplementationBodyCodegen.java | 56 +-- .../src/org/jetbrains/jet/JetNodeTypes.java | 1 - .../jet/lang/cfg/JetControlFlowProcessor.java | 2 +- .../jet/lang/diagnostics/Errors.java | 1 - .../rendering/DefaultErrorMessages.java | 1 - .../jet/lang/parsing/JetParsing.java | 31 -- .../org/jetbrains/jet/lang/psi/JetClass.java | 8 - .../jetbrains/jet/lang/psi/JetClassBody.java | 4 - .../jet/lang/psi/JetSecondaryConstructor.java | 93 ----- .../jetbrains/jet/lang/psi/JetVisitor.java | 4 - .../jet/lang/psi/JetVisitorVoid.java | 4 - .../lang/resolve/BodiesResolveContext.java | 1 - .../jet/lang/resolve/BodyResolver.java | 158 +-------- .../resolve/CachedBodiesResolveContext.java | 7 - .../jet/lang/resolve/ControlFlowAnalyzer.java | 5 - .../jet/lang/resolve/DeclarationResolver.java | 17 - .../jet/lang/resolve/DescriptorResolver.java | 5 - .../jet/lang/resolve/DescriptorUtils.java | 4 - .../lang/resolve/TopDownAnalysisContext.java | 6 - .../codegen/classes/secondaryConstructors.jet | 8 - .../testData/diagnostics/tests/Abstract.kt | 3 +- .../tests/AnonymousInitializers.kt | 5 - .../diagnostics/tests/Constructors.kt | 14 - .../tests/DefaultValuesTypechecking.kt | 2 +- .../diagnostics/tests/FunctionReturnTypes.kt | 6 - .../testData/diagnostics/tests/Properties.kt | 5 +- .../diagnostics/tests/SupertypeListChecks.kt | 1 - .../diagnostics/tests/TraitSupertypeList.kt | 1 - .../ScopeForSecondaryConstructors.kt | 17 - .../ThisConstructorInGenericClass.kt | 3 - .../diagnostics/tests/scopes/kt250.617.10.kt | 1 - .../testData/psi/AnonymousInitializer.jet | 3 - .../testData/psi/AnonymousInitializer.txt | 13 +- compiler/testData/psi/ByCaluses.jet | 14 +- compiler/testData/psi/ByCaluses.txt | 112 +++--- compiler/testData/psi/Constructors.jet | 7 - compiler/testData/psi/Constructors.txt | 118 +------ compiler/testData/psi/ShortAnnotations.jet | 1 - compiler/testData/psi/ShortAnnotations.txt | 78 ---- compiler/testData/psi/SimpleClassMembers.jet | 8 - compiler/testData/psi/SimpleClassMembers.txt | 213 +---------- .../testData/psi/SimpleClassMembers_ERR.jet | 10 - .../testData/psi/SimpleClassMembers_ERR.txt | 127 +------ compiler/testData/psi/examples/BinaryTree.txt | 106 +++--- .../psi/examples/collections/HashMap.jet | 2 +- .../psi/examples/collections/HashMap.txt | 35 +- .../testData/psi/examples/io/IOSamples.jet | 12 +- .../testData/psi/examples/io/IOSamples.txt | 118 +------ .../examples/priorityqueues/BinaryHeap.jet | 40 +-- .../examples/priorityqueues/BinaryHeap.txt | 332 ++---------------- .../testData/psi/script/ComplexScript.txt | 2 +- compiler/testData/psi/script/Import.txt | 2 +- compiler/testData/psi/script/Shebang.txt | 2 +- .../testData/psi/script/ShebangIncorrect.txt | 2 +- compiler/testData/psi/script/SimpleScript.txt | 2 +- .../resolve/ConstructorsAndInitializers.jet | 12 - .../testData/resolve/PrimaryConstructors.jet | 19 +- .../jetbrains/jet/cfg/JetControlFlowTest.java | 5 +- .../checkers/JetDiagnosticsTestGenerated.java | 15 +- .../jetbrains/jet/codegen/ClassGenTest.java | 7 +- .../jet/types/JetTypeCheckerTest.java | 5 - grammar/src/class_members.grm | 11 - .../refactoring/JetRefactoringUtil.java | 8 +- .../JetIntroduceVariableHandler.java | 20 -- 64 files changed, 240 insertions(+), 1695 deletions(-) delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetSecondaryConstructor.java delete mode 100644 compiler/testData/codegen/classes/secondaryConstructors.jet delete mode 100644 compiler/testData/diagnostics/tests/regressions/ScopeForSecondaryConstructors.kt delete mode 100644 compiler/testData/diagnostics/tests/regressions/ThisConstructorInGenericClass.kt delete mode 100644 compiler/testData/resolve/ConstructorsAndInitializers.jet diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java index c4419f0e84a..aad854b9035 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java @@ -884,10 +884,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { @Override protected void generateDeclaration(PropertyCodegen propertyCodegen, JetDeclaration declaration, FunctionCodegen functionCodegen) { - if (declaration instanceof JetSecondaryConstructor) { - generateSecondaryConstructor((JetSecondaryConstructor) declaration); - } - else if (declaration instanceof JetClassObject) { + if (declaration instanceof JetClassObject) { // done earlier in order to have accessors } else if (declaration instanceof JetEnumEntry && !((JetEnumEntry) declaration).hasPrimaryConstructor()) { @@ -944,57 +941,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { } } - private void generateSecondaryConstructor(JetSecondaryConstructor constructor) { - ConstructorDescriptor constructorDescriptor = bindingContext.get(BindingContext.CONSTRUCTOR, constructor); - if (constructorDescriptor == null) { - throw new UnsupportedOperationException("failed to get descriptor for secondary constructor"); - } - CallableMethod method = typeMapper.mapToCallableMethod(constructorDescriptor, kind, typeMapper.hasThis0(constructorDescriptor.getContainingDeclaration())); - int flags = JetTypeMapper.getAccessModifiers(constructorDescriptor, 0); - final MethodVisitor mv = v.newMethod(constructor, flags, "", method.getSignature().getAsmMethod().getDescriptor(), null, null); - - AnnotationVisitor jetConstructorVisitor = mv.visitAnnotation(JvmStdlibNames.JET_CONSTRUCTOR.getDescriptor(), true); - int flagsValue = BitSetUtils.toInt(CodegenUtil.getFlagsForVisibility(constructorDescriptor.getVisibility())); - if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flagsValue) { - jetConstructorVisitor.visit(JvmStdlibNames.JET_CLASS_FLAGS_FIELD, flagsValue); - } - jetConstructorVisitor.visitEnd(); - - if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) { - StubCodegen.generateStubCode(mv); - } - else if (state.getClassBuilderMode() == ClassBuilderMode.FULL) { - mv.visitCode(); - - ConstructorFrameMap frameMap = new ConstructorFrameMap(method, constructorDescriptor, typeMapper.hasThis0(constructorDescriptor.getContainingDeclaration())); - - final InstructionAdapter iv = new InstructionAdapter(mv); - ExpressionCodegen codegen = new ExpressionCodegen(mv, frameMap, Type.VOID_TYPE, context, state); - - for (JetDelegationSpecifier initializer : constructor.getInitializers()) { - if (initializer instanceof JetDelegatorToThisCall) { - JetDelegatorToThisCall thisCall = (JetDelegatorToThisCall) initializer; - DeclarationDescriptor thisDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, thisCall.getThisReference()); - if (!(thisDescriptor instanceof ConstructorDescriptor)) { - throw new UnsupportedOperationException("expected 'this' delegator to resolve to constructor"); - } - generateDelegatorToConstructorCall(iv, codegen, thisCall, (ConstructorDescriptor) thisDescriptor, frameMap, flags); - } - else { - throw new UnsupportedOperationException("unknown initializer type"); - } - } - - JetExpression bodyExpression = constructor.getBodyExpression(); - if (bodyExpression != null) { - codegen.gen(bodyExpression, Type.VOID_TYPE); - } - - mv.visitInsn(RETURN); - FunctionCodegen.endVisit(mv, "constructor", null); - } - } - public static void generateInitializers(@NotNull ExpressionCodegen codegen, @NotNull InstructionAdapter iv, @NotNull List declarations, @NotNull BindingContext bindingContext, @NotNull JetTypeMapper typeMapper) { for (JetDeclaration declaration : declarations) { diff --git a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java index 575457d7d0a..44031edd153 100644 --- a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java @@ -37,7 +37,6 @@ public interface JetNodeTypes { JetNodeType OBJECT_DECLARATION_NAME = new JetNodeType("OBJECT_DECLARATION_NAME", JetObjectDeclarationName.class); JetNodeType CLASS_OBJECT = new JetNodeType("CLASS_OBJECT", JetClassObject.class); - JetNodeType CONSTRUCTOR = new JetNodeType("CONSTRUCTOR", JetSecondaryConstructor.class); IElementType ENUM_ENTRY = JetStubElementTypes.ENUM_ENTRY; JetNodeType ANONYMOUS_INITIALIZER = new JetNodeType("ANONYMOUS_INITIALIZER", JetClassInitializer.class); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java index 02a2a388c9d..d467de2ca52 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java @@ -620,7 +620,7 @@ public class JetControlFlowProcessor { if (subroutine instanceof JetFunctionLiteralExpression) { subroutine = ((JetFunctionLiteralExpression) subroutine).getFunctionLiteral(); } - if (subroutine instanceof JetFunction || subroutine instanceof JetPropertyAccessor || subroutine instanceof JetSecondaryConstructor) { + if (subroutine instanceof JetFunction || subroutine instanceof JetPropertyAccessor) { if (returnedExpression == null) { builder.returnNoValue(expression, subroutine); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java index 8f30982abfd..2b6f6c33b92 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java @@ -245,7 +245,6 @@ public interface Errors { SimpleDiagnosticFactory SUPERTYPE_NOT_A_CLASS_OR_TRAIT = SimpleDiagnosticFactory.create(ERROR); SimpleDiagnosticFactory SUPERTYPE_INITIALIZED_IN_TRAIT = SimpleDiagnosticFactory.create(ERROR); SimpleDiagnosticFactory CONSTRUCTOR_IN_TRAIT = SimpleDiagnosticFactory.create(ERROR); - SimpleDiagnosticFactory SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED = SimpleDiagnosticFactory.create(WARNING); SimpleDiagnosticFactory SUPERTYPE_APPEARS_TWICE = SimpleDiagnosticFactory.create(ERROR); SimpleDiagnosticFactory FINAL_SUPERTYPE = SimpleDiagnosticFactory.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java index eea180cf368..71ebfa2ddea 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java @@ -279,7 +279,6 @@ public class DefaultErrorMessages { MAP.put(SUPERTYPE_NOT_A_CLASS_OR_TRAIT, "Only classes and traits may serve as supertypes"); MAP.put(SUPERTYPE_INITIALIZED_IN_TRAIT, "Traits cannot initialize supertypes"); MAP.put(CONSTRUCTOR_IN_TRAIT, "A trait may not have a constructor"); - MAP.put(SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED, "Secondary constructors are not supported"); MAP.put(SUPERTYPE_APPEARS_TWICE, "A supertype appears twice"); MAP.put(FINAL_SUPERTYPE, "This type is final, so it cannot be inherited from"); 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 38e9bec57be..c43ad1ede94 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -651,9 +651,6 @@ public class JetParsing extends AbstractJetParsing { else if (keywordToken == TYPE_KEYWORD) { declType = parseTypeDef(); } - else if (keywordToken == THIS_KEYWORD) { - declType = parseConstructor(); - } else if (keywordToken == OBJECT_KEYWORD) { parseObject(true, true); declType = OBJECT_DECLARATION; @@ -709,34 +706,6 @@ public class JetParsing extends AbstractJetParsing { } } - /* - * constructor - * : modifiers "this" functionParameters (":" initializer{","}) block? - * ; - */ - private JetNodeType parseConstructor() { - assert _at(THIS_KEYWORD); - - advance(); // THIS_KEYWORD - - parseValueParameterList(false, TokenSet.create(COLON, LBRACE, SEMICOLON)); - - if (at(COLON)) { - advance(); // COLON - - parseInitializerList(); - } - - if (at(LBRACE)) { - parseBlock(); - } - else { - consumeIf(SEMICOLON); - } - - return CONSTRUCTOR; - } - /* * initializer{","} */ diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClass.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClass.java index b901e48fdc1..b6fa6d8cbe3 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClass.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClass.java @@ -58,14 +58,6 @@ public class JetClass extends JetTypeParameterListOwnerStub imp return body.getDeclarations(); } - @NotNull - public List getSecondaryConstructors() { - JetClassBody body = (JetClassBody) findChildByType(JetNodeTypes.CLASS_BODY); - if (body == null) return Collections.emptyList(); - - return body.getSecondaryConstructors(); - } - @Override public void accept(@NotNull JetVisitorVoid visitor) { visitor.visitClass(this); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClassBody.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClassBody.java index 1da2255bf6a..b1f42305c6e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClassBody.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetClassBody.java @@ -41,10 +41,6 @@ public class JetClassBody extends JetElementImpl implements JetDeclarationContai return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class); } - public List getSecondaryConstructors() { - return PsiTreeUtil.getChildrenOfTypeAsList(this, JetSecondaryConstructor.class); - } - @Override public void accept(@NotNull JetVisitorVoid visitor) { visitor.visitClassBody(this); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetSecondaryConstructor.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetSecondaryConstructor.java deleted file mode 100644 index c5889dcb903..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetSecondaryConstructor.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2010-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.jet.lang.psi; - -import com.intellij.lang.ASTNode; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jet.JetNodeTypes; -import org.jetbrains.jet.lexer.JetTokens; - -import java.util.Collections; -import java.util.List; - -/** - * @author max - */ -public class JetSecondaryConstructor extends JetDeclarationImpl implements JetDeclarationWithBody, JetStatementExpression { - public JetSecondaryConstructor(@NotNull ASTNode node) { - super(node); - } - - @Override - public void accept(@NotNull JetVisitorVoid visitor) { - visitor.visitConstructor(this); - } - - @Override - public R accept(@NotNull JetVisitor visitor, D data) { - return visitor.visitConstructor(this, data); - } - - @Nullable @IfNotParsed - public JetParameterList getParameterList() { - return (JetParameterList) findChildByType(JetNodeTypes.VALUE_PARAMETER_LIST); - } - - @Override - @NotNull - public List getValueParameters() { - JetParameterList list = getParameterList(); - return list != null ? list.getParameters() : Collections.emptyList(); - } - - @Nullable - public JetInitializerList getInitializerList() { - return (JetInitializerList) findChildByType(JetNodeTypes.INITIALIZER_LIST); - } - - @NotNull - public List getInitializers() { - JetInitializerList list = getInitializerList(); - return list != null ? list.getInitializers() : Collections.emptyList(); - } - - @Override - public JetExpression getBodyExpression() { - return findChildByClass(JetExpression.class); - } - - @Override - public boolean hasBlockBody() { - return findChildByType(JetTokens.EQ) == null; - } - - @Override - public boolean hasDeclaredReturnType() { - return true; - } - - @NotNull - @Override - public JetElement asElement() { - return this; - } - - public ASTNode getNameNode() { - return getNode().findChildByType(JetTokens.THIS_KEYWORD); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitor.java index ebcdc2bc8cf..d46431ee69f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitor.java @@ -39,10 +39,6 @@ public class JetVisitor extends PsiElementVisitor { return visitDeclaration(classObject, data); } - public R visitConstructor(JetSecondaryConstructor constructor, D data) { - return visitDeclaration(constructor, data); - } - public R visitNamedFunction(JetNamedFunction function, D data) { return visitNamedDeclaration(function, data); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitorVoid.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitorVoid.java index 7580deeb16c..dc248a34a8d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitorVoid.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitorVoid.java @@ -38,10 +38,6 @@ public class JetVisitorVoid extends PsiElementVisitor { visitDeclaration(classObject); } - public void visitConstructor(JetSecondaryConstructor constructor) { - visitDeclaration(constructor); - } - public void visitNamedFunction(JetNamedFunction function) { visitNamedDeclaration(function); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodiesResolveContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodiesResolveContext.java index 54cd398cef4..3c64cf4ad20 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodiesResolveContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodiesResolveContext.java @@ -31,7 +31,6 @@ import java.util.Map; public interface BodiesResolveContext { Map getClasses(); Map getObjects(); - Map getConstructors(); Map getProperties(); Map getFunctions(); Map getDeclaringScopes(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java index f20b68af794..2a0ce001266 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java @@ -21,41 +21,8 @@ import com.google.common.collect.Sets; import com.intellij.psi.PsiElement; import com.intellij.util.containers.Queue; import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.lang.descriptors.ClassDescriptor; -import org.jetbrains.jet.lang.descriptors.ClassKind; -import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor; -import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; -import org.jetbrains.jet.lang.descriptors.FunctionDescriptor; -import org.jetbrains.jet.lang.descriptors.FunctionDescriptorUtil; -import org.jetbrains.jet.lang.descriptors.MutableClassDescriptor; -import org.jetbrains.jet.lang.descriptors.PropertyDescriptor; -import org.jetbrains.jet.lang.descriptors.PropertyGetterDescriptor; -import org.jetbrains.jet.lang.descriptors.PropertySetterDescriptor; -import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor; -import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor; -import org.jetbrains.jet.lang.psi.JetClass; -import org.jetbrains.jet.lang.psi.JetClassInitializer; -import org.jetbrains.jet.lang.psi.JetClassOrObject; -import org.jetbrains.jet.lang.psi.JetDeclarationWithBody; -import org.jetbrains.jet.lang.psi.JetDelegationSpecifier; -import org.jetbrains.jet.lang.psi.JetDelegatorByExpressionSpecifier; -import org.jetbrains.jet.lang.psi.JetDelegatorToSuperCall; -import org.jetbrains.jet.lang.psi.JetDelegatorToSuperClass; -import org.jetbrains.jet.lang.psi.JetDelegatorToThisCall; -import org.jetbrains.jet.lang.psi.JetElement; -import org.jetbrains.jet.lang.psi.JetEnumEntry; -import org.jetbrains.jet.lang.psi.JetExpression; -import org.jetbrains.jet.lang.psi.JetNamedFunction; -import org.jetbrains.jet.lang.psi.JetObjectDeclaration; -import org.jetbrains.jet.lang.psi.JetParameter; -import org.jetbrains.jet.lang.psi.JetProperty; -import org.jetbrains.jet.lang.psi.JetPropertyAccessor; -import org.jetbrains.jet.lang.psi.JetReferenceExpression; -import org.jetbrains.jet.lang.psi.JetSecondaryConstructor; -import org.jetbrains.jet.lang.psi.JetSimpleNameExpression; -import org.jetbrains.jet.lang.psi.JetTypeReference; -import org.jetbrains.jet.lang.psi.JetValueArgumentList; -import org.jetbrains.jet.lang.psi.JetVisitorVoid; +import org.jetbrains.jet.lang.descriptors.*; +import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.calls.CallMaker; import org.jetbrains.jet.lang.resolve.calls.CallResolver; import org.jetbrains.jet.lang.resolve.calls.OverloadResolutionResults; @@ -65,43 +32,18 @@ import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler; import org.jetbrains.jet.lang.resolve.scopes.WritableScope; import org.jetbrains.jet.lang.resolve.scopes.WritableScopeImpl; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor; -import org.jetbrains.jet.lang.types.DeferredType; -import org.jetbrains.jet.lang.types.ErrorUtils; -import org.jetbrains.jet.lang.types.JetType; -import org.jetbrains.jet.lang.types.TypeConstructor; -import org.jetbrains.jet.lang.types.TypeUtils; +import org.jetbrains.jet.lang.types.*; import org.jetbrains.jet.lang.types.checker.JetTypeChecker; import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices; -import org.jetbrains.jet.lang.types.lang.JetStandardClasses; import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.util.Box; import org.jetbrains.jet.util.lazy.ReenteringLazyValueComputationException; import org.jetbrains.jet.util.slicedmap.WritableSlice; import javax.inject.Inject; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; -import static org.jetbrains.jet.lang.diagnostics.Errors.ANONYMOUS_INITIALIZER_WITHOUT_CONSTRUCTOR; -import static org.jetbrains.jet.lang.diagnostics.Errors.BY_IN_SECONDARY_CONSTRUCTOR; -import static org.jetbrains.jet.lang.diagnostics.Errors.CONSTRUCTOR_IN_TRAIT; -import static org.jetbrains.jet.lang.diagnostics.Errors.DELEGATION_IN_TRAIT; -import static org.jetbrains.jet.lang.diagnostics.Errors.DELEGATION_NOT_TO_TRAIT; -import static org.jetbrains.jet.lang.diagnostics.Errors.FINAL_SUPERTYPE; -import static org.jetbrains.jet.lang.diagnostics.Errors.INITIALIZER_WITH_NO_ARGUMENTS; -import static org.jetbrains.jet.lang.diagnostics.Errors.MANY_CALLS_TO_THIS; -import static org.jetbrains.jet.lang.diagnostics.Errors.MANY_CLASSES_IN_SUPERTYPE_LIST; -import static org.jetbrains.jet.lang.diagnostics.Errors.SECONDARY_CONSTRUCTOR_BUT_NO_PRIMARY; -import static org.jetbrains.jet.lang.diagnostics.Errors.SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST; -import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_APPEARS_TWICE; -import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_INITIALIZED_IN_TRAIT; -import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_NOT_A_CLASS_OR_TRAIT; -import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_NOT_INITIALIZED; -import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_NOT_INITIALIZED_DEFAULT; -import static org.jetbrains.jet.lang.diagnostics.Errors.TYPE_MISMATCH; +import static org.jetbrains.jet.lang.diagnostics.Errors.*; import static org.jetbrains.jet.lang.resolve.BindingContext.DEFERRED_TYPE; import static org.jetbrains.jet.lang.types.TypeUtils.NO_EXPECTED_TYPE; @@ -180,7 +122,6 @@ public class BodyResolver { resolveAnonymousInitializers(); resolvePrimaryConstructorParameters(); - resolveSecondaryConstructorBodies(); resolveFunctionBodies(); scriptBodyResolverResolver.resolveScriptBodies(); @@ -411,95 +352,6 @@ public class BodyResolver { } } - private void resolveSecondaryConstructorBodies() { - for (Map.Entry entry : this.context.getConstructors().entrySet()) { - JetSecondaryConstructor constructor = entry.getKey(); - ConstructorDescriptor descriptor = entry.getValue(); - - resolveSecondaryConstructorBody(constructor, descriptor); - - assert descriptor.getReturnType() != null; - } - } - - private void resolveSecondaryConstructorBody(JetSecondaryConstructor declaration, final ConstructorDescriptor descriptor) { - if (!context.completeAnalysisNeeded(declaration)) return; - MutableClassDescriptor classDescriptor = (MutableClassDescriptor) descriptor.getContainingDeclaration(); - final JetScope scopeForSupertypeInitializers = FunctionDescriptorUtil.getFunctionInnerScope(classDescriptor.getScopeForSupertypeResolution(), descriptor, trace); - //contains only constructor parameters - final JetScope scopeForConstructorBody = FunctionDescriptorUtil.getFunctionInnerScope(classDescriptor.getScopeForInitializers(), descriptor, trace); - //contains members & backing fields - - final DataFlowInfo dataFlowInfo = DataFlowInfo.EMPTY; // TODO: dataFlowInfo - - PsiElement nameElement = declaration.getNameNode().getPsi(); - if (classDescriptor.getUnsubstitutedPrimaryConstructor() == null) { - trace.report(SECONDARY_CONSTRUCTOR_BUT_NO_PRIMARY.on(nameElement)); - } - else { - List initializers = declaration.getInitializers(); - if (initializers.isEmpty()) { - trace.report(SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST.on(nameElement)); - } - else { - initializers.get(0).accept(new JetVisitorVoid() { - @Override - public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) { - JetTypeReference typeReference = call.getTypeReference(); - if (typeReference != null) { - callResolver.resolveFunctionCall(trace, scopeForSupertypeInitializers, - CallMaker.makeCall(ReceiverDescriptor.NO_RECEIVER, null, call), - NO_EXPECTED_TYPE, dataFlowInfo); - } - } - - @Override - public void visitDelegationToThisCall(JetDelegatorToThisCall call) { - // TODO : check that there's no recursion in this() calls - // TODO : check: if a this() call is present, no other initializers are allowed - ClassDescriptor classDescriptor = descriptor.getContainingDeclaration(); - - callResolver.resolveFunctionCall(trace, - scopeForSupertypeInitializers, - CallMaker.makeCall(ReceiverDescriptor.NO_RECEIVER, null, call), NO_EXPECTED_TYPE, dataFlowInfo); -// call.getThisReference(), -// classDescriptor, -// classDescriptor.getDefaultType(), -// call); -// trace.getErrorHandler().genericError(call.getNode(), "this-calls are not supported"); - } - - @Override - public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) { - trace.report(BY_IN_SECONDARY_CONSTRUCTOR.on(specifier)); - } - - @Override - public void visitDelegationToSuperClassSpecifier(JetDelegatorToSuperClass specifier) { - trace.report(INITIALIZER_WITH_NO_ARGUMENTS.on(specifier)); - } - - @Override - public void visitDelegationSpecifier(JetDelegationSpecifier specifier) { - throw new IllegalStateException(); - } - }); - for (int i = 1, initializersSize = initializers.size(); i < initializersSize; i++) { - JetDelegationSpecifier initializer = initializers.get(i); - trace.report(MANY_CALLS_TO_THIS.on(initializer)); - } - } - } - JetExpression bodyExpression = declaration.getBodyExpression(); - if (bodyExpression != null) { - - expressionTypingServices.checkFunctionReturnType(scopeForConstructorBody, declaration, descriptor, DataFlowInfo.EMPTY, - JetStandardClasses.getUnitType(), trace); - } - - checkDefaultParameterValues(declaration.getValueParameters(), descriptor.getValueParameters(), scopeForConstructorBody); - } - private void resolvePropertyDeclarationBodies() { // Member properties diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/CachedBodiesResolveContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/CachedBodiesResolveContext.java index 863ef6323ed..4e9ba78be70 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/CachedBodiesResolveContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/CachedBodiesResolveContext.java @@ -36,7 +36,6 @@ import java.util.Map; public class CachedBodiesResolveContext implements BodiesResolveContext { private final Map classes; private final Map objects; - private final Map constructors; private final Map properties; private final Map functions; private final Map declaringScopes; @@ -48,7 +47,6 @@ public class CachedBodiesResolveContext implements BodiesResolveContext { public CachedBodiesResolveContext(TopDownAnalysisContext context) { classes = Collections.unmodifiableMap(context.getClasses()); objects = Collections.unmodifiableMap(context.getObjects()); - constructors = Collections.unmodifiableMap(context.getConstructors()); properties = Collections.unmodifiableMap(context.getProperties()); functions = Collections.unmodifiableMap(context.getFunctions()); declaringScopes = Collections.unmodifiableMap(context.getDeclaringScopes()); @@ -68,11 +66,6 @@ public class CachedBodiesResolveContext implements BodiesResolveContext { return objects; } - @Override - public Map getConstructors() { - return constructors; - } - @Override public Map getProperties() { return properties; diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/ControlFlowAnalyzer.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/ControlFlowAnalyzer.java index 8c0d02e74fa..a470fcc72ae 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/ControlFlowAnalyzer.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/ControlFlowAnalyzer.java @@ -23,7 +23,6 @@ import org.jetbrains.jet.lang.descriptors.PropertyDescriptor; import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.types.JetType; -import org.jetbrains.jet.lang.types.lang.JetStandardClasses; import javax.inject.Inject; import java.util.Map; @@ -65,10 +64,6 @@ public class ControlFlowAnalyzer { : functionDescriptor.getReturnType(); checkFunction(function, expectedReturnType); } - for (JetSecondaryConstructor constructor : bodiesResolveContext.getConstructors().keySet()) { - if (!bodiesResolveContext.completeAnalysisNeeded(constructor)) continue; - checkFunction(constructor, JetStandardClasses.getUnitType()); - } for (Map.Entry entry : bodiesResolveContext.getProperties().entrySet()) { JetProperty property = entry.getKey(); if (!bodiesResolveContext.completeAnalysisNeeded(property)) continue; diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationResolver.java index 0754795388a..c65992bff44 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationResolver.java @@ -103,9 +103,6 @@ public class DeclarationResolver { MutableClassDescriptor classDescriptor = entry.getValue(); processPrimaryConstructor(classDescriptor, jetClass); - for (JetSecondaryConstructor jetConstructor : jetClass.getSecondaryConstructors()) { - processSecondaryConstructor(classDescriptor, jetConstructor); - } } } @@ -250,20 +247,6 @@ public class DeclarationResolver { } } - private void processSecondaryConstructor(MutableClassDescriptor classDescriptor, JetSecondaryConstructor constructor) { - trace.report(SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED.on(constructor)); - if (classDescriptor.getKind() == ClassKind.TRAIT) { - trace.report(CONSTRUCTOR_IN_TRAIT.on(constructor.getNameNode().getPsi())); - } - ConstructorDescriptor constructorDescriptor = descriptorResolver.resolveSecondaryConstructorDescriptor( - classDescriptor.getScopeForMemberResolution(), - classDescriptor, - constructor, trace); - classDescriptor.addConstructor(constructorDescriptor, trace); - context.getConstructors().put(constructor, constructorDescriptor); - context.getDeclaringScopes().put(constructor, classDescriptor.getScopeForMemberLookup()); - } - private void checkRedeclarationsInNamespaces() { for (NamespaceDescriptorImpl descriptor : context.getNamespaceDescriptors().values()) { Multimap simpleNameDescriptors = descriptor.getMemberScope().getDeclaredDescriptorsAccessibleBySimpleName(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java index e0068a104ff..cc397011765 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java @@ -884,11 +884,6 @@ public class DescriptorResolver { return getterDescriptor; } - @NotNull - public ConstructorDescriptorImpl resolveSecondaryConstructorDescriptor(@NotNull JetScope scope, @NotNull ClassDescriptor classDescriptor, @NotNull JetSecondaryConstructor constructor, BindingTrace trace) { - return createConstructorDescriptor(scope, classDescriptor, false, constructor.getModifierList(), constructor, classDescriptor.getTypeConstructor().getParameters(), constructor.getValueParameters(), trace); - } - @NotNull private ConstructorDescriptorImpl createConstructorDescriptor( @NotNull JetScope scope, diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java index e8e2469e739..9b366580117 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java @@ -23,7 +23,6 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.psi.JetElement; import org.jetbrains.jet.lang.psi.JetFunction; -import org.jetbrains.jet.lang.psi.JetSecondaryConstructor; import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe; import org.jetbrains.jet.lang.resolve.name.Name; @@ -224,9 +223,6 @@ public class DescriptorUtils { expectedType = TypeUtils.NO_EXPECTED_TYPE; } } - else if (function instanceof JetSecondaryConstructor) { - expectedType = JetStandardClasses.getUnitType(); - } else { expectedType = descriptor.getReturnType(); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java index d6a03f85778..bb5ec650242 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java @@ -40,7 +40,6 @@ public class TopDownAnalysisContext implements BodiesResolveContext { private final Map declaringScopes = Maps.newHashMap(); private final Map functions = Maps.newLinkedHashMap(); - private final Map constructors = Maps.newLinkedHashMap(); private final Map properties = Maps.newLinkedHashMap(); private final Map primaryConstructorParameterProperties = Maps.newHashMap(); private Map members = null; @@ -133,11 +132,6 @@ public class TopDownAnalysisContext implements BodiesResolveContext { return primaryConstructorParameterProperties; } - @Override - public Map getConstructors() { - return constructors; - } - @Override public Map getProperties() { return properties; diff --git a/compiler/testData/codegen/classes/secondaryConstructors.jet b/compiler/testData/codegen/classes/secondaryConstructors.jet deleted file mode 100644 index 075ca6da77c..00000000000 --- a/compiler/testData/codegen/classes/secondaryConstructors.jet +++ /dev/null @@ -1,8 +0,0 @@ -class C(val n: Int, val s: String) { - this(n: Int): this(n, "foo") { } -} - -fun box(): String { - val c = C(10) - return if (c.s == "foo") "OK" else "fail" -} diff --git a/compiler/testData/diagnostics/tests/Abstract.kt b/compiler/testData/diagnostics/tests/Abstract.kt index b0eeeaaddb9..e7409af9f8a 100644 --- a/compiler/testData/diagnostics/tests/Abstract.kt +++ b/compiler/testData/diagnostics/tests/Abstract.kt @@ -53,10 +53,9 @@ abstract class B1( class B2() : B1(1, "r") {} abstract class B3(i: Int) { - this(): this(1) } fun foo(c: B3) { - val a = B3() + val a = B3(1) val b = B1(2, "s") } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt index 47251bef500..cb00fef671e 100644 --- a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt +++ b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt @@ -26,9 +26,4 @@ class WithC() { val zz = x val zzz = $a } - - this(a : Int) : this() { - val b = x - } - } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/Constructors.kt b/compiler/testData/diagnostics/tests/Constructors.kt index 7781fdecedd..4e8420422c1 100644 --- a/compiler/testData/diagnostics/tests/Constructors.kt +++ b/compiler/testData/diagnostics/tests/Constructors.kt @@ -7,24 +7,10 @@ class NoC2 : WithC1 class NoC3 : WithC1() class WithC2() : WithC1 -class NoPC { - this() {} -} - class WithPC0() { - this(a : Int) : this() {} } class WithPC1(a : Int) { - this() {} - - this(b : Long) : this("") {} - - this(s : String) : this(1) {} - - this(b : Char) : this("", 2) {} - - this(b : Byte) : this(""), this(1) {} } diff --git a/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt b/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt index f794c55a8a9..dd8ae91e637 100644 --- a/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt +++ b/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt @@ -7,7 +7,7 @@ fun bar(x : Int = "", y : Int = x, z // KT-371 Resolve default parameters for constructors class A(x : Int = y, y : Int = x) { // None of the references is resolved, no types checked - this(bool: Boolean, a: Int = b, b: String = a) : this(1) {} + fun foo(bool: Boolean, a: Int = b, b: String = a) {} } val z = 3 diff --git a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt index 7374b73bd99..27eb7d1eb95 100644 --- a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt +++ b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt @@ -137,12 +137,6 @@ fun nonBlockNoReturnIfUnitInOneBranch(): Int = if (1 < 2) {} val a = return 1 class A() { - this(a : Int) : this() { - if (a == 1) - return - return 1 - } - } fun illegalConstantBody(): Int = "s" fun illegalConstantBlock(): String { diff --git a/compiler/testData/diagnostics/tests/Properties.kt b/compiler/testData/diagnostics/tests/Properties.kt index aa2d11b6880..7f348f05692 100644 --- a/compiler/testData/diagnostics/tests/Properties.kt +++ b/compiler/testData/diagnostics/tests/Properties.kt @@ -16,11 +16,12 @@ class Test() { var a : Int = 111 var b : Int get() = $a; set(x) {a = x; $a = x} - this(i : Int) : this() { + { $b = $a $a = $b a = $b - } + } + fun f() { $b = $a a = $b diff --git a/compiler/testData/diagnostics/tests/SupertypeListChecks.kt b/compiler/testData/diagnostics/tests/SupertypeListChecks.kt index 8c6fff106ee..e6c0c487054 100644 --- a/compiler/testData/diagnostics/tests/SupertypeListChecks.kt +++ b/compiler/testData/diagnostics/tests/SupertypeListChecks.kt @@ -22,7 +22,6 @@ trait T1 {} trait T2 {} trait Test() { - this(x : Int) {} } trait Test1 : C2() {} diff --git a/compiler/testData/diagnostics/tests/TraitSupertypeList.kt b/compiler/testData/diagnostics/tests/TraitSupertypeList.kt index 320e4bcf052..60c9ca79205 100644 --- a/compiler/testData/diagnostics/tests/TraitSupertypeList.kt +++ b/compiler/testData/diagnostics/tests/TraitSupertypeList.kt @@ -1,7 +1,6 @@ open class bar() trait Foo() : bar(), bar, bar { - this(x : Int) {} } trait Foo2 : bar, Foo { diff --git a/compiler/testData/diagnostics/tests/regressions/ScopeForSecondaryConstructors.kt b/compiler/testData/diagnostics/tests/regressions/ScopeForSecondaryConstructors.kt deleted file mode 100644 index 375141603f7..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/ScopeForSecondaryConstructors.kt +++ /dev/null @@ -1,17 +0,0 @@ -class Foo(var bar : Int, var barr : Int, var barrr : Int) { - { - bar = 1 - barr = 1 - barrr = 1 - 1 : Int - this : Foo - } - - this(var bar : Int) : this(1, 1, 1) { - bar = 1 - this.bar - 1 : Int - val a : Int =1 - this : Foo - } - } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/ThisConstructorInGenericClass.kt b/compiler/testData/diagnostics/tests/regressions/ThisConstructorInGenericClass.kt deleted file mode 100644 index a2b408ae64d..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/ThisConstructorInGenericClass.kt +++ /dev/null @@ -1,3 +0,0 @@ -class Z() { - this(x : Int) : this() {} -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt index 869a85957ac..1aa4a886e71 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt @@ -42,7 +42,6 @@ open class X(p: Int, r: Int) { class Y(i: Int) : X(i, rrr) { val rrr = 3 - this(s: Int, r: Int) : this(s, rrr) } class Z(val i: Int) : X(s, x) { diff --git a/compiler/testData/psi/AnonymousInitializer.jet b/compiler/testData/psi/AnonymousInitializer.jet index f0c54460849..ffb4cefb3c5 100644 --- a/compiler/testData/psi/AnonymousInitializer.jet +++ b/compiler/testData/psi/AnonymousInitializer.jet @@ -5,8 +5,5 @@ class Foo { val c = f } - this() { - - } } diff --git a/compiler/testData/psi/AnonymousInitializer.txt b/compiler/testData/psi/AnonymousInitializer.txt index 76e9aeb1df4..e61e430a7f7 100644 --- a/compiler/testData/psi/AnonymousInitializer.txt +++ b/compiler/testData/psi/AnonymousInitializer.txt @@ -33,16 +33,5 @@ JetFile: AnonymousInitializer.jet PsiElement(IDENTIFIER)('f') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n') + PsiWhiteSpace('\n\n') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/ByCaluses.jet b/compiler/testData/psi/ByCaluses.jet index b6cab943917..05d1cbfef4a 100644 --- a/compiler/testData/psi/ByCaluses.jet +++ b/compiler/testData/psi/ByCaluses.jet @@ -1,23 +1,23 @@ class A : b by a { - this() {} + class object {} } class A : b by a + b() * 5 { - this() {} + class object {} } class A : b by (a) { - this() {} + class object {} } class A : b by (a {}) { - this() {} + class object {} } class A : b by a[a {}] { - this() {} + class object {} } class A : b by a(a {}) { - this() {} + class object {} } class A : b by object { fun f() = a {} } { - this() {} + class object {} } \ No newline at end of file diff --git a/compiler/testData/psi/ByCaluses.txt b/compiler/testData/psi/ByCaluses.txt index baa18e969f7..8a52f11ee5b 100644 --- a/compiler/testData/psi/ByCaluses.txt +++ b/compiler/testData/psi/ByCaluses.txt @@ -25,15 +25,15 @@ JetFile: ByCaluses.jet CLASS_BODY PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + CLASS_OBJECT + PsiElement(class)('class') PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + OBJECT_DECLARATION + PsiElement(object)('object') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') @@ -79,15 +79,15 @@ JetFile: ByCaluses.jet CLASS_BODY PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + CLASS_OBJECT + PsiElement(class)('class') PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + OBJECT_DECLARATION + PsiElement(object)('object') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') @@ -118,15 +118,15 @@ JetFile: ByCaluses.jet CLASS_BODY PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + CLASS_OBJECT + PsiElement(class)('class') PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + OBJECT_DECLARATION + PsiElement(object)('object') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') @@ -165,15 +165,15 @@ JetFile: ByCaluses.jet CLASS_BODY PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + CLASS_OBJECT + PsiElement(class)('class') PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + OBJECT_DECLARATION + PsiElement(object)('object') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') @@ -215,15 +215,15 @@ JetFile: ByCaluses.jet CLASS_BODY PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + CLASS_OBJECT + PsiElement(class)('class') PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + OBJECT_DECLARATION + PsiElement(object)('object') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') @@ -266,15 +266,15 @@ JetFile: ByCaluses.jet CLASS_BODY PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + CLASS_OBJECT + PsiElement(class)('class') PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + OBJECT_DECLARATION + PsiElement(object)('object') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') @@ -329,14 +329,14 @@ JetFile: ByCaluses.jet CLASS_BODY PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + CLASS_OBJECT + PsiElement(class)('class') PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + OBJECT_DECLARATION + PsiElement(object)('object') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/Constructors.jet b/compiler/testData/psi/Constructors.jet index 5251a19e464..c48aecd97d7 100644 --- a/compiler/testData/psi/Constructors.jet +++ b/compiler/testData/psi/Constructors.jet @@ -1,11 +1,4 @@ class foo { - - this() : this(a, b, c), Foo(bar) - - this(foo : bar) : this(a, b, c), Foo(bar) { - - } - } public class foo() : Bar diff --git a/compiler/testData/psi/Constructors.txt b/compiler/testData/psi/Constructors.txt index dc1ca863673..70af2dbc4b3 100644 --- a/compiler/testData/psi/Constructors.txt +++ b/compiler/testData/psi/Constructors.txt @@ -10,123 +10,7 @@ JetFile: Constructors.jet CLASS_BODY PsiElement(LBRACE)('{') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiElement(RPAR)(')') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiElement(RPAR)(')') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n') + PsiWhiteSpace('\n') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n') CLASS diff --git a/compiler/testData/psi/ShortAnnotations.jet b/compiler/testData/psi/ShortAnnotations.jet index 3109d77a93c..fc4de084eac 100644 --- a/compiler/testData/psi/ShortAnnotations.jet +++ b/compiler/testData/psi/ShortAnnotations.jet @@ -16,7 +16,6 @@ class Foo { foo bar(1) buzz(1) zoo val c : Int = 0 foo bar(1) buzz(1) zoo var v : Int = 0 foo bar(1) buzz(1) zoo type T = Int - foo bar(1) buzz(1) zoo this(x : Int) : this() {} foo bar(1) buzz(1) zoo {} } diff --git a/compiler/testData/psi/ShortAnnotations.txt b/compiler/testData/psi/ShortAnnotations.txt index 3954a8600fe..f70d859a720 100644 --- a/compiler/testData/psi/ShortAnnotations.txt +++ b/compiler/testData/psi/ShortAnnotations.txt @@ -856,84 +856,6 @@ JetFile: ShortAnnotations.jet USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('Int') - PsiWhiteSpace('\n ') - CONSTRUCTOR - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('buzz') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('zoo') - PsiWhiteSpace(' ') - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('x') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') ANONYMOUS_INITIALIZER MODIFIER_LIST diff --git a/compiler/testData/psi/SimpleClassMembers.jet b/compiler/testData/psi/SimpleClassMembers.jet index 125b86cf2c3..0064efeaea8 100644 --- a/compiler/testData/psi/SimpleClassMembers.jet +++ b/compiler/testData/psi/SimpleClassMembers.jet @@ -15,7 +15,6 @@ class foo { type foo = bar - this() : this(a, b, c), Foo(bar) } class Bar { @@ -49,7 +48,6 @@ class foo { type foo = bar - this() : this(a, b, c), Foo(bar) } fun foo() @@ -60,12 +58,6 @@ class foo { type foo = bar - this() : this(a, b, c), Foo(bar) - - this() : this(a, b, c), Foo(bar) { - - } - class object { } diff --git a/compiler/testData/psi/SimpleClassMembers.txt b/compiler/testData/psi/SimpleClassMembers.txt index df80bea0883..0d617dbe11c 100644 --- a/compiler/testData/psi/SimpleClassMembers.txt +++ b/compiler/testData/psi/SimpleClassMembers.txt @@ -74,58 +74,7 @@ JetFile: SimpleClassMembers.jet USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('bar') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiElement(RPAR)(')') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') + PsiWhiteSpace('\n\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') CLASS @@ -315,58 +264,7 @@ JetFile: SimpleClassMembers.jet USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('bar') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiElement(RPAR)(')') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') + PsiWhiteSpace('\n\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') FUN @@ -401,113 +299,6 @@ JetFile: SimpleClassMembers.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('bar') PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiElement(RPAR)(')') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiElement(RPAR)(')') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n ') CLASS_OBJECT PsiElement(class)('class') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/SimpleClassMembers_ERR.jet b/compiler/testData/psi/SimpleClassMembers_ERR.jet index 3600f3e5724..a8c2cc272c6 100644 --- a/compiler/testData/psi/SimpleClassMembers_ERR.jet +++ b/compiler/testData/psi/SimpleClassMembers_ERR.jet @@ -14,14 +14,4 @@ class foo { type foo = ; - this() : this(a, b, c), Foo(bar) { - - } - - this() : - { - - } - } \ No newline at end of file diff --git a/compiler/testData/psi/SimpleClassMembers_ERR.txt b/compiler/testData/psi/SimpleClassMembers_ERR.txt index 2fee7a73d04..4d2c3c2448c 100644 --- a/compiler/testData/psi/SimpleClassMembers_ERR.txt +++ b/compiler/testData/psi/SimpleClassMembers_ERR.txt @@ -78,130 +78,5 @@ JetFile: SimpleClassMembers_ERR.jet PsiErrorElement:Type expected PsiElement(SEMICOLON)(';') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiElement(RPAR)(')') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiErrorElement:Expecting a '>' - - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('c') - PsiElement(RPAR)(')') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Foo') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - PsiErrorElement:Expecting constructor call (this(...)) or supertype initializer - PsiElement(MINUS)('-') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n\n ') - PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/examples/BinaryTree.txt b/compiler/testData/psi/examples/BinaryTree.txt index 81213cbcfba..b8ed3dfbf38 100644 --- a/compiler/testData/psi/examples/BinaryTree.txt +++ b/compiler/testData/psi/examples/BinaryTree.txt @@ -152,15 +152,24 @@ JetFile: BinaryTree.jet PsiWhiteSpace('\n\n') PsiComment(EOL_COMMENT)('// override var size : Int { get; private set; }') PsiWhiteSpace('\n\n ') - CONSTRUCTOR + PsiErrorElement:Expecting member declaration PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('compare') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') + PsiErrorElement:Expecting member declaration + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('compare') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting member declaration + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION @@ -173,8 +182,10 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiElement(GT)('>') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') + PsiErrorElement:Expecting member declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + ANONYMOUS_INITIALIZER BLOCK PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') @@ -202,37 +213,42 @@ JetFile: BinaryTree.jet PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') - CONSTRUCTOR + PsiErrorElement:Expecting member declaration PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') + PsiErrorElement:Expecting member declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting member declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting member declaration PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('naturalOrder') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting member declaration + PsiElement(this)('this') + PsiErrorElement:Expecting member declaration + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('naturalOrder') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiErrorElement:Expecting member declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + ANONYMOUS_INITIALIZER BLOCK PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') @@ -2007,12 +2023,14 @@ JetFile: BinaryTree.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('TreeNode') PsiWhiteSpace('\n\n ') - CONSTRUCTOR + PsiErrorElement:Expecting member declaration PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') + PsiErrorElement:Expecting member declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting member declaration + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + ANONYMOUS_INITIALIZER BLOCK PsiElement(LBRACE)('{') PsiWhiteSpace('\n ') diff --git a/compiler/testData/psi/examples/collections/HashMap.jet b/compiler/testData/psi/examples/collections/HashMap.jet index 6243ee41618..3306ad429a0 100644 --- a/compiler/testData/psi/examples/collections/HashMap.jet +++ b/compiler/testData/psi/examples/collections/HashMap.jet @@ -50,7 +50,7 @@ class StrategyHashMap(hashingStrategy : IHashingStrategy) : IMap // where !(K : IHashable) - this() : this(JavaObjectHashingStrategy()) {} + //this() : this(JavaObjectHashingStrategy()) {} //this() where (K : IHashable) : this(DefaultHashingStrategy()) {} //... diff --git a/compiler/testData/psi/examples/collections/HashMap.txt b/compiler/testData/psi/examples/collections/HashMap.txt index 509893aaefa..7816fbcb988 100644 --- a/compiler/testData/psi/examples/collections/HashMap.txt +++ b/compiler/testData/psi/examples/collections/HashMap.txt @@ -937,40 +937,7 @@ JetFile: HashMap.jet PsiWhiteSpace('\n\n\n ') PsiComment(EOL_COMMENT)('// where !(K : IHashable)') PsiWhiteSpace('\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - THIS_CALL - THIS_CONSTRUCTOR_REFERENCE - PsiElement(this)('this') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('JavaObjectHashingStrategy') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('K') - PsiElement(GT)('>') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') + PsiComment(EOL_COMMENT)('//this() : this(JavaObjectHashingStrategy()) {}') PsiWhiteSpace('\n\n ') PsiComment(EOL_COMMENT)('//this() where (K : IHashable) : this(DefaultHashingStrategy()) {}') PsiWhiteSpace('\n ') diff --git a/compiler/testData/psi/examples/io/IOSamples.jet b/compiler/testData/psi/examples/io/IOSamples.jet index 621b6c0033b..cea319451a1 100644 --- a/compiler/testData/psi/examples/io/IOSamples.jet +++ b/compiler/testData/psi/examples/io/IOSamples.jet @@ -17,9 +17,9 @@ class FileInput : IIterator, JavaCloseableWrapper { private var next : Int private var nextUsed = false - this(file : File) : JavaCloseableWrapper(stream) { // implicitly throws IOException - stream = FileInputStream(file) // throws IOException - } + //this(file : File) : JavaCloseableWrapper(stream) { // implicitly throws IOException + // stream = FileInputStream(file) // throws IOException + //} override fun next() { if (!nextUsed) { @@ -43,9 +43,9 @@ class FileInput : IIterator, JavaCloseableWrapper { class FileOutput : IAdder, JavaCloseableWrapper { private val stream : OutputStream - this(file : File) : JavaCloseableWrapper(stream) { - stream = FileOutputStream(file) - } + //this(file : File) : JavaCloseableWrapper(stream) { + // stream = FileOutputStream(file) + //} override fun add(item : Byte) { stream.write(item) diff --git a/compiler/testData/psi/examples/io/IOSamples.txt b/compiler/testData/psi/examples/io/IOSamples.txt index fd3013fde9d..c8bbb9c90bf 100644 --- a/compiler/testData/psi/examples/io/IOSamples.txt +++ b/compiler/testData/psi/examples/io/IOSamples.txt @@ -275,62 +275,11 @@ JetFile: IOSamples.jet BOOLEAN_CONSTANT PsiElement(false)('false') PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('file') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('File') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('JavaCloseableWrapper') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('stream') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace(' ') - PsiComment(EOL_COMMENT)('// implicitly throws IOException') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('stream') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('FileInputStream') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('file') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiComment(EOL_COMMENT)('// throws IOException') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiComment(EOL_COMMENT)('//this(file : File) : JavaCloseableWrapper(stream) { // implicitly throws IOException') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('// stream = FileInputStream(file) // throws IOException') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('//}') PsiWhiteSpace('\n\n ') FUN MODIFIER_LIST @@ -543,58 +492,11 @@ JetFile: IOSamples.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('OutputStream') PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('file') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('File') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - INITIALIZER_LIST - DELEGATOR_SUPER_CALL - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('JavaCloseableWrapper') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('stream') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('stream') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('FileOutputStream') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('file') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiComment(EOL_COMMENT)('//this(file : File) : JavaCloseableWrapper(stream) {') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('// stream = FileOutputStream(file)') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('//}') PsiWhiteSpace('\n\n ') FUN MODIFIER_LIST diff --git a/compiler/testData/psi/examples/priorityqueues/BinaryHeap.jet b/compiler/testData/psi/examples/priorityqueues/BinaryHeap.jet index 5c8f9e05080..a5ecdc4d697 100644 --- a/compiler/testData/psi/examples/priorityqueues/BinaryHeap.jet +++ b/compiler/testData/psi/examples/priorityqueues/BinaryHeap.jet @@ -2,27 +2,27 @@ class BinaryHeap : IPriorityQueue { private val data : IMutableList private val compare : Comparison - this(data : IIterable, compare : Comparison = naturalOrder) { - this.compare = compare - this.data = ArrayList(data) -// siftDown(* this.data.size / 2 .. 0) +// this(data : IIterable, compare : Comparison = naturalOrder) { +// this.compare = compare +// this.data = ArrayList(data) +//// siftDown(* this.data.size / 2 .. 0) +// +// for (val i in data.size / 2 .. 0) { +// siftDown(i) +// } +// +// } - for (val i in data.size / 2 .. 0) { - siftDown(i) - } - - } - - this(compare : Comparison) { - this.compare = compare - this.data = ArrayList() - } - - this() { - this.data = ArrayList() - Assert(T is IComparable) - this.comparator = naturalOrder - } + //this(compare : Comparison) { + // this.compare = compare + // this.data = ArrayList() + //} + // + //this() { + // this.data = ArrayList() + // Assert(T is IComparable) + // this.comparator = naturalOrder + //} override fun extract() : T { if (this.isEmpty) diff --git a/compiler/testData/psi/examples/priorityqueues/BinaryHeap.txt b/compiler/testData/psi/examples/priorityqueues/BinaryHeap.txt index 931a6730500..ea2a919bbf7 100644 --- a/compiler/testData/psi/examples/priorityqueues/BinaryHeap.txt +++ b/compiler/testData/psi/examples/priorityqueues/BinaryHeap.txt @@ -76,300 +76,46 @@ JetFile: BinaryHeap.jet REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') PsiElement(GT)('>') + PsiWhiteSpace('\n\n') + PsiComment(EOL_COMMENT)('// this(data : IIterable, compare : Comparison = naturalOrder) {') + PsiWhiteSpace('\n') + PsiComment(EOL_COMMENT)('// this.compare = compare') + PsiWhiteSpace('\n') + PsiComment(EOL_COMMENT)('// this.data = ArrayList(data)') + PsiWhiteSpace('\n') + PsiComment(EOL_COMMENT)('//// siftDown(* this.data.size / 2 .. 0)') + PsiWhiteSpace('\n') + PsiComment(EOL_COMMENT)('//') + PsiWhiteSpace('\n') + PsiComment(EOL_COMMENT)('// for (val i in data.size / 2 .. 0) {') + PsiWhiteSpace('\n') + PsiComment(EOL_COMMENT)('// siftDown(i)') + PsiWhiteSpace('\n') + PsiComment(EOL_COMMENT)('// }') + PsiWhiteSpace('\n') + PsiComment(EOL_COMMENT)('//') + PsiWhiteSpace('\n') + PsiComment(EOL_COMMENT)('// }') PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('data') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('IIterable') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('compare') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Comparison') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('naturalOrder') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - THIS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(this)('this') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('compare') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('compare') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - THIS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(this)('this') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ArrayList') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n') - PsiComment(EOL_COMMENT)('// siftDown(* this.data.size / 2 .. 0)') - PsiWhiteSpace('\n\n ') - FOR - PsiElement(for)('for') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - LOOP_PARAMETER - PsiElement(val)('val') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('i') - PsiWhiteSpace(' ') - PsiElement(in)('in') - PsiWhiteSpace(' ') - LOOP_RANGE - BINARY_EXPRESSION - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('size') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(DIV)('/') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('2') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(RANGE)('..') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('0') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BODY - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('siftDown') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('i') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('compare') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Comparison') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - THIS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(this)('this') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('compare') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('compare') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - THIS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(this)('this') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ArrayList') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n ') - CONSTRUCTOR - PsiElement(this)('this') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - THIS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(this)('this') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ArrayList') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Assert') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - BINARY_WITH_PATTERN - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(is)('is') - PsiWhiteSpace(' ') - TYPE_PATTERN - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('IComparable') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - THIS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(this)('this') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('comparator') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('naturalOrder') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiComment(EOL_COMMENT)('//this(compare : Comparison) {') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('// this.compare = compare') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('// this.data = ArrayList()') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('//}') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('//') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('//this() {') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('// this.data = ArrayList()') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('// Assert(T is IComparable)') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('// this.comparator = naturalOrder') + PsiWhiteSpace('\n ') + PsiComment(EOL_COMMENT)('//}') PsiWhiteSpace('\n\n ') FUN MODIFIER_LIST diff --git a/compiler/testData/psi/script/ComplexScript.txt b/compiler/testData/psi/script/ComplexScript.txt index 4c5035734f3..db57fad6c3b 100644 --- a/compiler/testData/psi/script/ComplexScript.txt +++ b/compiler/testData/psi/script/ComplexScript.txt @@ -121,4 +121,4 @@ JetFile: ComplexScript.ktscript PsiElement(IDENTIFIER)('arg') PsiElement(RPAR)(')') PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/script/Import.txt b/compiler/testData/psi/script/Import.txt index 0a6ff977933..643b93e28a1 100644 --- a/compiler/testData/psi/script/Import.txt +++ b/compiler/testData/psi/script/Import.txt @@ -34,4 +34,4 @@ JetFile: Import.ktscript PsiElement(EQ)('=') PsiWhiteSpace(' ') INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') + PsiElement(INTEGER_LITERAL)('1') \ No newline at end of file diff --git a/compiler/testData/psi/script/Shebang.txt b/compiler/testData/psi/script/Shebang.txt index f24ec71f59d..8b8111c20af 100644 --- a/compiler/testData/psi/script/Shebang.txt +++ b/compiler/testData/psi/script/Shebang.txt @@ -11,4 +11,4 @@ JetFile: Shebang.ktscript VALUE_ARGUMENT REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('args') - PsiElement(RPAR)(')') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/script/ShebangIncorrect.txt b/compiler/testData/psi/script/ShebangIncorrect.txt index 2b2106c5722..92f20e35c02 100644 --- a/compiler/testData/psi/script/ShebangIncorrect.txt +++ b/compiler/testData/psi/script/ShebangIncorrect.txt @@ -32,4 +32,4 @@ JetFile: ShebangIncorrect.ktscript OPERATION_REFERENCE PsiElement(DIV)('/') REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('hi') + PsiElement(IDENTIFIER)('hi') \ No newline at end of file diff --git a/compiler/testData/psi/script/SimpleScript.txt b/compiler/testData/psi/script/SimpleScript.txt index ede34cb06e1..e0da35b59c3 100644 --- a/compiler/testData/psi/script/SimpleScript.txt +++ b/compiler/testData/psi/script/SimpleScript.txt @@ -9,4 +9,4 @@ JetFile: SimpleScript.ktscript VALUE_ARGUMENT INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') + PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/resolve/ConstructorsAndInitializers.jet b/compiler/testData/resolve/ConstructorsAndInitializers.jet deleted file mode 100644 index c20f608505b..00000000000 --- a/compiler/testData/resolve/ConstructorsAndInitializers.jet +++ /dev/null @@ -1,12 +0,0 @@ -class Z(a : Int) { - ~c1~this() : `c2`this(1, true) {} - - ~c2~this(x : Int, y : Boolean) : `c1`this() {} -} - -~Z1.c()~class Z1() : Z { - - this(x : Int, y : Boolean) : `Z1.c()`this() {} -} - -class Foo \ No newline at end of file diff --git a/compiler/testData/resolve/PrimaryConstructors.jet b/compiler/testData/resolve/PrimaryConstructors.jet index 72e3e71fca6..851d2f3321d 100644 --- a/compiler/testData/resolve/PrimaryConstructors.jet +++ b/compiler/testData/resolve/PrimaryConstructors.jet @@ -1,5 +1,4 @@ class A(~a~val a : Int) { - this() {`$a`a} ~b~val b = `$a`a ~f~fun f() = `$a`a } @@ -11,19 +10,11 @@ fun test() { a.`f`f()`:kotlin::Int` } -package Jet65 { - - class Foo(~bar~var bar : Int, ~barr~barr : Int, ~barrr~val barrr : Int) { - { - `$bar`bar = 1 - `barr`barr = 1 - `$barrr`barrr = 1 - } - - this(~s.bar~val bar : Int) : this(1, 1, 1) { - `s.bar`bar = 1 - this.`$bar`bar - } +class Foo(~bar~var bar : Int, ~barr~barr : Int, ~barrr~val barrr : Int) { + { + `$bar`bar = 1 + `barr`barr = 1 + `$barrr`barrr = 1 } } diff --git a/compiler/tests/org/jetbrains/jet/cfg/JetControlFlowTest.java b/compiler/tests/org/jetbrains/jet/cfg/JetControlFlowTest.java index 3c1552a2aa7..6448a6d08d4 100644 --- a/compiler/tests/org/jetbrains/jet/cfg/JetControlFlowTest.java +++ b/compiler/tests/org/jetbrains/jet/cfg/JetControlFlowTest.java @@ -108,7 +108,7 @@ public class JetControlFlowTest extends JetLiteFixture { JetElement correspondingElement = pseudocode.getCorrespondingElement(); String label = ""; - assert (correspondingElement instanceof JetNamedDeclaration || correspondingElement instanceof JetSecondaryConstructor || correspondingElement instanceof JetPropertyAccessor) : + assert (correspondingElement instanceof JetNamedDeclaration || correspondingElement instanceof JetPropertyAccessor) : "Unexpected element class is pseudocode: " + correspondingElement.getClass(); if (correspondingElement instanceof JetFunctionLiteral) { label = "anonymous_" + i++; @@ -121,9 +121,6 @@ public class JetControlFlowTest extends JetLiteFixture { String propertyName = ((JetProperty) correspondingElement.getParent()).getName(); label = (((JetPropertyAccessor) correspondingElement).isGetter() ? "get" : "set") + "_" + propertyName; } - else if (correspondingElement instanceof JetSecondaryConstructor) { - label = "this"; - } instructionDump.append("== ").append(label).append(" ==\n"); diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index b673e9dd8b9..8e35cfff322 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -15,12 +15,15 @@ */ package org.jetbrains.jet.checkers; +import junit.framework.Assert; import junit.framework.Test; import junit.framework.TestSuite; + +import java.io.File; import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.test.TestMetadata; -import java.io.File; +import org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve; /** This class is generated by {@link org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve}. DO NOT MODIFY MANUALLY */ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEagerResolve { @@ -2229,21 +2232,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage doTest("compiler/testData/diagnostics/tests/regressions/OverrideResolution.kt"); } - @TestMetadata("ScopeForSecondaryConstructors.kt") - public void testScopeForSecondaryConstructors() throws Exception { - doTest("compiler/testData/diagnostics/tests/regressions/ScopeForSecondaryConstructors.kt"); - } - @TestMetadata("SpecififcityByReceiver.kt") public void testSpecififcityByReceiver() throws Exception { doTest("compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt"); } - @TestMetadata("ThisConstructorInGenericClass.kt") - public void testThisConstructorInGenericClass() throws Exception { - doTest("compiler/testData/diagnostics/tests/regressions/ThisConstructorInGenericClass.kt"); - } - @TestMetadata("TypeMismatchOnUnaryOperations.kt") public void testTypeMismatchOnUnaryOperations() throws Exception { doTest("compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt"); diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java index 5276334f2ec..0acb5699682 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java @@ -137,11 +137,6 @@ public class ClassGenTest extends CodegenTestCase { blackBoxFile("classes/outerThis.jet"); } - public void testSecondaryConstructors() throws Exception { - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); - blackBoxFile("classes/secondaryConstructors.jet"); - } - public void testExceptionConstructor() throws Exception { createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); blackBoxFile("classes/exceptionConstructor.jet"); @@ -332,7 +327,7 @@ public class ClassGenTest extends CodegenTestCase { } public void testKt1120 () throws Exception { - createEnvironmentWithFullJdk(); + //createEnvironmentWithFullJdk(); // blackBoxFile("regressions/kt1120.kt"); } diff --git a/compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java b/compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java index a246e4728ec..1774c4c45e5 100644 --- a/compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java +++ b/compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java @@ -767,11 +767,6 @@ public class JetTypeCheckerTest extends JetLiteFixture { constructors, null ); - for (JetSecondaryConstructor constructor : classElement.getSecondaryConstructors()) { - ConstructorDescriptorImpl functionDescriptor = descriptorResolver.resolveSecondaryConstructorDescriptor(memberDeclarations, classDescriptor, constructor, JetTestUtils.DUMMY_TRACE); - functionDescriptor.setReturnType(classDescriptor.getDefaultType()); - constructors.add(functionDescriptor); - } ConstructorDescriptorImpl primaryConstructorDescriptor = descriptorResolver.resolvePrimaryConstructorDescriptor(scope, classDescriptor, classElement, JetTestUtils.DUMMY_TRACE); if (primaryConstructorDescriptor != null) { primaryConstructorDescriptor.setReturnType(classDescriptor.getDefaultType()); diff --git a/grammar/src/class_members.grm b/grammar/src/class_members.grm index addd0c4eb65..535cbfd31ef 100644 --- a/grammar/src/class_members.grm +++ b/grammar/src/class_members.grm @@ -4,12 +4,6 @@ h3. Class members /* class Example(a : Foo, i : Int) : Bar(i), Some { - // constrtuctors: - public this(a : Foo) : this(a, 0) - - public this(a : Foo) : Bar(5), Some(a) { - // code - } // functions abstract fun foo(a : Bar) @@ -56,11 +50,6 @@ classObject bq. See [Class objects|Classes and Inheritance#Class objects] */ -[undocumented] -constructor - : modifiers "this" valueParameters (":" initializer{","}) block? - ; - valueParameters : "(" functionParameter{","}? ")" // default values ; diff --git a/idea/src/org/jetbrains/jet/plugin/refactoring/JetRefactoringUtil.java b/idea/src/org/jetbrains/jet/plugin/refactoring/JetRefactoringUtil.java index 109974dc939..f0efb64333f 100644 --- a/idea/src/org/jetbrains/jet/plugin/refactoring/JetRefactoringUtil.java +++ b/idea/src/org/jetbrains/jet/plugin/refactoring/JetRefactoringUtil.java @@ -21,9 +21,11 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.ui.popup.JBPopupAdapter; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.LightweightWindowEvent; -import com.intellij.psi.*; +import com.intellij.psi.PsiComment; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiWhiteSpace; import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.psi.util.PsiUtilBase; import com.intellij.psi.util.PsiUtilCore; import com.intellij.ui.components.JBList; import org.jetbrains.annotations.NotNull; @@ -87,7 +89,7 @@ public class JetRefactoringUtil { ArrayList expressions = new ArrayList(); while (element != null && !(element instanceof JetBlockExpression && !(element.getParent() instanceof JetFunctionLiteral)) && !(element instanceof JetNamedFunction) - && !(element instanceof JetClassBody) && !(element instanceof JetSecondaryConstructor)) { + && !(element instanceof JetClassBody)) { if (element instanceof JetExpression && !(element instanceof JetStatementExpression)) { boolean addExpression = true; if (element.getParent() instanceof JetQualifiedExpression) { diff --git a/idea/src/org/jetbrains/jet/plugin/refactoring/introduceVariable/JetIntroduceVariableHandler.java b/idea/src/org/jetbrains/jet/plugin/refactoring/introduceVariable/JetIntroduceVariableHandler.java index dafa16e510a..9cb3cfba68d 100644 --- a/idea/src/org/jetbrains/jet/plugin/refactoring/introduceVariable/JetIntroduceVariableHandler.java +++ b/idea/src/org/jetbrains/jet/plugin/refactoring/introduceVariable/JetIntroduceVariableHandler.java @@ -292,12 +292,6 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase { oldElement = body; } } - else if (commonContainer instanceof JetSecondaryConstructor) { - JetExpression body = ((JetSecondaryConstructor)commonContainer).getBodyExpression(); - if (body != null) { - oldElement = body; - } - } else if (commonContainer instanceof JetContainerNode) { JetContainerNode container = (JetContainerNode)commonContainer; PsiElement[] children = container.getChildren(); @@ -513,12 +507,6 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase { return parent; } } - else if (parent instanceof JetSecondaryConstructor) { - JetSecondaryConstructor secondaryConstructor = (JetSecondaryConstructor)parent; - if (secondaryConstructor.getBodyExpression() == place) { - return parent; - } - } place = parent; } return null; @@ -570,14 +558,6 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase { } } } - else if (parent instanceof JetSecondaryConstructor) { - JetSecondaryConstructor secondaryConstructor = (JetSecondaryConstructor)parent; - if (secondaryConstructor.getBodyExpression() == place) { - if (!(place instanceof JetBlockExpression)) { - result = parent; - } - } - } place = parent; } return null;