void Error_ConversionFailed(ResolveContext ec, MethodBase method, Expression return_type) { MethodInfo invoke_method = Delegate.GetInvokeMethod(ec.Compiler, ec.CurrentType, type); string member_name = delegate_instance_expression != null? Delegate.FullDelegateDesc(method) : TypeManager.GetFullNameSignature(method); ec.Report.SymbolRelatedToPreviousError(type); ec.Report.SymbolRelatedToPreviousError(method); if (RootContext.Version == LanguageVersion.ISO_1) { ec.Report.Error(410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type", TypeManager.CSharpName(((MethodInfo)method).ReturnType), member_name, TypeManager.CSharpName(invoke_method.ReturnType), Delegate.FullDelegateDesc(invoke_method)); return; } if (return_type == null) { ec.Report.Error(123, loc, "A method or delegate `{0}' parameters do not match delegate `{1}' parameters", member_name, Delegate.FullDelegateDesc(invoke_method)); return; } ec.Report.Error(407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type", return_type.GetSignatureForError(), member_name, TypeManager.CSharpName(invoke_method.ReturnType), Delegate.FullDelegateDesc(invoke_method)); }
void Error_ConversionFailed(ResolveContext ec, MethodSpec method, Expression return_type) { var invoke_method = Delegate.GetInvokeMethod(type); string member_name = method_group.InstanceExpression != null? Delegate.FullDelegateDesc(method) : TypeManager.GetFullNameSignature(method); ec.Report.SymbolRelatedToPreviousError(type); ec.Report.SymbolRelatedToPreviousError(method); if (ec.Module.Compiler.Settings.Version == LanguageVersion.ISO_1) { ec.Report.Error(410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type", method.ReturnType.GetSignatureForError(), member_name, invoke_method.ReturnType.GetSignatureForError(), Delegate.FullDelegateDesc(invoke_method)); return; } if (return_type == null) { ec.Report.Error(123, loc, "A method or delegate `{0}' parameters do not match delegate `{1}' parameters", member_name, Delegate.FullDelegateDesc(invoke_method)); return; } ec.Report.Error(407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type", return_type.GetSignatureForError(), member_name, invoke_method.ReturnType.GetSignatureForError(), Delegate.FullDelegateDesc(invoke_method)); }
void Error_ConversionFailed (ResolveContext ec, MethodSpec method, Expression return_type) { var invoke_method = Delegate.GetInvokeMethod (type); string member_name = method_group.InstanceExpression != null ? Delegate.FullDelegateDesc (method) : TypeManager.GetFullNameSignature (method); ec.Report.SymbolRelatedToPreviousError (type); ec.Report.SymbolRelatedToPreviousError (method); if (ec.Module.Compiler.Settings.Version == LanguageVersion.ISO_1) { ec.Report.Error (410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type", method.ReturnType.GetSignatureForError (), member_name, invoke_method.ReturnType.GetSignatureForError (), Delegate.FullDelegateDesc (invoke_method)); return; } if (return_type == null) { ec.Report.Error (123, loc, "A method or delegate `{0}' parameters do not match delegate `{1}' parameters", member_name, Delegate.FullDelegateDesc (invoke_method)); return; } ec.Report.Error (407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type", return_type.GetSignatureForError (), member_name, invoke_method.ReturnType.GetSignatureForError (), Delegate.FullDelegateDesc (invoke_method)); }
public bool InferType(ResolveContext ec, Expression right_side) { if (type != null) throw new InternalErrorException ("An implicitly typed local variable could not be redefined"); type = right_side.Type; if (type == TypeManager.null_type || type == TypeManager.void_type || type == InternalType.AnonymousMethod || type == InternalType.MethodGroup) { ec.Report.Error (815, loc, "An implicitly typed local variable declaration cannot be initialized with `{0}'", right_side.GetSignatureForError ()); return false; } eclass = ExprClass.Variable; return true; }
public virtual MemberExpr ResolveMemberAccess(ResolveContext ec, Expression left, Location loc, SimpleName original) { // // Precondition: // original == null || original.Resolve (...) ==> left // if (left is TypeExpr) { left = ((TypeExpr) left).ResolveAsTypeTerminal (ec, false); if (left == null) return null; // TODO: Same problem as in class.cs, TypeTerminal does not // always do all necessary checks ObsoleteAttribute oa = left.Type.GetAttributeObsolete (); if (oa != null && !ec.IsObsolete) { AttributeTester.Report_ObsoleteMessage (oa, left.GetSignatureForError (), loc, ec.Report); } // GenericTypeExpr ct = left as GenericTypeExpr; // if (ct != null && !ct.CheckConstraints (ec)) // return null; // if (!IsStatic) { SimpleName.Error_ObjectRefRequired (ec, loc, GetSignatureForError ()); return null; } return this; } if (!IsInstance) { if (original != null && original.IdenticalNameAndTypeName (ec, left, loc)) return this; return ResolveExtensionMemberAccess (ec, left); } InstanceExpression = left; return this; }
static public void Error_IsNotConvertibleToIDisposable (Expression expr) { Report.SymbolRelatedToPreviousError (expr.Type); Report.Error (1674, expr.Location, "`{0}': type used in a using statement must be implicitly convertible to `System.IDisposable'", expr.GetSignatureForError ()); }
void Error_ConversionFailed (ResolveContext ec, MethodBase method, Expression return_type) { MethodInfo invoke_method = Delegate.GetInvokeMethod (ec.Compiler, ec.CurrentType, type); string member_name = delegate_instance_expression != null ? Delegate.FullDelegateDesc (method) : TypeManager.GetFullNameSignature (method); ec.Report.SymbolRelatedToPreviousError (type); ec.Report.SymbolRelatedToPreviousError (method); if (RootContext.Version == LanguageVersion.ISO_1) { ec.Report.Error (410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type", TypeManager.CSharpName (((MethodInfo) method).ReturnType), member_name, TypeManager.CSharpName (invoke_method.ReturnType), Delegate.FullDelegateDesc (invoke_method)); return; } if (return_type == null) { ec.Report.Error (123, loc, "A method or delegate `{0}' parameters do not match delegate `{1}' parameters", member_name, Delegate.FullDelegateDesc (invoke_method)); return; } ec.Report.Error (407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type", return_type.GetSignatureForError (), member_name, TypeManager.CSharpName (invoke_method.ReturnType), Delegate.FullDelegateDesc (invoke_method)); }