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;
}
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;
}
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);
}
}
Aggregations