示例#1
0
        public override IEnumerable <(string name, RealizedType type)> InferGenericArgument(ModuleContext context,
                                                                                            RealizedType concreteType)
        {
            OptionType concreteOption = concreteType as OptionType;

            if (concreteOption == null)
            {
                return(Enumerable.Empty <(string name, RealizedType type)>());
            }
            return(elementType.InferGenericArgument(context, concreteOption.elementType.UnderlyingType(context)));
        }
示例#2
0
        public override IEnumerable <(string name, RealizedType type)> InferGenericArgument(ModuleContext context,
                                                                                            RealizedType concreteType)
        {
            ResultType concreteResult = concreteType as ResultType;

            if (concreteResult == null)
            {
                return(Enumerable.Empty <(string name, RealizedType type)>());
            }
            return(successType.InferGenericArgument(context, concreteResult.successType.UnderlyingType(context)).Concat(
                       errorType.InferGenericArgument(context, concreteResult.errorType.UnderlyingType(context))));
        }
示例#3
0
        public override IEnumerable <(string name, RealizedType type)> InferGenericArgument(ModuleContext context,
                                                                                            RealizedType concreteType)
        {
            FunctionType concreteFunction = concreteType as FunctionType;

            if (concreteFunction == null)
            {
                return(Enumerable.Empty <(string name, RealizedType type)>());
            }
            return(returnType.InferGenericArgument(context, concreteFunction.returnType.UnderlyingType(context)).Concat(
                       parameterTypes.Zip(concreteFunction.parameterTypes,
                                          (p, concreteP) => p.InferGenericArgument(context, concreteP.UnderlyingType(context)))
                       .SelectMany(p => p)));
        }