From 41448327432aeff4cdb567dbc558ac7b4674b7e6 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 21 Aug 2023 15:58:05 -0700 Subject: [PATCH 1/3] Clarify behavior of severity --- accepted/2023/preview-apis/preview-apis.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/accepted/2023/preview-apis/preview-apis.md b/accepted/2023/preview-apis/preview-apis.md index d3bfd9773..ba22a0594 100644 --- a/accepted/2023/preview-apis/preview-apis.md +++ b/accepted/2023/preview-apis/preview-apis.md @@ -225,7 +225,17 @@ both options are being presented to the consumer. ### Compiler Behavior The compiler will raise a diagnostic when an experimental API is used, using the -supplied diagnostic ID. The severity is always error. +supplied diagnostic ID. + +> [!NOTE] +> The severity is warning, because errors cannot be suppressed. +> +> However, there will also be a generic compiler diagnostic ID that applies to +> all warnings raised for using experimental APIs (like nullable). The built-in +> `editor.config` that we ship with the .NET SDK will elevate these warnings to +> errors. From a user's standpoint this will result in these diagnostics to +> appear as errors that they are expected to suppress, which is the UX we +> desire. The semantics are identical to how obsolete is tracked, except there is no special treatment when both caller and callee are in the same assembly -- any From 821bd9e9646117088dbd8b0aaeb2fd1b91d2661e Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Tue, 26 Sep 2023 13:08:58 -0700 Subject: [PATCH 2/3] Update accepted/2023/preview-apis/preview-apis.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Köplinger --- accepted/2023/preview-apis/preview-apis.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accepted/2023/preview-apis/preview-apis.md b/accepted/2023/preview-apis/preview-apis.md index ba22a0594..e526cb5ea 100644 --- a/accepted/2023/preview-apis/preview-apis.md +++ b/accepted/2023/preview-apis/preview-apis.md @@ -232,7 +232,7 @@ supplied diagnostic ID. > > However, there will also be a generic compiler diagnostic ID that applies to > all warnings raised for using experimental APIs (like nullable). The built-in -> `editor.config` that we ship with the .NET SDK will elevate these warnings to +> `.editorconfig` that we ship with the .NET SDK will elevate these warnings to > errors. From a user's standpoint this will result in these diagnostics to > appear as errors that they are expected to suppress, which is the UX we > desire. From 17cc8781ad48209b5b7a817343b05d708bc9d4b8 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Tue, 26 Sep 2023 13:18:46 -0700 Subject: [PATCH 3/3] Update document --- accepted/2023/preview-apis/preview-apis.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/accepted/2023/preview-apis/preview-apis.md b/accepted/2023/preview-apis/preview-apis.md index e526cb5ea..1bed4a4ee 100644 --- a/accepted/2023/preview-apis/preview-apis.md +++ b/accepted/2023/preview-apis/preview-apis.md @@ -224,18 +224,14 @@ both options are being presented to the consumer. ### Compiler Behavior +*For more details on the compiler behavior, see [C# spec][csharp-spec].* + The compiler will raise a diagnostic when an experimental API is used, using the supplied diagnostic ID. > [!NOTE] -> The severity is warning, because errors cannot be suppressed. -> -> However, there will also be a generic compiler diagnostic ID that applies to -> all warnings raised for using experimental APIs (like nullable). The built-in -> `.editorconfig` that we ship with the .NET SDK will elevate these warnings to -> errors. From a user's standpoint this will result in these diagnostics to -> appear as errors that they are expected to suppress, which is the UX we -> desire. +> The severity is warning, because errors cannot be suppressed. However, the +> warning is promoted to an error for purpose of reporting. The semantics are identical to how obsolete is tracked, except there is no special treatment when both caller and callee are in the same assembly -- any @@ -264,6 +260,7 @@ the usual means (i.e. `#pragma` or project-wide `NoWarn`). - We should point users to this new attribute (`ExperimentalAttribute`) [preview-features]: ../../2021/preview-features/preview-features.md +[csharp-spec]: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-12.0/experimental-attribute.md ## Q & A