You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
@@ -104,12 +104,12 @@ namespace Mono.CSharp
|
||||
return Clone (Expr.Clone (clonectx));
|
||||
}
|
||||
|
||||
public virtual Expression CreateExpressionTree (ResolveContext ec)
|
||||
public virtual Expression CreateExpressionTree (ResolveContext rc)
|
||||
{
|
||||
if (ArgType == AType.Default)
|
||||
ec.Report.Error (854, Expr.Location, "An expression tree cannot contain an invocation which uses optional parameter");
|
||||
rc.Report.Error (854, Expr.Location, "An expression tree cannot contain an invocation which uses optional parameter");
|
||||
|
||||
return Expr.CreateExpressionTree (ec);
|
||||
return Expr.CreateExpressionTree (rc);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,12 +126,16 @@ namespace Mono.CSharp
|
||||
return;
|
||||
}
|
||||
|
||||
if (Expr.Type.Kind == MemberKind.ByRef) {
|
||||
Expr.Emit (ec);
|
||||
return;
|
||||
}
|
||||
|
||||
AddressOp mode = AddressOp.Store;
|
||||
if (ArgType == AType.Ref)
|
||||
mode |= AddressOp.Load;
|
||||
|
||||
IMemoryLocation ml = (IMemoryLocation) Expr;
|
||||
ml.AddressOf (ec, mode);
|
||||
((IMemoryLocation)Expr).AddressOf (ec, mode);
|
||||
}
|
||||
|
||||
public Argument EmitToField (EmitContext ec, bool cloneResult)
|
||||
@@ -421,17 +425,19 @@ namespace Mono.CSharp
|
||||
return all;
|
||||
}
|
||||
|
||||
public static Arguments CreateForExpressionTree (ResolveContext ec, Arguments args, params Expression[] e)
|
||||
public static Arguments CreateForExpressionTree (ResolveContext rc, Arguments args, params Expression[] e)
|
||||
{
|
||||
Arguments all = new Arguments ((args == null ? 0 : args.Count) + e.Length);
|
||||
for (int i = 0; i < e.Length; ++i) {
|
||||
if (e [i] != null)
|
||||
all.Add (new Argument (e[i]));
|
||||
var expr = e [i];
|
||||
if (expr != null) {
|
||||
all.Add (new Argument (expr));
|
||||
}
|
||||
}
|
||||
|
||||
if (args != null) {
|
||||
foreach (Argument a in args.args) {
|
||||
Expression tree_arg = a.CreateExpressionTree (ec);
|
||||
Expression tree_arg = a.CreateExpressionTree (rc);
|
||||
if (tree_arg != null)
|
||||
all.Add (new Argument (tree_arg));
|
||||
}
|
||||
|
||||
@@ -1755,6 +1755,10 @@ namespace Mono.CSharp {
|
||||
// New in .NET 4.7
|
||||
public readonly PredefinedTupleElementNamesAttribute TupleElementNames;
|
||||
|
||||
// New in .NET 4.7.1
|
||||
public readonly PredefinedAttribute IsReadOnly;
|
||||
public readonly PredefinedAttribute IsByRefLike;
|
||||
|
||||
//
|
||||
// Optional types which are used as types and for member lookup
|
||||
//
|
||||
@@ -1835,6 +1839,8 @@ namespace Mono.CSharp {
|
||||
CallerFilePathAttribute = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "CallerFilePathAttribute");
|
||||
|
||||
TupleElementNames = new PredefinedTupleElementNamesAttribute (module, "System.Runtime.CompilerServices", "TupleElementNamesAttribute");
|
||||
IsReadOnly = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "IsReadOnlyAttribute");
|
||||
IsByRefLike = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "IsByRefLikeAttribute");
|
||||
|
||||
// TODO: Should define only attributes which are used for comparison
|
||||
const System.Reflection.BindingFlags all_fields = System.Reflection.BindingFlags.Public |
|
||||
|
||||
@@ -1 +1 @@
|
||||
48b1c6921f3c897fe0b8e5780e59fe5f34a514aa
|
||||
da3ec32d6fb042738c08224ca2367f0262506c27
|
||||
@@ -206,7 +206,9 @@ namespace Mono.CSharp {
|
||||
c = field.ConvertInitializer (rc, c);
|
||||
|
||||
if (c == null) {
|
||||
if (TypeSpec.IsReferenceType (field.MemberType))
|
||||
if (expr is DefaultLiteralExpression) {
|
||||
// It's handled bellow in New.Constantify
|
||||
} else if (TypeSpec.IsReferenceType (field.MemberType))
|
||||
Error_ConstantCanBeInitializedWithNullOnly (rc, field.MemberType, expr.Location, GetSignatureForError ());
|
||||
else if (!(expr is Constant))
|
||||
Error_ExpressionMustBeConstant (rc, expr.Location, GetSignatureForError ());
|
||||
|
||||
@@ -392,6 +392,9 @@ namespace Mono.CSharp {
|
||||
if (!TypeSpec.IsValueType (expr_type))
|
||||
return null;
|
||||
|
||||
if (expr_type.IsByRefLike)
|
||||
return null;
|
||||
|
||||
return expr == null ? EmptyExpression.Null : new BoxedCast (expr, target_type);
|
||||
|
||||
case BuiltinTypeSpec.Type.Enum:
|
||||
@@ -1478,6 +1481,10 @@ namespace Mono.CSharp {
|
||||
return target_type.Kind == MemberKind.InternalCompilerType ? null : EmptyCast.Create (expr, target_type);
|
||||
}
|
||||
|
||||
if (expr_type == InternalType.DefaultType) {
|
||||
return new DefaultValueExpression (new TypeExpression (target_type, expr.Location), expr.Location).Resolve (ec);
|
||||
}
|
||||
|
||||
if (target_type.IsNullableType)
|
||||
return ImplicitNulableConversion (ec, expr, target_type);
|
||||
|
||||
@@ -1503,6 +1510,11 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (expr is ReferenceExpression) {
|
||||
// Only identify conversion is allowed
|
||||
return null;
|
||||
}
|
||||
|
||||
e = ImplicitNumericConversion (expr, expr_type, target_type);
|
||||
if (e != null)
|
||||
return e;
|
||||
@@ -1962,7 +1974,7 @@ namespace Mono.CSharp {
|
||||
// From object or dynamic to any reference type or value type (unboxing)
|
||||
//
|
||||
if (source_type.BuiltinType == BuiltinTypeSpec.Type.Object || source_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
|
||||
if (target_type.IsPointer)
|
||||
if (target_type.IsPointer || target_type.IsByRefLike)
|
||||
return null;
|
||||
|
||||
return
|
||||
|
||||
@@ -1 +1 @@
|
||||
5f885a77763b8ccebc07be47fb643c310be926f5
|
||||
e2e85431d997383f904cd014a958d6d8310f1915
|
||||
@@ -716,9 +716,15 @@ namespace Mono.CSharp
|
||||
res = Token.EXTERN_ALIAS;
|
||||
break;
|
||||
case Token.DEFAULT:
|
||||
if (peek_token () == Token.COLON) {
|
||||
switch (peek_token ()) {
|
||||
case Token.COLON:
|
||||
token ();
|
||||
res = Token.DEFAULT_COLON;
|
||||
break;
|
||||
case Token.OPEN_PARENS:
|
||||
case Token.OPEN_PARENS_CAST:
|
||||
res = Token.DEFAULT_VALUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Token.WHEN:
|
||||
@@ -812,10 +818,12 @@ namespace Mono.CSharp
|
||||
PushPosition ();
|
||||
|
||||
next_token = token ();
|
||||
bool ok = (next_token == Token.CLASS) ||
|
||||
(next_token == Token.STRUCT) ||
|
||||
(next_token == Token.INTERFACE) ||
|
||||
(next_token == Token.VOID);
|
||||
bool ok =
|
||||
next_token == Token.CLASS ||
|
||||
next_token == Token.STRUCT ||
|
||||
next_token == Token.INTERFACE ||
|
||||
next_token == Token.VOID ||
|
||||
next_token == Token.REF_STRUCT;
|
||||
|
||||
PopPosition ();
|
||||
|
||||
@@ -903,6 +911,12 @@ namespace Mono.CSharp
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case Token.REF:
|
||||
if (peek_token () == Token.STRUCT) {
|
||||
token ();
|
||||
res = Token.REF_STRUCT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1094,6 +1108,7 @@ namespace Mono.CSharp
|
||||
case Token.UNCHECKED:
|
||||
case Token.UNSAFE:
|
||||
case Token.DEFAULT:
|
||||
case Token.DEFAULT_VALUE:
|
||||
case Token.AWAIT:
|
||||
|
||||
//
|
||||
@@ -1273,14 +1288,21 @@ namespace Mono.CSharp
|
||||
|
||||
return false;
|
||||
case Token.OPEN_PARENS:
|
||||
if (!parsing_generic_declaration)
|
||||
return false;
|
||||
|
||||
int parens_count = 1;
|
||||
while (true) {
|
||||
switch (token ()) {
|
||||
case Token.COMMA:
|
||||
// tuple declaration after <
|
||||
return true;
|
||||
if (parens_count == 1)
|
||||
return true;
|
||||
continue;
|
||||
case Token.OPEN_PARENS:
|
||||
++parens_count;
|
||||
continue;
|
||||
case Token.CLOSE_PARENS:
|
||||
if (--parens_count <= 0)
|
||||
return false;
|
||||
continue;
|
||||
case Token.OP_GENERICS_GT:
|
||||
case Token.EOF:
|
||||
return false;
|
||||
@@ -3502,6 +3524,7 @@ namespace Mono.CSharp
|
||||
case Token.SWITCH:
|
||||
case Token.USING:
|
||||
case Token.DEFAULT:
|
||||
case Token.DEFAULT_VALUE:
|
||||
case Token.DELEGATE:
|
||||
case Token.OP_GENERICS_GT:
|
||||
case Token.REFVALUE:
|
||||
@@ -3963,26 +3986,29 @@ namespace Mono.CSharp
|
||||
{
|
||||
int d;
|
||||
|
||||
// Save current position and parse next token.
|
||||
PushPosition ();
|
||||
int generic_dimension = 0;
|
||||
if (parse_less_than (ref generic_dimension)) {
|
||||
if (parsing_generic_declaration && (parsing_generic_declaration_doc || token () != Token.DOT)) {
|
||||
d = Token.OP_GENERICS_LT_DECL;
|
||||
} else {
|
||||
if (generic_dimension > 0) {
|
||||
val = generic_dimension;
|
||||
DiscardPosition ();
|
||||
return Token.GENERIC_DIMENSION;
|
||||
}
|
||||
if (current_token != Token.OPERATOR) {
|
||||
// Save current position and parse next token.
|
||||
PushPosition ();
|
||||
int generic_dimension = 0;
|
||||
if (parse_less_than (ref generic_dimension)) {
|
||||
if (parsing_generic_declaration && (parsing_generic_declaration_doc || token () != Token.DOT)) {
|
||||
d = Token.OP_GENERICS_LT_DECL;
|
||||
} else {
|
||||
if (generic_dimension > 0) {
|
||||
val = generic_dimension;
|
||||
DiscardPosition ();
|
||||
return Token.GENERIC_DIMENSION;
|
||||
}
|
||||
|
||||
d = Token.OP_GENERICS_LT;
|
||||
d = Token.OP_GENERICS_LT;
|
||||
}
|
||||
PopPosition ();
|
||||
return d;
|
||||
}
|
||||
|
||||
PopPosition ();
|
||||
return d;
|
||||
}
|
||||
|
||||
PopPosition ();
|
||||
parsing_generic_less_than = 0;
|
||||
|
||||
d = peek_char ();
|
||||
|
||||
@@ -188,8 +188,8 @@ namespace Mono.CSharp {
|
||||
|
||||
CheckProtectedModifier ();
|
||||
|
||||
if (Compiler.Settings.StdLib && ret_type.IsSpecialRuntimeType) {
|
||||
Method.Error1599 (Location, ret_type, Report);
|
||||
if (ret_type.IsSpecialRuntimeType && Compiler.Settings.StdLib) {
|
||||
Method.Error_ReturnTypeCantBeRefAny (Location, ret_type, Report);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -587,8 +587,7 @@ namespace Mono.CSharp {
|
||||
rt = ec.BuiltinTypes.Object;
|
||||
|
||||
if (!Delegate.IsTypeCovariant (ec, rt, invoke_method.ReturnType)) {
|
||||
Expression ret_expr = new TypeExpression (delegate_method.ReturnType, loc);
|
||||
Error_ConversionFailed (ec, delegate_method, ret_expr);
|
||||
Error_ConversionFailed (ec, delegate_method, delegate_method.ReturnType);
|
||||
}
|
||||
|
||||
if (method_group.IsConditionallyExcluded) {
|
||||
@@ -604,8 +603,14 @@ namespace Mono.CSharp {
|
||||
}
|
||||
|
||||
var expr = method_group.InstanceExpression;
|
||||
if (expr != null && (expr.Type.IsGenericParameter || !TypeSpec.IsReferenceType (expr.Type)))
|
||||
if (expr != null && (expr.Type.IsGenericParameter || !TypeSpec.IsReferenceType (expr.Type))) {
|
||||
if (expr.Type.IsByRefLike || expr.Type.IsSpecialRuntimeType) {
|
||||
// CSC: Should be better error code
|
||||
Error_ConversionFailed (ec, delegate_method, null);
|
||||
}
|
||||
|
||||
method_group.InstanceExpression = new BoxedCast (expr, ec.BuiltinTypes.Object);
|
||||
}
|
||||
|
||||
eclass = ExprClass.Value;
|
||||
return this;
|
||||
@@ -639,7 +644,7 @@ namespace Mono.CSharp {
|
||||
method_group.FlowAnalysis (fc);
|
||||
}
|
||||
|
||||
void Error_ConversionFailed (ResolveContext ec, MethodSpec method, Expression return_type)
|
||||
void Error_ConversionFailed (ResolveContext ec, MethodSpec method, TypeSpec return_type)
|
||||
{
|
||||
var invoke_method = Delegate.GetInvokeMethod (type);
|
||||
string member_name = method_group.InstanceExpression != null ?
|
||||
@@ -661,6 +666,12 @@ namespace Mono.CSharp {
|
||||
return;
|
||||
}
|
||||
|
||||
if (invoke_method.ReturnType.Kind == MemberKind.ByRef) {
|
||||
ec.Report.Error (8189, loc, "By reference return delegate does not match `{0}' return type",
|
||||
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));
|
||||
|
||||
@@ -279,11 +279,19 @@ namespace Mono.CSharp
|
||||
|
||||
protected bool DoResolveCore (ResolveContext rc)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var arg in arguments) {
|
||||
if (arg.Type == InternalType.VarOutType) {
|
||||
// Should be special error message about dynamic dispatch
|
||||
rc.Report.Error (8197, arg.Expr.Location, "Cannot infer the type of implicitly-typed out variable `{0}'", ((DeclarationExpression) arg.Expr).Variable.Name);
|
||||
} else if (arg.Type == InternalType.DefaultType) {
|
||||
rc.Report.Error (8311, arg.Expr.Location, "Cannot use a default literal as an argument to a dynamically dispatched operation");
|
||||
}
|
||||
|
||||
// Forced limitation because Microsoft.CSharp needs to catch up
|
||||
if (i > 0 && arguments [i - 1] is NamedArgument && !(arguments [i] is NamedArgument))
|
||||
rc.Report.Error (8324, loc, "Named argument specifications must appear after all fixed arguments have been specified in a dynamic invocation");
|
||||
++i;
|
||||
}
|
||||
|
||||
if (rc.CurrentTypeParameters != null && rc.CurrentTypeParameters[0].IsMethodTypeParameter)
|
||||
|
||||
@@ -1 +1 @@
|
||||
9486475305452e2ab5c326d264e3f0954e58a661
|
||||
5e2e7f2436fd66421df911b794e620b8c8789969
|
||||
@@ -788,6 +788,7 @@ namespace Mono.CSharp
|
||||
return null;
|
||||
}
|
||||
|
||||
module.CloseContainerEarlyForReflectionEmit ();
|
||||
module.CloseContainer ();
|
||||
if (host != null)
|
||||
host.CloseContainer ();
|
||||
|
||||
@@ -1 +1 @@
|
||||
113ed29910c155493a769098bc9e058a05712a96
|
||||
74d15942be865d75be6494f7125eba6633ef6317
|
||||
@@ -700,6 +700,16 @@ namespace Mono.CSharp
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void DoMemberTypeIndependentChecks ()
|
||||
{
|
||||
if ((Parent.PartialContainer.ModFlags & Modifiers.READONLY) != 0 && (ModFlags & (Modifiers.READONLY | Modifiers.STATIC)) == 0) {
|
||||
Report.Error (8340, Location, "`{0}': Instance fields in readonly structs must be readonly",
|
||||
GetSignatureForError ());
|
||||
}
|
||||
|
||||
base.DoMemberTypeIndependentChecks ();
|
||||
}
|
||||
|
||||
protected override void DoMemberTypeDependentChecks ()
|
||||
{
|
||||
if ((ModFlags & Modifiers.BACKING_FIELD) != 0)
|
||||
|
||||
@@ -1543,6 +1543,9 @@ namespace Mono.CSharp {
|
||||
if (ec is PointerContainer)
|
||||
return PointerContainer.MakeType (context.Module, et);
|
||||
|
||||
if (ec is ReferenceContainer)
|
||||
return ReferenceContainer.MakeType (context.Module, et);
|
||||
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
@@ -2289,7 +2292,7 @@ namespace Mono.CSharp {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (te.IsPointer || te.IsSpecialRuntimeType) {
|
||||
if (te.IsPointer || te.IsSpecialRuntimeType || te.IsByRefLike) {
|
||||
ec.Module.Compiler.Report.Error (306, args[i].Location,
|
||||
"The type `{0}' may not be used as a type argument",
|
||||
te.GetSignatureForError ());
|
||||
@@ -3099,7 +3102,7 @@ namespace Mono.CSharp {
|
||||
//
|
||||
// Some types cannot be used as type arguments
|
||||
//
|
||||
if ((bound.Type.Kind == MemberKind.Void && !voidAllowed) || bound.Type.IsPointer || bound.Type.IsSpecialRuntimeType ||
|
||||
if ((bound.Type.Kind == MemberKind.Void && !voidAllowed) || bound.Type.IsPointer || bound.Type.IsSpecialRuntimeType || bound.Type.IsByRefLike ||
|
||||
bound.Type == InternalType.MethodGroup || bound.Type == InternalType.AnonymousMethod || bound.Type == InternalType.VarOutType ||
|
||||
bound.Type == InternalType.ThrowExpr)
|
||||
return;
|
||||
@@ -3107,6 +3110,9 @@ namespace Mono.CSharp {
|
||||
if (bound.Type.IsTupleType && TupleLiteral.ContainsNoTypeElement (bound.Type))
|
||||
return;
|
||||
|
||||
if (bound.Type == InternalType.DefaultType)
|
||||
return;
|
||||
|
||||
var a = bounds [index];
|
||||
if (a == null) {
|
||||
a = new List<BoundInfo> (2);
|
||||
|
||||
@@ -255,6 +255,7 @@ namespace Mono.CSharp
|
||||
sdk_directory.Add ("4.6.1", new string[] { "4.6.1-api", "v4.0.30319" });
|
||||
sdk_directory.Add ("4.6.2", new string [] { "4.6.2-api", "v4.0.30319" });
|
||||
sdk_directory.Add ("4.7", new string [] { "4.7-api", "v4.0.30319" });
|
||||
sdk_directory.Add ("4.7.1", new string [] { "4.7.1-api", "v4.0.30319" });
|
||||
sdk_directory.Add ("4.x", new string [] { "4.5", "net_4_x", "v4.0.30319" });
|
||||
}
|
||||
|
||||
|
||||
@@ -959,7 +959,8 @@ namespace Mono.CSharp
|
||||
}
|
||||
}
|
||||
|
||||
if (kind == MemberKind.Class) {
|
||||
switch (kind) {
|
||||
case MemberKind.Class:
|
||||
if ((ma & TypeAttributes.Sealed) != 0) {
|
||||
if ((ma & TypeAttributes.Abstract) != 0)
|
||||
mod |= Modifiers.STATIC;
|
||||
@@ -968,6 +969,17 @@ namespace Mono.CSharp
|
||||
} else if ((ma & TypeAttributes.Abstract) != 0) {
|
||||
mod |= Modifiers.ABSTRACT;
|
||||
}
|
||||
break;
|
||||
case MemberKind.Struct:
|
||||
if (HasAttribute (CustomAttributeData.GetCustomAttributes (type), "IsReadOnlyAttribute", CompilerServicesNamespace)) {
|
||||
mod |= Modifiers.READONLY;
|
||||
}
|
||||
|
||||
if (HasAttribute (CustomAttributeData.GetCustomAttributes (type), "IsByRefLikeAttribute", CompilerServicesNamespace)) {
|
||||
mod |= Modifiers.REF;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1187,11 +1187,15 @@ namespace Mono.CSharp
|
||||
return;
|
||||
|
||||
if (!CheckType (ret, parent, out iterator_type, out is_enumerable)) {
|
||||
parent.Compiler.Report.Error (1624, method.Location,
|
||||
"The body of `{0}' cannot be an iterator block " +
|
||||
"because `{1}' is not an iterator interface type",
|
||||
method.GetSignatureForError (),
|
||||
ret.GetSignatureForError ());
|
||||
if (ret.Kind == MemberKind.ByRef) {
|
||||
parent.Compiler.Report.Error (8154, method.Location,
|
||||
"The body of `{0}' cannot be an iterator block because the method returns by reference",
|
||||
method.GetSignatureForError ());
|
||||
} else {
|
||||
parent.Compiler.Report.Error (1624, method.Location,
|
||||
"The body of `{0}' cannot be an iterator block because `{1}' is not an iterator interface type",
|
||||
method.GetSignatureForError (), ret.GetSignatureForError ());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,6 +188,11 @@ namespace Mono.CSharp {
|
||||
|
||||
public override Expression CreateExpressionTree (ResolveContext ec)
|
||||
{
|
||||
if (Expr is ReferenceExpression) {
|
||||
ec.Report.Error (8155, Expr.Location, "Lambda expressions that return by reference cannot be converted to expression trees");
|
||||
return null;
|
||||
}
|
||||
|
||||
return Expr.CreateExpressionTree (ec);
|
||||
}
|
||||
|
||||
@@ -216,6 +221,12 @@ namespace Mono.CSharp {
|
||||
if (Expr == null)
|
||||
return false;
|
||||
|
||||
if (Expr is ReferenceExpression) {
|
||||
// CSC: should be different error code
|
||||
ec.Report.Error (8149, loc, "By-reference returns can only be used in lambda expressions that return by reference");
|
||||
return false;
|
||||
}
|
||||
|
||||
statement = Expr as ExpressionStatement;
|
||||
if (statement == null) {
|
||||
var reduced = Expr as IReducedExpressionStatement;
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Mono.CSharp {
|
||||
Enum = 1 << 14,
|
||||
Interface = 1 << 15,
|
||||
TypeParameter = 1 << 16,
|
||||
ByRef = 1 << 17,
|
||||
|
||||
ArrayType = 1 << 19,
|
||||
PointerType = 1 << 20,
|
||||
|
||||
@@ -701,6 +701,10 @@ namespace Mono.CSharp {
|
||||
if (MemberType.IsStatic) {
|
||||
Error_StaticReturnType ();
|
||||
}
|
||||
|
||||
if (MemberType.IsSpecialRuntimeType && Compiler.Settings.StdLib) {
|
||||
Error_ReturnTypeCantBeRefAny (Location, ReturnType, Report);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Emit ()
|
||||
@@ -764,6 +768,11 @@ namespace Mono.CSharp {
|
||||
GetSignatureForError ());
|
||||
}
|
||||
|
||||
public static void Error_ReturnTypeCantBeRefAny (Location loc, TypeSpec t, Report Report)
|
||||
{
|
||||
Report.Error (1599, loc, "The return type of `{0}' is not allowed", t.GetSignatureForError ());
|
||||
}
|
||||
|
||||
public bool IsPartialDefinition {
|
||||
get {
|
||||
return (ModFlags & Modifiers.PARTIAL) != 0 && Block == null;
|
||||
@@ -1231,11 +1240,6 @@ namespace Mono.CSharp {
|
||||
"Introducing `Finalize' method can interfere with destructor invocation. Did you intend to declare a destructor?");
|
||||
}
|
||||
|
||||
if (Compiler.Settings.StdLib && ReturnType.IsSpecialRuntimeType) {
|
||||
Error1599 (Location, ReturnType, Report);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CurrentTypeParameters == null) {
|
||||
if (base_method != null && !IsExplicitImpl) {
|
||||
if (parameters.Count == 1 && ParameterTypes[0].BuiltinType == BuiltinTypeSpec.Type.Object && MemberName.Name == "Equals")
|
||||
@@ -1396,11 +1400,6 @@ namespace Mono.CSharp {
|
||||
return base.EnableOverloadChecks (overload);
|
||||
}
|
||||
|
||||
public static void Error1599 (Location loc, TypeSpec t, Report Report)
|
||||
{
|
||||
Report.Error (1599, loc, "Method or delegate cannot return type `{0}'", t.GetSignatureForError ());
|
||||
}
|
||||
|
||||
protected override bool ResolveMemberType ()
|
||||
{
|
||||
if (CurrentTypeParameters != null) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user