public void applyRule(
     final SNode creator,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode elementType = SLinkOperations.getTarget(creator, "elementType", true);
   {
     SNode _nodeToCheck_1029348928467 = creator;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "1224414570410",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1224414558830",
                 true),
         (SNode) _quotation_createNode_qzfpnd_a0b0a(elementType),
         _info_12389875345);
   }
   if ((SLinkOperations.getTarget(creator, "initializer", true) != null)) {
     if (!(typeCheckingContext.isSingleTypeComputation())) {
       {
         SNode _nodeToCheck_1029348928467 =
             SLinkOperations.getTarget(creator, "initializer", true);
         EquationInfo _info_12389875345 =
             new EquationInfo(
                 _nodeToCheck_1029348928467,
                 null,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1224414640119",
                 0,
                 null);
         typeCheckingContext.createLessThanInequality(
             (SNode)
                 typeCheckingContext.typeOf(
                     _nodeToCheck_1029348928467,
                     "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                     "1224414629838",
                     true),
             (SNode) _quotation_createNode_qzfpnd_a0a0c0a(elementType),
             true,
             true,
             _info_12389875345);
       }
     }
   }
 }
 public void applyRule(
     final SNode op, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   {
     SNode _nodeToCheck_1029348928467 = op;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c895902f1(jetbrains.mps.lang.generator.generationContext.typesystem)",
             "5403673535105110320",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c895902f1(jetbrains.mps.lang.generator.generationContext.typesystem)",
                 "5403673535105110315",
                 true),
         (SNode) _quotation_createNode_3ufvnu_a0a0b(),
         _info_12389875345);
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 = SLinkOperations.getTarget(op, "nodeToCheck", true);
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c895902f1(jetbrains.mps.lang.generator.generationContext.typesystem)",
               "6908928803899694660",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c895902f1(jetbrains.mps.lang.generator.generationContext.typesystem)",
                   "6908928803899694662",
                   true),
           (SNode) _quotation_createNode_3ufvnu_a0b0b(),
           true,
           true,
           _info_12389875345);
     }
   }
 }
 public void applyRule(
     final SNode switchCase,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode switchNode =
       SNodeOperations.as(
           SNodeOperations.getParent(switchCase),
           "jetbrains.mps.baseLanguage.structure.SwitchStatement");
   if ((switchNode != null)) {
     if (!(typeCheckingContext.isSingleTypeComputation())) {
       {
         SNode _nodeToCheck_1029348928467 =
             SLinkOperations.getTarget(switchCase, "expression", true);
         EquationInfo _info_12389875345 =
             new EquationInfo(
                 _nodeToCheck_1029348928467,
                 null,
                 "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                 "9035995549588792237",
                 0,
                 null);
         typeCheckingContext.createLessThanInequality(
             (SNode)
                 typeCheckingContext.typeOf(
                     _nodeToCheck_1029348928467,
                     "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                     "9035995549588792243",
                     true),
             (SNode)
                 typeCheckingContext.typeOf(
                     SLinkOperations.getTarget(switchNode, "expression", true),
                     "r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)",
                     "9035995549588792240",
                     true),
             true,
             false,
             _info_12389875345);
       }
     }
   }
 }
 public void applyRule(
     final SNode operation,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 =
           SLinkOperations.getTarget(
               operation,
               MetaAdapterFactory.getContainmentLink(
                   0x7866978ea0f04cc7L,
                   0x81bc4d213d9375e1L,
                   0x120ed37e60cL,
                   0x120ed37e60dL,
                   "nameExpression"));
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c895902fe(jetbrains.mps.lang.smodel.typesystem)",
               "1240321449347",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c895902fe(jetbrains.mps.lang.smodel.typesystem)",
                   "1240321440339",
                   true),
           (SNode) _quotation_createNode_rhg2pa_a0a0b(),
           true,
           false,
           _info_12389875345);
     }
   }
 }
 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 containsKeyOperation,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   {
     SNode _nodeToCheck_1029348928467 = containsKeyOperation;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "1201873006966",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1201873003944",
                 true),
         (SNode) _quotation_createNode_n6vt4l_a0a0b(),
         _info_12389875345);
   }
   final SNode KEY_typevar_1201873088202 = typeCheckingContext.createNewRuntimeTypesVariable();
   final SNode VALUE_typevar_1201874216771 = typeCheckingContext.createNewRuntimeTypesVariable();
   {
     SNode _nodeToCheck_1029348928467 =
         IOperation__BehaviorDescriptor.getOperand_idhEwIP$m.invoke(containsKeyOperation);
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "7668447476859120479",
             0,
             null);
     typeCheckingContext.createGreaterThanInequality(
         (SNode)
             _quotation_createNode_n6vt4l_a0d0b(
                 typeCheckingContext.getRepresentative(VALUE_typevar_1201874216771),
                 typeCheckingContext.getRepresentative(KEY_typevar_1201873088202)),
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1201874242447",
                 true),
         false,
         true,
         _info_12389875345);
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 =
           SLinkOperations.getTarget(
               containsKeyOperation,
               MetaAdapterFactory.getContainmentLink(
                   0x8388864671ce4f1cL,
                   0x9c53c54016f6ad4fL,
                   0x117b3740258L,
                   0x117c8321b8fL,
                   "key"));
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
               "1201873049497",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                   "1201873021716",
                   true),
           (SNode) typeCheckingContext.getRepresentative(KEY_typevar_1201873088202),
           true,
           true,
           _info_12389875345);
     }
   }
 }
 public void applyRule(
     final SNode op, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   final SNode elementType_typevar_1227022325815 =
       typeCheckingContext.createNewRuntimeTypesVariable();
   {
     SNode _nodeToCheck_1029348928467 = IOperation_Behavior.call_getOperand_1213877410070(op);
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "7668447476859120474",
             0,
             null);
     typeCheckingContext.createGreaterThanInequality(
         (SNode)
             BehaviorReflection.invokeVirtual(
                 (Class<SNode>) ((Class) Object.class),
                 op,
                 "virtual_expectedOperandType_6368025520509018230",
                 new Object[] {
                   typeCheckingContext.getRepresentative(elementType_typevar_1227022325815)
                 }),
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1227022309333",
                 true),
         false,
         true,
         _info_12389875345);
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 = SLinkOperations.getTarget(op, "index", true);
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
               "1227022345453",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                   "1227022338592",
                   true),
           (SNode) _quotation_createNode_y1ttf7_a0c0b(),
           true,
           true,
           _info_12389875345);
     }
   }
   {
     SNode _nodeToCheck_1029348928467 = op;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "1227022501971",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1227022497064",
                 true),
         (SNode) typeCheckingContext.getRepresentative(elementType_typevar_1227022325815),
         _info_12389875345);
   }
 }
  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 expr, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 =
           SLinkOperations.getTarget(
               expr,
               MetaAdapterFactory.getContainmentLink(
                   0x64d34fcdad024e73L,
                   0xaff8a581124c2e30L,
                   0x1bd5a514384e1959L,
                   0x585a05e7f411353eL,
                   "queryNode"));
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c8959035a(jetbrains.mps.lang.findUsages.typesystem)",
               "6413574678187373071",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c8959035a(jetbrains.mps.lang.findUsages.typesystem)",
                   "6413574678187373073",
                   true),
           (SNode) _quotation_createNode_4qk8lm_a0a0b(),
           true,
           true,
           _info_12389875345);
     }
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 =
           SLinkOperations.getTarget(
               expr,
               MetaAdapterFactory.getContainmentLink(
                   0x64d34fcdad024e73L,
                   0xaff8a581124c2e30L,
                   0x1bd5a514384e1959L,
                   0x585a05e7f411353fL,
                   "scope"));
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c8959035a(jetbrains.mps.lang.findUsages.typesystem)",
               "6366407517031970690",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c8959035a(jetbrains.mps.lang.findUsages.typesystem)",
                   "6366407517031970695",
                   true),
           (SNode) _quotation_createNode_4qk8lm_a0b0b(),
           true,
           false,
           _info_12389875345);
     }
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 =
           SLinkOperations.getTarget(
               expr,
               MetaAdapterFactory.getContainmentLink(
                   0x64d34fcdad024e73L,
                   0xaff8a581124c2e30L,
                   0x1bd5a514384e1959L,
                   0x585a05e7f4113540L,
                   "progress"));
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c8959035a(jetbrains.mps.lang.findUsages.typesystem)",
               "6366407517031970703",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c8959035a(jetbrains.mps.lang.findUsages.typesystem)",
                   "6366407517031970708",
                   true),
           (SNode) _quotation_createNode_4qk8lm_a0c0b(),
           true,
           false,
           _info_12389875345);
     }
   }
   {
     SNode _nodeToCheck_1029348928467 = expr;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959035a(jetbrains.mps.lang.findUsages.typesystem)",
             "8150507060913379976",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959035a(jetbrains.mps.lang.findUsages.typesystem)",
                 "8150507060913379973",
                 true),
         (SNode) _quotation_createNode_4qk8lm_a0d0b(),
         _info_12389875345);
   }
 }
 public void applyRule(
     final SNode mapping,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   {
     SNode _nodeToCheck_1029348928467 = mapping;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
             "342110547582557667",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
                 "342110547582557391",
                 true),
         (SNode)
             typeCheckingContext.typeOf(
                 FigureParameterMapping_Behavior.call_getParameterDeclaration_4115105161238952352(
                     mapping),
                 "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
                 "342110547582557855",
                 true),
         _info_12389875345);
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 =
           SLinkOperations.getTarget(
               mapping,
               MetaAdapterFactory.getContainmentLink(
                   0x6106f6117a7442d1L,
                   0x80deedc5c602bfd1L,
                   0xf301bf106a7d7c7L,
                   0x3f6e840fdd824ddL,
                   "argument"));
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
               "342110547580710609",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
                   "342110547580708533",
                   true),
           (SNode)
               typeCheckingContext.typeOf(
                   FigureParameterMapping_Behavior
                       .call_getParameterDeclaration_4115105161238952352(mapping),
                   "r:40b64a44-89c9-404d-9824-6c98cb8ca353(jetbrains.mps.lang.editor.diagram.typesystem)",
                   "342110547580710824",
                   true),
           true,
           true,
           _info_12389875345);
     }
   }
 }
 public void applyRule(
     final SNode op, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   {
     SNode _nodeToCheck_1029348928467 = SLinkOperations.getTarget(op, "expression", true);
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c895903d1(jetbrains.mps.baseLanguage.dates.typesystem)",
             "1204416302428",
             0,
             null);
     typeCheckingContext.createLessThanInequality(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c895903d1(jetbrains.mps.baseLanguage.dates.typesystem)",
                 "1204416290893",
                 true),
         (SNode) _quotation_createNode_ppkk5o_a0a0a(),
         false,
         true,
         _info_12389875345);
   }
   {
     SNode _nodeToCheck_1029348928467 = op;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c895903d1(jetbrains.mps.baseLanguage.dates.typesystem)",
             "2639623922402551110",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c895903d1(jetbrains.mps.baseLanguage.dates.typesystem)",
                 "2639623922402551102",
                 true),
         (SNode)
             typeCheckingContext.typeOf(
                 SLinkOperations.getTarget(op, "datetime", true),
                 "r:00000000-0000-4000-0000-011c895903d1(jetbrains.mps.baseLanguage.dates.typesystem)",
                 "2639623922402551123",
                 true),
         _info_12389875345);
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 = SLinkOperations.getTarget(op, "datetime", true);
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c895903d1(jetbrains.mps.baseLanguage.dates.typesystem)",
               "3986031709810158442",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c895903d1(jetbrains.mps.baseLanguage.dates.typesystem)",
                   "3986031709810154698",
                   true),
           (SNode) _quotation_createNode_ppkk5o_a0c0a(),
           true,
           true,
           _info_12389875345);
     }
   }
 }
 public void applyRule(
     final SNode wo, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
   final SNode paramType_typevar_1203177832282 =
       typeCheckingContext.createNewRuntimeTypesVariable();
   {
     SNode _nodeToCheck_1029348928467 = IOperation_Behavior.call_getOperand_1213877410070(wo);
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "2762046050488366454",
             0,
             null);
     typeCheckingContext.createGreaterThanInequality(
         (SNode)
             _quotation_createNode_pin8c2_a0b0b(
                 typeCheckingContext.getRepresentative(paramType_typevar_1203177832282)),
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1225885301838",
                 true),
         false,
         true,
         _info_12389875345);
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 = SLinkOperations.getTarget(wo, "closure", true);
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
               "1225884077242",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                   "1225884077244",
                   true),
           (SNode)
               _quotation_createNode_pin8c2_a0c0b(
                   typeCheckingContext.getRepresentative(paramType_typevar_1203177832282)),
           true,
           true,
           _info_12389875345);
     }
   }
   {
     SNode _nodeToCheck_1029348928467 = wo;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "1203177922110",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1203177917787",
                 true),
         (SNode)
             _quotation_createNode_pin8c2_a0d0b(
                 typeCheckingContext.getRepresentative(paramType_typevar_1203177832282)),
         _info_12389875345);
   }
 }
 public void applyRule(
     final SNode operation,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   final SNode ELEMENT_TYPE_typevar_1240251732387 =
       typeCheckingContext.createNewRuntimeTypesVariable();
   {
     SNode _nodeToCheck_1029348928467 =
         IOperation_Behavior.call_getOperand_1213877410070(operation);
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "7668447476859120532",
             0,
             null);
     typeCheckingContext.createGreaterThanInequality(
         (SNode)
             _quotation_createNode_9sowee_a0b0b(
                 typeCheckingContext.getRepresentative(ELEMENT_TYPE_typevar_1240251732387)),
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1240251732397",
                 true),
         false,
         true,
         _info_12389875345);
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 =
           SLinkOperations.getTarget(operation, "fromElement", true);
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
               "1240251732401",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                   "1240251732405",
                   true),
           (SNode) typeCheckingContext.getRepresentative(ELEMENT_TYPE_typevar_1240251732387),
           true,
           true,
           _info_12389875345);
     }
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 = SLinkOperations.getTarget(operation, "toElement", true);
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               null,
               "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
               "1240251740453",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               typeCheckingContext.typeOf(
                   _nodeToCheck_1029348928467,
                   "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                   "1240251740457",
                   true),
           (SNode) typeCheckingContext.getRepresentative(ELEMENT_TYPE_typevar_1240251732387),
           true,
           true,
           _info_12389875345);
     }
   }
   {
     SNode _nodeToCheck_1029348928467 = operation;
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             null,
             "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
             "1240251732409",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode)
             typeCheckingContext.typeOf(
                 _nodeToCheck_1029348928467,
                 "r:00000000-0000-4000-0000-011c8959032b(jetbrains.mps.baseLanguage.collections.typesystem)",
                 "1240251732417",
                 true),
         (SNode)
             _quotation_createNode_9sowee_a0e0b(
                 typeCheckingContext.getRepresentative(ELEMENT_TYPE_typevar_1240251732387)),
         _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);
         }
       }
     }
   }
 }
 public void applyRule(
     final SNode operation,
     final TypeCheckingContext typeCheckingContext,
     IsApplicableStatus status) {
   SNode eventNode =
       SLinkOperations.getTarget(
           SNodeOperations.cast(
               SLinkOperations.getTarget(
                   SNodeOperations.cast(
                       SLinkOperations.getTarget(operation, "leftExpression", true),
                       "jetbrains.mps.baseLanguage.structure.DotExpression"),
                   "operation",
                   true),
               "jetbrains.mps.uiLanguage.structure.EventAccessOperation"),
           "member",
           false);
   SNode methodNode =
       SLinkOperations.getTarget(
           SNodeOperations.cast(
               SLinkOperations.getTarget(operation, "rightExpression", true),
               "jetbrains.mps.uiLanguage.structure.EventHandlerReference"),
           "handler",
           false);
   if (ListSequence.fromList(SLinkOperations.getTargets(methodNode, "parameter", true)).count()
       != 1) {
     {
       MessageTarget errorTarget = new NodeMessageTarget();
       IErrorReporter _reporter_2309309498 =
           typeCheckingContext.reportTypeError(
               methodNode,
               "handler must have 1 parameter",
               "r:00000000-0000-4000-0000-011c89590550(jetbrains.mps.uiLanguage.typesystem)",
               "1208689441014",
               null,
               errorTarget);
     }
   }
   if (!(typeCheckingContext.isSingleTypeComputation())) {
     {
       SNode _nodeToCheck_1029348928467 =
           SNodeOperations.getAncestor(
               operation, "jetbrains.mps.baseLanguage.structure.Statement", false, false);
       EquationInfo _info_12389875345 =
           new EquationInfo(
               _nodeToCheck_1029348928467,
               "parameter types do not match",
               "r:00000000-0000-4000-0000-011c89590550(jetbrains.mps.uiLanguage.typesystem)",
               "1208689441024",
               0,
               null);
       typeCheckingContext.createLessThanInequality(
           (SNode)
               SLinkOperations.getTarget(
                   SLinkOperations.getTarget(eventNode, "parameter", true), "type", true),
           (SNode)
               typeCheckingContext.typeOf(
                   ListSequence.fromList(SLinkOperations.getTargets(methodNode, "parameter", true))
                       .first(),
                   "r:00000000-0000-4000-0000-011c89590550(jetbrains.mps.uiLanguage.typesystem)",
                   "1208689441026",
                   true),
           true,
           false,
           _info_12389875345);
     }
   }
   {
     SNode _nodeToCheck_1029348928467 =
         SNodeOperations.getAncestor(
             operation, "jetbrains.mps.baseLanguage.structure.Statement", false, false);
     EquationInfo _info_12389875345 =
         new EquationInfo(
             _nodeToCheck_1029348928467,
             "handler return type must be void",
             "r:00000000-0000-4000-0000-011c89590550(jetbrains.mps.uiLanguage.typesystem)",
             "1208689441044",
             0,
             null);
     typeCheckingContext.createEquation(
         (SNode) SLinkOperations.getTarget(methodNode, "returnType", true),
         (SNode) _quotation_createNode_4xbi0r_a0e0b(),
         _info_12389875345);
   }
 }