-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Obsolete code should be allowed to use Obsolete API without warning #1055
Comments
This seems reasonable - is there any existing practice for this in C# or other languages? |
C# has something like this. [Obsolete]
public class C {
// no warning because C is obsolete
public static void Main()
=> A();
[Obsolete]
public static void A() {}
}
public class C1 {
// warning because C1 is not obsolete
public static void Main()
=> A();
[Obsolete]
public static void A() {}
}
public class C2 {
[Obsolete]
// no warning because Main is obsolete
public static void Main()
=> A();
[Obsolete]
public static void A() {}
} See Sharplab |
Also VB.NET Imports System
<Obsolete>
Public Class C
' no warning because C is obsolete
Public Shared Sub Main()
A()
End Sub
<Obsolete>
Public Shared Sub A()
End Sub
End Class
public class C1
' warning because C1 is not obsolete
Public Shared Sub Main()
A()
End Sub
<Obsolete>
Public Shared Sub A()
End Sub
End Class
public class C2
' no warning because Main is obsolete
<Obsolete>
Public Shared Sub Main()
A()
End Sub
<Obsolete>
Public Shared Sub A()
End Sub
End Class |
@WhiteBlackGoose One thing to note is that C# does not care about whether the obsoletion is a warning or an error. |
That's already a design issue, so I guess it should be redirected to the draft PR for this suggestion. |
OK will mark as approved |
For example,
Pros and Cons
The advantage, clearly, is that now we don't have to rewrite obsolete API's implementation with new functions (since it's anyway obsolete - unsupported).
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: this suggestion may let us to
nowarn
locally, which is not similar to what I'm proposing, but can partially resolve the issue.Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
For Readers
If you would like to see this issue implemented, please click the 👍 emoji on this issue. These counts are used to generally order the suggestions by engagement.
The text was updated successfully, but these errors were encountered: