Search in sources :

Example 31 with Model

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"));
}
Also used : Model(org.abs_models.frontend.ast.Model) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Example 32 with Model

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"));
}
Also used : Model(org.abs_models.frontend.ast.Model) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Example 33 with Model

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());
}
Also used : Model(org.abs_models.frontend.ast.Model) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Example 34 with Model

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());
}
Also used : Model(org.abs_models.frontend.ast.Model) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Example 35 with Model

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());
}
Also used : Model(org.abs_models.frontend.ast.Model) PatternVar(org.abs_models.frontend.ast.PatternVar) VarUse(org.abs_models.frontend.ast.VarUse) PatternVarDecl(org.abs_models.frontend.ast.PatternVarDecl) ConstructorPattern(org.abs_models.frontend.ast.ConstructorPattern) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Aggregations

Model (org.abs_models.frontend.ast.Model)268 Test (org.junit.Test)227 FrontendTest (org.abs_models.frontend.FrontendTest)101 ClassDecl (org.abs_models.frontend.ast.ClassDecl)72 DeltaDecl (org.abs_models.frontend.ast.DeltaDecl)34 SemanticConditionList (org.abs_models.frontend.analyser.SemanticConditionList)29 ABSTest (org.abs_models.ABSTest)22 ProductDecl (org.abs_models.frontend.ast.ProductDecl)17 FunctionDecl (org.abs_models.frontend.ast.FunctionDecl)15 HashSet (java.util.HashSet)13 ModifyClassModifier (org.abs_models.frontend.ast.ModifyClassModifier)13 PrintStream (java.io.PrintStream)12 Product (org.abs_models.frontend.ast.Product)11 SkipStmt (org.abs_models.frontend.ast.SkipStmt)11 VarUse (org.abs_models.frontend.ast.VarUse)11 Feature (org.abs_models.frontend.ast.Feature)10 File (java.io.File)9 ExpFunctionDef (org.abs_models.frontend.ast.ExpFunctionDef)9 ReturnStmt (org.abs_models.frontend.ast.ReturnStmt)9 KindedName (org.abs_models.frontend.typechecker.KindedName)9