Commit 63d6f349 authored by André Pacak's avatar André Pacak
Browse files

lookup bug for let bindings fixed

parent a232b62f
<?xml version="1.0" encoding="UTF-8"?>
<product version="3" modelHash="-5dm20859rehexsgjqa5gxm9rpl093hq" />
<?xml version="1.0" encoding="UTF-8"?>
<product version="3" modelHash="ej2wparby33zjzj6vgoxsct5vgaebnx" />
<?xml version="1.0" encoding="UTF-8"?>
<product version="3" modelHash="1hhaub1xvjhkc6k8agem5lgyaclzjkx" />
<?xml version="1.0" encoding="UTF-8"?>
<product version="3" modelHash="-5g1xuzz94l36jnmmqw06mfayt64w7oh" />
<?xml version="1.0" encoding="UTF-8"?>
<product version="3" modelHash="-9zlqu612nf87wikebidmo0g68tginye" />
......@@ -8,7 +8,7 @@ import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher;
import org.eclipse.viatra.query.runtime.api.IPatternMatch;
import org.inca.core.runtime.plugin.EnginePool;
import org.inca.core.runtime.plugin.AbstractScope;
import org.eclipse.viatra.query.runtime.rete.matcher.DRedReteBackendFactory;
import org.eclipse.viatra.query.runtime.rete.matcher.ScatteredTimelyReteBackendFactory;
import java.util.Set;
import org.inca.core.util.plugin.CodeGenerationHelper;
import jetbrains.mps.internal.collections.runtime.SetSequence;
......@@ -23,14 +23,14 @@ import org.inca.data.runtime.plugin.CompositeMatcher;
public class AnalysisResultAccess {
public static String expectedType(final SNode term, final SModel scope) {
final ViatraQueryMatcher<IPatternMatch> evaluator = EnginePool.getMatcher(Typing_InferQuerySpecification.instance(), AbstractScope.from(scope), true, DRedReteBackendFactory.INSTANCE);
final ViatraQueryMatcher<IPatternMatch> evaluator = EnginePool.getMatcher(Typing_InferQuerySpecification.instance(), AbstractScope.from(scope), true, ScatteredTimelyReteBackendFactory.INSTANCE);
final IPatternMatch tup = evaluator.newMatch(term, null);
final Set<LType.LTypeElement> values = CodeGenerationHelper.getAllValues(evaluator, "out_1", tup);
return typeToString(SetSequence.fromSet(values).first());
}
public static boolean isChecked(final SNode term, final SModel scope) {
final ViatraQueryMatcher<IPatternMatch> evaluator = EnginePool.getMatcher(Typing_InferQuerySpecification.instance(), AbstractScope.from(scope), true, DRedReteBackendFactory.INSTANCE);
final ViatraQueryMatcher<IPatternMatch> evaluator = EnginePool.getMatcher(Typing_InferQuerySpecification.instance(), AbstractScope.from(scope), true, ScatteredTimelyReteBackendFactory.INSTANCE);
final IPatternMatch tup = evaluator.newMatch(term, null);
final Set<LType.LTypeElement> values = CodeGenerationHelper.getAllValues(evaluator, "out_1", tup);
......
......@@ -34,31 +34,31 @@ public final class QuerySpecificationHints extends MPSQuerySpecificationHints {
this.conceptFeatures = new HashSet<SConceptFeature>();
this.conceptFeatures.add(MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93f1L, 0x1a4a252762eb93f6L, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93dcL, 0x1a4a252762eb93e5L, "ty2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93faL, 0x1a4a252762eb93ffL, "ty"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eba873L, 0x1a4a252762eba8bdL, "c2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eba873L, 0x1a4a252762eba8b6L, "c1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb92d7L, 0x1a4a252762eb92dcL, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb933aL, 0x1a4a252762eb9352L, "body"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9302L, 0x1a4a252762eb930bL, "t2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9390L, 0x1a4a252762eb9395L, "ty1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eba8aaL, 0x1a4a252762eba8afL, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb937fL, 0x1a4a252762eb9384L, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb936bL, 0x1a4a252762eb9374L, "t1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb937fL, 0x1a4a252762eb93d5L, "ty"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9302L, 0x1a4a252762eb9307L, "t1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb936bL, 0x1a4a252762eb9378L, "t2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9390L, 0x1a4a252762eb9395L, "ty1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9312L, 0x1a4a252762eb9317L, "t1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb933aL, 0x1a4a252762eb9352L, "body"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eba873L, 0x1a4a252762eba878L, "matchee"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93faL, 0x1a4a252762eb93ffL, "ty"));
this.conceptFeatures.add(MetaAdapterFactory.getReferenceLink(0xb802a05692a24fbcL, 0x902ef8e5004c331fL, 0x7980b687ac7456feL, 0x7980b687ac7456ffL, "parent"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eba873L, 0x1a4a252762eba8b6L, "c1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb937fL, 0x1a4a252762eb93d5L, "ty"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9362L, 0x1a4a252762eb9367L, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9359L, 0x1a4a252762eb935eL, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eba8aaL, 0x1a4a252762eba8afL, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getReferenceLink(0xb802a05692a24fbcL, 0x902ef8e5004c331fL, 0x7980b687ac7456feL, 0x7980b687ac7456ffL, "parent"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9312L, 0x1a4a252762eb9317L, "t1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9322L, 0x1a4a252762eb9336L, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93dcL, 0x1a4a252762eb93e1L, "ty1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9390L, 0x1a4a252762eb9399L, "ty2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb936bL, 0x1a4a252762eb9374L, "t1"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93dcL, 0x1a4a252762eb93e5L, "ty2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb92d7L, 0x1a4a252762eb92dcL, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9302L, 0x1a4a252762eb930bL, "t2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb933aL, 0x1a4a252762eb934eL, "bound"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb936bL, 0x1a4a252762eb9378L, "t2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93f1L, 0x1a4a252762eb93f6L, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9390L, 0x1a4a252762eb9399L, "ty2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9322L, 0x1a4a252762eb9336L, "t"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9312L, 0x1a4a252762eb931bL, "t2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eba873L, 0x1a4a252762eba8bdL, "c2"));
this.conceptFeatures.add(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93dcL, 0x1a4a252762eb93e1L, "ty1"));
this.languages = new HashSet<SLanguage>();
this.languages.add(MetaAdapterFactory.getLanguage(0xb802a05692a24fbcL, 0x902ef8e5004c331fL, "ceab5195-25ea-4f22-9b92-103b95ca8c0c"));
......
......@@ -26,7 +26,12 @@ import java.util.ArrayList;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation;
import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator;
import java.util.Arrays;
import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider;
import org.inca.core.runtime.plugin.ConceptFeatureKey;
@SuppressWarnings("all")
public final class Typing_AsLTypeQuerySpecification extends MPSQuerySpecification {
......@@ -86,10 +91,184 @@ public final class Typing_AsLTypeQuerySpecification extends MPSQuerySpecificatio
exportedParameters.add(new ExportedParameter(body, var_out_1, p_out_1));
body.setSymbolicParameters(exportedParameters);
PVariable var__8775378229005008969 = body.getOrCreateVariableByName("8775378229005008969");
PVariable var__7315585726604368428 = body.newVirtualVariable();
PVariable var__match_a0a0s = body.getOrCreateVariableByName("match_a0a0s");
PVariable var__tmp_300 = body.getOrCreateVariableByName("tmp_300");
new TypeConstraint(body, Tuples.flatTupleOf(var_ty), new ConceptKey(MetaAdapterFactory.getInterfaceConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb938fL, "SumTypes.structure.Type")));
new PositivePatternCall(body, Tuples.flatTupleOf(var_ty, var__8775378229005008969, var_out_1), Typing_AsLType_WrappedQuerySpecification.instance().getInternalQueryRepresentation());
new PositivePatternCall(body, Tuples.flatTupleOf(), Typing_AsLType_0_switchCommonQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var__match_a0a0s, var_ty);
new TypeConstraint(body, Tuples.flatTupleOf(var__match_a0a0s), new ConceptKey(MetaAdapterFactory.getConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93ecL, "SumTypes.structure.Nat")));
new ExpressionEvaluation(body, new IExpressionEvaluator() {
@Override
public String getShortDescription() {
return "7315585726604368428";
}
@Override
public Iterable<String> getInputParameterNames() {
return Arrays.asList();
}
@Override
public Object evaluateExpression(IValueProvider valueProvider) throws Exception {
return LType.Nat.create();
}
}, var__7315585726604368428, false);
new Equality(body, var__tmp_300, var__7315585726604368428);
new Equality(body, var__tmp_300, var_out_1);
SetSequence.fromSet(bodies).addElement(body);
}
{
PBody body = new PBody(this);
PVariable var_ty = body.getOrCreateVariableByName("ty");
PVariable var_out_1 = body.getOrCreateVariableByName("out_1");
List<ExportedParameter> exportedParameters = new ArrayList<ExportedParameter>();
exportedParameters.add(new ExportedParameter(body, var_ty, p_ty));
exportedParameters.add(new ExportedParameter(body, var_out_1, p_out_1));
body.setSymbolicParameters(exportedParameters);
PVariable var__lty2 = body.getOrCreateVariableByName("lty2");
PVariable var__7315585726604368487 = body.newVirtualVariable();
PVariable var__lty1 = body.getOrCreateVariableByName("lty1");
PVariable var__ty2 = body.getOrCreateVariableByName("ty2");
PVariable var__ty1 = body.getOrCreateVariableByName("ty1");
PVariable var__match_b0b0a81 = body.getOrCreateVariableByName("match_b0b0a81");
PVariable var__tmp_304 = body.getOrCreateVariableByName("tmp_304");
PVariable var__match_a0b0a81 = body.getOrCreateVariableByName("match_a0b0a81");
PVariable var__tmp_305 = body.getOrCreateVariableByName("tmp_305");
PVariable var__tmp_301 = body.getOrCreateVariableByName("tmp_301");
PVariable var__tmp_302 = body.getOrCreateVariableByName("tmp_302");
PVariable var__tmp_303 = body.getOrCreateVariableByName("tmp_303");
PVariable var__match_a1a0s = body.getOrCreateVariableByName("match_a1a0s");
new TypeConstraint(body, Tuples.flatTupleOf(var_ty), new ConceptKey(MetaAdapterFactory.getInterfaceConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb938fL, "SumTypes.structure.Type")));
new PositivePatternCall(body, Tuples.flatTupleOf(), Typing_AsLType_0_switchCommonQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var__match_a1a0s, var_ty);
new TypeConstraint(body, Tuples.flatTupleOf(var__match_a1a0s), new ConceptKey(MetaAdapterFactory.getConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9390L, "SumTypes.structure.Fun")));
new TypeConstraint(body, Tuples.staticArityFlatTupleOf(var__match_a1a0s, var__tmp_301), new ConceptFeatureKey(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9390L, 0x1a4a252762eb9395L, "ty1")));
new Equality(body, var__match_a0b0a81, var__tmp_301);
new Equality(body, var__ty1, var__match_a0b0a81);
new TypeConstraint(body, Tuples.staticArityFlatTupleOf(var__match_a1a0s, var__tmp_302), new ConceptFeatureKey(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb9390L, 0x1a4a252762eb9399L, "ty2")));
new Equality(body, var__match_b0b0a81, var__tmp_302);
new Equality(body, var__ty2, var__match_b0b0a81);
new PositivePatternCall(body, Tuples.flatTupleOf(var__ty1, var__tmp_303), Typing_AsLTypeQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var__lty1, var__tmp_303);
new PositivePatternCall(body, Tuples.flatTupleOf(var__ty2, var__tmp_304), Typing_AsLTypeQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var__lty2, var__tmp_304);
new ExpressionEvaluation(body, new IExpressionEvaluator() {
@Override
public String getShortDescription() {
return "7315585726604368487";
}
@Override
public Iterable<String> getInputParameterNames() {
return Arrays.asList("lty2", "lty1");
}
@Override
public Object evaluateExpression(IValueProvider valueProvider) throws Exception {
return LType.Fun.create(((LType.LTypeElement) valueProvider.getValue("lty1")), ((LType.LTypeElement) valueProvider.getValue("lty2")));
}
}, var__7315585726604368487, false);
new Equality(body, var__tmp_305, var__7315585726604368487);
new Equality(body, var__tmp_305, var_out_1);
SetSequence.fromSet(bodies).addElement(body);
}
{
PBody body = new PBody(this);
PVariable var_ty = body.getOrCreateVariableByName("ty");
PVariable var_out_1 = body.getOrCreateVariableByName("out_1");
List<ExportedParameter> exportedParameters = new ArrayList<ExportedParameter>();
exportedParameters.add(new ExportedParameter(body, var_ty, p_ty));
exportedParameters.add(new ExportedParameter(body, var_out_1, p_out_1));
body.setSymbolicParameters(exportedParameters);
PVariable var__7315585726604368548 = body.newVirtualVariable();
PVariable var__match_b0c0a81 = body.getOrCreateVariableByName("match_b0c0a81");
PVariable var__lty2 = body.getOrCreateVariableByName("lty2");
PVariable var__match_a0c0a81 = body.getOrCreateVariableByName("match_a0c0a81");
PVariable var__lty1 = body.getOrCreateVariableByName("lty1");
PVariable var__tmp_308 = body.getOrCreateVariableByName("tmp_308");
PVariable var__ty2 = body.getOrCreateVariableByName("ty2");
PVariable var__tmp_309 = body.getOrCreateVariableByName("tmp_309");
PVariable var__ty1 = body.getOrCreateVariableByName("ty1");
PVariable var__tmp_306 = body.getOrCreateVariableByName("tmp_306");
PVariable var__tmp_307 = body.getOrCreateVariableByName("tmp_307");
PVariable var__match_a2a0s = body.getOrCreateVariableByName("match_a2a0s");
PVariable var__tmp_310 = body.getOrCreateVariableByName("tmp_310");
new TypeConstraint(body, Tuples.flatTupleOf(var_ty), new ConceptKey(MetaAdapterFactory.getInterfaceConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb938fL, "SumTypes.structure.Type")));
new PositivePatternCall(body, Tuples.flatTupleOf(), Typing_AsLType_0_switchCommonQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var__match_a2a0s, var_ty);
new TypeConstraint(body, Tuples.flatTupleOf(var__match_a2a0s), new ConceptKey(MetaAdapterFactory.getConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93dcL, "SumTypes.structure.Sum")));
new TypeConstraint(body, Tuples.staticArityFlatTupleOf(var__match_a2a0s, var__tmp_306), new ConceptFeatureKey(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93dcL, 0x1a4a252762eb93e1L, "ty1")));
new Equality(body, var__match_a0c0a81, var__tmp_306);
new Equality(body, var__ty1, var__match_a0c0a81);
new TypeConstraint(body, Tuples.staticArityFlatTupleOf(var__match_a2a0s, var__tmp_307), new ConceptFeatureKey(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93dcL, 0x1a4a252762eb93e5L, "ty2")));
new Equality(body, var__match_b0c0a81, var__tmp_307);
new Equality(body, var__ty2, var__match_b0c0a81);
new PositivePatternCall(body, Tuples.flatTupleOf(var__ty1, var__tmp_308), Typing_AsLTypeQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var__lty1, var__tmp_308);
new PositivePatternCall(body, Tuples.flatTupleOf(var__ty2, var__tmp_309), Typing_AsLTypeQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var__lty2, var__tmp_309);
new ExpressionEvaluation(body, new IExpressionEvaluator() {
@Override
public String getShortDescription() {
return "7315585726604368548";
}
@Override
public Iterable<String> getInputParameterNames() {
return Arrays.asList("lty2", "lty1");
}
@Override
public Object evaluateExpression(IValueProvider valueProvider) throws Exception {
return LType.Sum.create(((LType.LTypeElement) valueProvider.getValue("lty1")), ((LType.LTypeElement) valueProvider.getValue("lty2")));
}
}, var__7315585726604368548, false);
new Equality(body, var__tmp_310, var__7315585726604368548);
new Equality(body, var__tmp_310, var_out_1);
SetSequence.fromSet(bodies).addElement(body);
}
{
PBody body = new PBody(this);
PVariable var_ty = body.getOrCreateVariableByName("ty");
PVariable var_out_1 = body.getOrCreateVariableByName("out_1");
List<ExportedParameter> exportedParameters = new ArrayList<ExportedParameter>();
exportedParameters.add(new ExportedParameter(body, var_ty, p_ty));
exportedParameters.add(new ExportedParameter(body, var_out_1, p_out_1));
body.setSymbolicParameters(exportedParameters);
PVariable var__type = body.getOrCreateVariableByName("type");
PVariable var__tmp_311 = body.getOrCreateVariableByName("tmp_311");
PVariable var__tmp_312 = body.getOrCreateVariableByName("tmp_312");
PVariable var__match_a0d0a81 = body.getOrCreateVariableByName("match_a0d0a81");
PVariable var__match_a3a0s = body.getOrCreateVariableByName("match_a3a0s");
new TypeConstraint(body, Tuples.flatTupleOf(var_ty), new ConceptKey(MetaAdapterFactory.getInterfaceConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb938fL, "SumTypes.structure.Type")));
new PositivePatternCall(body, Tuples.flatTupleOf(), Typing_AsLType_0_switchCommonQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var__match_a3a0s, var_ty);
new TypeConstraint(body, Tuples.flatTupleOf(var__match_a3a0s), new ConceptKey(MetaAdapterFactory.getConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93faL, "SumTypes.structure.ParensType")));
new TypeConstraint(body, Tuples.staticArityFlatTupleOf(var__match_a3a0s, var__tmp_311), new ConceptFeatureKey(MetaAdapterFactory.getContainmentLink(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93faL, 0x1a4a252762eb93ffL, "ty")));
new Equality(body, var__match_a0d0a81, var__tmp_311);
new Equality(body, var__type, var__match_a0d0a81);
new PositivePatternCall(body, Tuples.flatTupleOf(var__type, var__tmp_312), Typing_AsLTypeQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var__tmp_312, var_out_1);
SetSequence.fromSet(bodies).addElement(body);
}
......
package SumTypes_Checker.model;
/*Generated by MPS */
import org.inca.core.runtime.plugin.MPSQuerySpecification;
import org.inca.core.runtime.plugin.MPSQuerySpecificationHints;
import org.inca.core.runtime.plugin.MPSGenericPatternMatcher;
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
import org.eclipse.viatra.query.runtime.api.scope.QueryScope;
import org.inca.core.runtime.plugin.AbstractScope;
import org.inca.core.runtime.plugin.AbstractPQuery;
import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
import org.inca.core.runtime.plugin.ConceptKey;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.inca.data.runtime.plugin.LatticeInputKey;
import java.util.Set;
import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
import org.eclipse.viatra.query.runtime.matchers.psystem.queries.QueryInitializationException;
import jetbrains.mps.internal.collections.runtime.SetSequence;
import java.util.HashSet;
import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
import java.util.List;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
import java.util.ArrayList;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation;
import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator;
import java.util.Arrays;
import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider;
@SuppressWarnings("all")
public final class Typing_AsLType_WrappedBody0QuerySpecification extends MPSQuerySpecification {
private Typing_AsLType_WrappedBody0QuerySpecification() {
super(Typing_AsLType_WrappedBody0QuerySpecification.GeneratedPQuery.INSTANCE);
}
@Override
public MPSQuerySpecificationHints getHints() {
return QuerySpecificationHints.instance();
}
@Override
protected MPSGenericPatternMatcher instantiate(ViatraQueryEngine engine) throws ViatraQueryException {
return MPSGenericPatternMatcher.on(engine, this);
}
@Override
public Class<? extends QueryScope> getPreferredScopeClass() {
return AbstractScope.class;
}
public static Typing_AsLType_WrappedBody0QuerySpecification instance() {
return Typing_AsLType_WrappedBody0QuerySpecification.LazyHolder.INSTANCE;
}
@SuppressWarnings("all")
private static final class LazyHolder {
private static final Typing_AsLType_WrappedBody0QuerySpecification INSTANCE = make();
public static Typing_AsLType_WrappedBody0QuerySpecification make() {
return new Typing_AsLType_WrappedBody0QuerySpecification();
}
}
private static final class GeneratedPQuery extends AbstractPQuery {
private final PParameter p_ty = new PParameter("ty", "SumTypes.structure.Type", new ConceptKey(MetaAdapterFactory.getInterfaceConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb938fL, "SumTypes.structure.Type")));
private final PParameter p_f___match_a0a0s = new PParameter("f___match_a0a0s", "SumTypes.structure.Type", new ConceptKey(MetaAdapterFactory.getInterfaceConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb938fL, "SumTypes.structure.Type")));
private final PParameter p_out_2 = new PParameter("out_2", "SumTypes_Checker.model.LType", new LatticeInputKey("SumTypes_Checker.model.LType", LType.instance()));
private static final Typing_AsLType_WrappedBody0QuerySpecification.GeneratedPQuery INSTANCE = new Typing_AsLType_WrappedBody0QuerySpecification.GeneratedPQuery();
@Override
protected Set<PBody> doGetContainedBodies() throws QueryInitializationException {
Set<PBody> bodies = SetSequence.fromSet(new HashSet<PBody>());
{
PBody body = new PBody(this);
PVariable var_ty = body.getOrCreateVariableByName("ty");
PVariable var_f___match_a0a0s = body.getOrCreateVariableByName("f___match_a0a0s");
PVariable var_out_2 = body.getOrCreateVariableByName("out_2");
List<ExportedParameter> exportedParameters = new ArrayList<ExportedParameter>();
exportedParameters.add(new ExportedParameter(body, var_ty, p_ty));
exportedParameters.add(new ExportedParameter(body, var_f___match_a0a0s, p_f___match_a0a0s));
exportedParameters.add(new ExportedParameter(body, var_out_2, p_out_2));
body.setSymbolicParameters(exportedParameters);
PVariable var__8775378229005048030 = body.newVirtualVariable();
PVariable var__tmp_297 = body.getOrCreateVariableByName("tmp_297");
new TypeConstraint(body, Tuples.flatTupleOf(var_ty), new ConceptKey(MetaAdapterFactory.getInterfaceConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb938fL, "SumTypes.structure.Type")));
new TypeConstraint(body, Tuples.flatTupleOf(var_f___match_a0a0s), new ConceptKey(MetaAdapterFactory.getConcept(0x8d2332833fa47ceL, 0x89dfdaaa7554f251L, 0x1a4a252762eb93ecL, "SumTypes.structure.Nat")));
new PositivePatternCall(body, Tuples.flatTupleOf(), Typing_AsLType_0_switchCommonQuerySpecification.instance().getInternalQueryRepresentation());
new Equality(body, var_f___match_a0a0s, var_ty);
new ExpressionEvaluation(body, new IExpressionEvaluator() {
@Override
public String getShortDescription() {
return "8775378229005048030";
}
@Override
public Iterable<String> getInputParameterNames() {
return Arrays.asList();
}
@Override
public Object evaluateExpression(IValueProvider valueProvider) throws Exception {
return LType.Nat.create();
}
}, var__8775378229005048030, false);
new Equality(body, var__tmp_297, var__8775378229005048030);
new Equality(body, var__tmp_297, var_out_2);
SetSequence.fromSet(bodies).addElement(body);
}
return bodies;
}
@Override
public String getFullyQualifiedName() {
return "Typing.asLType_WrappedBody0";
}
@Override
public List<PParameter> getParameters() {
return Arrays.asList(p_ty, p_f___match_a0a0s, p_out_2);
}
@Override
public List<String> getParameterNames() {
return Arrays.asList("ty", "f___match_a0a0s", "out_2");
}
}
}
package SumTypes_Checker.model;
/*Generated by MPS */
import org.inca.core.runtime.plugin.MPSQuerySpecification;
import org.inca.core.runtime.plugin.MPSQuerySpecificationHints;
import org.inca.core.runtime.plugin.MPSGenericPatternMatcher;
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
import org.eclipse.viatra.query.runtime.api.scope.QueryScope;
import org.inca.core.runtime.plugin.AbstractScope;
import org.inca.core.runtime.plugin.AbstractPQuery;
import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
import org.inca.core.runtime.plugin.ConceptKey;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.inca.data.runtime.plugin.LatticeInputKey;
import java.util.Set;
import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
import org.eclipse.viatra.query.runtime.matchers.psystem.queries.QueryInitializationException;
import jetbrains.mps.internal.collections.runtime.SetSequence;
import java.util.HashSet;
import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
import java.util.List;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
import java.util.ArrayList;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
import org.inca.core.runtime.plugin.ConceptFeatureKey;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation;
import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator;
import java.util.Arrays;
import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider;
@SuppressWarnings("all")
public final class Typing_AsLType_WrappedBody1QuerySpecification extends MPSQuerySpecification {
private Typing_AsLType_WrappedBody1QuerySpecification() {