Unit obtained through a generic substitution should not be mapped to VOID

This commit is contained in:
Andrey Breslav
2014-10-06 21:45:12 +04:00
parent f5aed51fd0
commit 5be4dda58b
4 changed files with 48 additions and 2 deletions
@@ -159,7 +159,9 @@ public class JetTypeMapper {
private Type mapReturnType(@NotNull CallableDescriptor descriptor, @Nullable BothSignatureWriter sw) {
JetType returnType = descriptor.getReturnType();
assert returnType != null : "Function has no return type: " + descriptor;
if (returnType.equals(KotlinBuiltIns.getInstance().getUnitType()) && !(descriptor instanceof PropertyGetterDescriptor)) {
if (returnType.equals(KotlinBuiltIns.getInstance().getUnitType())
&& !TypeUtils.isNullableType(returnType)
&& !(descriptor instanceof PropertyGetterDescriptor)) {
if (sw != null) {
sw.writeAsmType(Type.VOID_TYPE);
}