Remove traces of class object constraints feature from parser, frontend, tests and psi
This commit is contained in:
@@ -220,7 +220,6 @@ public interface Errors {
|
||||
// Type parameter declarations
|
||||
|
||||
DiagnosticFactory1<JetTypeReference, JetType> FINAL_UPPER_BOUND = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory1<JetTypeReference, JetType> FINAL_COMPANION_OBJECT_UPPER_BOUND = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory0<JetTypeReference> DYNAMIC_UPPER_BOUND = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory1<JetNamedDeclaration, TypeParameterDescriptor> CONFLICTING_UPPER_BOUNDS =
|
||||
|
||||
-1
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<KotlinTypeConstraintStub> {
|
||||
public class JetTypeConstraint extends JetElementImplStub<KotlinPlaceHolderStub<JetTypeConstraint>> {
|
||||
public JetTypeConstraint(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public JetTypeConstraint(@NotNull KotlinTypeConstraintStub stub) {
|
||||
public JetTypeConstraint(@NotNull KotlinPlaceHolderStub<JetTypeConstraint> stub) {
|
||||
super(stub, JetStubElementTypes.TYPE_CONSTRAINT);
|
||||
}
|
||||
|
||||
@@ -37,15 +36,6 @@ public class JetTypeConstraint extends JetElementImplStub<KotlinTypeConstraintSt
|
||||
return visitor.visitTypeConstraint(this, data);
|
||||
}
|
||||
|
||||
public boolean isCompanionObjectConstraint() {
|
||||
KotlinTypeConstraintStub stub = getStub();
|
||||
if (stub != null) {
|
||||
return stub.isCompanionObjectConstraint();
|
||||
}
|
||||
return findChildByType(JetTokens.CLASS_KEYWORD) != null &&
|
||||
findChildByType(JetTokens.OBJECT_KEYWORD) != null;
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetSimpleNameExpression getSubjectTypeParameterName() {
|
||||
return getStubOrPsiChild(JetStubElementTypes.REFERENCE_EXPRESSION);
|
||||
|
||||
@@ -103,10 +103,6 @@ public trait KotlinPropertyStub : KotlinStubWithFqName<JetProperty> {
|
||||
public fun isProbablyNothingType(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinTypeConstraintStub : StubElement<JetTypeConstraint> {
|
||||
public fun isCompanionObjectConstraint(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinTypeParameterStub : KotlinStubWithFqName<JetTypeParameter> {
|
||||
public fun isInVariance(): Boolean
|
||||
public fun isOutVariance(): Boolean
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinFileStubImpl;
|
||||
import java.io.IOException;
|
||||
|
||||
public class JetFileElementType extends IStubFileElementType<KotlinFileStub> {
|
||||
public static final int STUB_VERSION = 41;
|
||||
public static final int STUB_VERSION = 42;
|
||||
|
||||
private static final String NAME = "kotlin.FILE";
|
||||
|
||||
|
||||
+2
-1
@@ -70,7 +70,8 @@ public interface JetStubElementTypes {
|
||||
JetPlaceHolderStubElementType<JetTypeConstraintList> TYPE_CONSTRAINT_LIST =
|
||||
new JetPlaceHolderStubElementType<JetTypeConstraintList>("TYPE_CONSTRAINT_LIST", JetTypeConstraintList.class);
|
||||
|
||||
JetTypeConstraintElementType TYPE_CONSTRAINT = new JetTypeConstraintElementType("TYPE_CONSTRAINT");
|
||||
JetPlaceHolderStubElementType<JetTypeConstraint> TYPE_CONSTRAINT =
|
||||
new JetPlaceHolderStubElementType<JetTypeConstraint>("TYPE_CONSTRAINT", JetTypeConstraint.class);
|
||||
|
||||
JetPlaceHolderStubElementType<JetNullableType> NULLABLE_TYPE =
|
||||
new JetPlaceHolderStubElementType<JetNullableType>("NULLABLE_TYPE", JetNullableType.class);
|
||||
|
||||
-51
@@ -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<KotlinTypeConstraintStub, JetTypeConstraint> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
-31
@@ -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<out PsiElement>?,
|
||||
private val isCompanionObjectConstraint: Boolean
|
||||
) : KotlinStubBaseImpl<JetTypeConstraint>(parent, JetStubElementTypes.TYPE_CONSTRAINT), KotlinTypeConstraintStub {
|
||||
|
||||
override fun isCompanionObjectConstraint() = isCompanionObjectConstraint
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
+1
-5
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
class Other
|
||||
trait Trait
|
||||
trait WithBounds<T: Trait>
|
||||
class Test1<T> where <!UNSUPPORTED!>class object T: WithBounds<<!UPPER_BOUND_VIOLATED!>Other<!>><!>
|
||||
@@ -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</*0*/ T> {
|
||||
public constructor Test1</*0*/ T>()
|
||||
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</*0*/ T : 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
|
||||
}
|
||||
@@ -23,10 +23,7 @@ class D() {
|
||||
class Test1<T : A>()
|
||||
where
|
||||
T : B,
|
||||
<!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T, // error
|
||||
<!UNSUPPORTED!>class object T : A<!>,
|
||||
<!UNSUPPORTED!>class object T : B<!>,
|
||||
<!UNSUPPORTED!>class object <!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T<!>
|
||||
<!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T // error
|
||||
{
|
||||
|
||||
fun test(t : T) {
|
||||
@@ -55,10 +52,7 @@ class Y<<!CONFLICTING_UPPER_BOUNDS!>T<!> : <!FINAL_UPPER_BOUND!>Foo<!>> where T
|
||||
fun <T : A> test2(t : T)
|
||||
where
|
||||
T : B,
|
||||
<!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T,
|
||||
<!UNSUPPORTED!>class object <!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T<!>,
|
||||
<!UNSUPPORTED!>class object T : B<!>,
|
||||
<!UNSUPPORTED!>class object T : A<!>
|
||||
<!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T
|
||||
{
|
||||
<!TYPE_PARAMETER_ON_LHS_OF_DOT!>T<!>.<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
<!TYPE_PARAMETER_ON_LHS_OF_DOT!>T<!>.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
@@ -70,9 +64,4 @@ val t1 = test2<<!UPPER_BOUND_VIOLATED!>A<!>>(A())
|
||||
val t2 = test2<<!UPPER_BOUND_VIOLATED!>B<!>>(C())
|
||||
val t3 = test2<C>(C())
|
||||
|
||||
class Test<T>
|
||||
where
|
||||
<!UNSUPPORTED!>class object T : <!FINAL_COMPANION_OBJECT_UPPER_BOUND!>Foo<!><!>,
|
||||
<!UNSUPPORTED!>class object T : A<!> {}
|
||||
|
||||
val <T, B : T> x : Int = 0
|
||||
@@ -78,13 +78,6 @@ package Jet87 {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class Test</*0*/ T> {
|
||||
public constructor Test</*0*/ T>()
|
||||
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</*0*/ T : Jet87.A> where T : Jet87.B {
|
||||
public constructor Test1</*0*/ T : Jet87.A>() where T : Jet87.B
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
class C<T> where <!UNSUPPORTED!>class object T: Any<!>
|
||||
fun f<T>() where <!UNSUPPORTED!>class object T: Any<!> {}
|
||||
@@ -1,10 +0,0 @@
|
||||
package
|
||||
|
||||
internal fun </*0*/ T> f(): kotlin.Unit
|
||||
|
||||
internal final class C</*0*/ T> {
|
||||
public constructor C</*0*/ T>()
|
||||
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
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
class CO<T> where <!UNSUPPORTED!>class object T : CO<T><!>
|
||||
@@ -1,8 +0,0 @@
|
||||
package
|
||||
|
||||
internal final class CO</*0*/ T> {
|
||||
public constructor CO</*0*/ T>()
|
||||
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
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
class foo<T> where T : T, class object T : T {
|
||||
class foo<T> where T : T {
|
||||
|
||||
}
|
||||
@@ -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)('{')
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
open class Builder<E, R> {
|
||||
[operator] fun plusAssign(item : E)
|
||||
fun result() : R
|
||||
}
|
||||
|
||||
open class Buildable {
|
||||
fun newBuilder<E, R>() : Builder<E, R>
|
||||
}
|
||||
|
||||
class List<T> {
|
||||
|
||||
companion object : Buildable {
|
||||
override fun newBuilder<E, R>() : Builder<E, R>
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <E, T, R> Map<E, T>.map(f : (E) -> R) : T<R> where
|
||||
T : Iterable<E>,
|
||||
class object T : Buildable<E, T> = {
|
||||
val builder = T.newBuilder()
|
||||
for (e in this) {
|
||||
builder += f(e)
|
||||
}
|
||||
builder.result()
|
||||
}
|
||||
@@ -1,404 +0,0 @@
|
||||
JetFile: PolymorphicClassObjects.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
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)('}')
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
|
||||
}
|
||||
val typeConstraintListStub = KotlinPlaceHolderStubImpl<JetTypeConstraintList>(parent, JetStubElementTypes.TYPE_CONSTRAINT_LIST)
|
||||
for ((name, type) in protosForTypeConstraintList) {
|
||||
val typeConstraintStub = KotlinTypeConstraintStubImpl(typeConstraintListStub, isCompanionObjectConstraint = false)
|
||||
val typeConstraintStub = KotlinPlaceHolderStubImpl<JetTypeConstraint>(typeConstraintListStub, JetStubElementTypes.TYPE_CONSTRAINT)
|
||||
KotlinNameReferenceExpressionStubImpl(typeConstraintStub, name.ref())
|
||||
createTypeReferenceStub(typeConstraintStub, type)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.*
|
||||
val attributes = HashMap<String, String>()
|
||||
|
||||
protected fun initTag<T : Element>(<warning>init</warning> : T.() -> Unit) : T
|
||||
where <error>class object T : Factory<T></error>{
|
||||
{
|
||||
val tag = <error>T</error>.<error>create</error>()
|
||||
<error>tag</error>.<error>init</error>()
|
||||
children.add(<error>tag</error>)
|
||||
|
||||
@@ -17,10 +17,7 @@ class D() {
|
||||
class Test1<T : A>()
|
||||
where
|
||||
T : B,
|
||||
<error>B</error> : T, // error
|
||||
<error>class object T : A</error>,
|
||||
<error>class object T : B</error>,
|
||||
<error>class object <error>B</error> : T</error>
|
||||
<error>B</error> : T // error
|
||||
{
|
||||
|
||||
fun test(t : T) {
|
||||
@@ -49,10 +46,7 @@ class Y<<error>T</error> : <warning>Foo</warning>> where T : <warning>Bar<Foo></
|
||||
fun <T : A> test2(t : T)
|
||||
where
|
||||
T : B,
|
||||
<error>B</error> : T,
|
||||
<error>class object <error>B</error> : T</error>,
|
||||
<error>class object T : B</error>,
|
||||
<error>class object T : A</error>
|
||||
<error>B</error> : T
|
||||
{
|
||||
<error>T</error>.<error>foo</error>()
|
||||
<error>T</error>.<error>bar</error>()
|
||||
@@ -64,9 +58,4 @@ val t1 = test2<<error>A</error>>(A())
|
||||
val t2 = test2<<error>B</error>>(C())
|
||||
val t3 = test2<C>(C())
|
||||
|
||||
class Test<T>
|
||||
where
|
||||
<error>class object T : <error>Foo</error></error>,
|
||||
<error>class object T : A</error> {}
|
||||
|
||||
val <T, B : T> x : Int = 0
|
||||
|
||||
+1
-1
@@ -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]
|
||||
|
||||
+3
-3
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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 : Any>(t: T) where class object T : Default = T.defaultValue()
|
||||
|
||||
fun box(): String = if (toDefault<MyInt>(MyInt()) == 610) "OK" else "fail"
|
||||
Reference in New Issue
Block a user