public void applyRule(
     final SNode classifier,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   List<SNode> ownMethods = Classifier_Behavior.call_getOwnMethods_1906502351318572840(classifier);
   ClassifierAndSuperClassifiersScope scope =
       new ClassifierAndSuperClassifiersScope(
           classifier,
           IClassifiersSearchScope.INSTANCE_METHOD | IClassifiersSearchScope.STATIC_METHOD);
   for (SNode ownMethod : ownMethods) {
     List<SNode> namesakes =
         scope.getMethodsByName(SPropertyOperations.getString(ownMethod, "name"));
     if (namesakes.size() < 2) {
       continue;
     }
     RulesFunctions_BaseLanguage.checkDuplicates(
         typeCheckingContext, ownMethod, classifier, namesakes);
   }
 }
 public void applyRule(
     final SNode func, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   SNode expectedRetType =
       BehaviorReflection.invokeVirtual(
           (Class<SNode>) ((Class) Object.class),
           func,
           "virtual_getExpectedReturnType_1213877374441",
           new Object[] {});
   boolean noReturnExpected =
       ((expectedRetType == null)
           || TypeChecker.getInstance()
               .getSubtypingManager()
               .isSubtype(expectedRetType, _quotation_createNode_bbraw4_b0a0a0b0b()));
   if (SConceptOperations.isExactly(
       SNodeOperations.getConceptDeclaration(expectedRetType),
       "jetbrains.mps.baseLanguage.structure.WildCardType")) {
     // function is expected to return value of any type
     expectedRetType = null;
   }
   if (!(noReturnExpected)) {
     final SNode LCS_typevar_1186052624152 = typeCheckingContext.createNewRuntimeTypesVariable();
     Iterable<SNode> returnStatements =
         RulesFunctions_BaseLanguage.collectReturnStatements(
             SLinkOperations.getTarget(func, "body", true));
     // should return subtypes of the 'expected type'
     // if 'expected type' is null - should still return some value (of any type)
     for (SNode returnStatement : Sequence.fromIterable(returnStatements)) {
       if ((SLinkOperations.getTarget(returnStatement, "expression", true) == null)) {
         {
           MessageTarget errorTarget = new NodeMessageTarget();
           IErrorReporter _reporter_2309309498 =
               typeCheckingContext.reportTypeError(
                   returnStatement,
                   "should return value",
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "1186053304501",
                   null,
                   errorTarget);
         }
       } else {
         {
           SNode _nodeToCheck_1029348928467 =
               SLinkOperations.getTarget(returnStatement, "expression", true);
           EquationInfo _info_12389875345 =
               new EquationInfo(
                   _nodeToCheck_1029348928467,
                   null,
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "1186053304511",
                   0,
                   null);
           typeCheckingContext.createGreaterThanInequality(
               (SNode) typeCheckingContext.getRepresentative(LCS_typevar_1186052624152),
               (SNode)
                   typeCheckingContext.typeOf(
                       _nodeToCheck_1029348928467,
                       "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                       "1186053304515",
                       true),
               false,
               true,
               _info_12389875345);
         }
         if ((expectedRetType != null)) {
           if (!(typeCheckingContext.isSingleTypeComputation())) {
             {
               SNode _nodeToCheck_1029348928467 =
                   SLinkOperations.getTarget(returnStatement, "expression", true);
               EquationInfo _info_12389875345 =
                   new EquationInfo(
                       _nodeToCheck_1029348928467,
                       null,
                       "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                       "7630810368327770735",
                       0,
                       null);
               typeCheckingContext.createLessThanInequality(
                   (SNode)
                       typeCheckingContext.typeOf(
                           _nodeToCheck_1029348928467,
                           "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                           "7630810368327770718",
                           true),
                   (SNode) expectedRetType,
                   true,
                   true,
                   _info_12389875345);
             }
           }
         }
       }
     }
     // last expression statement can serve as return statement
     SNode lastStatement =
         BehaviorReflection.invokeVirtual(
             (Class<SNode>) ((Class) Object.class),
             func,
             "virtual_getLastStatement_1239354409446",
             new Object[] {});
     if (SNodeOperations.isInstanceOf(
         lastStatement, "jetbrains.mps.baseLanguage.structure.ExpressionStatement")) {
       SNode expression =
           SLinkOperations.getTarget(
               SNodeOperations.cast(
                   lastStatement, "jetbrains.mps.baseLanguage.structure.ExpressionStatement"),
               "expression",
               true);
       {
         SNode _nodeToCheck_1029348928467 = expression;
         EquationInfo _info_12389875345 =
             new EquationInfo(
                 _nodeToCheck_1029348928467,
                 null,
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "1186053063874",
                 0,
                 null);
         typeCheckingContext.createGreaterThanInequality(
             (SNode) typeCheckingContext.getRepresentative(LCS_typevar_1186052624152),
             (SNode)
                 typeCheckingContext.typeOf(
                     _nodeToCheck_1029348928467,
                     "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                     "1186053084979",
                     true),
             false,
             true,
             _info_12389875345);
       }
       if ((expectedRetType != null)) {
         if (!(typeCheckingContext.isSingleTypeComputation())) {
           {
             SNode _nodeToCheck_1029348928467 = expression;
             EquationInfo _info_12389875345 =
                 new EquationInfo(
                     _nodeToCheck_1029348928467,
                     null,
                     "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                     "7630810368327770756",
                     0,
                     null);
             typeCheckingContext.createLessThanInequality(
                 (SNode)
                     typeCheckingContext.typeOf(
                         _nodeToCheck_1029348928467,
                         "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                         "7630810368327770753",
                         true),
                 (SNode) expectedRetType,
                 true,
                 true,
                 _info_12389875345);
           }
         }
       }
     }
     {
       SNode _nodeToCheck_1029348928467 = func;
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
               "1186053174208",
               0,
               null);
       typeCheckingContext.createEquation(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "1186053169643",
                   true),
           (SNode) typeCheckingContext.getRepresentative(LCS_typevar_1186052624152),
           _info_12389875345);
     }
     if ((expectedRetType != null)) {
       {
         SNode _nodeToCheck_1029348928467 = func;
         EquationInfo _info_12389875345 =
             new EquationInfo(
                 _nodeToCheck_1029348928467,
                 null,
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "1186053540847",
                 0,
                 null);
         typeCheckingContext.createLessThanInequality(
             (SNode)
                 typeCheckingContext.typeOf(
                     _nodeToCheck_1029348928467,
                     "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                     "1186053540851",
                     true),
             (SNode) expectedRetType,
             false,
             true,
             _info_12389875345);
       }
     }
   }
 }
 public void applyRule(
     final SNode func, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   // function is expected to return value of any type
   final SNode expectedRetType =
       (SConceptOperations.isExactly(
               SNodeOperations.asSConcept(
                   SNodeOperations.getConcept(
                       ConceptFunction__BehaviorDescriptor.getExpectedReturnType_idhEwIGRD.invoke(
                           func))),
               MetaAdapterFactory.getConcept(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x110dae5f4a3L,
                   "jetbrains.mps.baseLanguage.structure.WildCardType"))
           ? null
           : ConceptFunction__BehaviorDescriptor.getExpectedReturnType_idhEwIGRD.invoke(func));
   boolean noReturnExpected =
       ((expectedRetType == null)
           || TypeChecker.getInstance()
               .getSubtypingManager()
               .isSubtype(expectedRetType, _quotation_createNode_bbraw4_b0a0a0c0b()));
   if (!(noReturnExpected)) {
     final SNode LCS_typevar_1186052624152 = typeCheckingContext.createNewRuntimeTypesVariable();
     Iterable<SNode> returnStatements =
         RulesFunctions_BaseLanguage.collectReturnStatements(
             SLinkOperations.getTarget(
                 func,
                 MetaAdapterFactory.getContainmentLink(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0x108bbca0f48L,
                     0x108bbd29b4aL,
                     "body")));
     // should return subtypes of the 'expected type'
     // if 'expected type' is null - should still return some value (of any type)
     for (SNode returnStatement : Sequence.fromIterable(returnStatements)) {
       if ((SLinkOperations.getTarget(
               returnStatement,
               MetaAdapterFactory.getContainmentLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0xf8cc67c7feL,
                   0xf8cc6bf96cL,
                   "expression"))
           == null)) {
         {
           MessageTarget errorTarget = new NodeMessageTarget();
           IErrorReporter _reporter_2309309498 =
               typeCheckingContext.reportTypeError(
                   returnStatement,
                   "should return value",
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "1186053304501",
                   null,
                   errorTarget);
         }
       } else {
         {
           SNode _nodeToCheck_1029348928467 =
               SLinkOperations.getTarget(
                   returnStatement,
                   MetaAdapterFactory.getContainmentLink(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0xf8cc67c7feL,
                       0xf8cc6bf96cL,
                       "expression"));
           EquationInfo _info_12389875345 =
               new EquationInfo(
                   _nodeToCheck_1029348928467,
                   null,
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "1186053304511",
                   0,
                   null);
           typeCheckingContext.createGreaterThanInequality(
               (SNode) typeCheckingContext.getRepresentative(LCS_typevar_1186052624152),
               (SNode)
                   typeCheckingContext.typeOf(
                       _nodeToCheck_1029348928467,
                       "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                       "1186053304515",
                       true),
               false,
               true,
               _info_12389875345);
         }
         if ((expectedRetType != null)) {
           if (!(typeCheckingContext.isSingleTypeComputation())) {
             {
               SNode _nodeToCheck_1029348928467 =
                   SLinkOperations.getTarget(
                       returnStatement,
                       MetaAdapterFactory.getContainmentLink(
                           0xf3061a5392264cc5L,
                           0xa443f952ceaf5816L,
                           0xf8cc67c7feL,
                           0xf8cc6bf96cL,
                           "expression"));
               EquationInfo _info_12389875345 =
                   new EquationInfo(
                       _nodeToCheck_1029348928467,
                       null,
                       "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                       "7630810368327770735",
                       0,
                       null);
               typeCheckingContext.createLessThanInequality(
                   (SNode)
                       typeCheckingContext.typeOf(
                           _nodeToCheck_1029348928467,
                           "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                           "7410236346363166597",
                           true),
                   (SNode) expectedRetType,
                   true,
                   true,
                   _info_12389875345);
             }
           }
         }
       }
     }
     // last expression statement can serve as return statement
     SNode lastStatement = IMethodLike__BehaviorDescriptor.getLastStatement_idi2fhS7A.invoke(func);
     if (SNodeOperations.isInstanceOf(
         lastStatement,
         MetaAdapterFactory.getConcept(
             0xf3061a5392264cc5L,
             0xa443f952ceaf5816L,
             0xf8cc56b213L,
             "jetbrains.mps.baseLanguage.structure.ExpressionStatement"))) {
       final SNode expression =
           SLinkOperations.getTarget(
               SNodeOperations.cast(
                   lastStatement,
                   MetaAdapterFactory.getConcept(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0xf8cc56b213L,
                       "jetbrains.mps.baseLanguage.structure.ExpressionStatement")),
               MetaAdapterFactory.getContainmentLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0xf8cc56b213L,
                   0xf8cc56b214L,
                   "expression"));
       {
         SNode _nodeToCheck_1029348928467 = expression;
         EquationInfo _info_12389875345 =
             new EquationInfo(
                 _nodeToCheck_1029348928467,
                 null,
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "1186053063874",
                 0,
                 null);
         typeCheckingContext.createGreaterThanInequality(
             (SNode) typeCheckingContext.getRepresentative(LCS_typevar_1186052624152),
             (SNode)
                 typeCheckingContext.typeOf(
                     _nodeToCheck_1029348928467,
                     "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                     "1186053084979",
                     true),
             false,
             true,
             _info_12389875345);
       }
       if ((expectedRetType != null)) {
         if (!(typeCheckingContext.isSingleTypeComputation())) {
           {
             SNode _nodeToCheck_1029348928467 = expression;
             EquationInfo _info_12389875345 =
                 new EquationInfo(
                     _nodeToCheck_1029348928467,
                     null,
                     "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                     "7630810368327770756",
                     0,
                     null);
             typeCheckingContext.createLessThanInequality(
                 (SNode)
                     typeCheckingContext.typeOf(
                         _nodeToCheck_1029348928467,
                         "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                         "7410236346363168757",
                         true),
                 (SNode) expectedRetType,
                 true,
                 true,
                 _info_12389875345);
           }
         }
       }
     }
     {
       SNode _nodeToCheck_1029348928467 = func;
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
               "1186053174208",
               0,
               null);
       typeCheckingContext.createEquation(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "1186053169643",
                   true),
           (SNode) typeCheckingContext.getRepresentative(LCS_typevar_1186052624152),
           _info_12389875345);
     }
     if ((expectedRetType != null)) {
       if (!(typeCheckingContext.isSingleTypeComputation())) {
         {
           SNode _nodeToCheck_1029348928467 = func;
           EquationInfo _info_12389875345 =
               new EquationInfo(
                   _nodeToCheck_1029348928467,
                   null,
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "1186053540847",
                   0,
                   null);
           typeCheckingContext.createLessThanInequality(
               (SNode)
                   typeCheckingContext.typeOf(
                       _nodeToCheck_1029348928467,
                       "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                       "7410236346363168929",
                       true),
               (SNode) expectedRetType,
               true,
               true,
               _info_12389875345);
         }
       }
     }
   }
 }