use of org.eclipse.ceylon.model.loader.TypeParser in project ceylon by eclipse.
the class TypeParserTests method testSpreadCallableAbbrev.
@Test
public void testSpreadCallableAbbrev() {
Type type = new TypeParser(MockLoader.instance).decodeType("a(*[b,a])", null, mockDefaultModule, mockPkgUnit);
Assert.assertNotNull(type);
TypeDeclaration declaration = type.getDeclaration();
Assert.assertNotNull(declaration);
Assert.assertTrue(declaration instanceof Interface);
Assert.assertEquals("ceylon.language::Callable", declaration.getQualifiedNameString());
Assert.assertEquals("a(b, a)", type.asString());
Assert.assertNull(type.getQualifyingType());
}
use of org.eclipse.ceylon.model.loader.TypeParser in project ceylon by eclipse.
the class TypeParserTests method testParamsVariance3.
@Test
public void testParamsVariance3() {
Type type = new TypeParser(MockLoader.instance).decodeType("t2<in b,c>", null, mockDefaultModule, mockPkgUnit);
assertTypeWithParameters(type);
Map<TypeParameter, SiteVariance> varianceOverrides = type.getVarianceOverrides();
Assert.assertNotNull(varianceOverrides);
Assert.assertEquals(1, varianceOverrides.size());
List<TypeParameter> tps = type.getDeclaration().getTypeParameters();
Assert.assertEquals(SiteVariance.IN, varianceOverrides.get(tps.get(0)));
Assert.assertEquals(null, varianceOverrides.get(tps.get(1)));
}
use of org.eclipse.ceylon.model.loader.TypeParser in project ceylon by eclipse.
the class TypeParserTests method testTuple2Abbrev.
@Test
public void testTuple2Abbrev() {
Type type = new TypeParser(MockLoader.instance).decodeType("[a,b]", null, mockDefaultModule, mockPkgUnit);
Assert.assertNotNull(type);
TypeDeclaration declaration = type.getDeclaration();
Assert.assertNotNull(declaration);
Assert.assertTrue(declaration instanceof Class);
Assert.assertEquals("ceylon.language::Tuple", declaration.getQualifiedNameString());
Assert.assertEquals("[a, b]", type.asString());
Assert.assertNull(type.getQualifyingType());
}
use of org.eclipse.ceylon.model.loader.TypeParser in project ceylon by eclipse.
the class TypeParserTests method testParamsVariance1.
@Test
public void testParamsVariance1() {
Type type = new TypeParser(MockLoader.instance).decodeType("t2<in b,out c>", null, mockDefaultModule, mockPkgUnit);
assertTypeWithParameters(type);
Map<TypeParameter, SiteVariance> varianceOverrides = type.getVarianceOverrides();
Assert.assertNotNull(varianceOverrides);
Assert.assertEquals(2, varianceOverrides.size());
List<TypeParameter> tps = type.getDeclaration().getTypeParameters();
Assert.assertEquals(SiteVariance.IN, varianceOverrides.get(tps.get(0)));
Assert.assertEquals(SiteVariance.OUT, varianceOverrides.get(tps.get(1)));
}
use of org.eclipse.ceylon.model.loader.TypeParser in project ceylon by eclipse.
the class TypeParserTests method testEmptyAbbrev.
@Test
public void testEmptyAbbrev() {
Type type = new TypeParser(MockLoader.instance).decodeType("[]", null, mockDefaultModule, mockPkgUnit);
Assert.assertNotNull(type);
TypeDeclaration declaration = type.getDeclaration();
Assert.assertNotNull(declaration);
Assert.assertTrue(declaration instanceof Interface);
Assert.assertEquals("ceylon.language::Empty", declaration.getQualifiedNameString());
Assert.assertNull(type.getQualifyingType());
}
Aggregations