use of org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference in project xtext-xtend by eclipse.
the class LinkingTest method testTypeParameterReference_16.
@Test
public void testTypeParameterReference_16() throws Exception {
XtendFunction func = (XtendFunction) ((XtendClass) file("class X<Z> implements Iterable<Z> { def <Y> Iterable<Y> foo() { val r = new X r }}").getXtendTypes().get(0)).getMembers().get(0);
JvmOperation operation = associator.getDirectlyInferredOperation(func);
JvmTypeReference returnType = operation.getReturnType();
assertEquals("java.lang.Iterable<Y>", returnType.getIdentifier());
LightweightTypeReference bodyType = getType(func.getExpression());
assertEquals("X<Y>", bodyType.getIdentifier());
LightweightTypeReference bodyReturnType = getReturnType(func.getExpression());
assertEquals("X<Y>", bodyReturnType.getIdentifier());
}
use of org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference in project xtext-xtend by eclipse.
the class LinkingTest method testTypeParameterReference_15.
@Test
public void testTypeParameterReference_15() throws Exception {
XtendFunction func = (XtendFunction) ((XtendClass) file("class X<Z> implements Iterable<Z> { def Iterable<String> foo() { val result = new X result }}").getXtendTypes().get(0)).getMembers().get(0);
JvmOperation operation = associator.getDirectlyInferredOperation(func);
JvmTypeReference returnType = operation.getReturnType();
assertEquals("java.lang.Iterable<java.lang.String>", returnType.getIdentifier());
LightweightTypeReference bodyType = getType(func.getExpression());
assertEquals("X<java.lang.String>", bodyType.getIdentifier());
LightweightTypeReference bodyReturnType = getReturnType(func.getExpression());
assertEquals("X<java.lang.String>", bodyReturnType.getIdentifier());
}
use of org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference in project xtext-xtend by eclipse.
the class LinkingTest method testTypeParameterReference_12.
@Test
public void testTypeParameterReference_12() throws Exception {
XtendFunction func = (XtendFunction) ((XtendClass) file("class X<Z> implements Iterable<Z> { def Iterable<String> foo() { val result = new X return result }}").getXtendTypes().get(0)).getMembers().get(0);
JvmOperation operation = associator.getDirectlyInferredOperation(func);
JvmTypeReference returnType = operation.getReturnType();
assertEquals("java.lang.Iterable<java.lang.String>", returnType.getIdentifier());
LightweightTypeReference bodyType = getType(func.getExpression());
assertEquals("void", bodyType.getIdentifier());
LightweightTypeReference bodyReturnType = getReturnType(func.getExpression());
assertEquals("X<java.lang.String>", bodyReturnType.getIdentifier());
}
Aggregations