public static StructuralTypingResult result(TypeRef left,TypeRef right,List<String> missingMembers,List<String> wrongMembersErrors){
  if (missingMembers.isEmpty() && wrongMembersErrors.isEmpty()) {
    return success();
  }
 else {
    String msg=left.getTypeRefAsString() + " is not a structural subtype of " + right.getTypeRefAsString()+ ": ";
    if (!missingMembers.isEmpty()) {
      msg+="missing " + missingMembers.get(0);
      if (missingMembers.size() > 1) {
        msg+=" and " + (missingMembers.size() - 1) + " more";
      }
    }
    if (!wrongMembersErrors.isEmpty()) {
      if (!missingMembers.isEmpty()) {
        msg+="; ";
      }
      msg+=wrongMembersErrors.get(0);
      if (wrongMembersErrors.size() > 1) {
        msg+=" and " + (wrongMembersErrors.size() - 1) + " more problems";
      }
    }
    return failure(msg);
  }
}

public static StructuralTypingResult result ( TypeRef left , TypeRef right , List < String > missingMembers , List < String > wrongMembersErrors ) { if ( missingMembers . isEmpty ( ) && wrongMembersErrors . isEmpty ( ) ) { return success ( ) ; } else { String msg = left . getTypeRefAsString ( ) + " is not a structural subtype of " + right . getTypeRefAsString ( ) + ": " ; if ( ! missingMembers . isEmpty ( ) ) { msg += "missing " + missingMembers . get ( 0 ) ; if ( missingMembers . size ( ) > 1 ) { msg += " and " + ( missingMembers . size ( ) - 1 ) + " more" ; } } if ( ! wrongMembersErrors . isEmpty ( ) ) { if ( ! missingMembers . isEmpty ( ) ) { msg += "; " ; } msg += wrongMembersErrors . get ( 0 ) ; if ( wrongMembersErrors . size ( ) > 1 ) { msg += " and " + ( wrongMembersErrors . size ( ) - 1 ) + " more problems" ; } } return failure ( msg ) ; } }
creates a result with failure ( value = false ) with appropriate error message , if the passed lists are non - empty ; otherwise a success is assumed ( value = true ) .
