@Override
 public JetTypeInfo visitObjectDeclaration(
     JetObjectDeclaration declaration, ExpressionTypingContext context) {
   TopDownAnalyzer.processClassOrObject(
       context.expressionTypingServices.getProject(),
       context.trace,
       scope,
       scope.getContainingDeclaration(),
       declaration);
   ClassDescriptor classDescriptor =
       context.trace.getBindingContext().get(BindingContext.CLASS, declaration);
   if (classDescriptor != null) {
     VariableDescriptor variableDescriptor =
         context
             .expressionTypingServices
             .getDescriptorResolver()
             .resolveObjectDeclaration(
                 scope.getContainingDeclaration(), declaration, classDescriptor, context.trace);
     scope.addVariableDescriptor(variableDescriptor);
   }
   return DataFlowUtils.checkStatementType(declaration, context, context.dataFlowInfo);
 }
 @Override
 public JetTypeInfo visitClass(JetClass klass, ExpressionTypingContext context) {
   TopDownAnalyzer.processClassOrObject(
       context.expressionTypingServices.getProject(),
       context.trace,
       scope,
       scope.getContainingDeclaration(),
       klass);
   ClassDescriptor classDescriptor =
       context.trace.getBindingContext().get(BindingContext.CLASS, klass);
   if (classDescriptor != null) {
     scope.addClassifierDescriptor(classDescriptor);
   }
   return DataFlowUtils.checkStatementType(klass, context, context.dataFlowInfo);
 }
  @Override
  public JetTypeInfo visitProperty(JetProperty property, ExpressionTypingContext context) {
    JetTypeReference receiverTypeRef = property.getReceiverTypeRef();
    if (receiverTypeRef != null) {
      context.trace.report(LOCAL_EXTENSION_PROPERTY.on(receiverTypeRef));
    }

    JetPropertyAccessor getter = property.getGetter();
    if (getter != null) {
      context.trace.report(LOCAL_VARIABLE_WITH_GETTER.on(getter));
    }

    JetPropertyAccessor setter = property.getSetter();
    if (setter != null) {
      context.trace.report(LOCAL_VARIABLE_WITH_SETTER.on(setter));
    }

    VariableDescriptor propertyDescriptor =
        context
            .expressionTypingServices
            .getDescriptorResolver()
            .resolveLocalVariableDescriptor(
                scope.getContainingDeclaration(),
                scope,
                property,
                context.dataFlowInfo,
                context.trace);
    JetExpression initializer = property.getInitializer();
    DataFlowInfo dataFlowInfo = context.dataFlowInfo;
    if (initializer != null) {
      JetType outType = propertyDescriptor.getType();
      JetTypeInfo typeInfo =
          facade.getTypeInfo(initializer, context.replaceExpectedType(outType).replaceScope(scope));
      dataFlowInfo = typeInfo.getDataFlowInfo();
    }

    {
      VariableDescriptor olderVariable = scope.getLocalVariable(propertyDescriptor.getName());
      ExpressionTypingUtils.checkVariableShadowing(context, propertyDescriptor, olderVariable);
    }

    scope.addVariableDescriptor(propertyDescriptor);
    ModifiersChecker.create(context.trace).checkModifiersForLocalDeclaration(property);
    return DataFlowUtils.checkStatementType(property, context, dataFlowInfo);
  }
  @Override
  public JetTypeInfo visitNamedFunction(
      JetNamedFunction function, ExpressionTypingContext context) {
    SimpleFunctionDescriptor functionDescriptor =
        context
            .expressionTypingServices
            .getDescriptorResolver()
            .resolveFunctionDescriptor(
                scope.getContainingDeclaration(), scope, function, context.trace);

    scope.addFunctionDescriptor(functionDescriptor);
    JetScope functionInnerScope =
        FunctionDescriptorUtil.getFunctionInnerScope(
            context.scope, functionDescriptor, context.trace);
    context.expressionTypingServices.checkFunctionReturnType(
        functionInnerScope,
        function,
        functionDescriptor,
        context.dataFlowInfo,
        null,
        context.trace);
    ModifiersChecker.create(context.trace).checkModifiersForLocalDeclaration(function);
    return DataFlowUtils.checkStatementType(function, context, context.dataFlowInfo);
  }