Prohibit named parameters in function types in supertype position

This commit is contained in:
Alexey Tsvetkov
2015-10-07 15:39:47 +03:00
parent 90849a67ae
commit 0e606a3210
9 changed files with 57 additions and 8 deletions
@@ -427,6 +427,17 @@ public class BodyResolver {
JetTypeReference typeReference = entry.getKey();
JetType supertype = entry.getValue();
JetTypeElement typeElement = typeReference.getTypeElement();
if (typeElement instanceof JetFunctionType) {
for (JetParameter parameter : ((JetFunctionType) typeElement).getParameters()) {
PsiElement nameIdentifier = parameter.getNameIdentifier();
if (nameIdentifier != null) {
trace.report(Errors.UNSUPPORTED.on(nameIdentifier, "named parameter in function type in supertype position"));
}
}
}
boolean addSupertype = true;
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);