Community
Participate
Working Groups
Integer a = null; Currently results in a type mismatch error "can not convert Object to Integer". The evaluator already copes with null assignment, so this is only a validation issue. Unfotunately, it is not enough to only check for direct assignment of null - null values can also be part of type inference in other situations: var a = if wtf() then null else 2; where the common type of null and 2 (Integer) is computed. By introducing a NullType and modifying TypeUtils.isAssignableFrom(Type, Type), and other methods dealing with type compatibility to synthetically allow assignment of null the issue should be solved.
A NullType was introduced. Tests added that checks that ["a", null, "b"] results in List<String> being inferred (and a few other tests).