Exemplo n.º 1
0
        public static Nullability Create(AnnotatedTypeSymbol ts)
        {
            if (ts.HasConsistentNullability())
            {
                switch (ts.Nullability)
                {
                case NullableAnnotation.Annotated:
                    return(annotated);

                case NullableAnnotation.NotAnnotated:
                    return(notannotated);

                default:
                    return(oblivious);
                }
            }

            return(new Nullability(ts));
        }
Exemplo n.º 2
0
 private Nullability(AnnotatedTypeSymbol ts) : this(ts.Nullability)
 {
     NullableParameters = ts.HasConsistentNullability() ? emptyArray : ts.GetAnnotatedTypeArguments().Select(Create).ToArray();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Holds if the type symbol is completely oblivious to nullability.
 /// </summary>
 /// <param name="at">The annotated type symbol.</param>
 /// <returns>If at is oblivious.</returns>
 public static bool HasObliviousNullability(this AnnotatedTypeSymbol at) =>
 at.Nullability.GetTypeAnnotation() == Kinds.TypeAnnotation.None && at.HasConsistentNullability();