use of org.eclipse.xtend.core.xtend.XtendClass in project xtext-xtend by eclipse.
the class DispatchHelperTest method testSort_01.
@Test
public void testSort_01() throws Exception {
XtendClass clazz = clazz("class X {\n" + " def dispatch foo(Integer i) {null}" + " def dispatch foo(Boolean i) {null}" + " def dispatch foo(String i) {null}" + "}");
JvmGenericType type = associations.getInferredType(clazz);
ListMultimap<DispatchSignature, JvmOperation> multimap = dispatchHelper.getDeclaredOrEnhancedDispatchMethods(type);
List<JvmOperation> list = multimap.get(new DispatchHelper.DispatchSignature("foo", 1));
Iterator<JvmOperation> i = list.iterator();
assertEquals(Integer.class.getName(), i.next().getParameters().get(0).getParameterType().getIdentifier());
assertEquals(Boolean.class.getName(), i.next().getParameters().get(0).getParameterType().getIdentifier());
assertEquals(String.class.getName(), i.next().getParameters().get(0).getParameterType().getIdentifier());
}
use of org.eclipse.xtend.core.xtend.XtendClass in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method testSugaredAssignment_asExtension.
@Test
public void testSugaredAssignment_asExtension() throws Exception {
XtendClass clazz = clazz("class SomeClass {\n" + " def void method(String something) {\n" + " something.myValue = 'foo'\n" + " }\n" + " def void setMyValue(String something, String value) {}" + "}");
XAssignment assignment = getLastAssignment(clazz);
assertLinksTo("SomeClass.setMyValue(java.lang.String,java.lang.String)", assignment);
assertImplicitReceiver("SomeClass", assignment);
}
use of org.eclipse.xtend.core.xtend.XtendClass in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method testUnqualifiedField_onExtension.
@Test
public void testUnqualifiedField_onExtension() throws Exception {
XtendClass clazz = clazz("class SomeClass {\n" + " def void method() {\n" + " stringField = 'foo'\n" + " }\n" + " extension testdata.FieldAccess" + "}");
XAssignment assignment = getLastAssignment(clazz);
assertLinksTo("testdata.FieldAccess.stringField", assignment);
assertImplicitReceiver("SomeClass._fieldAccess", assignment);
}
use of org.eclipse.xtend.core.xtend.XtendClass in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method testBug447982_05.
@Test
public void testBug447982_05() throws Exception {
XtendClass clazz = clazz("class C {\n" + " def m(String it) {\n" + " x = 1\n" + " } \n" + " def x(String s, int x) {}\n" + " def setX(String s, int x) {}\n" + "}");
XAssignment assignment = getLastAssignment(clazz);
assertLinksTo("C.setX(java.lang.String,int)", TypesPackage.Literals.JVM_OPERATION, assignment);
}
use of org.eclipse.xtend.core.xtend.XtendClass in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method testBug447982_04.
@Test
public void testBug447982_04() throws Exception {
XtendClass clazz = clazz("class C {\n" + " def static m() {\n" + " x = 1\n" + " } \n" + " static int x\n" + " def static setX(int x) {}\n" + "}");
XAssignment assignment = getLastAssignment(clazz);
assertLinksTo("C.x", TypesPackage.Literals.JVM_FIELD, assignment);
}
Aggregations