return tc.GetSignatureForError ();
}
- public IList<MethodSpec> LookupExtensionMethod (TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
+ public ExtensionMethodCandidates LookupExtensionMethod (TypeSpec extensionType, string name, int arity)
{
return null;
}
ExpressionStatement s = fi.ResolveStatement (ec);
if (s == null) {
s = EmptyExpressionStatement.Instance;
- } else if (fi.IsComplexInitializer) {
+ } else if (!fi.IsSideEffectFree) {
has_complex_initializer |= true;
}
continue;
}
+ if ((f.caching_flags & Flags.IsAssigned) != 0)
+ continue;
+
//
// Only report 649 on level 4
//
if (Report.WarningLevel < 4)
continue;
-
- if ((f.caching_flags & Flags.IsAssigned) != 0)
- continue;
//
// Don't be pendatic over serializable attributes
continue;
Constant c = New.Constantify (f.MemberType, f.Location);
- Report.Warning (649, 4, f.Location, "Field `{0}' is never assigned to, and will always have its default value `{1}'",
- f.GetSignatureForError (), c == null ? "null" : c.GetValueAsLiteral ());
+ string value;
+ if (c != null) {
+ value = c.GetValueAsLiteral ();
+ } else if (TypeSpec.IsReferenceType (f.MemberType)) {
+ value = "null";
+ } else {
+ // Ignore this warning for struct value fields (they are always initialized)
+ if (f.MemberType.IsStruct)
+ continue;
+
+ value = null;
+ }
+
+ if (value != null)
+ value = " `" + value + "'";
+
+ Report.Warning (649, 4, f.Location, "Field `{0}' is never assigned to, and will always have its default value{1}",
+ f.GetSignatureForError (), value);
}
}
}
}
}
- public override IList<MethodSpec> LookupExtensionMethod (TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
+ public override ExtensionMethodCandidates LookupExtensionMethod (TypeSpec extensionType, string name, int arity)
{
DeclSpace top_level = Parent;
if (top_level != null) {
- var candidates = NamespaceEntry.NS.LookupExtensionMethod (this, extensionType, name, arity);
- if (candidates != null) {
- scope = NamespaceEntry;
- return candidates;
+ var methods = NamespaceEntry.NS.LookupExtensionMethod (this, extensionType, name, arity);
+ if (methods != null) {
+ return new ExtensionMethodCandidates (methods, NamespaceEntry, NamespaceEntry.NS) {
+ HasUninspectedMembers = true
+ };
}
}
- return NamespaceEntry.LookupExtensionMethod (extensionType, name, arity, ref scope);
+ return NamespaceEntry.LookupExtensionMethod (extensionType, name, arity);
}
protected override TypeAttributes TypeAttr {