Exemplo n.º 1
0
 bool OverloadResolver.IErrorHandler.AmbiguousCandidates(ResolveContext ec, MemberSpec best, MemberSpec ambiguous)
 {
     ec.Report.SymbolRelatedToPreviousError(best);
     ec.Report.SymbolRelatedToPreviousError(ambiguous);
     ec.Report.Error(1940, loc, "Ambiguous implementation of the query pattern `{0}' for source type `{1}'",
                     best.Name, mg.InstanceExpression.GetSignatureForError());
     return(true);
 }
Exemplo n.º 2
0
			bool OverloadResolver.IErrorHandler.AmbiguousCandidates (ResolveContext ec, MemberSpec best, MemberSpec ambiguous)
			{
				var emg = mg as ExtensionMethodGroupExpr;
				var type = emg == null ? mg.InstanceExpression : emg.ExtensionExpression;

				ec.Report.SymbolRelatedToPreviousError (best);
				ec.Report.SymbolRelatedToPreviousError (ambiguous);
				ec.Report.Error (1940, loc, "Ambiguous implementation of the query pattern `{0}' for source type `{1}'",
					best.Name, type.Type.GetSignatureForError ());
				return true;
			}
Exemplo n.º 3
0
 bool OverloadResolver.IErrorHandler.NoArgumentMatch(ResolveContext rc, MemberSpec best)
 {
     return(false);
 }
Exemplo n.º 4
0
            bool OverloadResolver.IErrorHandler.TypeInferenceFailed(ResolveContext rc, MemberSpec best)
            {
                var      ms          = (MethodSpec)best;
                TypeSpec source_type = ms.Parameters.ExtensionMethodType;

                if (source_type != null)
                {
                    Argument a = arguments[0];

                    if (TypeManager.IsGenericType(source_type) && InflatedTypeSpec.ContainsTypeParameter(source_type))
                    {
                        TypeInferenceContext tic = new TypeInferenceContext(source_type.TypeArguments);
                        tic.OutputTypeInference(rc, a.Expr, source_type);
                        if (tic.FixAllTypes(rc))
                        {
                            source_type = source_type.GetDefinition().MakeGenericType(tic.InferredTypeArguments);
                        }
                    }

                    if (!Convert.ImplicitConversionExists(rc, a.Expr, source_type))
                    {
                        rc.Report.Error(1936, loc, "An implementation of `{0}' query expression pattern for source type `{1}' could not be found",
                                        best.Name, TypeManager.CSharpName(a.Type));
                        return(true);
                    }
                }

                if (best.Name == "SelectMany")
                {
                    rc.Report.Error(1943, loc,
                                    "An expression type is incorrect in a subsequent `from' clause in a query expression with source type `{0}'",
                                    arguments[0].GetSignatureForError());
                }
                else
                {
                    rc.Report.Error(1942, loc,
                                    "An expression type in `{0}' clause is incorrect. Type inference failed in the call to `{1}'",
                                    best.Name.ToLowerInvariant(), best.Name);
                }

                return(true);
            }
Exemplo n.º 5
0
 public virtual IEnumerable<Attribute> LoadDeclaredAttributes(MemberSpec memberSpec)
 {
     if (memberSpec == null)
         throw new ArgumentNullException(nameof(memberSpec));
     return memberSpec.OnLoadDeclaredAttributes();
 }
Exemplo n.º 6
0
 bool OverloadResolver.IErrorHandler.ArgumentMismatch(ResolveContext rc, MemberSpec best, Argument arg, int index)
 {
     return(false);
 }
Exemplo n.º 7
0
 public override string LoadName(MemberSpec memberSpec)
 {
     return memberSpec
         .Maybe()
         .Switch()
         .Case<PropertySpec>().Then(x => Filter.GetPropertyMappedName(x.ReflectedType, x.PropertyInfo))
         .Case<TypeSpec>().Then(x => Filter.GetTypeMappedName(x.Type))
         .EndSwitch()
         .OrDefault(() => base.LoadName(memberSpec));
 }
Exemplo n.º 8
0
			bool OverloadResolver.IErrorHandler.AmbiguousCandidates (ResolveContext ec, MemberSpec best, MemberSpec ambiguous)
			{
				ec.Report.SymbolRelatedToPreviousError (best);
				ec.Report.SymbolRelatedToPreviousError (ambiguous);
				ec.Report.Error (1940, loc, "Ambiguous implementation of the query pattern `{0}' for source type `{1}'",
					best.Name, mg.InstanceExpression.GetSignatureForError ());
				return true;
			}
Exemplo n.º 9
0
 public ReferenceEmitter(MemberSpec ms, int off, ReferenceKind k, RegistersEnum reg)
     : this(ms, off, k)
 {
     Register = reg;
 }
Exemplo n.º 10
0
        public override IEnumerable<Attribute> LoadDeclaredAttributes(MemberSpec memberSpec)
        {
            var attrs = base.LoadDeclaredAttributes(memberSpec);

            var typeSpec = memberSpec as TypeSpec;
            if (typeSpec != null)
            {
                var customClientLibraryType = Filter.GetClientLibraryType(typeSpec.Type);
                if (customClientLibraryType != null)
                    attrs = attrs.Append(new CustomClientLibraryTypeAttribute(customClientLibraryType));
                var customJsonConverter = Filter.GetJsonConverterForType(typeSpec.Type);
                if (customJsonConverter != null)
                    attrs = attrs.Append(new CustomJsonConverterAttribute(customJsonConverter));
            }
            var propSpec = memberSpec as PropertySpec;
            if (propSpec != null)
            {
                var formulaExpr = Filter.GetPropertyFormula(propSpec.ReflectedType, propSpec.PropertyInfo);
                if (formulaExpr != null)
                    attrs = attrs.Append(new PropertyFormulaAttribute(formulaExpr));

                attrs =
                    attrs.Concat(
                        Filter.GetPropertyAttributes(propSpec.ReflectedType, propSpec.PropertyInfo).EmptyIfNull());
            }
            return attrs;
        }
Exemplo n.º 11
0
 public ReferenceEmitter(MemberSpec ms, int off, ReferenceKind k)
     : base(k)
 {
     Member = ms;
     Offset = off;
 }
Exemplo n.º 12
0
 public SeeNode(MemberSpec reference)
 {
     if (reference == null)
         throw new ArgumentNullException(nameof(reference));
     Reference = reference;
 }
Exemplo n.º 13
0
 public virtual string LoadName(MemberSpec memberSpec)
 {
     if (memberSpec == null)
         throw new ArgumentNullException(nameof(memberSpec));
     return memberSpec.OnLoadName();
 }
Exemplo n.º 14
0
			bool OverloadResolver.IErrorHandler.NoArgumentMatch (ResolveContext rc, MemberSpec best)
			{
				return false;
			}
Exemplo n.º 15
0
 public IDocNode GetSummary(MemberSpec member)
 {
     return GetMemberSummary(member.Member);
 }
Exemplo n.º 16
0
			bool OverloadResolver.IErrorHandler.TypeInferenceFailed (ResolveContext rc, MemberSpec best)
			{
				var ms = (MethodSpec) best;
				TypeSpec source_type = ms.Parameters.ExtensionMethodType;
				if (source_type != null) {
					Argument a = arguments[0];

					if (TypeManager.IsGenericType (source_type) && TypeManager.ContainsGenericParameters (source_type)) {
						TypeInferenceContext tic = new TypeInferenceContext (source_type.TypeArguments);
						tic.OutputTypeInference (rc, a.Expr, source_type);
						if (tic.FixAllTypes (rc)) {
							source_type = source_type.GetDefinition ().MakeGenericType (tic.InferredTypeArguments);
						}
					}

					if (!Convert.ImplicitConversionExists (rc, a.Expr, source_type)) {
						rc.Report.Error (1936, loc, "An implementation of `{0}' query expression pattern for source type `{1}' could not be found",
							best.Name, TypeManager.CSharpName (a.Type));
						return true;
					}
				}

				if (best.Name == "SelectMany") {
					rc.Report.Error (1943, loc,
						"An expression type is incorrect in a subsequent `from' clause in a query expression with source type `{0}'",
						arguments[0].GetSignatureForError ());
				} else {
					rc.Report.Error (1942, loc,
						"An expression type in `{0}' clause is incorrect. Type inference failed in the call to `{1}'",
						best.Name.ToLowerInvariant (), best.Name);
				}

				return true;
			}
Exemplo n.º 17
0
            bool OverloadResolver.IErrorHandler.AmbiguousCandidates(ResolveContext ec, MemberSpec best, MemberSpec ambiguous)
            {
                var emg  = mg as ExtensionMethodGroupExpr;
                var type = emg == null ? mg.InstanceExpression : emg.ExtensionExpression;

                ec.Report.SymbolRelatedToPreviousError(best);
                ec.Report.SymbolRelatedToPreviousError(ambiguous);
                ec.Report.Error(1940, loc, "Ambiguous implementation of the query pattern `{0}' for source type `{1}'",
                                best.Name, type.Type.GetSignatureForError());
                return(true);
            }
Exemplo n.º 18
0
			bool OverloadResolver.IErrorHandler.ArgumentMismatch (ResolveContext rc, MemberSpec best, Argument arg, int index)
			{
				return false;
			}
Exemplo n.º 19
0
 public IDocNode GetSummary(MemberSpec member)
 {
     return(GetMemberSummary(member.Member));
 }