public override bool Equals(Symbol other, TypeCompareKind compareKind)
        {
            if (other == (object)this)
            {
                return(true);
            }

            if (!(other is LocalSymbol otherLocal))
            {
                return(false);
            }

            SourceLocalSymbol?otherSource = otherLocal switch
            {
                UpdatedContainingSymbolAndNullableAnnotationLocal updated => updated._underlyingLocal,
                SourceLocalSymbol source => source,
                             _ => null
            };

            if (otherSource is null || !_underlyingLocal.Equals(otherSource, compareKind))
            {
                return(false);
            }

            var ignoreNullable = (compareKind & TypeCompareKind.AllNullableIgnoreOptions) != 0;

            return(ignoreNullable ||
                   (TypeWithAnnotations.Equals(otherLocal.TypeWithAnnotations, compareKind) &&
                    ContainingSymbol.Equals(otherLocal.ContainingSymbol, compareKind)));
        }
示例#2
0
            public override bool Equals(Symbol obj, TypeCompareKind compareKind)
            {
                if (obj == (object)this)
                {
                    return(true);
                }

                var other = obj as SynthesizedOperatorParameterSymbol;

                if ((object)other == null)
                {
                    return(false);
                }

                return(Ordinal == other.Ordinal && ContainingSymbol.Equals(other.ContainingSymbol, compareKind));
            }