Package com.redhat.ceylon.compiler.typechecker.model

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedType$Substitution


                    t instanceof Tree.PrefixOperatorExpression;
        }
    }
   
    private ProducedType eraseDefaultedParameters(ProducedType t) {
        ProducedType ct =
                t.getSupertype(unit.getCallableDeclaration());
        if (ct!=null) {
            List<ProducedType> typeArgs =
                    ct.getTypeArgumentList();
            if (typeArgs.size()>=2) {
                ProducedType rt = typeArgs.get(0);
                ProducedType pts = typeArgs.get(1);
                List<ProducedType> argTypes =
                        unit.getTupleElementTypes(pts);
                boolean variadic =
                        unit.isTupleLengthUnbounded(pts);
                boolean atLeastOne =
                        unit.isTupleVariantAtLeastOne(pts);
                if (variadic) {
                    ProducedType spt =
                            argTypes.get(argTypes.size()-1);
                    argTypes.set(argTypes.size()-1,
                            unit.getIteratedType(spt));
                }
                return producedType(unit.getCallableDeclaration(), rt,
View Full Code Here


        return t;
    }
   
    static ProducedReference getRefinedMember(MethodOrValue d,
            ClassOrInterface classOrInterface) {
        ProducedType supertype = classOrInterface.getType()
                .getSupertype((TypeDeclaration) d.getContainer());
        return d.getProducedReference(supertype,
                Collections.<ProducedType>emptyList());
    }
View Full Code Here

                        parameterLists.size()<=i ?
                                null : parameterLists.get(i);
                for (int j=0; j<refinedParameters.getParameters().size(); j++) {
                    Parameter refinedParameter =
                            refinedParameters.getParameters().get(j);
                    ProducedType refinedParameterType =
                            refinedProducedReference
                            .getTypedParameter(refinedParameter)
                            .getFullType();
                    if (parameterList==null ||
                            parameterList.getParameters().size()<=j) {
                        Parameter p = parameters.getParameters().get(j);
                        p.getModel().setType(refinedParameterType);
                    }
                    else {
                        Tree.Parameter parameter =
                                parameterList.getParameters().get(j);
                        Parameter p = parameter.getParameterModel();
                        ProducedType parameterType =
                                p.getModel().getTypedReference().getFullType();
                        Node typeNode = parameter;
                        if (parameter instanceof Tree.ParameterDeclaration) {
                            Tree.Type type =
                                    ((Tree.ParameterDeclaration) parameter)
View Full Code Here

    }
   
    @Override public void visit(Tree.TypeParameterDeclaration that) {
        super.visit(that);
        TypeParameter tpd = that.getDeclarationModel();
        ProducedType dta = tpd.getDefaultTypeArgument();
        if (dta!=null) {
            for (ProducedType st: tpd.getSatisfiedTypes()) {
                checkAssignable(dta, st,
                        that.getTypeSpecifier().getType(),
                        "default type argument does not satisfy type constraint");
View Full Code Here

    @Override public void visit(Tree.InitializerParameter that) {
        super.visit(that);
        Parameter p = that.getParameterModel();
        MethodOrValue model = p.getModel();
        if (model!=null) {
          ProducedType type =
                  model.getTypedReference().getFullType();
          if (type!=null && !isTypeUnknown(type)) {
            checkType(type, that.getSpecifierExpression());
          }
        }
View Full Code Here

    }
   
    private void checkType(ProducedType declaredType,
            Tree.SpecifierOrInitializerExpression sie) {
        if (sie!=null && sie.getExpression()!=null) {
            ProducedType t = sie.getExpression().getTypeModel();
            if (!isTypeUnknown(t)) {
                checkAssignable(t, declaredType, sie,
                        "specified expression must be assignable to declared type");
            }
        }
View Full Code Here

    }

    private void checkType(ProducedType declaredType, String name,
            Tree.SpecifierOrInitializerExpression sie, int code) {
        if (sie!=null && sie.getExpression()!=null) {
            ProducedType t = sie.getExpression().getTypeModel();
            if (!isTypeUnknown(t)) {
                checkAssignable(t, declaredType, sie,
                        "specified expression must be assignable to declared type of '" +
                                name + "'",
                        code);
View Full Code Here

    private void checkOptionalType(Tree.Variable var,
            Tree.SpecifierExpression se) {
        if (var.getType()!=null &&
                !(var.getType() instanceof Tree.LocalModifier)) {
            ProducedType vt = var.getType().getTypeModel();
            if (!isTypeUnknown(vt)) {
                checkAssignable(vt,
                        unit.getType(unit.getObjectDeclaration()),
                        var.getType(),
                        "specified type may not be optional");
            }
            Tree.Expression e = se.getExpression();
            if (se!=null && e!=null) {
                ProducedType set = e.getTypeModel();
                if (set!=null) {
                    if (!isTypeUnknown(vt) && !isTypeUnknown(set)) {
                        checkAssignable(unit.getDefiniteType(set), vt, se,
                                "specified expression must be assignable to declared type");
                    }
View Full Code Here

    private void checkEmptyOptionalType(Tree.Variable var,
            Tree.SpecifierExpression se) {
        if (var.getType()!=null &&
                !(var.getType() instanceof Tree.LocalModifier)) {
            ProducedType vt = var.getType().getTypeModel();
            if (!isTypeUnknown(vt)) {
                checkAssignable(vt,
                        unit.getSequenceType(unit.getType(unit.getAnythingDeclaration())),
                        var.getType(),
                        "specified type must be a nonempty sequence type");
            }
            Tree.Expression e = se.getExpression();
            if (se!=null && e!=null) {
                ProducedType set = e.getTypeModel();
                if (!isTypeUnknown(vt) && !isTypeUnknown(set)) {
                    checkType(unit.getOptionalType(unit.getPossiblyEmptyType(vt)), se);
                }
            }
        }
View Full Code Here

    }

    private void checkContainedType(Tree.Variable var,
            Tree.SpecifierExpression se) {
        if (var.getType()!=null) {
            ProducedType vt = var.getType().getTypeModel();
            if (!isTypeUnknown(vt)) {
                checkType(unit.getIterableType(vt), se);
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.typechecker.model.ProducedType$Substitution

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.