use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method functionTypeArgs4.
@Test
public void functionTypeArgs4() {
Model m = assertParseOkStdLib(" data Foo<A> = Bar(A,Bool); " + "def Bool f<A>(Foo<A> o) = case o { Bar(a,b) => b; } ;");
ParametricFunctionDecl d = getLastParametricFunctionDecl(m);
Type type = ((ExpFunctionDef) d.getFunctionDef()).getRhs().getType();
assertEquals(m.getBoolType(), type);
}
use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method testInterfaceType.
@Test
public void testInterfaceType() {
Model m = assertParseOk("interface I { } class C {} { I i = new local C(); I i2 = i; }");
assertEquals(m.lookupModule("UnitTest").getDecl(0).getType(), getTypeOfNthAssignment(m, 2));
}
use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method testFnApp.
@Test
public void testFnApp() {
Model m = assertParseOkStdLib("def Bool f() = f();");
assertEquals(m.getBoolType(), getFirstFunctionExpr(m).getType());
}
use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method testDataTypeStringLit.
@Test
public void testDataTypeStringLit() {
Model m = assertParseOkStdLib("{ String i = \"5\"; }");
assertEquals(m.getStringType(), getTypeOfFirstAssignment(m));
}
use of abs.frontend.ast.Model in project abstools by abstools.
the class TypingTest method testDataTypeIntLit.
@Test
public void testDataTypeIntLit() {
Model m = assertParseOkStdLib("{ Int i = 5; }");
assertEquals(m.getIntType(), getTypeOfFirstAssignment(m));
}
Aggregations