Search in sources :

Example 1 with NullCheckerExtension

use of org.abs_models.frontend.typechecker.nullable.NullCheckerExtension in project abstools by abstools.

the class NullCheckerTests method assertTypeErrors.

@Override
protected SemanticCondition assertTypeErrors(String absCode, Config... config) {
    Model m = assertParse(absCode, config);
    String msg = "";
    m.registerTypeSystemExtension(new NullCheckerExtension(m));
    SemanticConditionList l = m.typeCheck();
    if (l.containsErrors()) {
        msg = l.getFirstError().getMsgWithHint(absCode);
    } else if (l.containsWarnings() && isSet(EXPECT_WARNING, config)) {
        msg = l.getFirstWarning().getMsgWithHint(absCode);
    }
    assertEquals(msg, isSet(EXPECT_TYPE_ERROR, config), l.containsErrors());
    if (isSet(EXPECT_WARNING, config)) {
        assertEquals(msg, isSet(EXPECT_WARNING, config), l.containsWarnings());
    }
    return l.containsErrors() ? l.getFirstError() : null;
}
Also used : SemanticConditionList(org.abs_models.frontend.analyser.SemanticConditionList) Model(org.abs_models.frontend.ast.Model) NullCheckerExtension(org.abs_models.frontend.typechecker.nullable.NullCheckerExtension)

Example 2 with NullCheckerExtension

use of org.abs_models.frontend.typechecker.nullable.NullCheckerExtension in project abstools by abstools.

the class NullableTests method getModel.

private static Model getModel(String prog) {
    Model m = assertParse(prog);
    m.registerTypeSystemExtension(new NullCheckerExtension(m));
    m.typeCheck();
    return m;
}
Also used : NullCheckerExtension(org.abs_models.frontend.typechecker.nullable.NullCheckerExtension)

Example 3 with NullCheckerExtension

use of org.abs_models.frontend.typechecker.nullable.NullCheckerExtension in project abstools by abstools.

the class Main method registerNullableTypeChecking.

private void registerNullableTypeChecking(Model m) {
    if (!arguments.nonullcheck) {
        if (arguments.verbose)
            System.out.println("Registering Nullable Type Checking...");
        NullCheckerExtension nce = new NullCheckerExtension(m);
        if (arguments.defaultNullableType != null)
            nce.setDefaultType(arguments.defaultNullableType);
        if (arguments.verbose)
            nce.setWarnAboutMissingAnnotation(true);
        m.registerTypeSystemExtension(nce);
    }
}
Also used : NullCheckerExtension(org.abs_models.frontend.typechecker.nullable.NullCheckerExtension)

Aggregations

NullCheckerExtension (org.abs_models.frontend.typechecker.nullable.NullCheckerExtension)3 SemanticConditionList (org.abs_models.frontend.analyser.SemanticConditionList)1 Model (org.abs_models.frontend.ast.Model)1