use of org.eclipse.ceylon.model.loader.TypeParser in project ceylon by eclipse.
the class TypeParserTests method testParamsVariance2.
@Test
public void testParamsVariance2() {
Type type = new TypeParser(MockLoader.instance).decodeType("t2<b,out 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(null, 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 testTuple1Abbrev.
@Test
public void testTuple1Abbrev() {
Type type = new TypeParser(MockLoader.instance).decodeType("[a]", 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]", type.asString());
Assert.assertNull(type.getQualifyingType());
}
use of org.eclipse.ceylon.model.loader.TypeParser in project ceylon by eclipse.
the class TypeParserTests method testOptionalEntry.
@Test
public void testOptionalEntry() {
Type type = new TypeParser(MockLoader.instance).decodeType("<ceylon.language::Boolean->a>?", null, mockDefaultModule, mockPkgUnit);
Assert.assertNotNull(type);
TypeDeclaration declaration = type.getDeclaration();
Assert.assertNotNull(declaration);
Assert.assertTrue(declaration instanceof UnionType);
Assert.assertEquals("ceylon.language::Null|ceylon.language::Entry<ceylon.language::Boolean,a>", printType(type));
Assert.assertNull(type.getQualifyingType());
}
use of org.eclipse.ceylon.model.loader.TypeParser in project ceylon by eclipse.
the class TypeParserTests method testPackageQualified.
@Test
public void testPackageQualified() {
Type type = new TypeParser(MockLoader.instance).decodeType("pkg::v", null, mockDefaultModule, mockPkgUnit);
Assert.assertNotNull(type);
TypeDeclaration declaration = type.getDeclaration();
Assert.assertNotNull(declaration);
Assert.assertTrue(declaration instanceof Class);
Assert.assertEquals("pkg::v", declaration.getQualifiedNameString());
Assert.assertNull(type.getQualifyingType());
}
use of org.eclipse.ceylon.model.loader.TypeParser in project ceylon by eclipse.
the class TypeParserTests method testTuple1To3StarAbbrev.
// [a,b=,c+] it not allowed (for good reason)
@Test
public void testTuple1To3StarAbbrev() {
Type type = new TypeParser(MockLoader.instance).decodeType("[a,b=,c*]", 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("ceylon.language::Tuple<a|b|c,a,ceylon.language::Empty|ceylon.language::Tuple<b|c,b,ceylon.language::Sequential<c>>>", printType(type));
Assert.assertNull(type.getQualifyingType());
}
Aggregations