Projections in immediate arguments to supertypes prohibited

This commit is contained in:
Andrey Breslav
2011-09-13 19:05:48 +04:00
parent bacd514919
commit f8cb012097
2 changed files with 16 additions and 0 deletions
@@ -106,6 +106,16 @@ public class ClassDescriptorResolver {
JetTypeReference typeReference = delegationSpecifier.getTypeReference();
if (typeReference != null) {
result.add(resolver.resolveType(extensibleScope, typeReference));
JetTypeElement typeElement = typeReference.getTypeElement();
if (typeElement instanceof JetUserType) {
JetUserType userType = (JetUserType) typeElement;
List<JetTypeProjection> typeArguments = userType.getTypeArguments();
for (JetTypeProjection typeArgument : typeArguments) {
if (typeArgument.getProjectionKind() != JetProjectionKind.NONE) {
trace.getErrorHandler().genericError(typeArgument.getProjectionNode(), "Projections are not allowed for immediate arguments of a supertype");
}
}
}
}
else {
result.add(ErrorUtils.createErrorType("No type reference"));
@@ -0,0 +1,6 @@
trait A<T> {}
trait B<T> {}
trait C<T> {}
trait D<T> {}
trait Test : A<<error>in</error> Int>, B<<error>out</error> T>, C<<error>*</error>>, D<Int> {}