public void applyRule( final SNode op, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) { final SNode conceptLinkDecl = SLinkOperations.getTarget(op, "conceptLinkDeclaration", false); if (conceptLinkDecl == null) { return; } SNode concreteConcept = RulesUtil.get_inputNodeConcept(op, true); SNode declaringConcept = SNodeOperations.cast( SNodeOperations.getParent(conceptLinkDecl), "jetbrains.mps.lang.structure.structure.AbstractConceptDeclaration"); RulesUtil.checkAssignableConcept( typeCheckingContext, (SNode) concreteConcept, declaringConcept, op, "operation is applied to wrong concept"); }
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); } }