Skip to content

Commit

Permalink
Remove module scope from NullableContextAttribute
Browse files Browse the repository at this point in the history
Following dotnet#37610
  • Loading branch information
roji committed Aug 6, 2019
1 parent baa0dcc commit 2766fd9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions docs/features/nullable-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ Each type parameter definition may have an associated `NullableAttribute` with a
namespace System.Runtime.CompilerServices
{
[System.AttributeUsage(
AttributeTargets.Module |
AttributeTargets.Class |
AttributeTargets.Delegate |
AttributeTargets.Interface |
Expand All @@ -102,7 +101,7 @@ The type declaration is synthesized by the compiler if not already included in t

The `NullableContextAttribute` is optional - nullable annotations can be represented in metadata with full fidelity using `NullableAttribute` only.

`NullableContextAttribute` is valid in metadata at the module level and at type and method declarations.
`NullableContextAttribute` is valid in metadata at the type and method declarations.
The `byte` value represents the implicit `NullableAttribute` value for type references within that scope
that do not have an explicit `NullableAttribute` and would not otherwise be represented by an empty `byte[]`.
The nearest `NullableContextAttribute` in the metadata hierarchy applies.
Expand All @@ -121,8 +120,6 @@ and any `NullableContextAttribute` attributes on immediate children.
If there are no single `byte` values, there are no changes.
Otherwise, a `NullableContext(value)` attribute is created at that level where `value` is most common
value (preferring `0` over `1` and preferring `1` over `2`), and all `NullableAttribute` and `NullableContextAttribute` attributes with that value are removed.
That iterative process continues up to the module level.
If the common value at the module level is a value other than `0` (the default), a module level `NullableContext(value)` attribute is emitted.

Note that an assembly compiled with C#8 where all reference types are oblivious will have no
`NullableContextAttribute` and no `NullableAttribute` attributes emitted.
Expand Down

0 comments on commit 2766fd9

Please sign in to comment.