package jetbrains.mps.lang.typesystem.typesystem;
/*Generated by MPS */
import jetbrains.mps.lang.typesystem.runtime.AbstractInequationReplacementRule_Runtime;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.lang.typesystem.runtime.IsApplicable2Status;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.lang.pattern.util.MatchingUtil;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.typesystem.inference.TypeChecker;
import jetbrains.mps.typesystemEngine.util.CoerceUtil;
import jetbrains.mps.typesystem.inference.EquationInfo;
import jetbrains.mps.typesystem.inference.TypeCheckingContext;
import jetbrains.mps.lang.typesystem.runtime.IsApplicableStatus;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
public class JoinType_supertypeOf_arguments_InequationReplacementRule extends AbstractInequationReplacementRule_Runtime {
public JoinType_supertypeOf_arguments_InequationReplacementRule() {
}
public boolean isApplicableCustom(SNode subtype, SNode supertype, IsApplicable2Status status) {
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (MatchingUtil.matchNodes(arg, subtype)) {
return true;
}
}
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (eq_6boqzn_a0a0b0b(SNodeOperations.getConcept(arg), SNodeOperations.getConcept(subtype))) {
return true;
}
}
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (TypeChecker.getInstance().getSubtypingManager().isSubtype(subtype, arg)) {
return true;
}
}
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (CoerceUtil.canBeCoerced(subtype, SNodeOperations.getConcept(arg)) && CoerceUtil.canBeCoerced(arg, SNodeOperations.getConcept(subtype))) {
return true;
}
}
return false;
}
public void processInequation(final SNode subtype, final SNode supertype, final EquationInfo equationInfo, final TypeCheckingContext typeCheckingContext, IsApplicable2Status status, final boolean inequalityIsWeak, final boolean inequalityIsLessThan) {
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (MatchingUtil.matchNodes(arg, subtype)) {
{
SNode _nodeToCheck_1029348928467 = equationInfo.getNodeWithError();
EquationInfo _info_12389875345 = new EquationInfo(_nodeToCheck_1029348928467, null, "r:00000000-0000-4000-0000-011c895902b1(jetbrains.mps.lang.typesystem.typesystem)", "176833115774977717", 0, null);
_info_12389875345.getOuterRulesIdFromInfo(equationInfo);
typeCheckingContext.createLessThanInequality((SNode) subtype, (SNode) arg, false, true, _info_12389875345);
}
return;
}
}
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (TypeChecker.getInstance().getSubtypingManager().isSubtype(subtype, arg)) {
{
SNode _nodeToCheck_1029348928467 = equationInfo.getNodeWithError();
EquationInfo _info_12389875345 = new EquationInfo(_nodeToCheck_1029348928467, null, "r:00000000-0000-4000-0000-011c895902b1(jetbrains.mps.lang.typesystem.typesystem)", "4903733294584216031", 0, null);
_info_12389875345.getOuterRulesIdFromInfo(equationInfo);
typeCheckingContext.createLessThanInequality((SNode) subtype, (SNode) arg, false, true, _info_12389875345);
}
return;
}
}
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (eq_6boqzn_a0a0c0c(SNodeOperations.getConcept(arg), SNodeOperations.getConcept(subtype))) {
{
SNode _nodeToCheck_1029348928467 = equationInfo.getNodeWithError();
EquationInfo _info_12389875345 = new EquationInfo(_nodeToCheck_1029348928467, null, "r:00000000-0000-4000-0000-011c895902b1(jetbrains.mps.lang.typesystem.typesystem)", "1269166727599073781", 0, null);
_info_12389875345.getOuterRulesIdFromInfo(equationInfo);
typeCheckingContext.createLessThanInequality((SNode) subtype, (SNode) arg, false, true, _info_12389875345);
}
return;
}
}
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (CoerceUtil.canBeCoerced(subtype, SNodeOperations.getConcept(arg)) && CoerceUtil.canBeCoerced(arg, SNodeOperations.getConcept(subtype))) {
{
SNode _nodeToCheck_1029348928467 = equationInfo.getNodeWithError();
EquationInfo _info_12389875345 = new EquationInfo(_nodeToCheck_1029348928467, null, "r:00000000-0000-4000-0000-011c895902b1(jetbrains.mps.lang.typesystem.typesystem)", "8991952304890041665", 0, null);
_info_12389875345.getOuterRulesIdFromInfo(equationInfo);
typeCheckingContext.createLessThanInequality((SNode) subtype, (SNode) arg, false, true, _info_12389875345);
}
break;
}
}
}
public boolean checkInequation(final SNode subtype, final SNode supertype, final EquationInfo equationInfo, IsApplicable2Status status, final boolean inequalityIsWeak, final boolean inequalityIsLessThan) {
boolean result_14532009 = true;
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (MatchingUtil.matchNodes(arg, subtype)) {
result_14532009 = result_14532009 && TypeChecker.getInstance().getSubtypingManager().isSubtype((SNode) subtype, (SNode) arg, true);
return result_14532009;
}
}
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (TypeChecker.getInstance().getSubtypingManager().isSubtype(subtype, arg)) {
result_14532009 = result_14532009 && TypeChecker.getInstance().getSubtypingManager().isSubtype((SNode) subtype, (SNode) arg, true);
return result_14532009;
}
}
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (eq_6boqzn_a0a0c0b0d(SNodeOperations.getConcept(arg), SNodeOperations.getConcept(subtype))) {
result_14532009 = result_14532009 && TypeChecker.getInstance().getSubtypingManager().isSubtype((SNode) subtype, (SNode) arg, true);
return result_14532009;
}
}
for (SNode arg : SLinkOperations.getChildren(supertype, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, 0x1129e73a76aL, "argument"))) {
if (CoerceUtil.canBeCoerced(subtype, SNodeOperations.getConcept(arg)) && CoerceUtil.canBeCoerced(arg, SNodeOperations.getConcept(subtype))) {
result_14532009 = result_14532009 && TypeChecker.getInstance().getSubtypingManager().isSubtype((SNode) subtype, (SNode) arg, true);
break;
}
}
return result_14532009;
}
public boolean isWeak() {
return true;
}
public IsApplicableStatus isApplicableSubtypeAndPattern(SNode node) {
return new IsApplicableStatus(node.getConcept().isSubConceptOf(getApplicableSubtypeConcept()), null);
}
public IsApplicableStatus isApplicableSupertypeAndPattern(SNode node) {
return new IsApplicableStatus(node.getConcept().isSubConceptOf(getApplicableSupertypeConcept()), null);
}
public SAbstractConcept getApplicableSubtypeConcept() {
return MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x10802efe25aL, "jetbrains.mps.lang.core.structure.BaseConcept");
}
public SAbstractConcept getApplicableSupertypeConcept() {
return MetaAdapterFactory.getConcept(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1129e737f02L, "jetbrains.mps.lang.typesystem.structure.JoinType");
}
private static boolean eq_6boqzn_a0a0b0b(Object a, Object b) {
return (a != null ? a.equals(b) : a == b);
}
private static boolean eq_6boqzn_a0a0c0c(Object a, Object b) {
return (a != null ? a.equals(b) : a == b);
}
private static boolean eq_6boqzn_a0a0c0b0d(Object a, Object b) {
return (a != null ? a.equals(b) : a == b);
}
}