Package com.redhat.ceylon.compiler.typechecker.tree.Tree

Examples of com.redhat.ceylon.compiler.typechecker.tree.Tree.TypeVariance


                if (tal!=null) {
                    List<Tree.Type> args = tal.getTypes();
                    for (int i = 0; i<args.size(); i++) {
                        Tree.Type t = args.get(i);
                        if (t instanceof Tree.StaticType) {
                            TypeVariance variance =
                                    ((Tree.StaticType) t).getTypeVariance();
                            if (variance!=null) {
                                TypeParameter p = params.get(i);
                                if (p.isInvariant()) {
                                    if (variance.getText().equals("out")) {
                                        pt.setVariance(p, OUT);
                                    }
                                    else if (variance.getText().equals("in")) {
                                        pt.setVariance(p, IN);
                                    }
                                }
                                else {
                                    variance.addError("type parameter is not declared invariant: '" +
                                            p.getName() + "' of '" + type.getName(unit) + "'");
                                }
                            }
                        }
                    }
View Full Code Here


    private void checkSupertypeVarianceAnnotations(Tree.SimpleType et) {
        Tree.TypeArgumentList tal = et.getTypeArgumentList();
        if (tal!=null) {
            for (Tree.Type t: tal.getTypes()) {
                if (t instanceof Tree.StaticType) {
                    TypeVariance variance = ((Tree.StaticType) t).getTypeVariance();
                    if (variance!=null) {
                        variance.addError("supertype expression may not specify variance");
                    }
                }
            }
        }
    }
View Full Code Here

            //TODO: dupe of logic in ExpressionVisitor
            List<Tree.Type> args = tal.getTypes();
            for (int i = 0; i<args.size(); i++) {
                Tree.Type t = args.get(i);
                if (t instanceof Tree.StaticType) {
                    TypeVariance variance =
                            ((Tree.StaticType) t).getTypeVariance();
                    if (variance!=null) {
                        TypeParameter p = params.get(i);
                        if (p.isInvariant()) {
                            if (variance.getText().equals("out")) {
                                pt.setVariance(p, OUT);
                            }
                            else if (variance.getText().equals("in")) {
                                pt.setVariance(p, IN);
                            }
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.typechecker.tree.Tree.TypeVariance

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.