public void applyRule(
     final SNode classifier,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   OverridingMethodsFinder finder = new OverridingMethodsFinder(classifier);
   Set<SNode> overridingMethods = finder.getOverridingMethods();
   for (SNode method : SLinkOperations.getTargets(classifier, "method", true)) {
     for (SNode annotationInstance : SLinkOperations.getTargets(method, "annotation", true)) {
       if (SLinkOperations.getTarget(annotationInstance, "annotation", false)
               == SNodeOperations.getNode(
                   "f:java_stub#6354ebe7-c22a-4a0f-ac54-50b52ab9b065#java.lang(JDK/java.lang@java_stub)",
                   "~Override")
           && !(SetSequence.fromSet(overridingMethods).contains(method))) {
         {
           MessageTarget errorTarget = new NodeMessageTarget();
           IErrorReporter _reporter_2309309498 =
               typeCheckingContext.reportTypeError(
                   annotationInstance,
                   "Method does not override method from its superclass",
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "4540477783368646804",
                   null,
                   errorTarget);
         }
         break;
       }
     }
   }
 }
 public void applyRule(
     final SNode variableReference,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (SNodeOperations.isInstanceOf(
       SLinkOperations.getTarget(variableReference, "variableDeclaration", false),
       "jetbrains.mps.baseLanguage.structure.ParameterDeclaration")) {
     SNode declaration =
         SNodeOperations.cast(
             SLinkOperations.getTarget(variableReference, "variableDeclaration", false),
             "jetbrains.mps.baseLanguage.structure.ParameterDeclaration");
     if ((declaration != null) && !(SPropertyOperations.getBoolean(declaration, "isFinal"))) {
       if (!(VariableReference_Behavior.call_isParameterOfThisMethod_1240394425603(
           variableReference))) {
         {
           MessageTarget errorTarget = new NodeMessageTarget();
           IErrorReporter _reporter_2309309498 =
               typeCheckingContext.reportTypeError(
                   variableReference,
                   "Parameter must be final",
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "1240395578471",
                   null,
                   errorTarget);
         }
       }
     }
   }
 }
 public void applyRule(
     final SNode part, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   SNode returnType =
       TypeChecker.getInstance().getTypeOf(SLinkOperations.getTarget(part, "factoryMethod", true));
   if (!(TypeChecker.getInstance()
       .getSubtypingManager()
       .isSubtype(returnType, _quotation_createNode_5hdosv_b0a0b0a()))) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               part,
               "Factory method should return subtype of Iterable<AbstractMigrationRefactoring> (now \""
                   + BehaviorReflection.invokeVirtual(
                       String.class,
                       returnType,
                       "virtual_getPresentation_1213877396640",
                       new Object[] {})
                   + "\")",
               "r:00000000-0000-4000-0000-011c89590320(jetbrains.mps.lang.script.typesystem)",
               "2598676492883176352",
               null,
               errorTarget);
     }
   }
 }
 public void applyRule(
     final SNode expr, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   // todo: do right stuff! =(
   if (!(SPropertyOperations.getString(
           SNodeOperations.getNodeAncestor(
               expr,
               MetaAdapterFactory.getConcept(
                   0xaf65afd8f0dd4942L,
                   0x87d963a55f2a9db1L,
                   0x11d4348057eL,
                   "jetbrains.mps.lang.behavior.structure.ConceptMethodDeclaration"),
               false,
               false),
           MetaAdapterFactory.getProperty(
               0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"))
       .equals("getScope"))) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               expr,
               "Should be in getScope method",
               "r:c2d05fc3-fe25-4093-95ce-8e3356e61084(jetbrains.mps.lang.scopes.typesystem)",
               "8077936094962911290",
               null,
               errorTarget);
     }
   }
 }
 public void applyRule(
     final SNode annotationInstance,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode annotation = SLinkOperations.getTarget(annotationInstance, "annotation", false);
   for (SNode annotationMethod : SLinkOperations.getTargets(annotation, "method", true)) {
     if ((SLinkOperations.getTarget(annotationMethod, "defaultValue", true) != null)) {
       continue;
     }
     boolean found = false;
     for (SNode annotationInstanceValue :
         SLinkOperations.getTargets(annotationInstance, "value", true)) {
       if (SLinkOperations.getTarget(annotationInstanceValue, "key", false) == annotationMethod) {
         found = true;
         break;
       }
     }
     if (!(found)) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 annotationInstance,
                 "'"
                     + SPropertyOperations.getString(annotationMethod, "name")
                     + "' missing though required",
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "6624237184121162632",
                 null,
                 errorTarget);
       }
     }
   }
 }
  public void applyRule(
      final SNode unkCall,
      final TypeCheckingContext typeCheckingContext,
      IsApplicableStatus status) {
    if (BehaviorReflection.invokeVirtual(
            (Class<_FunctionTypes._return_P0_E0<? extends SNode>>) ((Class) Object.class),
            unkCall,
            "virtual_evaluateSubst_8136348407761606764",
            new Object[] {})
        != null) {
      // success
      {
        MessageTarget errorTarget = new NodeMessageTarget();
        IErrorReporter _reporter_2309309498 =
            typeCheckingContext.reportTypeError(
                unkCall,
                "Resolved local call",
                "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                "6021327890422133162",
                null,
                errorTarget);
        {
          BaseQuickFixProvider intentionProvider =
              new BaseQuickFixProvider(
                  "jetbrains.mps.baseLanguage.typesystem.ResolvedUnknownNode_QuickFix", true);
          intentionProvider.putArgument("unknownNode", unkCall);
          _reporter_2309309498.addIntentionProvider(intentionProvider);
        }
      }
      return;
    }

    {
      MessageTarget errorTarget = new NodeMessageTarget();
      IErrorReporter _reporter_2309309498 =
          typeCheckingContext.reportTypeError(
              unkCall,
              "Unresolved method call",
              "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
              "6396739326936528614",
              null,
              errorTarget);
    }
  }
 public void applyRule(
     final SNode abstractRule,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   final String name =
       SPropertyOperations.getString(
           abstractRule,
           MetaAdapterFactory.getProperty(
               0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
   if ((name == null || name.length() == 0)) {
     return;
   }
   if (ListSequence.fromList(
           SModelOperations.roots(
               SNodeOperations.getModel(abstractRule),
               MetaAdapterFactory.getConcept(
                   0x7a5dda6291404668L,
                   0xab76d5ed1746f2b2L,
                   0x1117e7b5c73L,
                   "jetbrains.mps.lang.typesystem.structure.AbstractRule")))
       .any(
           new IWhereFilter<SNode>() {
             public boolean accept(SNode it) {
               return it != abstractRule
                   && name.equalsIgnoreCase(
                       SPropertyOperations.getString(
                           it,
                           MetaAdapterFactory.getProperty(
                               0xceab519525ea4f22L,
                               0x9b92103b95ca8c0cL,
                               0x110396eaaa4L,
                               0x110396ec041L,
                               "name")));
             }
           })) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       errorTarget = new PropertyMessageTarget("name");
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               abstractRule,
               "Duplicated name of the typesystem rule",
               "r:00000000-0000-4000-0000-011c895902b1(jetbrains.mps.lang.typesystem.typesystem)",
               "8433157989202147284",
               null,
               errorTarget);
     }
   }
 }
 public void applyRule(
     final SNode typeOfExpression,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (!(RulesUtil.withinInferenceItem(typeOfExpression))) {
     MessageTarget errorTarget = new NodeMessageTarget();
     IErrorReporter _reporter_2309309498 =
         typeCheckingContext.reportTypeError(
             typeOfExpression,
             "TYPEOF should be used only within inference rules",
             "r:00000000-0000-4000-0000-011c895902b1(jetbrains.mps.lang.typesystem.typesystem)",
             "1195217231011",
             null,
             errorTarget);
   }
   if (!(!(SNodeOperations.isInstanceOf(
       SLinkOperations.getTarget(
           typeOfExpression,
           MetaAdapterFactory.getContainmentLink(
               0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1117f0ad10aL, 0x1117f0b26bdL, "term")),
       MetaAdapterFactory.getConcept(
           0x7a5dda6291404668L,
           0xab76d5ed1746f2b2L,
           0x1117f90b04cL,
           "jetbrains.mps.lang.typesystem.structure.TypeVarReference"))))) {
     MessageTarget errorTarget = new NodeMessageTarget();
     IErrorReporter _reporter_2309309498 =
         typeCheckingContext.reportTypeError(
             typeOfExpression,
             "type of a type has little sense",
             "r:00000000-0000-4000-0000-011c895902b1(jetbrains.mps.lang.typesystem.typesystem)",
             "1204815653385",
             null,
             errorTarget);
   }
 }
 public void applyRule(
     final SNode variableReference,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (SPropertyOperations.getBoolean(
       SLinkOperations.getTarget(
           variableReference,
           MetaAdapterFactory.getReferenceLink(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0xf8c77f1e98L,
               0xf8cc6bf960L,
               "variableDeclaration")),
       MetaAdapterFactory.getProperty(
           0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0x111f9e9f00cL, "isFinal"))) {
     if (!(VariableReferenceUtil.isUninitializedOrBad(variableReference))) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 variableReference,
                 "Cannot assign a value to final variable '"
                     + SPropertyOperations.getString(
                         SLinkOperations.getTarget(
                             variableReference,
                             MetaAdapterFactory.getReferenceLink(
                                 0xf3061a5392264cc5L,
                                 0xa443f952ceaf5816L,
                                 0xf8c77f1e98L,
                                 0xf8cc6bf960L,
                                 "variableDeclaration")),
                         MetaAdapterFactory.getProperty(
                             0xceab519525ea4f22L,
                             0x9b92103b95ca8c0cL,
                             0x110396eaaa4L,
                             0x110396ec041L,
                             "name"))
                     + "'",
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "4705425356437995912",
                 null,
                 errorTarget);
       }
     }
   }
 }
 public void applyRule(
     final SNode testCase,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (!(CheckUtils.checkPluginKindForMPSTestCase(testCase))) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               testCase,
               "MPS related test cases should be created in plugin solutions",
               "r:2b2539c5-00c8-487d-9567-ecc2b9274c7b(jetbrains.mps.baseLanguage.unitTest.typesystem)",
               "8797237962361641928",
               null,
               errorTarget);
     }
   }
 }
 public void applyRule(
     final SNode constructorInvocation,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode constructor =
       SNodeOperations.getNodeAncestor(
           constructorInvocation,
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0xf8cc56b204L,
               "jetbrains.mps.baseLanguage.structure.ConstructorDeclaration"),
           false,
           false);
   if (constructor != null) {
     SNode statementList =
         SLinkOperations.getTarget(
             constructor,
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b1fcL, 0xf8cc56b1ffL, "body"));
     SNode firstStatement =
         StatementList_Behavior.call_getFirstStatement_5420652334935371934(statementList);
     if (firstStatement != constructorInvocation) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 constructorInvocation,
                 "Call to '"
                     + BehaviorReflection.invokeVirtual(
                         String.class,
                         constructorInvocation,
                         "virtual_getPresentation_1213877396640",
                         new Object[] {})
                     + "' must be first statement in constructor body",
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "3133930811460325358",
                 null,
                 errorTarget);
       }
     }
   }
 }
 public void applyRule(
     final SNode runConfiguration,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if ((RunConfiguration_BehaviorDescriptor.getExecutor_id3gs394eDyIj.invoke(runConfiguration)
       == null)) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               runConfiguration,
               "Run configuration should define an executor",
               "r:8b43a830-217d-43d8-a0f8-6460c443f22d(jetbrains.mps.execution.configurations.typesystem)",
               "2535050848643223624",
               null,
               errorTarget);
     }
   }
 }
 public void applyRule(
     final SNode nodeToCheck,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode operandType =
       TypeChecker.getInstance()
           .getTypeOf(IOperation_BehaviorDescriptor.getOperand_idhEwIP$m.invoke(nodeToCheck));
   {
     IMatchingPattern pattern_hm5x7h_b0 =
         HUtil.createMatchingPatternByConceptFQName(
             "jetbrains.mps.baseLanguage.classifiers.structure.BaseClassifierType");
     SNode coercedNode_hm5x7h_b0 =
         TypeChecker.getInstance().getRuntimeSupport().coerce_(operandType, pattern_hm5x7h_b0);
     if (coercedNode_hm5x7h_b0 != null) {
       if (!(ListSequence.fromList(
               BaseClassifierType_BehaviorDescriptor.getMembers_idhEwINC$.invoke(
                   coercedNode_hm5x7h_b0, nodeToCheck))
           .contains(
               SLinkOperations.getTarget(
                   nodeToCheck,
                   MetaAdapterFactory.getReferenceLink(
                       0x443f4c36fcf54eb6L,
                       0x95008d06ed259e3eL,
                       0x118bca97396L,
                       0x118bcb657ecL,
                       "member"))))) {
         {
           MessageTarget errorTarget = new NodeMessageTarget();
           IErrorReporter _reporter_2309309498 =
               typeCheckingContext.reportTypeError(
                   nodeToCheck,
                   "Declaration is out of scope",
                   "r:00000000-0000-4000-0000-011c89590371(jetbrains.mps.baseLanguage.classifiers.typesystem)",
                   "1205921883388",
                   null,
                   errorTarget);
         }
       }
     } else {
     }
   }
 }
 public void processInequation(
     final SNode subtype,
     final SNode supertype,
     final EquationInfo equationInfo,
     final TypeCheckingContext typeCheckingContext,
     IsApplicable2Status status,
     final boolean inequalityIsWeak,
     final boolean inequalityIsLessThan) {
   if (!(SConceptOperations.isSubConceptOf(
       SNodeOperations.getConceptDeclaration(subtype),
       NameUtil.nodeFQName(SNodeOperations.getConceptDeclaration(supertype))))) {
     MessageTarget errorTarget = new NodeMessageTarget();
     IErrorReporter _reporter_2309309498 =
         typeCheckingContext.reportTypeError(
             equationInfo.getNodeWithError(),
             "Incompatible types",
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "1240153585729",
             null,
             errorTarget);
     HUtil.addAdditionalRuleIdsFromInfo(_reporter_2309309498, equationInfo);
   }
   {
     SNode _nodeToCheck_1029348928467 = equationInfo.getNodeWithError();
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "1237470147423",
             0,
             null);
     _info_12389875345.getOuterRulesIdFromInfo(equationInfo);
     typeCheckingContext.createLessThanInequality(
         (SNode) SLinkOperations.getTarget(subtype, "elementType", true),
         (SNode) SLinkOperations.getTarget(supertype, "elementType", true),
         false,
         true,
         inequalityIsLessThan,
         _info_12389875345);
   }
 }
 public void applyRule(
     final SNode jarEntry,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   String relativePath =
       BuildSourcePath_Behavior.call_getRelativePath_5481553824944787371(
           SLinkOperations.getTarget(jarEntry, "path", true));
   if (!(relativePath.endsWith("}")) && !(relativePath.endsWith(".jar"))) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               jarEntry,
               "should end with .jar (or macro)",
               "r:473be7a1-ec10-4475-89b9-397d2558ecb0(jetbrains.mps.build.mps.typesystem)",
               "4278635856200826411",
               null,
               errorTarget);
     }
   }
 }
 public void applyRule(
     final SNode assignment,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if ((SLinkOperations.getTarget(
           assignment,
           MetaAdapterFactory.getContainmentLink(
               0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11b0d00332cL, 0xf8c77f1e97L, "lValue"))
       == null)) {
     return;
   }
   if (!((boolean)
       Expression__BehaviorDescriptor.isLValue_idhEwJgmE.invoke(
           SLinkOperations.getTarget(
               assignment,
               MetaAdapterFactory.getContainmentLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x11b0d00332cL,
                   0xf8c77f1e97L,
                   "lValue"))))) {
     MessageTarget errorTarget = new NodeMessageTarget();
     IErrorReporter _reporter_2309309498 =
         typeCheckingContext.reportTypeError(
             SLinkOperations.getTarget(
                 assignment,
                 MetaAdapterFactory.getContainmentLink(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0x11b0d00332cL,
                     0xf8c77f1e97L,
                     "lValue")),
             "unexpected in left part or assignment",
             "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
             "1175519229331",
             null,
             errorTarget);
   }
 }
 public void applyRule(
     final SNode baseMethodDeclaration,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (BehaviorReflection.invokeVirtual(
           Boolean.TYPE,
           baseMethodDeclaration,
           "virtual_isAbstract_1232982539764",
           new Object[] {})
       && SPropertyOperations.getBoolean(baseMethodDeclaration, "isSynchronized")) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               baseMethodDeclaration,
               "Abstract method can't be synchronized",
               "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
               "4276006055364077562",
               null,
               errorTarget);
     }
   }
 }
 public void applyRule(
     final SNode jarEntry,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   String relativePath =
       BehaviorReflection.invokeVirtual(
           String.class,
           SLinkOperations.getTarget(jarEntry, "path", true),
           "virtual_getRelativePath_5481553824944787371",
           new Object[] {});
   if (!(relativePath.endsWith("}")) && !(relativePath.endsWith(".jar"))) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               jarEntry,
               "should end with .jar (or macro)",
               "r:473be7a1-ec10-4475-89b9-397d2558ecb0(jetbrains.mps.build.mps.typesystem)",
               "1258644073389052213",
               null,
               errorTarget);
     }
   }
 }
 public void applyRule(
     final SNode customConstructorUsage,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode args =
       SLinkOperations.getTarget(
           SLinkOperations.getTarget(customConstructorUsage, "customConstructor", false),
           "arguments",
           true);
   if (SNodeOperations.isInstanceOf(
       args, "jetbrains.mps.baseLanguage.constructors.structure.CustomArgumentClause")) {
     if (ListSequence.fromList(
                 SLinkOperations.getTargets(
                     SNodeOperations.cast(
                         args,
                         "jetbrains.mps.baseLanguage.constructors.structure.CustomArgumentClause"),
                     "parameter",
                     true))
             .count()
         != ListSequence.fromList(
                 SLinkOperations.getTargets(customConstructorUsage, "element", true))
             .count()) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 customConstructorUsage,
                 "Wrong number of arguments",
                 "r:c19fbfce-5c58-4528-8b93-60edfa062cac(jetbrains.mps.baseLanguage.constructors.typesystem)",
                 "960932673514559399",
                 null,
                 errorTarget);
       }
     }
   }
 }
  public void applyRule(
      final SNode anonymousClass,
      final TypeCheckingContext typeCheckingContext,
      IsApplicableStatus status) {
    SNode cdecl =
        SLinkOperations.getTarget(
            anonymousClass,
            MetaAdapterFactory.getReferenceLink(
                0xf3061a5392264cc5L,
                0xa443f952ceaf5816L,
                0x11857355952L,
                0xf8c78301adL,
                "baseMethodDeclaration"));
    if (cdecl == null) {
      return;
    }
    final SNode classifier =
        SLinkOperations.getTarget(
            anonymousClass,
            MetaAdapterFactory.getReferenceLink(
                0xf3061a5392264cc5L,
                0xa443f952ceaf5816L,
                0x1107e0cb103L,
                0x1107e0fd2a0L,
                "classifier"));
    if ((classifier == null)) {
      return;
    }

    if (!((ListSequence.fromList(
                SLinkOperations.getChildren(
                    anonymousClass,
                    MetaAdapterFactory.getContainmentLink(
                        0xf3061a5392264cc5L,
                        0xa443f952ceaf5816L,
                        0x1107e0cb103L,
                        0x117ac45a693L,
                        "typeParameter")))
            .isEmpty()
        || ListSequence.fromList(
                    SLinkOperations.getChildren(
                        anonymousClass,
                        MetaAdapterFactory.getContainmentLink(
                            0xf3061a5392264cc5L,
                            0xa443f952ceaf5816L,
                            0x1107e0cb103L,
                            0x117ac45a693L,
                            "typeParameter")))
                .count()
            == ListSequence.fromList(
                    SLinkOperations.getChildren(
                        classifier,
                        MetaAdapterFactory.getContainmentLink(
                            0xf3061a5392264cc5L,
                            0xa443f952ceaf5816L,
                            0x102463b447aL,
                            0x102463bb98eL,
                            "typeVariableDeclaration")))
                .count()))) {
      {
        MessageTarget errorTarget = new NodeMessageTarget();
        errorTarget = new ReferenceMessageTarget("classifier");
        IErrorReporter _reporter_2309309498 =
            typeCheckingContext.reportTypeError(
                anonymousClass,
                "wrong number of type parameters",
                "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                "2925336694746296749",
                null,
                errorTarget);
      }
    }

    for (SNode parameter :
        SLinkOperations.getChildren(
            anonymousClass,
            MetaAdapterFactory.getContainmentLink(
                0xf3061a5392264cc5L,
                0xa443f952ceaf5816L,
                0x1107e0cb103L,
                0x117ac45a693L,
                "typeParameter"))) {
      if (!(!(TypeChecker.getInstance()
          .getSubtypingManager()
          .isSubtype(
              parameter,
              SLinkOperations.getTarget(
                  _quotation_createNode_fj2vg7_a1a0a0a7a1(),
                  MetaAdapterFactory.getReferenceLink(
                      0xed6d7656532c4bc2L,
                      0x81d1af945aeb8280L,
                      0x10de9cbf8e8L,
                      0x10de9cbf8e7L,
                      "descriptor")),
              false)))) {
        MessageTarget errorTarget = new NodeMessageTarget();
        IErrorReporter _reporter_2309309498 =
            typeCheckingContext.reportTypeError(
                parameter,
                "primitive type not allowed",
                "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                "2925336694746296785",
                null,
                errorTarget);
      }
    }

    final Map<SNode, SNode> subs = MapSequence.fromMap(new HashMap<SNode, SNode>());
    // TODO: this is to avoid collecting generics from explicitly substituted types
    List<SNode> typeParam =
        ListSequence.fromList(
                SLinkOperations.getChildren(
                    anonymousClass,
                    MetaAdapterFactory.getContainmentLink(
                        0xf3061a5392264cc5L,
                        0xa443f952ceaf5816L,
                        0x1107e0cb103L,
                        0x117ac45a693L,
                        "typeParameter")))
            .select(
                new ISelector<SNode, SNode>() {
                  public SNode select(SNode tp) {
                    final SNode TP_typevar_5449655299304737730 =
                        typeCheckingContext.createNewRuntimeTypesVariable();
                    SNode tmp =
                        typeCheckingContext.getRepresentative(TP_typevar_5449655299304737730);
                    {
                      SNode _nodeToCheck_1029348928467 = tp;
                      EquationInfo _info_12389875345 =
                          new EquationInfo(
                              _nodeToCheck_1029348928467,
                              null,
                              "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                              "5449655299304737735",
                              0,
                              null);
                      typeCheckingContext.createEquation(
                          (SNode)
                              typeCheckingContext.getRepresentative(TP_typevar_5449655299304737730),
                          (SNode) tp,
                          _info_12389875345);
                    }
                    return tmp;
                  }
                })
            .toListSequence();
    SNode newType = _quotation_createNode_fj2vg7_a0m0b(anonymousClass, typeParam);
    IGenericType__BehaviorDescriptor.collectGenericSubstitutions_id3zZky3wF74h.invoke(
        newType, subs);

    List<SNode> argl =
        SLinkOperations.getChildren(
            anonymousClass,
            MetaAdapterFactory.getContainmentLink(
                0xf3061a5392264cc5L,
                0xa443f952ceaf5816L,
                0x11857355952L,
                0xf8c78301aeL,
                "actualArgument"));
    List<SNode> typel =
        ITypeApplicable__BehaviorDescriptor.getTypeApplicationParameters_id7bu6bIyR2DR.invoke(
            cdecl, ((int) ListSequence.fromList(argl).count()));
    for (SNode type : ListSequence.fromList(typel)) {
      if (SNodeOperations.isInstanceOf(
          type,
          MetaAdapterFactory.getInterfaceConcept(
              0xf3061a5392264cc5L,
              0xa443f952ceaf5816L,
              0x38ff5220e0ac710dL,
              "jetbrains.mps.baseLanguage.structure.IGenericType"))) {
        IGenericType__BehaviorDescriptor.collectGenericSubstitutions_id3zZky3wF74h.invoke(
            SNodeOperations.cast(
                type,
                MetaAdapterFactory.getInterfaceConcept(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0x38ff5220e0ac710dL,
                    "jetbrains.mps.baseLanguage.structure.IGenericType")),
            subs);
      }
    }

    {
      Iterator<SNode> type_it = ListSequence.fromList(typel).iterator();
      Iterator<SNode> arg_it = ListSequence.fromList(argl).iterator();
      SNode type_var;
      SNode arg_var;
      while (type_it.hasNext() && arg_it.hasNext()) {
        type_var = type_it.next();
        arg_var = arg_it.next();
        if (SNodeOperations.isInstanceOf(
            type_var,
            MetaAdapterFactory.getInterfaceConcept(
                0xf3061a5392264cc5L,
                0xa443f952ceaf5816L,
                0x38ff5220e0ac710dL,
                "jetbrains.mps.baseLanguage.structure.IGenericType"))) {
          {
            SNode _nodeToCheck_1029348928467 = arg_var;
            EquationInfo _info_12389875345 =
                new EquationInfo(
                    _nodeToCheck_1029348928467,
                    null,
                    "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                    "5449655299304749819",
                    0,
                    null);
            typeCheckingContext.createGreaterThanInequality(
                (SNode)
                    IGenericType__BehaviorDescriptor.expandGenerics_id3zZky3wFPhu.invoke(
                        SNodeOperations.cast(
                            type_var,
                            MetaAdapterFactory.getInterfaceConcept(
                                0xf3061a5392264cc5L,
                                0xa443f952ceaf5816L,
                                0x38ff5220e0ac710dL,
                                "jetbrains.mps.baseLanguage.structure.IGenericType")),
                        subs),
                (SNode)
                    typeCheckingContext.typeOf(
                        _nodeToCheck_1029348928467,
                        "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                        "5449655299304749821",
                        true),
                false,
                true,
                _info_12389875345);
          }
        } else {
          if (!(typeCheckingContext.isSingleTypeComputation())) {
            {
              SNode _nodeToCheck_1029348928467 = arg_var;
              EquationInfo _info_12389875345 =
                  new EquationInfo(
                      _nodeToCheck_1029348928467,
                      null,
                      "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                      "5449655299304749835",
                      0,
                      null);
              typeCheckingContext.createGreaterThanInequality(
                  (SNode) type_var,
                  (SNode)
                      typeCheckingContext.typeOf(
                          _nodeToCheck_1029348928467,
                          "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                          "5449655299304749837",
                          true),
                  true,
                  true,
                  _info_12389875345);
            }
          }
        }
      }
    }
    {
      SNode _nodeToCheck_1029348928467 = anonymousClass;
      EquationInfo _info_12389875345 =
          new EquationInfo(
              _nodeToCheck_1029348928467,
              null,
              "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
              "5449655299304749841",
              0,
              null);
      typeCheckingContext.createEquation(
          (SNode)
              typeCheckingContext.typeOf(
                  _nodeToCheck_1029348928467,
                  "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                  "5449655299304749843",
                  true),
          (SNode) newType,
          _info_12389875345);
    }
  }
  public void applyRule(
      final SNode classifier,
      final TypeCheckingContext typeCheckingContext,
      IsApplicableStatus status) {
    OverridingMethodsFinder finder = new OverridingMethodsFinder(classifier);
    for (SNode overridingMethod : SetSequence.fromSet(finder.getOverridingMethods())) {
      Set<Tuples._2<SNode, SNode>> overridenMethods = finder.getOverridenMethods(overridingMethod);
      for (Iterator<Tuples._2<SNode, SNode>> it = SetSequence.fromSet(overridenMethods).iterator();
          it.hasNext(); ) {
        SNode overridenMethod = it.next()._0();
        SNode returnType = SLinkOperations.getTarget(overridenMethod, "returnType", true);
        SNode ancestor =
            SNodeOperations.cast(
                SNodeOperations.getParent(overridenMethod),
                "jetbrains.mps.baseLanguage.structure.Classifier");
        SNode overridingMethodParent = SNodeOperations.getParent(overridingMethod);
        SNode resolvedReturnType;
        if (SNodeOperations.isInstanceOf(
            overridingMethodParent, "jetbrains.mps.baseLanguage.structure.Classifier")) {
          resolvedReturnType =
              Classifier_Behavior.call_getWithResolvedTypevars_3305065273710852527(
                  SNodeOperations.cast(
                      overridingMethodParent, "jetbrains.mps.baseLanguage.structure.Classifier"),
                  returnType,
                  ancestor,
                  overridingMethod,
                  overridenMethod);
        } else if (SNodeOperations.isInstanceOf(
            overridingMethodParent,
            "jetbrains.mps.baseLanguage.structure.EnumConstantDeclaration")) {
          SNode enumClass =
              SNodeOperations.cast(
                  SNodeOperations.getParent(
                      SNodeOperations.cast(
                          overridingMethodParent,
                          "jetbrains.mps.baseLanguage.structure.EnumConstantDeclaration")),
                  "jetbrains.mps.baseLanguage.structure.EnumClass");
          SNode dummy =
              SConceptOperations.createNewNode(
                  "jetbrains.mps.baseLanguage.structure.AnonymousClass", null);
          SLinkOperations.setTarget(dummy, "classifier", enumClass, false);
          resolvedReturnType =
              Classifier_Behavior.call_getWithResolvedTypevars_3305065273710852527(
                  dummy, returnType, ancestor, overridingMethod, overridenMethod);
        } else {
          {
            MessageTarget errorTarget = new NodeMessageTarget();
            IErrorReporter _reporter_2309309498 =
                typeCheckingContext.reportTypeError(
                    overridingMethodParent,
                    "This node is not supposed to override methods",
                    "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                    "6207253590661761584",
                    null,
                    errorTarget);
          }
          return;
        }

        if (!(TypeChecker.getInstance()
            .getSubtypingManager()
            .isSubtype(
                SLinkOperations.getTarget(overridingMethod, "returnType", true),
                resolvedReturnType))) {
          {
            MessageTarget errorTarget = new NodeMessageTarget();
            IErrorReporter _reporter_2309309498 =
                typeCheckingContext.reportTypeError(
                    SLinkOperations.getTarget(overridingMethod, "returnType", true),
                    "method's return type is incompatible with overridden method ",
                    "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                    "2792291462223216211",
                    null,
                    errorTarget);
          }
          break;
        }
      }
    }
  }
  public void applyRule(
      final SNode classConcept,
      final TypeCheckingContext typeCheckingContext,
      IsApplicableStatus status) {
    Iterable<SNode> instMethods =
        Sequence.fromIterable(
                Classifier_BehaviorDescriptor.methods_id4_LVZ3pBKCn.invoke(classConcept))
            .where(
                new IWhereFilter<SNode>() {
                  public boolean accept(SNode it) {
                    return DispatchUtil.isReadyMethod(it);
                  }
                });
    Iterable<SNode> statMethods =
        Sequence.fromIterable(
                Classifier_BehaviorDescriptor.methods_id4_LVZ3pBKCn.invoke(classConcept))
            .where(
                new IWhereFilter<SNode>() {
                  public boolean accept(SNode it) {
                    return DispatchUtil.isReadyMethod(it);
                  }
                });

    if (Sequence.fromIterable(instMethods).isEmpty()
        && Sequence.fromIterable(statMethods).isEmpty()) {
      return;
    }

    DispatchMethodCollector collector = new DispatchMethodCollector(classConcept);
    Iterable<DispatchGroup> groups = collector.getGroups();

    for (DispatchGroup g : Sequence.fromIterable(groups)) {
      DispatchGroup.Error err = g.check();

      if (err != null) {
        String msg = err.getMessage();
        for (SNode m : Sequence.fromIterable(err.getMethods())) {
          {
            MessageTarget errorTarget = new NodeMessageTarget();
            IErrorReporter _reporter_2309309498 =
                typeCheckingContext.reportTypeError(
                    ListSequence.fromList(
                            SLinkOperations.getChildren(
                                m,
                                MetaAdapterFactory.getContainmentLink(
                                    0xf3061a5392264cc5L,
                                    0xa443f952ceaf5816L,
                                    0xf8cc56b1fcL,
                                    0xf8cc56b1feL,
                                    "parameter")))
                        .first(),
                    msg,
                    "r:7a94bb66-9653-4830-af67-903eb2cfbd29(jetbrains.mps.baseLanguage.doubleDispatch.typesystem)",
                    "7139749370073616981",
                    null,
                    errorTarget);
          }
        }
      }
    }
  }
 public void applyRule(
     final SNode iMethodCall,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode baseMethodDeclaration =
       SLinkOperations.getTarget(
           iMethodCall,
           MetaAdapterFactory.getReferenceLink(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x11857355952L,
               0xf8c78301adL,
               "baseMethodDeclaration"));
   boolean isOk;
   if (baseMethodDeclaration != null) {
     List<SNode> parameterDeclarations =
         SLinkOperations.getChildren(
             baseMethodDeclaration,
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0xf8cc56b1fcL,
                 0xf8cc56b1feL,
                 "parameter"));
     List<SNode> actualArguments =
         SLinkOperations.getChildren(
             iMethodCall,
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x11857355952L,
                 0xf8c78301aeL,
                 "actualArgument"));
     if (SNodeOperations.isInstanceOf(
         SLinkOperations.getTarget(
             ListSequence.fromList(parameterDeclarations).last(),
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x450368d90ce15bc3L,
                 0x4ed4d318133c80ceL,
                 "type")),
         MetaAdapterFactory.getConcept(
             0xf3061a5392264cc5L,
             0xa443f952ceaf5816L,
             0x11c08f42e7bL,
             "jetbrains.mps.baseLanguage.structure.VariableArityType"))) {
       isOk =
           ListSequence.fromList(parameterDeclarations).count() - 1
               <= ListSequence.fromList(actualArguments).count();
     } else {
       isOk =
           ListSequence.fromList(parameterDeclarations).count()
               == ListSequence.fromList(actualArguments).count();
     }
     if (!(isOk)) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 iMethodCall,
                 "wrong number of parameters",
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "1219948518456",
                 null,
                 errorTarget);
       }
     }
   }
 }
 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 abstractDiagramCreation,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (!((SNodeOperations.isInstanceOf(
           SLinkOperations.getTarget(
               abstractDiagramCreation,
               MetaAdapterFactory.getContainmentLink(
                   0x6106f6117a7442d1L,
                   0x80deedc5c602bfd1L,
                   0x120f760a04397296L,
                   0x120f760a0439bb2bL,
                   "query")),
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x116b46a08c4L,
               "jetbrains.mps.baseLanguage.structure.DotExpression"))
       && SNodeOperations.isInstanceOf(
           SLinkOperations.getTarget(
               SNodeOperations.cast(
                   SLinkOperations.getTarget(
                       abstractDiagramCreation,
                       MetaAdapterFactory.getContainmentLink(
                           0x6106f6117a7442d1L,
                           0x80deedc5c602bfd1L,
                           0x120f760a04397296L,
                           0x120f760a0439bb2bL,
                           "query")),
                   MetaAdapterFactory.getConcept(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0x116b46a08c4L,
                       "jetbrains.mps.baseLanguage.structure.DotExpression")),
               MetaAdapterFactory.getContainmentLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x116b46a08c4L,
                   0x116b46b36c4L,
                   "operation")),
           MetaAdapterFactory.getConcept(
               0x7866978ea0f04cc7L,
               0x81bc4d213d9375e1L,
               0x108f970c119L,
               "jetbrains.mps.lang.smodel.structure.SLinkListAccess"))))) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               SLinkOperations.getTarget(
                   abstractDiagramCreation,
                   MetaAdapterFactory.getContainmentLink(
                       0x6106f6117a7442d1L,
                       0x80deedc5c602bfd1L,
                       0x120f760a04397296L,
                       0x120f760a0439bb2bL,
                       "query")),
               "Use DotExpression to point to the containment LinkDeclaration",
               "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
               "8570854907291359968",
               null,
               errorTarget);
     }
   } else {
     SNode containmentLink =
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 SLinkOperations.getTarget(
                     SNodeOperations.cast(
                         SLinkOperations.getTarget(
                             abstractDiagramCreation,
                             MetaAdapterFactory.getContainmentLink(
                                 0x6106f6117a7442d1L,
                                 0x80deedc5c602bfd1L,
                                 0x120f760a04397296L,
                                 0x120f760a0439bb2bL,
                                 "query")),
                         MetaAdapterFactory.getConcept(
                             0xf3061a5392264cc5L,
                             0xa443f952ceaf5816L,
                             0x116b46a08c4L,
                             "jetbrains.mps.baseLanguage.structure.DotExpression")),
                     MetaAdapterFactory.getContainmentLink(
                         0xf3061a5392264cc5L,
                         0xa443f952ceaf5816L,
                         0x116b46a08c4L,
                         0x116b46b36c4L,
                         "operation")),
                 MetaAdapterFactory.getConcept(
                     0x7866978ea0f04cc7L,
                     0x81bc4d213d9375e1L,
                     0x108f970c119L,
                     "jetbrains.mps.lang.smodel.structure.SLinkListAccess")),
             MetaAdapterFactory.getReferenceLink(
                 0x7866978ea0f04cc7L,
                 0x81bc4d213d9375e1L,
                 0x108f970c119L,
                 0x108f974c962L,
                 "link"));
     if (SLinkOperations.getTarget(
                 abstractDiagramCreation,
                 MetaAdapterFactory.getReferenceLink(
                     0x6106f6117a7442d1L,
                     0x80deedc5c602bfd1L,
                     0x120f760a04397296L,
                     0x120f760a0439bb31L,
                     "concept"))
             != null
         && SLinkOperations.getTarget(
                 containmentLink,
                 MetaAdapterFactory.getReferenceLink(
                     0xc72da2b97cce4447L,
                     0x8389f407dc1158b7L,
                     0xf979bd086aL,
                     0xf98055fef0L,
                     "target"))
             != null
         && !((boolean)
             AbstractConceptDeclaration__BehaviorDescriptor.isSubconceptOf_id73yVtVlWOga.invoke(
                 SLinkOperations.getTarget(
                     abstractDiagramCreation,
                     MetaAdapterFactory.getReferenceLink(
                         0x6106f6117a7442d1L,
                         0x80deedc5c602bfd1L,
                         0x120f760a04397296L,
                         0x120f760a0439bb31L,
                         "concept")),
                 SLinkOperations.getTarget(
                     containmentLink,
                     MetaAdapterFactory.getReferenceLink(
                         0xc72da2b97cce4447L,
                         0x8389f407dc1158b7L,
                         0xf979bd086aL,
                         0xf98055fef0L,
                         "target"))))) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         errorTarget = new ReferenceMessageTarget("concept");
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 abstractDiagramCreation,
                 "Only subconcept of containment link target contept ("
                     + SLinkOperations.getTarget(
                         containmentLink,
                         MetaAdapterFactory.getReferenceLink(
                             0xc72da2b97cce4447L,
                             0x8389f407dc1158b7L,
                             0xf979bd086aL,
                             0xf98055fef0L,
                             "target"))
                     + ") can be used here.",
                 "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
                 "1301388602725875172",
                 null,
                 errorTarget);
       }
     }
   }
 }
 public void applyRule(
     final SNode method,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode superMethod =
       BehaviorReflection.invokeVirtual(
           (Class<SNode>) ((Class) Object.class),
           method,
           "virtual_getNearestOverriddenMethod_5358895268254685434",
           new Object[] {});
   if ((superMethod == null)) {
     return;
   }
   if (BaseMethodDeclaration_Behavior.call_hasAnnotation_5499146221535822693(
       superMethod,
       SNodeOperations.getNode(
           "3f233e7f-b8a6-46d2-a57f-795d56775243/java:org.jetbrains.annotations(Annotations/)",
           "~NotNull"))) {
     if (!(BaseMethodDeclaration_Behavior.call_hasAnnotation_5499146221535822693(
         method,
         SNodeOperations.getNode(
             "3f233e7f-b8a6-46d2-a57f-795d56775243/java:org.jetbrains.annotations(Annotations/)",
             "~NotNull")))) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 method,
                 "This method must have @NotNull annotation",
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "5499146221535829680",
                 null,
                 errorTarget);
         {
           BaseQuickFixProvider intentionProvider =
               new BaseQuickFixProvider(
                   "jetbrains.mps.baseLanguage.typesystem.Add_NotNullAnnotation_QuickFix", false);
           intentionProvider.putArgument("method", method);
           _reporter_2309309498.addIntentionProvider(intentionProvider);
         }
       }
     }
   }
   for (int i = 0;
       i
           < ListSequence.fromList(
                   SLinkOperations.getChildren(
                       superMethod,
                       MetaAdapterFactory.getContainmentLink(
                           0xf3061a5392264cc5L,
                           0xa443f952ceaf5816L,
                           0xf8cc56b1fcL,
                           0xf8cc56b1feL,
                           "parameter")))
               .count();
       i++) {
     if (ParameterDeclaration_Behavior.call_hasAnnotation_5499146221535981742(
         ListSequence.fromList(
                 SLinkOperations.getChildren(
                     superMethod,
                     MetaAdapterFactory.getContainmentLink(
                         0xf3061a5392264cc5L,
                         0xa443f952ceaf5816L,
                         0xf8cc56b1fcL,
                         0xf8cc56b1feL,
                         "parameter")))
             .getElement(i),
         SNodeOperations.getNode(
             "3f233e7f-b8a6-46d2-a57f-795d56775243/java:org.jetbrains.annotations(Annotations/)",
             "~Nullable"))) {
       SNode param =
           ListSequence.fromList(
                   SLinkOperations.getChildren(
                       method,
                       MetaAdapterFactory.getContainmentLink(
                           0xf3061a5392264cc5L,
                           0xa443f952ceaf5816L,
                           0xf8cc56b1fcL,
                           0xf8cc56b1feL,
                           "parameter")))
               .getElement(i);
       if (param != null
           && !(ParameterDeclaration_Behavior.call_hasAnnotation_5499146221535981742(
               param,
               SNodeOperations.getNode(
                   "3f233e7f-b8a6-46d2-a57f-795d56775243/java:org.jetbrains.annotations(Annotations/)",
                   "~Nullable")))) {
         {
           MessageTarget errorTarget = new NodeMessageTarget();
           IErrorReporter _reporter_2309309498 =
               typeCheckingContext.reportTypeError(
                   param,
                   "This parameter must have @Nullable annotation",
                   "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                   "5499146221535981784",
                   null,
                   errorTarget);
           {
             BaseQuickFixProvider intentionProvider =
                 new BaseQuickFixProvider(
                     "jetbrains.mps.baseLanguage.typesystem.Add_NullableAnnotationToParameter_QuickFix",
                     false);
             intentionProvider.putArgument("parameter", param);
             _reporter_2309309498.addIntentionProvider(intentionProvider);
           }
         }
       }
     }
   }
 }
 public void applyRule(
     final SNode abstractDiagramCreation,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (!((SNodeOperations.isInstanceOf(
           SLinkOperations.getTarget(abstractDiagramCreation, "query", true),
           "jetbrains.mps.baseLanguage.structure.DotExpression")
       && SNodeOperations.isInstanceOf(
           SLinkOperations.getTarget(
               SNodeOperations.cast(
                   SLinkOperations.getTarget(abstractDiagramCreation, "query", true),
                   "jetbrains.mps.baseLanguage.structure.DotExpression"),
               "operation",
               true),
           "jetbrains.mps.lang.smodel.structure.SLinkListAccess")))) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               SLinkOperations.getTarget(abstractDiagramCreation, "query", true),
               "Use DotExpression to point to the containment LinkDeclaration",
               "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
               "8570854907291359968",
               null,
               errorTarget);
     }
   } else {
     SNode containmentLink =
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 SLinkOperations.getTarget(
                     SNodeOperations.cast(
                         SLinkOperations.getTarget(abstractDiagramCreation, "query", true),
                         "jetbrains.mps.baseLanguage.structure.DotExpression"),
                     "operation",
                     true),
                 "jetbrains.mps.lang.smodel.structure.SLinkListAccess"),
             "link",
             false);
     if (SLinkOperations.getTarget(abstractDiagramCreation, "concept", false) != null
         && SLinkOperations.getTarget(containmentLink, "target", false) != null
         && !(SConceptOperations.isSubConceptOf(
             SLinkOperations.getTarget(abstractDiagramCreation, "concept", false),
             NameUtil.nodeFQName(SLinkOperations.getTarget(containmentLink, "target", false))))) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         errorTarget = new ReferenceMessageTarget("concept");
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 abstractDiagramCreation,
                 "Only subconcept of containment link target contept ("
                     + SLinkOperations.getTarget(containmentLink, "target", false)
                     + ") can be used here.",
                 "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
                 "1301388602725875172",
                 null,
                 errorTarget);
       }
     }
   }
 }
 public void applyRule(
     final SNode creator,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode createdType = SLinkOperations.getTarget(creator, "createdType", true);
   if (createdType != null) {
     if (SLinkOperations.getTarget(createdType, "concept", false) == null) {
       {
         MessageTarget errorTarget = new NodeMessageTarget();
         IErrorReporter _reporter_2309309498 =
             typeCheckingContext.reportTypeError(
                 createdType,
                 "concrete node type is expected",
                 "r:00000000-0000-4000-0000-011c895902fe(jetbrains.mps.lang.smodel.typesystem)",
                 "1181944909006",
                 null,
                 errorTarget);
       }
       return;
     }
     if (SLinkOperations.getTarget(creator, "prototypeNode", true) != null) {
       {
         SNode _nodeToCheck_1029348928467 =
             SLinkOperations.getTarget(creator, "prototypeNode", true);
         EquationInfo _info_12389875345 =
             new EquationInfo(
                 _nodeToCheck_1029348928467,
                 null,
                 "r:00000000-0000-4000-0000-011c895902fe(jetbrains.mps.lang.smodel.typesystem)",
                 "1181945011354",
                 0,
                 null);
         typeCheckingContext.createLessThanInequality(
             (SNode)
                 typeCheckingContext.typeOf(
                     _nodeToCheck_1029348928467,
                     "r:00000000-0000-4000-0000-011c895902fe(jetbrains.mps.lang.smodel.typesystem)",
                     "1186061742845",
                     true),
             (SNode) _quotation_createNode_tty23h_a0a0b0b0b(),
             false,
             true,
             _info_12389875345);
       }
     }
     {
       SNode _nodeToCheck_1029348928467 = creator;
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c895902fe(jetbrains.mps.lang.smodel.typesystem)",
               "1203712073961",
               0,
               null);
       typeCheckingContext.createEquation(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c895902fe(jetbrains.mps.lang.smodel.typesystem)",
                   "1203712073963",
                   true),
           (SNode) createdType,
           _info_12389875345);
     }
   }
 }
  public void applyRule(
      final SNode macro, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
    SNode containingTemplate =
        SNodeOperations.getNodeAncestor(
            macro,
            MetaAdapterFactory.getConcept(
                0xb401a68083254110L,
                0x8fd384331ff25befL,
                0xfe43cb41d0L,
                "jetbrains.mps.lang.generator.structure.TemplateDeclaration"),
            false,
            false);
    SNode includedTemplate =
        SLinkOperations.getTarget(
            macro,
            MetaAdapterFactory.getReferenceLink(
                0xb401a68083254110L,
                0x8fd384331ff25befL,
                0x11621ab7715L,
                0x11621b434a7L,
                "includeTemplate"));

    if ((includedTemplate == null)) {
      {
        MessageTarget errorTarget = new NodeMessageTarget();
        IErrorReporter _reporter_2309309498 =
            typeCheckingContext.reportTypeError(
                macro,
                "No template",
                "r:00000000-0000-4000-0000-011c895902e4(jetbrains.mps.lang.generator.typesystem)",
                "7260186302264328988",
                null,
                errorTarget);
      }
    } else if ((containingTemplate == null)) {
      if (!(ListSequence.fromList(
              SLinkOperations.getChildren(
                  includedTemplate,
                  MetaAdapterFactory.getContainmentLink(
                      0xb401a68083254110L,
                      0x8fd384331ff25befL,
                      0xda3dc6e5137e9b1L,
                      0xda3dc6e5137ea56L,
                      "parameter")))
          .isEmpty())) {
        {
          MessageTarget errorTarget = new NodeMessageTarget();
          IErrorReporter _reporter_2309309498 =
              typeCheckingContext.reportTypeError(
                  macro,
                  "Cannot include template with arguments",
                  "r:00000000-0000-4000-0000-011c895902e4(jetbrains.mps.lang.generator.typesystem)",
                  "7260186302264329007",
                  null,
                  errorTarget);
        }
      }
    } else {
      Map<String, SNode> available = MapSequence.fromMap(new HashMap<String, SNode>());
      for (SNode param :
          ListSequence.fromList(
              SLinkOperations.getChildren(
                  containingTemplate,
                  MetaAdapterFactory.getContainmentLink(
                      0xb401a68083254110L,
                      0x8fd384331ff25befL,
                      0xda3dc6e5137e9b1L,
                      0xda3dc6e5137ea56L,
                      "parameter")))) {
        MapSequence.fromMap(available)
            .put(
                SPropertyOperations.getString(
                    param,
                    MetaAdapterFactory.getProperty(
                        0xceab519525ea4f22L,
                        0x9b92103b95ca8c0cL,
                        0x110396eaaa4L,
                        0x110396ec041L,
                        "name")),
                SLinkOperations.getTarget(
                    param,
                    MetaAdapterFactory.getContainmentLink(
                        0xb401a68083254110L,
                        0x8fd384331ff25befL,
                        0x190d31fe6a0962e6L,
                        0x190d31fe6a096acfL,
                        "type")));
      }
      for (SNode p :
          ListSequence.fromList(
              SLinkOperations.getChildren(
                  includedTemplate,
                  MetaAdapterFactory.getContainmentLink(
                      0xb401a68083254110L,
                      0x8fd384331ff25befL,
                      0xda3dc6e5137e9b1L,
                      0xda3dc6e5137ea56L,
                      "parameter")))) {
        if (!(MapSequence.fromMap(available)
            .containsKey(
                SPropertyOperations.getString(
                    p,
                    MetaAdapterFactory.getProperty(
                        0xceab519525ea4f22L,
                        0x9b92103b95ca8c0cL,
                        0x110396eaaa4L,
                        0x110396ec041L,
                        "name"))))) {
          {
            MessageTarget errorTarget = new NodeMessageTarget();
            IErrorReporter _reporter_2309309498 =
                typeCheckingContext.reportTypeError(
                    macro,
                    "no `"
                        + SPropertyOperations.getString(
                            p,
                            MetaAdapterFactory.getProperty(
                                0xceab519525ea4f22L,
                                0x9b92103b95ca8c0cL,
                                0x110396eaaa4L,
                                0x110396ec041L,
                                "name"))
                        + "' parameter",
                    "r:00000000-0000-4000-0000-011c895902e4(jetbrains.mps.lang.generator.typesystem)",
                    "7260186302264329045",
                    null,
                    errorTarget);
          }
        } else if (!(TypeChecker.getInstance()
            .getSubtypingManager()
            .isSubtype(
                MapSequence.fromMap(available)
                    .get(
                        SPropertyOperations.getString(
                            p,
                            MetaAdapterFactory.getProperty(
                                0xceab519525ea4f22L,
                                0x9b92103b95ca8c0cL,
                                0x110396eaaa4L,
                                0x110396ec041L,
                                "name"))),
                SLinkOperations.getTarget(
                    p,
                    MetaAdapterFactory.getContainmentLink(
                        0xb401a68083254110L,
                        0x8fd384331ff25befL,
                        0x190d31fe6a0962e6L,
                        0x190d31fe6a096acfL,
                        "type"))))) {
          {
            MessageTarget errorTarget = new NodeMessageTarget();
            IErrorReporter _reporter_2309309498 =
                typeCheckingContext.reportTypeError(
                    macro,
                    "bad type of `"
                        + SPropertyOperations.getString(
                            p,
                            MetaAdapterFactory.getProperty(
                                0xceab519525ea4f22L,
                                0x9b92103b95ca8c0cL,
                                0x110396eaaa4L,
                                0x110396ec041L,
                                "name"))
                        + "' parameter",
                    "r:00000000-0000-4000-0000-011c895902e4(jetbrains.mps.lang.generator.typesystem)",
                    "7260186302264329073",
                    null,
                    errorTarget);
          }
        }
      }
    }
    if ((includedTemplate != null)
        && (SLinkOperations.getTarget(
                includedTemplate,
                MetaAdapterFactory.getReferenceLink(
                    0xb401a68083254110L,
                    0x8fd384331ff25befL,
                    0xfe43cb41d0L,
                    0x1100343ad9eL,
                    "applicableConcept"))
            != null)) {
      SNode inputNodeConcept =
          BehaviorReflection.invokeVirtual(
              (Class<SNode>) ((Class) Object.class),
              macro,
              "virtual_getInputNodeTypeInsideOfMacro_1213877290799",
              new Object[] {});
      if ((inputNodeConcept != null)) {
        if (!(MetaAdapterByDeclaration.getConcept(inputNodeConcept)
            .isSubConceptOf(
                MetaAdapterByDeclaration.getConcept(
                    SLinkOperations.getTarget(
                        includedTemplate,
                        MetaAdapterFactory.getReferenceLink(
                            0xb401a68083254110L,
                            0x8fd384331ff25befL,
                            0xfe43cb41d0L,
                            0x1100343ad9eL,
                            "applicableConcept")))))) {
          String msg =
              String.format(
                  "Input node (%s) is not an instance of template's expected concept (%s)",
                  SPropertyOperations.getString(
                      inputNodeConcept,
                      MetaAdapterFactory.getProperty(
                          0xceab519525ea4f22L,
                          0x9b92103b95ca8c0cL,
                          0x110396eaaa4L,
                          0x110396ec041L,
                          "name")),
                  SPropertyOperations.getString(
                      SLinkOperations.getTarget(
                          includedTemplate,
                          MetaAdapterFactory.getReferenceLink(
                              0xb401a68083254110L,
                              0x8fd384331ff25befL,
                              0xfe43cb41d0L,
                              0x1100343ad9eL,
                              "applicableConcept")),
                      MetaAdapterFactory.getProperty(
                          0xceab519525ea4f22L,
                          0x9b92103b95ca8c0cL,
                          0x110396eaaa4L,
                          0x110396ec041L,
                          "name")));
          {
            MessageTarget errorTarget = new NodeMessageTarget();
            IErrorReporter _reporter_2309309498 =
                typeCheckingContext.reportTypeError(
                    macro,
                    msg,
                    "r:00000000-0000-4000-0000-011c895902e4(jetbrains.mps.lang.generator.typesystem)",
                    "3850501259760070529",
                    null,
                    errorTarget);
          }
        }
      }
    }
  }
  public void applyRule(
      final SNode builder,
      final TypeCheckingContext typeCheckingContext,
      IsApplicableStatus status) {
    Language containingLanguage =
        as_46aqev_a0a0a1(SNodeOperations.getModel(builder).getModule(), Language.class);
    if (containingLanguage == null
        || SLinkOperations.getTarget(
                builder,
                MetaAdapterFactory.getReferenceLink(
                    0x7fa12e9cb9494976L,
                    0xb4fa19accbc320b4L,
                    0x118e58cd635L,
                    0x118e58d76a0L,
                    "conceptDeclaration"))
            == null) {
      return;
    }

    Map<SNode, List<SNode>> duplicatingDeclarations =
        MapSequence.fromMap(new HashMap<SNode, List<SNode>>());
    SModel dataFlowModel = SModuleOperations.getAspect(containingLanguage, "dataFlow");
    if (dataFlowModel != null) {
      List<SNode> roots =
          SModelOperations.roots(
              dataFlowModel,
              MetaAdapterFactory.getConcept(
                  0x7fa12e9cb9494976L,
                  0xb4fa19accbc320b4L,
                  0x118e58cd635L,
                  "jetbrains.mps.lang.dataFlow.structure.DataFlowBuilderDeclaration"));
      for (SNode root : ListSequence.fromList(roots)) {
        if (root == builder
            || SLinkOperations.getTarget(
                    root,
                    MetaAdapterFactory.getReferenceLink(
                        0x7fa12e9cb9494976L,
                        0xb4fa19accbc320b4L,
                        0x118e58cd635L,
                        0x118e58d76a0L,
                        "conceptDeclaration"))
                != SLinkOperations.getTarget(
                    builder,
                    MetaAdapterFactory.getReferenceLink(
                        0x7fa12e9cb9494976L,
                        0xb4fa19accbc320b4L,
                        0x118e58cd635L,
                        0x118e58d76a0L,
                        "conceptDeclaration"))) {
          continue;
        }
        if (ListSequence.fromList(
                    SLinkOperations.getChildren(
                        builder,
                        MetaAdapterFactory.getContainmentLink(
                            0x7fa12e9cb9494976L,
                            0xb4fa19accbc320b4L,
                            0x118e58cd635L,
                            0x6e8db6877fd04efbL,
                            "modes")))
                .isEmpty()
            && ListSequence.fromList(
                    SLinkOperations.getChildren(
                        root,
                        MetaAdapterFactory.getContainmentLink(
                            0x7fa12e9cb9494976L,
                            0xb4fa19accbc320b4L,
                            0x118e58cd635L,
                            0x6e8db6877fd04efbL,
                            "modes")))
                .isEmpty()) {
          MapSequence.fromMap(duplicatingDeclarations)
              .put(root, ListSequence.fromList(new ArrayList<SNode>()));
        } else {
          for (SNode myMode :
              ListSequence.fromList(
                  SLinkOperations.getChildren(
                      builder,
                      MetaAdapterFactory.getContainmentLink(
                          0x7fa12e9cb9494976L,
                          0xb4fa19accbc320b4L,
                          0x118e58cd635L,
                          0x6e8db6877fd04efbL,
                          "modes")))) {
            if (ListSequence.fromList(
                    SLinkOperations.getChildren(
                        root,
                        MetaAdapterFactory.getContainmentLink(
                            0x7fa12e9cb9494976L,
                            0xb4fa19accbc320b4L,
                            0x118e58cd635L,
                            0x6e8db6877fd04efbL,
                            "modes")))
                .select(
                    new ISelector<SNode, SConcept>() {
                      public SConcept select(SNode it) {
                        return SNodeOperations.getConcept(it);
                      }
                    })
                .contains(SNodeOperations.getConcept(myMode))) {
              if (MapSequence.fromMap(duplicatingDeclarations).get(root) == null) {
                MapSequence.fromMap(duplicatingDeclarations)
                    .put(root, ListSequence.fromList(new ArrayList<SNode>()));
              }
              ListSequence.fromList(MapSequence.fromMap(duplicatingDeclarations).get(root))
                  .addElement(myMode);
            }
          }
        }
      }
    }

    if (SetSequence.fromSet(MapSequence.fromMap(duplicatingDeclarations).keySet()).isNotEmpty()) {
      for (SNode duplicatingDecl :
          SetSequence.fromSet(MapSequence.fromMap(duplicatingDeclarations).keySet())) {
        {
          MessageTarget errorTarget = new NodeMessageTarget();
          IErrorReporter _reporter_2309309498 =
              typeCheckingContext.reportTypeError(
                  builder,
                  "Conflicting modes. Data flow builder"
                      + ((ListSequence.fromList(
                                  MapSequence.fromMap(duplicatingDeclarations).get(duplicatingDecl))
                              .isEmpty()
                          ? ""
                          : "  with modes ("
                              + ListSequence.fromList(
                                      MapSequence.fromMap(duplicatingDeclarations)
                                          .get(duplicatingDecl))
                                  .select(
                                      new ISelector<SNode, String>() {
                                        public String select(SNode it) {
                                          return SNodeOperations.getConcept(it).getName();
                                        }
                                      })
                                  .reduceLeft(
                                      new ILeftCombinator<String, String>() {
                                        public String combine(String a, String b) {
                                          return a + " , " + b;
                                        }
                                      })
                              + ")"))
                      + " was defined in: "
                      + INamedConcept__BehaviorDescriptor.getFqName_idhEwIO9y.invoke(
                          duplicatingDecl),
                  "r:00000000-0000-4000-0000-011c8959037a(jetbrains.mps.lang.dataFlow.typesystem)",
                  "6246554009626560906",
                  null,
                  errorTarget);
        }
      }
    }
  }