use of com.redhat.ceylon.model.typechecker.model.Class in project ceylon-compiler by ceylon.
the class LocalTypeVisitor method visit.
@Override
public void visit(Tree.BaseMemberOrTypeExpression that) {
Declaration model = that.getDeclaration();
if (model != null && (model instanceof Function || model instanceof Class) && // if it's a parameter we don't need to wrap it in a class
!model.isParameter() && !that.getDirectlyInvoked()) {
String prefix = this.prefix;
enterAnonymousClass();
super.visit(that);
exitAnonymousClass();
this.prefix = prefix;
} else {
super.visit(that);
}
}
use of com.redhat.ceylon.model.typechecker.model.Class in project ceylon-compiler by ceylon.
the class TypeParserTests method testTuple1OrMoreAbbrev.
@Test
public void testTuple1OrMoreAbbrev() {
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 com.redhat.ceylon.model.typechecker.model.Class in project ceylon-compiler by ceylon.
the class TypeParserTests method testTypeCallPackage.
@Test
public void testTypeCallPackage() {
Type type = new TypeParser(MockLoader.instance).decodeType("pkg::package", null, mockDefaultModule, mockPkgUnit);
Assert.assertNotNull(type);
TypeDeclaration declaration = type.getDeclaration();
Assert.assertNotNull(declaration);
Assert.assertTrue(declaration instanceof Class);
Assert.assertEquals("pkg::package", printType(type));
Assert.assertNull(type.getQualifyingType());
}
use of com.redhat.ceylon.model.typechecker.model.Class in project ceylon-compiler by ceylon.
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 com.redhat.ceylon.model.typechecker.model.Class in project ceylon-compiler by ceylon.
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