Search in sources :

Example 6 with ParametricFunctionDecl

use of org.abs_models.frontend.ast.ParametricFunctionDecl in project abstools by abstools.

the class TypingTest method functionTypeArgs3.

@Test
public void functionTypeArgs3() {
    Model m = assertParse(" def A f<A>(Maybe<A> o) = case o { Just(a) => a; } ;");
    ParametricFunctionDecl d = getLastParametricFunctionDecl(m);
    TypeParameterDecl typeParameter = d.getTypeParameter(0);
    TypeParameter type = (TypeParameter) ((ExpFunctionDef) d.getFunctionDef()).getRhs().getType();
    TypeParameterDecl decl = type.getDecl();
    assertEquals(typeParameter, decl);
}
Also used : TypeParameterDecl(org.abs_models.frontend.ast.TypeParameterDecl) ParametricFunctionDecl(org.abs_models.frontend.ast.ParametricFunctionDecl) TypeParameter(org.abs_models.frontend.typechecker.TypeParameter) Model(org.abs_models.frontend.ast.Model) ExpFunctionDef(org.abs_models.frontend.ast.ExpFunctionDef) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Aggregations

FrontendTest (org.abs_models.frontend.FrontendTest)6 Model (org.abs_models.frontend.ast.Model)6 ParametricFunctionDecl (org.abs_models.frontend.ast.ParametricFunctionDecl)6 Test (org.junit.Test)6 ExpFunctionDef (org.abs_models.frontend.ast.ExpFunctionDef)3 TypeParameter (org.abs_models.frontend.typechecker.TypeParameter)3 TypeParameterDecl (org.abs_models.frontend.ast.TypeParameterDecl)2 DataTypeType (org.abs_models.frontend.typechecker.DataTypeType)2 Type (org.abs_models.frontend.typechecker.Type)1 UnionType (org.abs_models.frontend.typechecker.UnionType)1