diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/CommonSupertypes.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/CommonSupertypes.java index 6c43f506593..a63c1cbd42c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/CommonSupertypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/CommonSupertypes.java @@ -35,8 +35,9 @@ import static org.jetbrains.jet.lang.types.Variance.*; public class CommonSupertypes { @NotNull public static JetType commonSupertype(@NotNull Collection types) { + assert !types.isEmpty(); Collection typeSet = new HashSet(types); - assert !typeSet.isEmpty(); + if (typeSet.size() == 1) return typeSet.iterator().next(); // If any of the types is nullable, the result must be nullable // This also removed Nothing and Nothing? because they are subtypes of everything else