Examples of ProducedTypedReference


Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

    private void inferParameterTypes(ProducedReference pr,
            Parameter param, Tree.Expression e, boolean variadic) {
        if (e!=null) {
            Tree.Term term = unwrapExpressionUntilTerm(e.getTerm());
            ProducedTypedReference tpr = pr.getTypedParameter(param);
            if (term instanceof Tree.FunctionArgument) {
                if (param.getModel() instanceof Functional) {
                    //NOTE: this branch is basically redundant
                    //      and could be removed
                    inferParameterTypesFromCallableParameter(pr,
                            param, (Tree.FunctionArgument) term);
                }
                else {
                    ProducedType paramType = tpr.getFullType();
                    if (variadic) {
                        paramType = unit.getIteratedType(paramType);
                    }
                    if (unit.isCallableType(paramType)) {
                        inferParameterTypesFromCallableType(paramType,
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

        TypeArguments typeArguments = smte.getTypeArguments();
        Declaration dec = smte.getDeclaration();
        if (typeArguments instanceof Tree.InferredTypeArguments &&
                dec instanceof Generic &&
                !((Generic) dec).getTypeParameters().isEmpty()) {
            ProducedTypedReference param = smte.getTargetParameter();
            ProducedType paramType = smte.getParameterType();
            if (paramType==null && param!=null) {
                paramType = param.getFullType();
            }
            ProducedReference arg = getProducedReference(smte);
            if (!smte.getStaticMethodReferencePrimary() &&
                    dec instanceof Functional &&
                    param!=null) {
                Functional fun = (Functional) dec;
                List<ParameterList> apls = fun.getParameterLists();
                Declaration pdec = param.getDeclaration();
                if (pdec instanceof Functional) {
                    Functional pfun = (Functional) pdec;
                    List<ParameterList> ppls = pfun.getParameterLists();
                    if (apls.isEmpty() || ppls.isEmpty()) {
                        return null; //TODO: to give a nicer error
                    }
                    else {
                        List<ProducedType> inferredTypes =
                                new ArrayList<ProducedType>();
                        List<Parameter> apl = apls.get(0).getParameters();
                        List<Parameter> ppl = ppls.get(0).getParameters();
                        for (TypeParameter tp: fun.getTypeParameters()) {
                            List<ProducedType> list =
                                    new ArrayList<ProducedType>();
                            for (int i=0; i<apl.size() && i<ppl.size(); i++) {
                                Parameter ap = apl.get(i);
                                Parameter pp = ppl.get(i);
                                ProducedType type =
                                        param.getTypedParameter(pp).getFullType();
                                ProducedType template =
                                        arg.getTypedParameter(ap).getFullType();
                                ProducedType it =
                                        inferTypeArg(tp, template, type,
                                                true, false,
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

            List<ProducedType> typeArgs, Tree.TypeArguments tal) {
        ProducedType receiverType =
                accountForStaticReferenceReceiverType(that,
                        unwrap(receivingType, that));
        if (acceptsTypeArguments(receiverType, member, typeArgs, tal, that, false)) {
            ProducedTypedReference ptr =
                    receiverType.getTypedMember(member, typeArgs,
                            that.getAssigned());
            /*if (ptr==null) {
                that.addError("member method or attribute does not exist: " +
                        member.getName(unit) + " of type " +
                        receiverType.getDeclaration().getName(unit));
            }
            else {*/
            that.setTarget(ptr);
            ProducedType fullType =
                    ptr.getFullType(wrap(ptr.getType(), receivingType, that));
            if (!dynamic && !isAbstraction(member) &&
                    isTypeUnknown(fullType)) {
                //this occurs with an ambiguous reference
                //to a member of an intersection type
                that.addError("could not determine type of method or attribute reference: '" +
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

            TypedDeclaration member, List<ProducedType> typeArgs,
            Tree.TypeArguments tal) {
        if (acceptsTypeArguments(member, typeArgs, tal, that, false)) {
            ProducedType outerType =
                    that.getScope().getDeclaringType(member);
            ProducedTypedReference pr =
                    member.getProducedTypedReference(outerType, typeArgs,
                            that.getAssigned());
            that.setTarget(pr);
            ProducedType fullType = pr.getFullType();
            if (!dynamic && !isAbstraction(member) &&
                    isTypeUnknown(fullType)) {
                that.addError("could not determine type of function or value reference: '" +
                        member.getName(unit) + "'");
            }
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

                        getTypeParameters(method), outerType);
                    if (tal != null) {
                        tal.setTypeModels(ta);
                    }
                    if (acceptsTypeArguments(outerType, method, ta, tal, that, false)) {
                        ProducedTypedReference pr = outerType==null ?
                                method.getProducedTypedReference(null, ta) :
                                    outerType.getTypedMember(method, ta);
                                that.setTarget(pr);
                                that.setTypeModel(unit.getFunctionMetatype(pr));
                    }
                }
                else {
                    that.addError("missing type arguments to: '" + method.getName(unit) + "'");
                }
            }
        }
        else if (result instanceof Value) {
            Value value = (Value) result;
            if (that.getTypeArgumentList() != null) {
                that.addError("does not accept type arguments: '" + result.getName(unit) + "'");
            }
            else {
                ProducedTypedReference pr = value.getProducedTypedReference(outerType,
                        Collections.<ProducedType>emptyList());
                that.setTarget(pr);
                that.setTypeModel(unit.getValueMetatype(pr));
            }
        }
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

        @Override
        protected void resultType(MethodDefinitionBuilder overloadBuilder) {
            if (!isAnything(getModel().getType())
                    || !Decl.isUnboxedVoid(getModel())
                    || Strategy.useBoxedVoid((Method)getModel())) {
                ProducedTypedReference typedRef = (ProducedTypedReference) typedMember;
                overloadBuilder.resultTypeNonWidening(typedMember.getQualifyingType(), typedRef, typedMember.getType(), 0);
            } else {
                super.resultType(overloadBuilder);
            }
        }
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

            }
            return paramType;
        }

        private ProducedType paramType(Parameter parameter) {
            final ProducedTypedReference typedParameter = typedMember.getTypedParameter(parameter);
            ProducedType paramType;
            // if the supertype method itself got erased to Object, we can't do better than this
            if (gen().willEraseToObject(parameter.getType()) && !gen().willEraseToBestBounds(parameter)) {
                paramType = typeFact().getObjectDeclaration().getType();
            } else {
                paramType = typedParameter.getType();
            }
            return paramType;
        }
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

            mods |= FINAL;
        }
        TypedDeclaration nonWideningDecl = null;
        ProducedType nonWideningType;
        if (Decl.isValue(mov)) {
            ProducedTypedReference typedRef = gen.getTypedReference(mov);
            ProducedTypedReference nonWideningTypedRef = gen.nonWideningTypeDecl(typedRef);
            nonWideningType = gen.nonWideningType(typedRef, nonWideningTypedRef);
            nonWideningDecl = nonWideningTypedRef.getDeclaration();
        }else{
            nonWideningType = param.getType();
            nonWideningDecl = param.getModel();
        }
       
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

                    resultType = gen.typeFact().getCallableType(resultType);
                }
                return resultType(gen.makeJavaType(resultType, CodegenUtil.isUnBoxed(method) ? 0 : AbstractTransformer.JT_NO_PRIMITIVES), method);
            }
        }
        ProducedTypedReference typedRef = gen.getTypedReference(method);
        ProducedTypedReference nonWideningTypedRef = gen.nonWideningTypeDecl(typedRef);
        ProducedType nonWideningType = gen.nonWideningType(typedRef, nonWideningTypedRef);
        if(method.isActual()
                && CodegenUtil.hasTypeErased(method))
            flags |= AbstractTransformer.JT_RAW;
        return resultType(makeResultType(nonWideningTypedRef.getDeclaration(), nonWideningType, flags), method);
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.ProducedTypedReference

        return resultType(makeResultType(nonWideningTypedRef.getDeclaration(), nonWideningType, flags), method);
    }
   
    public MethodDefinitionBuilder resultTypeNonWidening(ProducedType currentType, ProducedTypedReference typedRef,
            ProducedType returnType, int flags){
        ProducedTypedReference nonWideningTypedRef = gen.nonWideningTypeDecl(typedRef, currentType);
        returnType = gen.nonWideningType(typedRef, nonWideningTypedRef);
        return resultType(makeResultType(nonWideningTypedRef.getDeclaration(), returnType, flags), typedRef.getDeclaration());

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.