Search in sources :

Example 21 with TypeDeclaration

use of com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.

the class NamingTests method testCC.

@Test
public void testCC() throws Exception {
    final TypeDeclaration decl = findType("CC.ceylon", "CC.C");
    Assert.assertEquals("C", naming.makeTypeDeclarationName(decl));
    Assert.assertEquals(QUAL + "CC.C", naming.makeTypeDeclarationName(decl, QUALIFIED));
    assertEquals("com.redhat.ceylon.compiler.java.codegen.CC.C", CodegenUtil.getJavaNameOfDeclaration(decl));
}
Also used : TypeDeclaration(com.redhat.ceylon.model.typechecker.model.TypeDeclaration) Test(org.junit.Test)

Example 22 with TypeDeclaration

use of com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.

the class NamingTests method testfCC.

@Test
public void testfCC() throws Exception {
    final TypeDeclaration decl = findType("fCC.ceylon", "fCC.CC.C");
    Assert.assertEquals("C", naming.makeTypeDeclarationName(decl));
    Assert.assertEquals("CC.C", naming.makeTypeDeclarationName(decl, QUALIFIED));
    try {
        CodegenUtil.getJavaNameOfDeclaration(decl);
        fail();
    } catch (IllegalArgumentException e) {
    }
}
Also used : TypeDeclaration(com.redhat.ceylon.model.typechecker.model.TypeDeclaration) Test(org.junit.Test)

Example 23 with TypeDeclaration

use of com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.

the class NamingTests method testfII.

@Test
public void testfII() throws Exception {
    final TypeDeclaration decl = findType("fII.ceylon", "fII.II.I");
    Assert.assertEquals("fII$II$I_", naming.makeTypeDeclarationName(decl));
    Assert.assertEquals("I$impl", naming.makeTypeDeclarationName(decl, COMPANION));
    Assert.assertEquals(QUAL + "fII$II$I_", naming.makeTypeDeclarationName(decl, QUALIFIED));
    Assert.assertEquals("II$impl.I$impl", naming.makeTypeDeclarationName(decl, COMPANION, QUALIFIED));
    try {
        CodegenUtil.getJavaNameOfDeclaration(decl);
        fail();
    } catch (IllegalArgumentException e) {
    }
}
Also used : TypeDeclaration(com.redhat.ceylon.model.typechecker.model.TypeDeclaration) Test(org.junit.Test)

Example 24 with TypeDeclaration

use of com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.

the class NamingTests method testIC.

@Test
public void testIC() throws Exception {
    final TypeDeclaration decl = findType("IC.ceylon", "IC.C");
    Assert.assertEquals("C", naming.makeTypeDeclarationName(decl));
    Assert.assertEquals(QUAL + "IC$impl.C", naming.makeTypeDeclarationName(decl, QUALIFIED));
    assertEquals("com.redhat.ceylon.compiler.java.codegen.IC$impl.C", CodegenUtil.getJavaNameOfDeclaration(decl));
}
Also used : TypeDeclaration(com.redhat.ceylon.model.typechecker.model.TypeDeclaration) Test(org.junit.Test)

Example 25 with TypeDeclaration

use of com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.

the class NamingTests method testoI.

@Test
public void testoI() throws Exception {
    final TypeDeclaration decl = findType("oI.ceylon", "oI.I");
    Assert.assertEquals("oI$I_", naming.makeTypeDeclarationName(decl));
    Assert.assertEquals("I$impl", naming.makeTypeDeclarationName(decl, COMPANION));
    Assert.assertEquals(QUAL + "oI$I_", naming.makeTypeDeclarationName(decl, QUALIFIED));
    Assert.assertEquals(QUAL + "oI_.I$impl", naming.makeTypeDeclarationName(decl, COMPANION, QUALIFIED));
    assertEquals("com.redhat.ceylon.compiler.java.codegen.oI$I_", CodegenUtil.getJavaNameOfDeclaration(decl));
}
Also used : TypeDeclaration(com.redhat.ceylon.model.typechecker.model.TypeDeclaration) Test(org.junit.Test)

Aggregations

TypeDeclaration (com.redhat.ceylon.model.typechecker.model.TypeDeclaration)140 Type (com.redhat.ceylon.model.typechecker.model.Type)85 Test (org.junit.Test)51 Class (com.redhat.ceylon.model.typechecker.model.Class)40 ClassOrInterface (com.redhat.ceylon.model.typechecker.model.ClassOrInterface)37 TypedDeclaration (com.redhat.ceylon.model.typechecker.model.TypedDeclaration)36 IntersectionType (com.redhat.ceylon.model.typechecker.model.IntersectionType)33 UnionType (com.redhat.ceylon.model.typechecker.model.UnionType)33 TypeParser (com.redhat.ceylon.model.loader.TypeParser)32 Declaration (com.redhat.ceylon.model.typechecker.model.Declaration)32 Interface (com.redhat.ceylon.model.typechecker.model.Interface)27 JCExpression (com.sun.tools.javac.tree.JCTree.JCExpression)24 Tree (com.redhat.ceylon.compiler.typechecker.tree.Tree)20 ModelUtil.appliedType (com.redhat.ceylon.model.typechecker.model.ModelUtil.appliedType)19 TypeParameter (com.redhat.ceylon.model.typechecker.model.TypeParameter)19 Function (com.redhat.ceylon.model.typechecker.model.Function)18 ArrayList (java.util.ArrayList)17 JCTree (com.sun.tools.javac.tree.JCTree)16 FunctionOrValue (com.redhat.ceylon.model.typechecker.model.FunctionOrValue)14 JCNewClass (com.sun.tools.javac.tree.JCTree.JCNewClass)14