Fix for KT-4413 Do not add error types to supertype lists

The list is not filtered upon creation because it would force lazy types to compute

#KT-4413 Fixed
This commit is contained in:
Andrey Breslav
2014-01-16 20:01:41 +04:00
parent 72d3b46fc6
commit 0155bf0189
7 changed files with 123 additions and 0 deletions
@@ -316,6 +316,18 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme
@NotNull
@Override
public Collection<JetType> getSupertypes() {
// We cannot have error supertypes because subclasses inherit error functions from them
// Filtering right away means copying the list every time, so we check for the rare condition first, and only then filter
for (JetType supertype : supertypes) {
if (supertype.isError()) {
return KotlinPackage.filter(supertypes, new Function1<JetType, Boolean>() {
@Override
public Boolean invoke(JetType type) {
return !type.isError();
}
});
}
}
return supertypes;
}