use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class TypeProviderTest method testTypeOfThisInConstructor.
@Test
public void testTypeOfThisInConstructor() throws Exception {
XtendConstructor constructor = constructor("new(int a) {\n" + " this()\n" + "}\n" + "new() {}");
XBlockExpression body = (XBlockExpression) constructor.getExpression();
XFeatureCall thisCall = (XFeatureCall) body.getExpressions().get(0);
assertEquals("void", getType(thisCall).getIdentifier());
assertNull(getExpectedType(thisCall));
assertNull(getExpectedReturnType(thisCall));
}
use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class LinkingErrorTest method testFieldsAreNotSugared.
@Test
public void testFieldsAreNotSugared() throws Exception {
XtendClass clazz = clazz("class A {\n" + " String getFoo\n" + " def String doStuff() {\n" + " foo\n" + " }");
XFeatureCall call = (XFeatureCall) ((XBlockExpression) ((XtendFunction) clazz.getMembers().get(1)).getExpression()).getExpressions().get(0);
JvmIdentifiableElement feature = call.getFeature();
assertTrue(feature.eIsProxy());
}
use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class LinkingShadowingTest method testStaticImport_overloaded.
@Test
public void testStaticImport_overloaded() throws Exception {
XtendClass clazz = clazz("import static org.junit.Assert.*\n" + "class SomeClass extends org.junit.Assert {\n" + " def void method() {\n" + " assertTrue(false)\n" + " }\n" + "}");
XFeatureCall featureCall = (XFeatureCall) getFirstFeatureCall(clazz);
assertLinksTo("org.junit.Assert.assertTrue(boolean)", featureCall);
assertNull(featureCall.getImplicitFirstArgument());
assertNull(featureCall.getImplicitReceiver());
}
use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class LinkingTest method testSugarOverTypeLiteral_04.
@Test
public void testSugarOverTypeLiteral_04() throws Exception {
XtendFile file = file("import org.eclipse.emf.ecore.EPackage\n" + "class C {\n" + " def m(Object it) {\n" + " EPackage" + " }" + " def void getEPackage(String s) {}\n" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XtendFunction m = (XtendFunction) c.getMembers().get(0);
XBlockExpression body = (XBlockExpression) m.getExpression();
XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
JvmIdentifiableElement method = featureCall.getFeature();
assertEquals("org.eclipse.emf.ecore.EPackage", method.getIdentifier());
}
use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.
the class LinkingTest method testBug403580_07.
@Ignore("Depends on the order of the overloaded methods")
@Test
public void testBug403580_07() throws Exception {
XtendFile file = file("abstract class C {\n" + " def void m() {\n" + " overloaded [ String s | s.length ]\n" + " }\n" + " def <T> void overloaded(Comparable<T> c)" + " def void overloaded((String)=>int s)" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XtendFunction m = (XtendFunction) c.getMembers().get(0);
XBlockExpression body = (XBlockExpression) m.getExpression();
XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
JvmIdentifiableElement method = featureCall.getFeature();
assertEquals("C.overloaded(java.lang.Comparable)", method.getIdentifier());
}
Aggregations