PropertyAccess,
EventAccess,
IndexerAccess,
- Nothing,
+ Nothing,
}
/// <remarks>
return MemberLookupToExpression (rc, members, errorMode, queried_type, name, arity, restrictions, loc);
}
+ if ((restrictions & MemberLookupRestrictions.InvocableOnly) == 0) {
+ var ntuple = queried_type as NamedTupleSpec;
+ if (ntuple != null) {
+ var ms = ntuple.FindElement (rc, name, loc);
+ if (ms != null)
+ return ExprClassFromMemberInfo (ms, loc);
+ }
+ }
+
return null;
}
{
}
- public bool InferType (ResolveContext ec, Expression right_side)
+ public bool InferType (ResolveContext ec, Expression rhs)
{
if (type != null)
throw new InternalErrorException ("An implicitly typed local variable could not be redefined");
- type = right_side.Type;
- if (type == InternalType.NullLiteral || type.Kind == MemberKind.Void || type == InternalType.AnonymousMethod || type == InternalType.MethodGroup) {
+ type = rhs.Type;
+
+ if (type.Kind == MemberKind.Void || InternalType.HasNoType (type) || (rhs is TupleLiteral && TupleLiteral.ContainsNoTypeElement (type))) {
ec.Report.Error (815, loc,
"An implicitly typed local variable declaration cannot be initialized with `{0}'",
type.GetSignatureForError ());