use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class InterfaceDeclarationTest method circular.
@Test
public void circular() {
Model p = assertParse("interface I extends I {} {}");
assertEquals(1, p.getErrors().getErrorCount());
assertEndsWith(p.getErrors().getFirstError(), ErrorMessage.CYCLIC_INHERITANCE.withArgs("I"));
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class InterfaceDeclarationTest method mutuallyCircularIndirect.
@Test
public void mutuallyCircularIndirect() {
Model p = assertParse("interface I extends J {} interface J extends K {} interface K extends I {}");
assertEquals(3, p.getErrors().getErrorCount());
Iterator<SemanticCondition> i = p.getErrors().iterator();
assertEndsWith(i.next(), ErrorMessage.CYCLIC_INHERITANCE.withArgs("I"));
assertEndsWith(i.next(), ErrorMessage.CYCLIC_INHERITANCE.withArgs("J"));
assertEndsWith(i.next(), ErrorMessage.CYCLIC_INHERITANCE.withArgs("K"));
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class InterfaceDeclarationTest method trivial.
@Test
public void trivial() {
Model p = assertParse("interface I {} {}");
assertTrue(!p.getErrors().containsErrors());
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class InterfaceDeclarationTest method extending.
@Test
public void extending() {
Model p = assertParse("interface I {} interface J extends I {} {}");
assertTrue(!p.getErrors().containsErrors());
}
use of org.abs_models.frontend.ast.Model in project abstools by abstools.
the class VarResolutionTest method testNestedPatternVar.
@Test
public void testNestedPatternVar() {
Model m = assertParse("data Foo = Bar(Bool); def Bool m(Foo f) = case f { Bar(y) => y; };");
assertThat(getFirstCaseExpr(m), instanceOf(VarUse.class));
ConstructorPattern p = (ConstructorPattern) getFirstCasePattern(m);
PatternVarDecl decl = ((PatternVar) p.getParam(0)).getVar();
assertEquals("y", decl.getName());
}
Aggregations