public static SoyType computeLowestCommonType ( SoyTypeRegistry typeRegistry , SoyType t0 , SoyType t1 ) { if ( t0 == ErrorType . getInstance ( ) || t1 == ErrorType . getInstance ( ) ) { return ErrorType . getInstance ( ) ; } if ( t0 . isAssignableFrom ( t1 ) ) { return t0 ; } else if ( t1 . isAssignableFrom ( t0 ) ) { return t1 ; } else { // Create a union. This preserves the most information. return typeRegistry . getOrCreateUnionType ( t0 , t1 ) ; } }
Compute the most specific type that is assignable from both t0 and t1 .