use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.
the class TypeProviderTest method testDeferredTypeArgumentResolution_02.
@Test
public void testDeferredTypeArgumentResolution_02() throws Exception {
XtendFile file = file("package testPackage\n" + "class C {\n" + " def CharSequence m(String s) {\n" + " newArrayList().get(0) \n" + " }\n" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XAbstractFeatureCall get = findSingleFeatureCall(c);
assertEquals("java.util.ArrayList.get(int)", get.getFeature().getIdentifier());
assertEquals("CharSequence", getType(get).getSimpleName());
}
use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.
the class TypeProviderTest method testDeferredTypeArgumentResolution_01.
@Test
public void testDeferredTypeArgumentResolution_01() throws Exception {
XtendFile file = file("package testPackage\n" + "class C {\n" + " def String m(String s) {\n" + " newArrayList().iterator.next\n" + " }\n" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XAbstractFeatureCall next = findSingleFeatureCall(c);
assertEquals("java.util.Iterator.next()", next.getFeature().getIdentifier());
assertEquals("String", getType(next).getSimpleName());
}
use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.
the class TypeProviderTest method testParameterizedExtension_03.
@Test
public void testParameterizedExtension_03() throws Exception {
XtendFile file = file("package testPackage\n" + "import org.eclipse.xtext.testing.util.ParseHelper\n" + "import org.eclipse.xtend.core.xtend.XtendFile\n" + "class C<T extends XtendFile> {\n" + " extension ParseHelper<T>\n" + " def m() {" + " parse('')\n" + " }\n" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XAbstractFeatureCall parse = findSingleFeatureCall(c);
assertEquals("org.eclipse.xtext.testing.util.ParseHelper.parse(java.lang.CharSequence)", parse.getFeature().getIdentifier());
assertEquals("T", getType(parse).getSimpleName());
}
use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.
the class TypeProviderTest method testDeferredTypeArgumentResolution_03.
@Test
public void testDeferredTypeArgumentResolution_03() throws Exception {
XtendFile file = file("package testPackage\n" + "class C {\n" + " def String m(String s) {\n" + " newArrayList.flatten.head\n" + " }\n" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XAbstractFeatureCall head = findSingleFeatureCall(c);
assertEquals("org.eclipse.xtext.xbase.lib.IterableExtensions.head(java.lang.Iterable)", head.getFeature().getIdentifier());
assertEquals("String", getType(head).getSimpleName());
}
use of org.eclipse.xtext.xbase.XAbstractFeatureCall in project xtext-xtend by eclipse.
the class LinkingShadowingTest method testField_local_shadows_importedExtension.
@Test
public void testField_local_shadows_importedExtension() throws Exception {
XtendClass clazz = clazz("import static extension testdata.LinkingStaticType.*" + "class SomeClass {\n" + " def method() {\n" + " publicField\n" + " }\n" + " String publicField\n" + "}");
XAbstractFeatureCall featureCall = getFirstFeatureCall(clazz);
assertLinksTo("SomeClass.publicField", featureCall);
}
Aggregations