Do not wrap flexible types into Nullable/NotNull types

This commit is contained in:
Andrey Breslav
2014-08-25 19:09:11 +04:00
parent 141e731f39
commit bdbd469aad
3 changed files with 43 additions and 0 deletions
@@ -111,6 +111,8 @@ public class TypeUtils {
@NotNull
public static JetType makeNullableAsSpecified(@NotNull JetType type, boolean nullable) {
if (TypesPackage.isFlexible(type)) return type;
// Wrapping serves two purposes here
// 1. It's requires less memory than copying with a changed nullability flag: a copy has many fields, while a wrapper has only one
// 2. It preserves laziness of types