use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method testContextDecl.
@Test
public void testContextDecl() {
Model m = assertParseOk("class C implements I { I m() { return this; } } interface I { }");
ClassDecl d = (ClassDecl) m.getDecls().iterator().next();
ReturnStmt s = (ReturnStmt) d.getMethod(0).getBlock().getStmt(0);
assertEquals(d, s.getRetExp().getContextDecl());
}
use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method functionTypeArgs2.
@Test
public void functionTypeArgs2() {
Model m = assertParseOkStdLib(" def Maybe<A> f<A>(Maybe<A> o) = o ;");
ParametricFunctionDecl d = getLastParametricFunctionDecl(m);
assertEquals(d.getTypeUse().getType(), ((ExpFunctionDef) d.getFunctionDef()).getRhs().getType());
}
use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method testCase2.
@Test
public void testCase2() {
Model m = assertParseOkStdLib("def Bool f(Bool x) = case x { True => x; False => x; };");
assertEquals(m.getBoolType(), getFirstFunctionExpr(m).getType());
}
use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method testAsyncCall.
@Test
public void testAsyncCall() {
Model m = assertParseOkStdLib(" interface I { Bool m(); } { I i; i!m(); }");
assertEquals(m.getFutType(m.getBoolType()), getSecondExp(m).getType());
}
use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method testDataTypeBoolLit.
@Test
public void testDataTypeBoolLit() {
Model m = assertParseOkStdLib("{ Bool i = True; }");
assertEquals(m.getBoolType(), getTypeOfFirstAssignment(m));
}
Aggregations