Search in sources :

Example 1 with LocationTypeExtension

use of abs.frontend.typechecker.locationtypes.LocationTypeExtension in project abstools by abstools.

the class LocationTypeTests method testInferenceRetypeChecking.

@Test
public void testInferenceRetypeChecking() {
    String code = "interface I { Unit m(); } { [Far] I i; I j; i = j; j.m(); }";
    Model m = assertParseOkStdLib(code);
    LocationTypeExtension te = new LocationTypeExtension(m);
    m.registerTypeSystemExtension(te);
    SemanticConditionList e = m.typeCheck();
    m.typeCheck(new SemanticConditionList());
}
Also used : SemanticConditionList(abs.frontend.analyser.SemanticConditionList) LocationTypeExtension(abs.frontend.typechecker.locationtypes.LocationTypeExtension) Model(abs.frontend.ast.Model) Test(org.junit.Test) FrontendTest(abs.frontend.FrontendTest)

Example 2 with LocationTypeExtension

use of abs.frontend.typechecker.locationtypes.LocationTypeExtension in project abstools by abstools.

the class LocationTypeTests method assertLocationTypeErrorOnly.

private void assertLocationTypeErrorOnly(String code) {
    Model m = assertParse(code, WITH_STD_LIB);
    LocationTypeExtension te = new LocationTypeExtension(m);
    m.registerTypeSystemExtension(te);
    SemanticConditionList e = m.typeCheck();
    assertFalse("No type error occurred", !e.containsErrors());
    assertInferFails(code);
}
Also used : SemanticConditionList(abs.frontend.analyser.SemanticConditionList) LocationTypeExtension(abs.frontend.typechecker.locationtypes.LocationTypeExtension) Model(abs.frontend.ast.Model)

Example 3 with LocationTypeExtension

use of abs.frontend.typechecker.locationtypes.LocationTypeExtension in project abstools by abstools.

the class LocationTypeTests method assertTypeOkOnly.

private void assertTypeOkOnly(String code) {
    Model m = assertParse(code, WITH_STD_LIB);
    LocationTypeExtension te = new LocationTypeExtension(m);
    m.registerTypeSystemExtension(te);
    m.getErrors();
    SemanticConditionList e = m.typeCheck();
    assertTrue(!e.containsErrors() ? "" : "Found error " + e.getFirstError().getMessage(), !e.containsErrors());
    assertInferOk(code);
}
Also used : SemanticConditionList(abs.frontend.analyser.SemanticConditionList) LocationTypeExtension(abs.frontend.typechecker.locationtypes.LocationTypeExtension) Model(abs.frontend.ast.Model)

Example 4 with LocationTypeExtension

use of abs.frontend.typechecker.locationtypes.LocationTypeExtension in project abstools by abstools.

the class LocationTypeInferrerExtension method finished.

@Override
public void finished() {
    if (enablesStats) {
        for (int i = 0; i < 4; i++) {
            SatGenerator satGen = new SatGenerator(constraints);
            // satGen.enableStats = enablesStats;
            results = satGen.generate(errors);
        }
    }
    SatGenerator satGen = new SatGenerator(constraints);
    satGen.enableStats = enablesStats;
    results = satGen.generate(errors);
    if (!errors.containsErrors()) {
        SemanticConditionList sel = new SemanticConditionList();
        List<TypeSystemExtension> curr = model.getTypeExt().getTypeSystemExtensionList();
        model.getTypeExt().clearTypeSystemExtensions();
        model.getTypeExt().register(new LocationTypeExtension(model, this));
        model.typeCheck(sel);
        errors.addAll(sel);
        model.getTypeExt().clearTypeSystemExtensions();
        model.getTypeExt().registerAll(curr);
    }
}
Also used : SemanticConditionList(abs.frontend.analyser.SemanticConditionList) LocationTypeExtension(abs.frontend.typechecker.locationtypes.LocationTypeExtension) DefaultTypeSystemExtension(abs.frontend.typechecker.ext.DefaultTypeSystemExtension) TypeSystemExtension(abs.frontend.typechecker.ext.TypeSystemExtension)

Aggregations

SemanticConditionList (abs.frontend.analyser.SemanticConditionList)4 LocationTypeExtension (abs.frontend.typechecker.locationtypes.LocationTypeExtension)4 Model (abs.frontend.ast.Model)3 FrontendTest (abs.frontend.FrontendTest)1 DefaultTypeSystemExtension (abs.frontend.typechecker.ext.DefaultTypeSystemExtension)1 TypeSystemExtension (abs.frontend.typechecker.ext.TypeSystemExtension)1 Test (org.junit.Test)1