Search in sources :

Example 6 with BuiltInTypeScope

use of org.eclipse.n4js.ts.scoping.builtin.BuiltInTypeScope in project n4js by eclipse.

the class BuiltInTypeScopeTest method testResolveSuperTypeOfBuiltInType.

@SuppressWarnings("javadoc")
@Test
public void testResolveSuperTypeOfBuiltInType() {
    BuiltInTypeScope scope = BuiltInTypeScope.get(resourceSet);
    // trigger loading
    IEObjectDescription intDescription = scope.getSingleElement(QualifiedName.create("i18nKey"));
    PrimitiveType intType = (PrimitiveType) intDescription.getEObjectOrProxy();
    PrimitiveType assCompatType = intType.getAssignmentCompatible();
    Assert.assertFalse(assCompatType.eIsProxy());
    Assert.assertEquals("string", assCompatType.getName());
}
Also used : PrimitiveType(org.eclipse.n4js.ts.types.PrimitiveType) BuiltInTypeScope(org.eclipse.n4js.ts.scoping.builtin.BuiltInTypeScope) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 7 with BuiltInTypeScope

use of org.eclipse.n4js.ts.scoping.builtin.BuiltInTypeScope in project n4js by eclipse.

the class BuiltInTypeScopeTest method testResolveAllBuiltInTypes.

@SuppressWarnings("javadoc")
@Test
public void testResolveAllBuiltInTypes() {
    BuiltInTypeScope scope = BuiltInTypeScope.get(resourceSet);
    // trigger loading
    scope.getSingleElement(QualifiedName.create("any"));
    Assert.assertEquals(5, resourceSet.getResources().size());
    EcoreUtil.resolveAll(resourceSet);
    Assert.assertEquals(5, resourceSet.getResources().size());
    Map<EObject, Collection<Setting>> unresolvedProxies = EcoreUtil.UnresolvedProxyCrossReferencer.find(resourceSet);
    Assert.assertTrue(unresolvedProxies.toString(), unresolvedProxies.isEmpty());
}
Also used : EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Collection(java.util.Collection) BuiltInTypeScope(org.eclipse.n4js.ts.scoping.builtin.BuiltInTypeScope) Test(org.junit.Test)

Aggregations

BuiltInTypeScope (org.eclipse.n4js.ts.scoping.builtin.BuiltInTypeScope)7 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)4 Test (org.junit.Test)4 FunctionTypeExpression (org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression)2 Collection (java.util.Collection)1 EObject (org.eclipse.emf.ecore.EObject)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 Diagnostic (org.eclipse.emf.ecore.resource.Resource.Diagnostic)1 AdditiveExpression (org.eclipse.n4js.n4JS.AdditiveExpression)1 AssignmentExpression (org.eclipse.n4js.n4JS.AssignmentExpression)1 AwaitExpression (org.eclipse.n4js.n4JS.AwaitExpression)1 BinaryBitwiseExpression (org.eclipse.n4js.n4JS.BinaryBitwiseExpression)1 BinaryLogicalExpression (org.eclipse.n4js.n4JS.BinaryLogicalExpression)1 CastExpression (org.eclipse.n4js.n4JS.CastExpression)1 CommaExpression (org.eclipse.n4js.n4JS.CommaExpression)1 ConditionalExpression (org.eclipse.n4js.n4JS.ConditionalExpression)1 EqualityExpression (org.eclipse.n4js.n4JS.EqualityExpression)1 Expression (org.eclipse.n4js.n4JS.Expression)1 FunctionExpression (org.eclipse.n4js.n4JS.FunctionExpression)1