use of org.eclipse.xtext.common.types.JvmTypeParameter in project xtext-xtend by eclipse.
the class LinkingTest method testTypeParameterShadowsType_3.
@Test
public void testTypeParameterShadowsType_3() throws Exception {
final XtendFile file = file("class A {} class B extends A { def <A> A foo(A x) {x}}");
final XtendClass xtendClass = ((XtendClass) file.getXtendTypes().get(1));
final JvmType extendedType = xtendClass.getExtends().getType();
assertTrue(extendedType instanceof JvmGenericType);
XtendFunction func = (XtendFunction) xtendClass.getMembers().get(0);
JvmTypeReference returnType = func.getReturnType();
JvmTypeParameter typeParamDecl = (JvmTypeParameter) returnType.getType();
assertEquals("A", typeParamDecl.getIdentifier());
JvmTypeParameter param = (JvmTypeParameter) func.getParameters().get(0).getParameterType().getType();
assertSame(typeParamDecl, param);
assertNotSame(extendedType, param);
}
use of org.eclipse.xtext.common.types.JvmTypeParameter in project xtext-xtend by eclipse.
the class RecursionGuardBenchmark method timeTryNextFailsAvg.
public int timeTryNextFailsAvg(int reps) {
JvmTypeParameter candidate = parameters.get(size / 2);
int result = 0;
for (int i = 0; i < reps; i++) {
if (populatedGuard.tryNext(candidate)) {
result++;
}
}
return result;
}
Aggregations