use of nl.ramsolutions.sw.magik.analysis.typing.types.UndefinedType in project magik-tools by StevenLooman.
the class LocalTypeReasonerTest method testUnknownMethodCall.
@Test
void testUnknownMethodCall() {
final String code = "" + "_method object.test\n" + " _return object.unknown()\n" + "_endmethod\n";
// Set up TypeKeeper/TypeReasoner.
final TypeKeeper typeKeeper = new TypeKeeper();
// Do analysis.
final MagikTypedFile magikFile = this.createMagikFile(code, typeKeeper);
final LocalTypeReasoner reasoner = magikFile.getTypeReasoner();
// Assert user:object.test type determined.resul
final AstNode topNode = magikFile.getTopNode();
final AstNode methodNode = topNode.getFirstChild(MagikGrammar.METHOD_DEFINITION);
final ExpressionResult result = reasoner.getNodeType(methodNode);
assertThat(result).isEqualTo(ExpressionResult.UNDEFINED);
final UndefinedType resultType = (UndefinedType) result.get(0, null);
assertThat(resultType).isNotNull();
assertThat(resultType.getFullName()).isEqualTo(UndefinedType.SERIALIZED_NAME);
}
Aggregations