Search in sources :

Example 1 with JvmVoid

use of org.eclipse.xtext.common.types.JvmVoid in project xtext-eclipse by eclipse.

the class JdtTypeProviderTest method testBug300216.

@Test
public void testBug300216() {
    JvmDeclaredType type = (JvmDeclaredType) getTypeProvider().findTypeByName("java.lang.Object");
    assertTrue(type.getSuperTypes().isEmpty());
    URI unresolveableType = URI.createURI("java:/Objects/Something#Something");
    JvmVoid proxy = TypesFactory.eINSTANCE.createJvmVoid();
    JvmParameterizedTypeReference typeReference = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference();
    typeReference.setType(proxy);
    ((InternalEObject) proxy).eSetProxyURI(unresolveableType);
    type.getSuperTypes().add(typeReference);
    assertTrue(type.getSuperTypes().get(0).getType().eIsProxy());
    assertEquals(2, type.eResource().getResourceSet().getResources().size());
}
Also used : JvmVoid(org.eclipse.xtext.common.types.JvmVoid) JvmDeclaredType(org.eclipse.xtext.common.types.JvmDeclaredType) JvmParameterizedTypeReference(org.eclipse.xtext.common.types.JvmParameterizedTypeReference) URI(org.eclipse.emf.common.util.URI) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Test(org.junit.Test)

Example 2 with JvmVoid

use of org.eclipse.xtext.common.types.JvmVoid in project xtext-eclipse by eclipse.

the class AbstractConstructorScopeTest method testGetElementByInstance_02.

@Test
public void testGetElementByInstance_02() {
    JvmVoid voidType = TypesFactory.eINSTANCE.createJvmVoid();
    IEObjectDescription element = getConstructorScope().getSingleElement(voidType);
    assertNull(element);
}
Also used : JvmVoid(org.eclipse.xtext.common.types.JvmVoid) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 3 with JvmVoid

use of org.eclipse.xtext.common.types.JvmVoid in project xtext-eclipse by eclipse.

the class AbstractTypeScopeTest method testGetElementByInstance_01.

@Test
public void testGetElementByInstance_01() {
    JvmVoid voidType = TypesFactory.eINSTANCE.createJvmVoid();
    IEObjectDescription element = getTypeScope().getSingleElement(voidType);
    assertNotNull(element);
    assertEquals(voidType.getIdentifier(), element.getName().toString());
}
Also used : JvmVoid(org.eclipse.xtext.common.types.JvmVoid) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 4 with JvmVoid

use of org.eclipse.xtext.common.types.JvmVoid in project xtext-xtend by eclipse.

the class LinkingErrorTest method testNoException_02.

@Test
public void testNoException_02() throws Exception {
    XtendFunction function = function("def noException() {\n" + // exception case is i
    "	    val closure = [ i| return i]\n" + "	    for (x : 1..100) closure.apply(x)\n" + "	}");
    JvmTypeReference type = associations.getDirectlyInferredOperation(function).getReturnType();
    assertTrue(type.getType() instanceof JvmVoid);
    assertFalse(type.getType().eIsProxy());
    assertNoExceptions(function);
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) JvmVoid(org.eclipse.xtext.common.types.JvmVoid) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) Test(org.junit.Test)

Example 5 with JvmVoid

use of org.eclipse.xtext.common.types.JvmVoid in project xtext-xtend by eclipse.

the class LinkingErrorTest method testNoException_01.

@Test
public void testNoException_01() throws Exception {
    XtendFunction function = function("def noException() {\n" + // exception case is Integeri
    "	    val closure = [Integeri| return i]\n" + "	    for (x : 1..100) closure.apply(x)\n" + "	}");
    JvmTypeReference type = associations.getDirectlyInferredOperation(function).getReturnType();
    assertTrue(type.getType() instanceof JvmVoid);
    assertFalse(type.getType().eIsProxy());
    assertNoExceptions(function);
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) JvmVoid(org.eclipse.xtext.common.types.JvmVoid) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) Test(org.junit.Test)

Aggregations

JvmVoid (org.eclipse.xtext.common.types.JvmVoid)6 Test (org.junit.Test)5 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)2 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)2 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)2 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)2 URI (org.eclipse.emf.common.util.URI)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 PrimitiveTypeImpl (org.eclipse.xtend.core.macro.declaration.PrimitiveTypeImpl)1 VoidTypeImpl (org.eclipse.xtend.core.macro.declaration.VoidTypeImpl)1 XtendAnnotationType (org.eclipse.xtend.core.xtend.XtendAnnotationType)1 AccessorType (org.eclipse.xtend.lib.annotations.AccessorType)1 Type (org.eclipse.xtend.lib.macro.declaration.Type)1 JvmAnnotationType (org.eclipse.xtext.common.types.JvmAnnotationType)1 JvmArrayType (org.eclipse.xtext.common.types.JvmArrayType)1 JvmComponentType (org.eclipse.xtext.common.types.JvmComponentType)1 JvmEnumerationType (org.eclipse.xtext.common.types.JvmEnumerationType)1 JvmGenericType (org.eclipse.xtext.common.types.JvmGenericType)1 JvmParameterizedTypeReference (org.eclipse.xtext.common.types.JvmParameterizedTypeReference)1 JvmPrimitiveType (org.eclipse.xtext.common.types.JvmPrimitiveType)1