Package com.redhat.ceylon.compiler.loader

Examples of com.redhat.ceylon.compiler.loader.TypeParser


       
    };
   
    @Test
    public void testUnion(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("a|b|c", null, mockModule, mockUnit);
        Assert.assertNotNull(type);
        TypeDeclaration declaration = type.getDeclaration();
        Assert.assertNotNull(declaration);
        Assert.assertTrue(declaration instanceof UnionType);
        UnionType union = (UnionType) declaration;
View Full Code Here


        Assert.assertTrue(types.get(2).getDeclaration() instanceof Class);
    }

    @Test
    public void testIntersection(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("a&b&c", null, mockModule, mockUnit);
        Assert.assertNotNull(type);
        TypeDeclaration declaration = type.getDeclaration();
        Assert.assertNotNull(declaration);
        Assert.assertTrue(declaration instanceof IntersectionType);
        IntersectionType intersection = (IntersectionType) declaration;
View Full Code Here

        Assert.assertTrue(types.get(2).getDeclaration() instanceof Class);
    }

    @Test
    public void testIntersectionAndUnion(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("a&b|c", null, mockModule, mockUnit);
        Assert.assertNotNull(type);
        TypeDeclaration declaration = type.getDeclaration();
        Assert.assertNotNull(declaration);
        Assert.assertTrue(declaration instanceof UnionType);
        UnionType union = (UnionType) declaration;
View Full Code Here

        Assert.assertTrue(unionTypes.get(1).getDeclaration() instanceof Class);
    }

    @Test
    public void testParams(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("t2<b,c>", null, mockModule, mockUnit);
        assertTypeWithParameters(type);
       
        Assert.assertTrue(type.getVarianceOverrides().isEmpty());
    }
View Full Code Here

        Assert.assertTrue(type.getVarianceOverrides().isEmpty());
    }

    @Test
    public void testParamsVariance1(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("t2<in b,out c>", null, mockModule, mockUnit);
        assertTypeWithParameters(type);

        Map<TypeParameter, SiteVariance> varianceOverrides = type.getVarianceOverrides();
        Assert.assertNotNull(varianceOverrides);
        Assert.assertEquals(2, varianceOverrides.size());
View Full Code Here

        Assert.assertEquals(SiteVariance.OUT, varianceOverrides.get(tps.get(1)));
    }

    @Test
    public void testParamsVariance2(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("t2<b,out c>", null, mockModule, mockUnit);
        assertTypeWithParameters(type);

        Map<TypeParameter, SiteVariance> varianceOverrides = type.getVarianceOverrides();
        Assert.assertNotNull(varianceOverrides);
        Assert.assertEquals(1, varianceOverrides.size());
View Full Code Here

        Assert.assertEquals(SiteVariance.OUT, varianceOverrides.get(tps.get(1)));
    }

    @Test
    public void testParamsVariance3(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("t2<in b,c>", null, mockModule, mockUnit);
        assertTypeWithParameters(type);

        Map<TypeParameter, SiteVariance> varianceOverrides = type.getVarianceOverrides();
        Assert.assertNotNull(varianceOverrides);
        Assert.assertEquals(1, varianceOverrides.size());
View Full Code Here

        Assert.assertTrue(tal.get(1).getDeclaration() instanceof Class);
    }

    @Test
    public void testUnionParams(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("a|t2<b|c,t2<d,e|f>>", null, mockModule, mockUnit);
        Assert.assertNotNull(type);
        TypeDeclaration declaration = type.getDeclaration();
        Assert.assertNotNull(declaration);
        Assert.assertTrue(declaration instanceof UnionType);
        UnionType union = (UnionType) declaration;
View Full Code Here

    }

    @Test
    public void testQualified(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("a.b", null, mockModule, mockUnit);
        Assert.assertNotNull(type);
        TypeDeclaration declaration = type.getDeclaration();
        Assert.assertNotNull(declaration);
        Assert.assertTrue(declaration instanceof Class);
        Assert.assertEquals("a.b", declaration.getQualifiedNameString());
View Full Code Here

        Assert.assertEquals("a", qualifyingDeclaration.getName());
    }

    @Test
    public void testQualifiedAndParameterised(){
        ProducedType type = new TypeParser(MockLoader.instance).decodeType("t2<a,b>.t2<c,d>", null, mockModule, mockUnit);
        Assert.assertNotNull(type);
        TypeDeclaration declaration = type.getDeclaration();
        Assert.assertNotNull(declaration);
        Assert.assertTrue(declaration instanceof Class);
        Assert.assertEquals("t2.t2", declaration.getQualifiedNameString());
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.loader.TypeParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.