code: protected ClassNode findCurrentInstanceOfClass(final Expression expr, final ClassNode type) {
          if (!typeCheckingContext.temporaryIfBranchTypeInformation.empty()) {
              List<ClassNode> nodes = getTemporaryTypesForExpression(expr);
              if (nodes != null && nodes.size() == 1) return nodes.get(0);
          }
          return type;
      }
docs: A helper method which determines which receiver class should be used in error messages when a field or attribute
  is not found. The returned type class depends on whether we have temporary type information available (due to
  instanceof checks) and whether there is a single candidate in that case.
  
  @param expr the expression for which an unknown field has been found
  @param type the type of the expression (used as fallback type)
  @return if temporary information is available and there's only one type, returns the temporary type class
  otherwise falls back to the provided type class.