예제 #1
0
        protected override void CheckTypeDependency(ResolveContext rc)
        {
            base.CheckTypeDependency(rc);

            if (rc.IsStaticType(ResolvedMemberType))
            {
                rc.Report.Error(722, Location,
                                "`{0}': static types cannot be used as return types",
                                ResolvedMemberType.ToString());
            }
        }
예제 #2
0
 protected virtual void CheckTypeDependency(ResolveContext rc)
 {
     // verify accessibility
     if (!ResolvedEntity.IsAccessibleAs(ResolvedMemberType))
     {
         if (this is PropertyDeclaration)
         {
             rc.Report.Error(206, Location,
                             "Inconsistent accessibility: property type `" +
                             ResolvedMemberType.ToString() + "' is less " +
                             "accessible than property `" + GetSignatureForError() + "'");
         }
         else if (this is IndexerDeclaration)
         {
             rc.Report.Error(207, Location,
                             "Inconsistent accessibility: indexer return type `" +
                             ResolvedMemberType.ToString() + "' is less " +
                             "accessible than indexer `" + GetSignatureForError() + "'");
         }
         else if (this is MethodCore)
         {
             if (this is OperatorDeclaration)
             {
                 rc.Report.Error(208, Location,
                                 "Inconsistent accessibility: return type `" +
                                 ResolvedMemberType.ToString() + "' is less " +
                                 "accessible than operator `" + GetSignatureForError() + "'");
             }
             else
             {
                 rc.Report.Error(209, Location,
                                 "Inconsistent accessibility: return type `" +
                                 ResolvedMemberType.ToString() + "' is less " +
                                 "accessible than method `" + GetSignatureForError() + "'");
             }
         }
         else if (this is EventDeclaration)
         {
             rc.Report.Error(210, Location,
                             "Inconsistent accessibility: event type `{0}' is less accessible than event `{1}'",
                             ResolvedMemberType.ToString(), GetSignatureForError());
         }
         else
         {
             rc.Report.Error(211, Location,
                             "Inconsistent accessibility: field type `" +
                             ResolvedMemberType.ToString() + "' is less " +
                             "accessible than field `" + GetSignatureForError() + "'");
         }
     }
 }