diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 51c8d00740f..e649e07ed70 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -220,7 +220,6 @@ public interface Errors { // Type parameter declarations DiagnosticFactory1 FINAL_UPPER_BOUND = DiagnosticFactory1.create(WARNING); - DiagnosticFactory1 FINAL_COMPANION_OBJECT_UPPER_BOUND = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 DYNAMIC_UPPER_BOUND = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 CONFLICTING_UPPER_BOUNDS = diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 34263bd6300..04add4c66b0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -356,7 +356,6 @@ public class DefaultErrorMessages { }); MAP.put(UPPER_BOUND_VIOLATED, "Type argument is not within its bounds: should be subtype of ''{0}''", RENDER_TYPE, RENDER_TYPE); - MAP.put(FINAL_COMPANION_OBJECT_UPPER_BOUND, "''{0}'' is a final type, and thus a companion object cannot extend it", RENDER_TYPE); MAP.put(FINAL_UPPER_BOUND, "''{0}'' is a final type, and thus a value of the type parameter is predetermined", RENDER_TYPE); MAP.put(DYNAMIC_UPPER_BOUND, "Dynamic type can not be used as an upper bound"); MAP.put(USELESS_ELVIS, "Elvis operator (?:) always returns the left operand of non-nullable type {0}", RENDER_TYPE); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java index b59d7d324e6..bca675a79e7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java @@ -1550,7 +1550,6 @@ public class JetParsing extends AbstractJetParsing { /* * typeConstraint * : annotations SimpleName ":" type - * : annotations "class" "object" SimpleName ":" type * ; */ private void parseTypeConstraint() { @@ -1558,13 +1557,6 @@ public class JetParsing extends AbstractJetParsing { parseAnnotations(REGULAR_ANNOTATIONS_ONLY_WITH_BRACKETS); - if (at(CLASS_KEYWORD)) { - advance(); // CLASS_KEYWORD - - expect(OBJECT_KEYWORD, "Expecting 'object'", TYPE_REF_FIRST); - - } - PsiBuilder.Marker reference = mark(); if (expect(IDENTIFIER, "Expecting type parameter name", TokenSet.orSet(TokenSet.create(COLON, COMMA), TYPE_REF_FIRST))) { reference.done(REFERENCE_EXPRESSION); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetTypeConstraint.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetTypeConstraint.java index 06249b8240a..64b5c748ab1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetTypeConstraint.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetTypeConstraint.java @@ -19,16 +19,15 @@ package org.jetbrains.kotlin.psi; import com.intellij.lang.ASTNode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.lexer.JetTokens; -import org.jetbrains.kotlin.psi.stubs.KotlinTypeConstraintStub; +import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub; import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes; -public class JetTypeConstraint extends JetElementImplStub { +public class JetTypeConstraint extends JetElementImplStub> { public JetTypeConstraint(@NotNull ASTNode node) { super(node); } - public JetTypeConstraint(@NotNull KotlinTypeConstraintStub stub) { + public JetTypeConstraint(@NotNull KotlinPlaceHolderStub stub) { super(stub, JetStubElementTypes.TYPE_CONSTRAINT); } @@ -37,15 +36,6 @@ public class JetTypeConstraint extends JetElementImplStub { public fun isProbablyNothingType(): Boolean } -public trait KotlinTypeConstraintStub : StubElement { - public fun isCompanionObjectConstraint(): Boolean -} - public trait KotlinTypeParameterStub : KotlinStubWithFqName { public fun isInVariance(): Boolean public fun isOutVariance(): Boolean diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetFileElementType.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetFileElementType.java index aadd6ab862e..5f2dfa1c0d8 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetFileElementType.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetFileElementType.java @@ -36,7 +36,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinFileStubImpl; import java.io.IOException; public class JetFileElementType extends IStubFileElementType { - public static final int STUB_VERSION = 41; + public static final int STUB_VERSION = 42; private static final String NAME = "kotlin.FILE"; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetStubElementTypes.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetStubElementTypes.java index 2517067e101..b86f8a7cb59 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetStubElementTypes.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetStubElementTypes.java @@ -70,7 +70,8 @@ public interface JetStubElementTypes { JetPlaceHolderStubElementType TYPE_CONSTRAINT_LIST = new JetPlaceHolderStubElementType("TYPE_CONSTRAINT_LIST", JetTypeConstraintList.class); - JetTypeConstraintElementType TYPE_CONSTRAINT = new JetTypeConstraintElementType("TYPE_CONSTRAINT"); + JetPlaceHolderStubElementType TYPE_CONSTRAINT = + new JetPlaceHolderStubElementType("TYPE_CONSTRAINT", JetTypeConstraint.class); JetPlaceHolderStubElementType NULLABLE_TYPE = new JetPlaceHolderStubElementType("NULLABLE_TYPE", JetNullableType.class); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetTypeConstraintElementType.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetTypeConstraintElementType.java deleted file mode 100644 index a1683593d29..00000000000 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetTypeConstraintElementType.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2010-2015 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.kotlin.psi.stubs.elements; - -import com.intellij.psi.stubs.StubElement; -import com.intellij.psi.stubs.StubInputStream; -import com.intellij.psi.stubs.StubOutputStream; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.psi.JetTypeConstraint; -import org.jetbrains.kotlin.psi.stubs.KotlinTypeConstraintStub; -import org.jetbrains.kotlin.psi.stubs.impl.KotlinTypeConstraintStubImpl; - -import java.io.IOException; - -public class JetTypeConstraintElementType extends JetStubElementType { - public JetTypeConstraintElementType(@NotNull @NonNls String debugName) { - super(debugName, JetTypeConstraint.class, KotlinTypeConstraintStub.class); - } - - @Override - public KotlinTypeConstraintStub createStub(@NotNull JetTypeConstraint psi, StubElement parentStub) { - return new KotlinTypeConstraintStubImpl(parentStub, psi.isCompanionObjectConstraint()); - } - - @Override - public void serialize(@NotNull KotlinTypeConstraintStub stub, @NotNull StubOutputStream dataStream) throws IOException { - dataStream.writeBoolean(stub.isCompanionObjectConstraint()); - } - - @NotNull - @Override - public KotlinTypeConstraintStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException { - boolean isCompanionObjectConstraint = dataStream.readBoolean(); - return new KotlinTypeConstraintStubImpl(parentStub, isCompanionObjectConstraint); - } -} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinTypeConstraintStubImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinTypeConstraintStubImpl.kt deleted file mode 100644 index 833c5fce4af..00000000000 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinTypeConstraintStubImpl.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2010-2015 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.kotlin.psi.stubs.impl - -import com.intellij.psi.stubs.StubElement -import org.jetbrains.kotlin.psi.JetTypeConstraint -import org.jetbrains.kotlin.psi.stubs.KotlinTypeConstraintStub -import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes -import com.intellij.psi.PsiElement - -public class KotlinTypeConstraintStubImpl( - parent: StubElement?, - private val isCompanionObjectConstraint: Boolean -) : KotlinStubBaseImpl(parent, JetStubElementTypes.TYPE_CONSTRAINT), KotlinTypeConstraintStub { - - override fun isCompanionObjectConstraint() = isCompanionObjectConstraint -} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java index cd4a0bb1b17..13921ded53e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java @@ -158,12 +158,12 @@ public class DeclarationsChecker { for (JetTypeParameter jetTypeParameter : jetClass.getTypeParameters()) { checkBoundsForTypeInClassHeader(jetTypeParameter.getExtendsBound()); - checkFinalUpperBounds(jetTypeParameter.getExtendsBound(), false); + checkFinalUpperBounds(jetTypeParameter.getExtendsBound()); } for (JetTypeConstraint constraint : jetClass.getTypeConstraints()) { checkBoundsForTypeInClassHeader(constraint.getBoundTypeReference()); - checkFinalUpperBounds(constraint.getBoundTypeReference(), constraint.isCompanionObjectConstraint()); + checkFinalUpperBounds(constraint.getBoundTypeReference()); } } @@ -176,11 +176,11 @@ public class DeclarationsChecker { } } - private void checkFinalUpperBounds(@Nullable JetTypeReference typeReference, boolean isCompanionObjectConstraint) { + private void checkFinalUpperBounds(@Nullable JetTypeReference typeReference) { if (typeReference != null) { JetType type = trace.getBindingContext().get(TYPE, typeReference); if (type != null) { - DescriptorResolver.checkUpperBoundType(typeReference, type, isCompanionObjectConstraint, trace); + DescriptorResolver.checkUpperBoundType(typeReference, type, trace); } } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java index 3789c237d62..686ed00181a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java @@ -456,12 +456,10 @@ public class DescriptorResolver { static final class UpperBoundCheckerTask { JetTypeReference upperBound; JetType upperBoundType; - boolean isCompanionObjectConstraint; - private UpperBoundCheckerTask(JetTypeReference upperBound, JetType upperBoundType, boolean companionObjectConstraint) { + private UpperBoundCheckerTask(JetTypeReference upperBound, JetType upperBoundType) { this.upperBound = upperBound; this.upperBoundType = upperBoundType; - isCompanionObjectConstraint = companionObjectConstraint; } } @@ -486,12 +484,10 @@ public class DescriptorResolver { if (extendsBound != null) { JetType type = typeResolver.resolveType(scope, extendsBound, trace, false); typeParameterDescriptor.addUpperBound(type); - deferredUpperBoundCheckerTasks.add(new UpperBoundCheckerTask(extendsBound, type, false)); + deferredUpperBoundCheckerTasks.add(new UpperBoundCheckerTask(extendsBound, type)); } } for (JetTypeConstraint constraint : declaration.getTypeConstraints()) { - reportUnsupportedCompanionObjectConstraint(trace, constraint); - JetSimpleNameExpression subjectTypeParameterName = constraint.getSubjectTypeParameterName(); if (subjectTypeParameterName == null) { continue; @@ -502,19 +498,13 @@ public class DescriptorResolver { JetType bound = null; if (boundTypeReference != null) { bound = typeResolver.resolveType(scope, boundTypeReference, trace, false); - deferredUpperBoundCheckerTasks - .add(new UpperBoundCheckerTask(boundTypeReference, bound, constraint.isCompanionObjectConstraint())); + deferredUpperBoundCheckerTasks.add(new UpperBoundCheckerTask(boundTypeReference, bound)); } if (typeParameterDescriptor != null) { trace.record(BindingContext.REFERENCE_TARGET, subjectTypeParameterName, typeParameterDescriptor); if (bound != null) { - if (constraint.isCompanionObjectConstraint()) { - // Companion object bounds are not supported - } - else { - typeParameterDescriptor.addUpperBound(bound); - } + typeParameterDescriptor.addUpperBound(bound); } } } @@ -529,7 +519,7 @@ public class DescriptorResolver { if (!(declaration instanceof JetClass)) { for (UpperBoundCheckerTask checkerTask : deferredUpperBoundCheckerTasks) { - checkUpperBoundType(checkerTask.upperBound, checkerTask.upperBoundType, checkerTask.isCompanionObjectConstraint, trace); + checkUpperBoundType(checkerTask.upperBound, checkerTask.upperBoundType, trace); } checkNamesInConstraints(declaration, descriptor, scope, trace); @@ -577,25 +567,13 @@ public class DescriptorResolver { } } - public static void reportUnsupportedCompanionObjectConstraint(BindingTrace trace, JetTypeConstraint constraint) { - if (constraint.isCompanionObjectConstraint()) { - trace.report(UNSUPPORTED.on(constraint, "Companion objects constraints are not supported yet")); - } - } - public static void checkUpperBoundType( JetTypeReference upperBound, @NotNull JetType upperBoundType, - boolean isCompanionObjectConstraint, BindingTrace trace ) { if (!TypeUtils.canHaveSubtypes(JetTypeChecker.DEFAULT, upperBoundType)) { - if (isCompanionObjectConstraint) { - trace.report(FINAL_COMPANION_OBJECT_UPPER_BOUND.on(upperBound, upperBoundType)); - } - else { - trace.report(FINAL_UPPER_BOUND.on(upperBound, upperBoundType)); - } + trace.report(FINAL_UPPER_BOUND.on(upperBound, upperBoundType)); } if (TypesPackage.isDynamic(upperBoundType)) { trace.report(DYNAMIC_UPPER_BOUND.on(upperBound)); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyTypeParameterDescriptor.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyTypeParameterDescriptor.java index fff429eacae..2ac33a31c48 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyTypeParameterDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyTypeParameterDescriptor.java @@ -83,8 +83,6 @@ public class LazyTypeParameterDescriptor extends AbstractLazyTypeParameterDescri if (classOrObject instanceof JetClass) { JetClass jetClass = (JetClass) classOrObject; for (JetTypeConstraint jetTypeConstraint : jetClass.getTypeConstraints()) { - DescriptorResolver.reportUnsupportedCompanionObjectConstraint(c.getTrace(), jetTypeConstraint); - JetSimpleNameExpression constrainedParameterName = jetTypeConstraint.getSubjectTypeParameterName(); if (constrainedParameterName != null) { if (getName().equals(constrainedParameterName.getReferencedNameAsName())) { @@ -93,9 +91,7 @@ public class LazyTypeParameterDescriptor extends AbstractLazyTypeParameterDescri JetTypeReference boundTypeReference = jetTypeConstraint.getBoundTypeReference(); if (boundTypeReference != null) { JetType boundType = resolveBoundType(boundTypeReference); - if (!jetTypeConstraint.isCompanionObjectConstraint()) { - upperBounds.add(boundType); - } + upperBounds.add(boundType); } } } diff --git a/compiler/testData/diagnostics/tests/FinalClassObjectBound.kt b/compiler/testData/diagnostics/tests/FinalClassObjectBound.kt deleted file mode 100644 index f7bf2f02c9c..00000000000 --- a/compiler/testData/diagnostics/tests/FinalClassObjectBound.kt +++ /dev/null @@ -1,4 +0,0 @@ -class Other -trait Trait -trait WithBounds -class Test1 where class object T: WithBounds<Other> \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/FinalClassObjectBound.txt b/compiler/testData/diagnostics/tests/FinalClassObjectBound.txt deleted file mode 100644 index e02782af546..00000000000 --- a/compiler/testData/diagnostics/tests/FinalClassObjectBound.txt +++ /dev/null @@ -1,27 +0,0 @@ -package - -internal final class Other { - public constructor Other() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal final class Test1 { - public constructor Test1() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal trait Trait { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal trait WithBounds { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/MultipleBounds.kt b/compiler/testData/diagnostics/tests/MultipleBounds.kt index 746332c7049..0fcd73ad2fe 100644 --- a/compiler/testData/diagnostics/tests/MultipleBounds.kt +++ b/compiler/testData/diagnostics/tests/MultipleBounds.kt @@ -23,10 +23,7 @@ class D() { class Test1() where T : B, - B : T, // error - class object T : A, - class object T : B, - class object B : T + B : T // error { fun test(t : T) { @@ -55,10 +52,7 @@ class Y<T : Foo> where T fun test2(t : T) where T : B, - B : T, - class object B : T, - class object T : B, - class object T : A + B : T { T.foo() T.bar() @@ -70,9 +64,4 @@ val t1 = test2<A>(A()) val t2 = test2<B>(C()) val t3 = test2(C()) -class Test - where - class object T : Foo, - class object T : A {} - val x : Int = 0 \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/MultipleBounds.txt b/compiler/testData/diagnostics/tests/MultipleBounds.txt index 6fc591e9688..e50ab3723e2 100644 --- a/compiler/testData/diagnostics/tests/MultipleBounds.txt +++ b/compiler/testData/diagnostics/tests/MultipleBounds.txt @@ -78,13 +78,6 @@ package Jet87 { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - internal final class Test { - public constructor Test() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } - internal final class Test1 where T : Jet87.B { public constructor Test1() where T : Jet87.B public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/generics/ClassObjectBoundsAreNotSupported.kt b/compiler/testData/diagnostics/tests/generics/ClassObjectBoundsAreNotSupported.kt deleted file mode 100644 index 63c79d717a1..00000000000 --- a/compiler/testData/diagnostics/tests/generics/ClassObjectBoundsAreNotSupported.kt +++ /dev/null @@ -1,2 +0,0 @@ -class C where class object T: Any -fun f() where class object T: Any {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/generics/ClassObjectBoundsAreNotSupported.txt b/compiler/testData/diagnostics/tests/generics/ClassObjectBoundsAreNotSupported.txt deleted file mode 100644 index 8b0ba58fe3f..00000000000 --- a/compiler/testData/diagnostics/tests/generics/ClassObjectBoundsAreNotSupported.txt +++ /dev/null @@ -1,10 +0,0 @@ -package - -internal fun f(): kotlin.Unit - -internal final class C { - public constructor C() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/generics/kt1575-ClassObject.kt b/compiler/testData/diagnostics/tests/generics/kt1575-ClassObject.kt deleted file mode 100644 index 70add8bb3ac..00000000000 --- a/compiler/testData/diagnostics/tests/generics/kt1575-ClassObject.kt +++ /dev/null @@ -1 +0,0 @@ -class CO where class object T : CO \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/generics/kt1575-ClassObject.txt b/compiler/testData/diagnostics/tests/generics/kt1575-ClassObject.txt deleted file mode 100644 index 1587f0b81b0..00000000000 --- a/compiler/testData/diagnostics/tests/generics/kt1575-ClassObject.txt +++ /dev/null @@ -1,8 +0,0 @@ -package - -internal final class CO { - public constructor CO() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/psi/TypeConstraints.kt b/compiler/testData/psi/TypeConstraints.kt index b152fcf3609..5acbc040994 100644 --- a/compiler/testData/psi/TypeConstraints.kt +++ b/compiler/testData/psi/TypeConstraints.kt @@ -1,3 +1,3 @@ -class foo where T : T, class object T : T { +class foo where T : T { } \ No newline at end of file diff --git a/compiler/testData/psi/TypeConstraints.txt b/compiler/testData/psi/TypeConstraints.txt index 6b1754c8a1e..e7487f7d042 100644 --- a/compiler/testData/psi/TypeConstraints.txt +++ b/compiler/testData/psi/TypeConstraints.txt @@ -24,22 +24,6 @@ JetFile: TypeConstraints.kt USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_CONSTRAINT - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(object)('object') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') PsiWhiteSpace(' ') CLASS_BODY PsiElement(LBRACE)('{') diff --git a/compiler/testData/psi/examples/PolymorphicClassObjects.kt b/compiler/testData/psi/examples/PolymorphicClassObjects.kt deleted file mode 100644 index fdeadc1e859..00000000000 --- a/compiler/testData/psi/examples/PolymorphicClassObjects.kt +++ /dev/null @@ -1,27 +0,0 @@ -open class Builder { - [operator] fun plusAssign(item : E) - fun result() : R -} - -open class Buildable { - fun newBuilder() : Builder -} - -class List { - - companion object : Buildable { - override fun newBuilder() : Builder - - } - -} - -fun Map.map(f : (E) -> R) : T where - T : Iterable, - class object T : Buildable = { - val builder = T.newBuilder() - for (e in this) { - builder += f(e) - } - builder.result() -} \ No newline at end of file diff --git a/compiler/testData/psi/examples/PolymorphicClassObjects.txt b/compiler/testData/psi/examples/PolymorphicClassObjects.txt deleted file mode 100644 index 57fb8663e64..00000000000 --- a/compiler/testData/psi/examples/PolymorphicClassObjects.txt +++ /dev/null @@ -1,404 +0,0 @@ -JetFile: PolymorphicClassObjects.kt - PACKAGE_DIRECTIVE - - CLASS - MODIFIER_LIST - PsiElement(open)('open') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('Builder') - TYPE_PARAMETER_LIST - PsiElement(LT)('<') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('E') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('R') - PsiElement(GT)('>') - PsiWhiteSpace(' ') - CLASS_BODY - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - FUN - MODIFIER_LIST - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('operator') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('plusAssign') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('item') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('E') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - FUN - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('result') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('R') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - PsiElement(open)('open') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('Buildable') - PsiWhiteSpace(' ') - CLASS_BODY - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - FUN - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('newBuilder') - TYPE_PARAMETER_LIST - PsiElement(LT)('<') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('E') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('R') - PsiElement(GT)('>') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Builder') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('E') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('R') - PsiElement(GT)('>') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n') - CLASS - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('List') - TYPE_PARAMETER_LIST - PsiElement(LT)('<') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiWhiteSpace(' ') - CLASS_BODY - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n\n ') - OBJECT_DECLARATION - MODIFIER_LIST - PsiElement(companion)('companion') - PsiWhiteSpace(' ') - PsiElement(object)('object') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - DELEGATION_SPECIFIER_LIST - DELEGATOR_SUPER_CLASS - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Buildable') - PsiWhiteSpace(' ') - CLASS_BODY - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - FUN - MODIFIER_LIST - PsiElement(override)('override') - PsiWhiteSpace(' ') - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('newBuilder') - TYPE_PARAMETER_LIST - PsiElement(LT)('<') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('E') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('R') - PsiElement(GT)('>') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Builder') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('E') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('R') - PsiElement(GT)('>') - PsiWhiteSpace('\n\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n') - FUN - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - TYPE_PARAMETER_LIST - PsiElement(LT)('<') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('E') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('T') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PARAMETER - PsiElement(IDENTIFIER)('R') - PsiElement(GT)('>') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Map') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('E') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiElement(DOT)('.') - PsiElement(IDENTIFIER)('map') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - FUNCTION_TYPE - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('E') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(ARROW)('->') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('R') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('R') - PsiElement(GT)('>') - PsiWhiteSpace(' ') - PsiElement(where)('where') - PsiWhiteSpace('\n ') - TYPE_CONSTRAINT_LIST - TYPE_CONSTRAINT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Iterable') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('E') - PsiElement(GT)('>') - PsiElement(COMMA)(',') - PsiWhiteSpace('\n ') - TYPE_CONSTRAINT - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(object)('object') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Buildable') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('E') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(GT)('>') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - PROPERTY - PsiElement(val)('val') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('builder') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('newBuilder') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - FOR - PsiElement(for)('for') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('e') - PsiWhiteSpace(' ') - PsiElement(in)('in') - PsiWhiteSpace(' ') - LOOP_RANGE - THIS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(this)('this') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BODY - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('builder') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(PLUSEQ)('+=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('f') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('e') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('builder') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('result') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 8c367bd4660..caf84ceb3f0 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -270,12 +270,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } - @TestMetadata("FinalClassObjectBound.kt") - public void testFinalClassObjectBound() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/FinalClassObjectBound.kt"); - doTest(fileName); - } - @TestMetadata("ForRangeConventions.kt") public void testForRangeConventions() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/ForRangeConventions.kt"); @@ -5035,24 +5029,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } - @TestMetadata("ClassObjectBoundsAreNotSupported.kt") - public void testClassObjectBoundsAreNotSupported() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/ClassObjectBoundsAreNotSupported.kt"); - doTest(fileName); - } - @TestMetadata("kt1575-Class.kt") public void testKt1575_Class() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/kt1575-Class.kt"); doTest(fileName); } - @TestMetadata("kt1575-ClassObject.kt") - public void testKt1575_ClassObject() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/kt1575-ClassObject.kt"); - doTest(fileName); - } - @TestMetadata("kt1575-Function.kt") public void testKt1575_Function() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/kt1575-Function.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java index b068a59fc49..5fa9ce7ca14 100644 --- a/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java @@ -808,12 +808,6 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { doParsingTest(fileName); } - @TestMetadata("PolymorphicClassObjects.kt") - public void testPolymorphicClassObjects() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/examples/PolymorphicClassObjects.kt"); - doParsingTest(fileName); - } - @TestMetadata("Queue.kt") public void testQueue() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/examples/Queue.kt"); diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt index c1f085de3d9..c9cdc108add 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt @@ -195,7 +195,7 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) { } val typeConstraintListStub = KotlinPlaceHolderStubImpl(parent, JetStubElementTypes.TYPE_CONSTRAINT_LIST) for ((name, type) in protosForTypeConstraintList) { - val typeConstraintStub = KotlinTypeConstraintStubImpl(typeConstraintListStub, isCompanionObjectConstraint = false) + val typeConstraintStub = KotlinPlaceHolderStubImpl(typeConstraintListStub, JetStubElementTypes.TYPE_CONSTRAINT) KotlinNameReferenceExpressionStubImpl(typeConstraintStub, name.ref()) createTypeReferenceStub(typeConstraintStub, type) } diff --git a/idea/testData/checker/Builders.kt b/idea/testData/checker/Builders.kt index e92eecd8ff6..296de8b6e68 100644 --- a/idea/testData/checker/Builders.kt +++ b/idea/testData/checker/Builders.kt @@ -15,7 +15,7 @@ import java.util.* val attributes = HashMap() protected fun initTag(init : T.() -> Unit) : T - where class object T : Factory{ + { val tag = T.create() tag.init() children.add(tag) diff --git a/idea/testData/checker/MultipleBounds.kt b/idea/testData/checker/MultipleBounds.kt index 063cf655220..a2ccd56b410 100644 --- a/idea/testData/checker/MultipleBounds.kt +++ b/idea/testData/checker/MultipleBounds.kt @@ -17,10 +17,7 @@ class D() { class Test1() where T : B, - B : T, // error - class object T : A, - class object T : B, - class object B : T + B : T // error { fun test(t : T) { @@ -49,10 +46,7 @@ class Y<T : Foo> where T : Bar test2(t : T) where T : B, - B : T, - class object B : T, - class object T : B, - class object T : A + B : T { T.foo() T.bar() @@ -64,9 +58,4 @@ val t1 = test2<A>(A()) val t2 = test2<B>(C()) val t3 = test2(C()) -class Test - where - class object T : Foo, - class object T : A {} - val x : Int = 0 diff --git a/idea/testData/decompiler/stubBuilder/SecondaryConstructors/SecondaryConstructors.txt b/idea/testData/decompiler/stubBuilder/SecondaryConstructors/SecondaryConstructors.txt index 8404fb664fb..211b6090a63 100644 --- a/idea/testData/decompiler/stubBuilder/SecondaryConstructors/SecondaryConstructors.txt +++ b/idea/testData/decompiler/stubBuilder/SecondaryConstructors/SecondaryConstructors.txt @@ -54,7 +54,7 @@ PsiJetFileStubImpl[package=test] REFERENCE_EXPRESSION:[referencedName=kotlin] REFERENCE_EXPRESSION:[referencedName=Int] TYPE_CONSTRAINT_LIST: - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=G] TYPE_REFERENCE: USER_TYPE:[isAbsoluteInRootPackage=false] diff --git a/idea/testData/decompiler/stubBuilder/TypeBoundsAndDelegationSpecifiers/TypeBoundsAndDelegationSpecifiers.txt b/idea/testData/decompiler/stubBuilder/TypeBoundsAndDelegationSpecifiers/TypeBoundsAndDelegationSpecifiers.txt index 8d9e4932ffe..10b3a3b26c3 100644 --- a/idea/testData/decompiler/stubBuilder/TypeBoundsAndDelegationSpecifiers/TypeBoundsAndDelegationSpecifiers.txt +++ b/idea/testData/decompiler/stubBuilder/TypeBoundsAndDelegationSpecifiers/TypeBoundsAndDelegationSpecifiers.txt @@ -34,7 +34,7 @@ PsiJetFileStubImpl[package=test] REFERENCE_EXPRESSION:[referencedName=test] REFERENCE_EXPRESSION:[referencedName=T] TYPE_CONSTRAINT_LIST: - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=H] TYPE_REFERENCE: USER_TYPE:[isAbsoluteInRootPackage=false] @@ -48,14 +48,14 @@ PsiJetFileStubImpl[package=test] USER_TYPE:[isAbsoluteInRootPackage=false] REFERENCE_EXPRESSION:[referencedName=kotlin] REFERENCE_EXPRESSION:[referencedName=String] - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=G] TYPE_REFERENCE: USER_TYPE:[isAbsoluteInRootPackage=false] USER_TYPE:[isAbsoluteInRootPackage=false] REFERENCE_EXPRESSION:[referencedName=kotlin] REFERENCE_EXPRESSION:[referencedName=CharSequence] - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=C] TYPE_REFERENCE: NULLABLE_TYPE: diff --git a/idea/testData/decompiler/stubBuilder/TypeParams/TypeParams.txt b/idea/testData/decompiler/stubBuilder/TypeParams/TypeParams.txt index cf2fefc1f6f..f82ff3d2502 100644 --- a/idea/testData/decompiler/stubBuilder/TypeParams/TypeParams.txt +++ b/idea/testData/decompiler/stubBuilder/TypeParams/TypeParams.txt @@ -49,7 +49,7 @@ PsiJetFileStubImpl[package=test] MODIFIER_LIST:[public] VALUE_PARAMETER_LIST: TYPE_CONSTRAINT_LIST: - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=T1] TYPE_REFERENCE: NULLABLE_TYPE: @@ -57,7 +57,7 @@ PsiJetFileStubImpl[package=test] USER_TYPE:[isAbsoluteInRootPackage=false] REFERENCE_EXPRESSION:[referencedName=kotlin] REFERENCE_EXPRESSION:[referencedName=Any] - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=T1] TYPE_REFERENCE: NULLABLE_TYPE: @@ -65,14 +65,14 @@ PsiJetFileStubImpl[package=test] USER_TYPE:[isAbsoluteInRootPackage=false] REFERENCE_EXPRESSION:[referencedName=kotlin] REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=T1] TYPE_REFERENCE: USER_TYPE:[isAbsoluteInRootPackage=false] USER_TYPE:[isAbsoluteInRootPackage=false] REFERENCE_EXPRESSION:[referencedName=kotlin] REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=T7] TYPE_REFERENCE: USER_TYPE:[isAbsoluteInRootPackage=false] @@ -355,14 +355,14 @@ PsiJetFileStubImpl[package=test] REFERENCE_EXPRESSION:[referencedName=kotlin] REFERENCE_EXPRESSION:[referencedName=Unit] TYPE_CONSTRAINT_LIST: - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=G3] TYPE_REFERENCE: USER_TYPE:[isAbsoluteInRootPackage=false] USER_TYPE:[isAbsoluteInRootPackage=false] REFERENCE_EXPRESSION:[referencedName=kotlin] REFERENCE_EXPRESSION:[referencedName=String] - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=G3] TYPE_REFERENCE: NULLABLE_TYPE: diff --git a/idea/testData/stubs/SecondaryConstructors.expected b/idea/testData/stubs/SecondaryConstructors.expected index feefbd11212..8e808d7b220 100644 --- a/idea/testData/stubs/SecondaryConstructors.expected +++ b/idea/testData/stubs/SecondaryConstructors.expected @@ -42,7 +42,7 @@ PsiJetFileStubImpl[package=test] USER_TYPE:[isAbsoluteInRootPackage=false] REFERENCE_EXPRESSION:[referencedName=Int] TYPE_CONSTRAINT_LIST: - TYPE_CONSTRAINT:[isCompanionObjectConstraint=false] + TYPE_CONSTRAINT: REFERENCE_EXPRESSION:[referencedName=G] TYPE_REFERENCE: USER_TYPE:[isAbsoluteInRootPackage=false] diff --git a/js/js.translator/testData/examples/sortedTests/unsupported/classObjectMethod.kt b/js/js.translator/testData/examples/sortedTests/unsupported/classObjectMethod.kt deleted file mode 100644 index 55dd6926eda..00000000000 --- a/js/js.translator/testData/examples/sortedTests/unsupported/classObjectMethod.kt +++ /dev/null @@ -1,13 +0,0 @@ -abstract open class Default { - abstract fun defaultValue(): Int -} - -class MyInt() { - companion object : Default { - override fun defaultValue(): Int = 610 - } -} - -fun toDefault(t: T) where class object T : Default = T.defaultValue() - -fun box(): String = if (toDefault(MyInt()) == 610) "OK" else "fail"